feat(tradein): premium_houses MV + premium_building flag (#2002) #2006
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#2006
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-premium-flag"
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?
Summary
Data-derived premium-building identification for EKB (#2002 roadmap). Flags whether the target unit sits in a premium building — for manual-review routing (#4) and as honest context. Metadata only — does NOT change
expected_sold(so the regression gate is unaffected).premium_housesmaterialized view (data/sql/139_*.sql): premium houses by listing concentration —n≥4 active listings AND (median ppm² ≥220k OR ≥3 listings ≥20M₽). Dry-run on prod: 298 houses, covering ~65% of all ≥20M elite listings (surfaces the real premium core: Гоголя 21, Ельцина 6, Олимпийская наб, Хохрякова 48, Энергостроителей 7…). Refreshed by the existingrefresh_search_matviewtask. Idempotent (IF NOT EXISTS). House_id dupes (imperfect dedup) kept on purpose — all variants stay in the set, so coverage isn't hurt.estimate_qualityresolvestarget_house_id(already), then_is_premium_building(db, house_id)→premium_building+premium_building_median_ppm2on theAggregatedEstimateresponse.CAST(:hid AS bigint)(psycopg v3); wrapped in try/except → graceful(False, None)if the MV is missing, never breaks an estimate. Runs afterdb.commit()so a failed read can't poison the persisted estimate.Why a flag, not an uplift
The research proved the elite point is unidentifiable from observable signals (premium = unit-level finish/class, not on deals). A premium-building flag → manual-review is the safe move; an auto-uplift would re-introduce overpay risk on an un-validatable magnitude. (An uplift could be revisited later with forward-logging validation.)
Test plan
tests/test_estimator_premium_building.py— 6 cases (premium→True/median, non-premium→False, None short-circuit, MV-missing graceful, NULL median, default serialization; assertsCASTnot::)Follow-up (#2002)
#4 manual-review flag consumes
premium_building(+ high-value + low-confidence) → "ручная оценка" routing + frontend.Refs #2002