feat(tradein-estimator): exclude rosreestr deals from output #504
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#504
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-drop-rosreestr-deals"
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?
Problem
Production estimate
a0a0b820-e8a8-4eee-aa73-0ab3b98ac233:rosreestr contains ДДУ first-market contracts that don't represent secondary market. They skew
actual_dealsmedian by +40%.Fix
estimate_quality()passesdeals: list = []instead of calling_fetch_deals()_fetch_deals()helper kept in place (PR 8 cleanup is a separate concern; may re-enable per-segment later)Roadmap
PR 2 of 8 — see
[[Decision_TradeIn_DataQuality_8PR_Roadmap]].Verify
Deep Code Review — verdict
Summary
services/)Decision_TradeIn_DataQuality_8PR_Roadmap(PR 2 of 8) — exact matchCritical / High / Medium
None.
Cross-file impact (verified)
With
deals: list[dict[str, Any]] = [](line 595), three downstream consumers all degrade gracefully:estimator.py:600—deals_lots = [_deal_to_analog(d) for d in deals[:10]]→[].estimator.py:658—deals_jsoninsert payload →[]JSON.actual_dealsJSONB column receives empty array. Schema unchanged → DB backward compat OK for legacy estimates.estimator.py:726—_estimate_days_on_market(listings_clean, deals). Withdeals=[],(*listings, *deals)collapses to listings only. Existinglen(values) < 3 → Nonefallback already handles thin data → no break, but ETA precision slightly degrades. Acceptable per Decision (deals были искажающим сигналом, не точным)._fetch_dealshelper at line 928 — preserved per PR body and roadmap (PR 8 cleanup separate). No dead-code blocker.AggregatedEstimate.actual_deals(response) →[]. Frontend handling deferred to PR 7 of roadmap — explicit scope split.Anyimport present at line 26 — type annotation legal.Performance
Small WIN: removed PostGIS query against partitioned
rosreestr_dealstable per estimate call. No regression.Test coverage
No unit test update in diff. Acceptable:
jq .actual_deals == [].test_estimator_cian_integration.pydoes not testactual_dealsshape (only cache_key logic).qa-testercurl verify on fresh UUID is sufficient gate.Vault cross-check
Decision_TradeIn_DataQuality_8PR_Roadmap.mdPR 2 specification matches diff verbatim:_fetch_deals(), passdeals=[]NOTE/comment in docstring + inline at line 588-592 reference the Decision — good audit trail.
Positive
list[dict[str, Any]] = []keeps downstream type-narrowing intactRecommended next steps (post-merge, not blockers)
qa-tester:curl -u admin:… https://gendsgn.ru/trade-in/api/v1/trade-in/estimate/<fresh-uuid> | jq '.actual_deals, .est_days_on_market'_estimate_days_on_market(degenerate listings-only case)Complexity / blast radius
✅ ready for human merge