feat(tradein): enrich /estimate response for web map, distribution, exposure & trend #685
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#685
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-estimate-enrich"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Backend foundation for the web-native result features (map / distribution / price↔exposure / trend). Additive + optional → zero risk.
Coverage verified on live DB. ruff clean; 237 estimator tests pass (10 new in test_estimator_enrich.py). NOTE: price_trend/last_scraped_at are computed on fresh POST only — GET /estimate/{id} (shared link/PDF reopen) returns None for them (analogs lat/lon do persist); small follow-up if needed.
Refs #647 #667
Additive + optional fields for upcoming web features: - analogs[]/actual_deals[] now carry lat/lon (radius comps ~100% covered, deals 100%) — were projected in SQL but discarded at the AnalogLot step. - price_trend: monthly ₽/m² series (houses_price_dynamics → house_placement_history fallback; 2347 houses covered, houses_price_dynamics empty in prod). - last_scraped_at (absolute companion to data_freshness_minutes). All nullable/graceful → zero risk to existing consumers. 237 estimator tests pass. NOTE: price_trend/last_scraped_at computed on POST only (GET/{id} returns None) — small follow-up if trend-on-reopen needed. Refs #647 #667Enrich /estimate response (price_trend, last_scraped_at, per-comp lat/lon). Reviewed via subagent. Backward-compat clean: all 4 new fields optional (X|None=None); -43 lines are comment reformatting; NO existing field renamed/removed/required -> frontend contract intact. #674/#682 NO regression: expected_sold still derived post-mutation (estimator.py:1870), enrichment strictly downstream read-only. TX-safe: _fetch_price_trend runs after db.commit, rolls back only failed read tx (estimate already persisted). Edges solid: house_id None short-circuit (0 db calls), <min_points->None, empty->None, missing coords->None lat/lon, NULLIF(area,0)+WHERE>0 (no div-by-zero). SQL psycopg v3: CAST(:x AS type), parameterized, no injection, no unbounded SELECT. async/sync correct, cold-path post-commit queries. NITS (non-blocking): PR title overstates distribution/exposure (client-derived, not server fields); one except->None branch uncovered. APPROVE.