fix(tradein): exclude novostroyki from radius-median comp pool (#935)
Some checks failed
Deploy Trade-In / test (push) Successful in 31s
Deploy Trade-In / deploy (push) Blocked by required conditions
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / build-frontend (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / build-backend (push) Has been cancelled

Co-authored-by: bot-backend <bot-backend@gendsgn.local>
Co-committed-by: bot-backend <bot-backend@gendsgn.local>
This commit is contained in:
bot-backend 2026-05-31 21:33:23 +00:00 committed by bot-reviewer
parent 571980c56e
commit 3294bc2021

View file

@ -3246,6 +3246,10 @@ _COMMON_WHERE = """
OR year_built BETWEEN CAST(:cohort_year_min AS integer)
AND CAST(:cohort_year_max AS integer)
)
-- Исключаем новостройки из comp-пула вторички: девелоперский прайс искажает
-- медиану /м². NULL сегмент пропускаем (rosreestr/avito/yandex без сегмента
-- это вторичка или неклассифицированный объект).
AND (listing_segment IS NULL OR listing_segment <> 'novostroyki')
"""
# Note: Tier W has its own inline copy of the cohort clause (PR #519 line
# ~1280). Не удалять — Tier W не использует _COMMON_WHERE из-за inline
@ -3594,6 +3598,9 @@ def _fetch_analogs(
OR year_built BETWEEN CAST(:cohort_year_min AS integer)
AND CAST(:cohort_year_max AS integer)
)
-- Tier W: исключаем новостройки из comp-пула (sync с _COMMON_WHERE).
-- NULL сегмент пропускаем rosreestr/avito/yandex без сегмента вторичка.
AND (listing_segment IS NULL OR listing_segment <> 'novostroyki')
-- 2026-05-23: Avito coords теперь real (PR #487 убрал jitter после
-- C-5 audit). Listings с NULL coords отфильтруются через ST_DWithin
-- (geom IS NULL не matches). geocode-missing-listings backfill