feat(tradein): blend Avito IMV anchor into estimate + ДКП corridor advisory (#651, #652) #674

Merged
bot-reviewer merged 5 commits from feat/tradein-651-652-accuracy into main 2026-05-29 17:42:06 +00:00

5 commits

Author SHA1 Message Date
lekss361
70a1f604f9 Merge remote-tracking branch 'forgejo/main' into feat/tradein-651-652-accuracy
# Conflicts:
#	tradein-mvp/backend/app/core/config.py
#	tradein-mvp/backend/app/services/estimator.py
2026-05-29 20:39:15 +03:00
lekss361
e9eb812d8b fix(tradein): recompute expected_sold_* after IMV blend + band-guard anchor (#651)
Review-bot findings:
- CRITICAL: expected_sold_* were derived from PRE-blend median/range/ppm2, so
  after the #651 blend raised median_price the UI showed asking (blended) vs
  expected-sold (un-blended) → nonsensical discount. Moved the asking→sold
  derivation to AFTER the blend block; INSERT + returned estimate now use the
  post-blend values.
- IMV anchor had no rooms/area band → a studio-only IMV row could anchor a
  3-room target and inflate via the x1.15 trigger. Added NULL-tolerant guard
  (abs(Δrooms)<=1 AND area_m2 BETWEEN area*0.7..1.3) in _fetch_house_imv_anchor.
- Tests: expected_sold↔blended-median consistency, band rejection, weight clamp
  [0,1], corridor count branch. ruff clean; 26 + 145 estimator regression pass.
2026-05-29 20:11:25 +03:00
lekss361
1d74410832 Merge remote-tracking branch 'forgejo/main' into feat/tradein-651-652-accuracy
# Conflicts:
#	tradein-mvp/backend/app/core/config.py
2026-05-29 19:11:51 +03:00
lekss361
6a81e91a83 feat(tradein): surface Avito IMV anchor + ДКП corridor in HeroSummary (#651, #652)
Frontend surfacing in the DEPLOYED trade-in UI (tradein-mvp/frontend):
- types/trade-in.ts: add AvitoImvSummary + DkpCorridor, optional avito_imv /
  dkp_corridor on AggregatedEstimate (mirror backend snake_case, no any)
- HeroSummary.tsx: 'Avito IMV: X млн ₽' caption near price + 'Коридор реальных
  сделок: X–Y млн · N ДКП (Росреестр)' line. No new fetch, no-op when null.
tsc --noEmit clean. Root legacy frontend/ untouched.
2026-05-29 19:04:32 +03:00
lekss361
70ee7b282c feat(tradein): blend Avito IMV anchor into estimate + ДКП corridor advisory — backend (#651, #652)
Radius-median underestimated premium/view units ~2x. #651: blend real Avito
IMV (house_imv_evaluations per house_id) one-directional raise-only — when
IMV recommended > median*1.15, median = blend(median,IMV,w=0.5), range_high
extends to IMV higher. #652: ДКП corridor (rosreestr deals, RUB/m2, advisory
+ soft +-25% note, no clamp). Behind config flags (default on), null-guarded
no-op when absent. Adds avito_imv + dkp_corridor to AggregatedEstimate.
Validated on live DB (B. Yeltsina 6 80m2: 19.7M->25.8M, range->33.5M).
Frontend surfacing (tradein-mvp/frontend) follows in next commit.
2026-05-29 18:58:10 +03:00