feat(tradein): AI-curated premium-building overlay — class + false-positive demotion (#2002) #2021

Merged
lekss361 merged 1 commit from feat/tradein-premium-curated into main 2026-06-27 18:43:06 +00:00
Owner

Summary

An AI/human-curated overlay on the concentration-based premium_houses MV (#2006). The MV flags a building premium purely by expensive-listing concentration — which mislabels mass-market buildings with a few inflated lots, and non-EKB / data-noise listings, as premium. A 9-agent curation pass assessed the top-90 candidates by descriptions + ppm² + web (ЖК name/class/developer): 69 confirmed premium (with class tier) + 19 false-positives demoted (~21% of the top tier — mostly cross-city mislabels: Нижний Новгород / Челябинск / Краснодар / Сочи, and comfort-class buildings with outlier lots). Metadata only — pricing untouched, gate byte-identical.

  • premium_buildings_curated (data/sql/142): house_id PK, tier, is_premium, confidence, note. Seeded with 88 curated rows, idempotent (ON CONFLICT DO UPDATE). Dry-run on prod: CREATE + INSERT 88, demoted=19, rolled back.
  • _is_premium_building now consults curated FIRST → (is_premium, med_ppm2, building_class): a curated row overrides the MV (corrects the flag + supplies a class); uncurated house_ids fall back to MV membership (recall preserved). CAST(:hid AS bigint), graceful try/except if either table is missing.
  • AggregatedEstimate.premium_building_class (новое поле) — feeds manual-review (#2019) + frontend. premium_building bool now reflects the corrected value (e.g. house_id 9401 Цвиллинга 7/6 «Парковый квартал», comfort → now false).

Examples (curated)

Гоголя 21 → элит · Башня Исеть (Ельцина 6) → премиум · Тихвинъ (Хохрякова 48) → элит · Макаровский Элит (Олимпийская 5) → элит · Клубный Most/Литературный → премиум · Чкалова 119 (ЛСР Южные кварталы, comfort) → demoted.

Test plan

  • migration dry-run on prod (88 rows, 19 demoted, rolled back)
  • regression gate byte-identical (premium is metadata, no pricing path)
  • tests/test_estimator_premium_building.py rewritten for 3-tuple — curated-override, false-positive demotion, class flow-through, uncurated MV fallback, graceful missing-table
  • full suite 2578 passed / 2 skipped (1 pre-existing unrelated test_search_cache_hit)

Follow-up (#2002)

Frontend surfaces premium_building_class + manual_review_*. Data-quality: the cross-city false-positives are non-EKB listings polluting EKB house_ids — worth a separate scraper-geo audit.

Refs #2002

## Summary An **AI/human-curated overlay** on the concentration-based `premium_houses` MV (#2006). The MV flags a building premium purely by expensive-listing concentration — which mislabels mass-market buildings with a few inflated lots, and non-EKB / data-noise listings, as premium. A 9-agent curation pass assessed the top-90 candidates by descriptions + ppm² + web (ЖК name/class/developer): **69 confirmed premium (with class tier) + 19 false-positives demoted** (~21% of the top tier — mostly cross-city mislabels: Нижний Новгород / Челябинск / Краснодар / Сочи, and comfort-class buildings with outlier lots). **Metadata only — pricing untouched, gate byte-identical.** - **`premium_buildings_curated`** (`data/sql/142`): `house_id PK, tier, is_premium, confidence, note`. Seeded with 88 curated rows, idempotent (`ON CONFLICT DO UPDATE`). **Dry-run on prod: CREATE + INSERT 88, demoted=19, rolled back.** - **`_is_premium_building`** now consults curated FIRST → `(is_premium, med_ppm2, building_class)`: a curated row overrides the MV (corrects the flag + supplies a class); uncurated house_ids fall back to MV membership (recall preserved). `CAST(:hid AS bigint)`, graceful try/except if either table is missing. - **`AggregatedEstimate.premium_building_class`** (новое поле) — feeds manual-review (#2019) + frontend. `premium_building` bool now reflects the corrected value (e.g. `house_id 9401` Цвиллинга 7/6 «Парковый квартал», comfort → now `false`). ## Examples (curated) Гоголя 21 → элит · Башня Исеть (Ельцина 6) → премиум · Тихвинъ (Хохрякова 48) → элит · Макаровский Элит (Олимпийская 5) → элит · Клубный Most/Литературный → премиум · Чкалова 119 (ЛСР Южные кварталы, comfort) → demoted. ## Test plan - [x] migration dry-run on prod (88 rows, 19 demoted, rolled back) - [x] regression gate **byte-identical** (premium is metadata, no pricing path) - [x] `tests/test_estimator_premium_building.py` rewritten for 3-tuple — curated-override, false-positive demotion, class flow-through, uncurated MV fallback, graceful missing-table - [x] full suite **2578 passed / 2 skipped** (1 pre-existing unrelated `test_search_cache_hit`) ## Follow-up (#2002) Frontend surfaces `premium_building_class` + `manual_review_*`. Data-quality: the cross-city false-positives are non-EKB listings polluting EKB house_ids — worth a separate scraper-geo audit. Refs #2002
lekss361 added 1 commit 2026-06-27 18:42:50 +00:00
feat(tradein): AI-curated premium-building overlay — class labels + false-positive demotion (#2002)
All checks were successful
CI / changes (pull_request) Successful in 9s
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
31f101acbb
lekss361 merged commit e39fb86a9b into main 2026-06-27 18:43:06 +00:00
lekss361 deleted branch feat/tradein-premium-curated 2026-06-27 18:43:06 +00:00
lekss361 added the
analytics
priority/p2
scope/backend
tradein
labels 2026-06-27 18:43:06 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#2021
No description provided.