gendesign/tradein-mvp/backend/app
lekss361 d3ad896efe fix(tradein): filter ДКП-only in rosreestr importer + re-enable deals
rosreestr_deals open dataset contains both ДКП (resale, ~110-120K ₽/м²) and
ДДУ (developer pre-sale, ~177-200K ₽/м²). Mixed import previously skewed
secondary-market median, forcing PR #504 to disable deals output entirely.

This PR fixes the root cause: filter doc_type='ДКП' in import-rosreestr.sh
(WHERE clause) and re-enable _fetch_deals() call in estimator.py (was stubbed
to deals=[] since PR #504). dedup_hash prefix changed to 'ros:dkp:' to allow
future ДДУ import as separate source without collision.

Also fix pre-existing broken mock in test_estimator_cian_integration.py:
_fetch_analogs returns 3-tuple (list, bool, str) but mocks passed ([], False)
— updated to ([], False, 'W') matching actual signature.

Post-merge ops (NOT in this PR):
  DELETE FROM deals WHERE source='rosreestr' AND dedup_hash NOT LIKE 'ros:dkp:%';
  ./deploy/import-rosreestr.sh   # на prod

Tests: _fetch_deals already mocked in test_estimator_cian_integration.py.

Refs: Decision_TradeIn_DataQuality_8PR_Roadmap (PR #504 reversed properly).
2026-05-24 22:31:23 +03:00
..
api feat(tradein): cian price-change badges + split chart Avito/Yandex (#547) 2026-05-24 18:24:00 +00:00
core feat(tradein): postgres_fdw live read of gendesign.cad_buildings (replaces snapshot) (#493) 2026-05-24 08:57:30 +00:00
schemas feat(tradein): cian price-change badges + split chart Avito/Yandex (#547) 2026-05-24 18:24:00 +00:00
services fix(tradein): filter ДКП-only in rosreestr importer + re-enable deals 2026-05-24 22:31:23 +03:00
tasks feat(tradein/cian): valuation backfill + runner script для prod (#539) 2026-05-24 15:16:45 +00:00
__init__.py feat: add tradein-mvp subproject (Trade-In Estimator под /trade-in) 2026-05-21 00:25:39 +03:00
main.py feat(tradein): postgres_fdw live read of gendesign.cad_buildings (replaces snapshot) (#493) 2026-05-24 08:57:30 +00:00