feat(tradein-estimator): exclude rosreestr deals from actual_deals output

rosreestr_deals contains застройщик DDU contracts (177-200 К/м²) that skew
median for secondary-market valuation (~114 К/м²). Pass empty deals list to
AggregatedEstimate; keep _fetch_deals() helper intact for future
segmentation work.

Source: estimate a0a0b820-e8a8-4eee-aa73-0ab3b98ac233 (deals median +40% vs analogs).
This commit is contained in:
lekss361 2026-05-24 13:29:09 +03:00
parent 02b48b8d04
commit 4b32b263e1

View file

@ -402,8 +402,12 @@ async def estimate_quality(
) -> AggregatedEstimate:
"""Главная функция — оценка квартиры по реальным данным.
NOTE 2026-05-24: rosreestr_deals temporarily NOT included in actual_deals
output (they contain ДДУ first-market data that skews secondary-market
median). See Decision_TradeIn_DataQuality_8PR_Roadmap.
Returns:
AggregatedEstimate с estimate_id, медианой, диапазоном, аналогами, сделками.
AggregatedEstimate с estimate_id, медианой, диапазоном, аналогами.
"""
# 1. Geocode
geo: GeocodeResult | None = None
@ -585,11 +589,11 @@ async def estimate_quality(
except Exception as exc:
logger.warning("cian_valuation: lookup failed (graceful): %s", exc)
# 5. Deals — фактические сделки за период
deals = _fetch_deals(
db, lat=geo.lat, lon=geo.lon, rooms=payload.rooms, area=payload.area_m2,
radius_m=DEFAULT_RADIUS_M,
)
# 5. Deals — отключены 2026-05-24 (см. Decision_TradeIn_DataQuality_8PR_Roadmap).
# rosreestr_deals содержит ДДУ первичного рынка (177-200 К/м²), что искажает
# оценку вторички (~114 К/м²). Возвращаемся к этому когда отделим вторичные
# сделки от ДДУ в источнике.
deals: list[dict[str, Any]] = []
# 6. Сохраняем в trade_in_estimates
estimate_id = uuid4()