gendesign/backend/tests/services/forecasting
Light1YT e67cb721bf fix(objective): physflat-dedup current-state consumers + honest n_sold window (#1964)
objective_lots — current-state UPSERT (UNIQUE objective_lot_id, 5 snapshot_date),
но Объектив присваивает ОДНОМУ физлоту (project,corpus,section,floor,lot_number)
несколько lot_id за пере-листинги → таблица раздута ~2.91× (прод: 1.75M квартир-
строк vs 603k физлотов). История — в отдельной objective_lots_history (не трогаем).

STEP 1: миграция 175 — VIEW v_objective_lots_latest (DISTINCT ON physflat-ключ,
последний снапшот). ol.* стабилен (51==51 колонок). DRY-RUN на проде: 603 049
квартир vs 1 753 283 raw.

STEP 2: репойнт current-state консьюмеров objective_lots → v_objective_lots_latest:
- supply_layers._L1_OPEN_SQL (L1 открытое предложение → дефицит-форсайт; прод:
  Юго-Западный комфорт 58 606 → 12 620)
- competitors._SOLD_COUNT_SQL (+ комментарий: COUNT(DISTINCT lot_id) СОХРАНЁН для
  fan-out-защиты маппинга, не COUNT(*) — view гарантирует physflat-дедуп, DISTINCT
  гарантирует mapping-fan-out-safety)
- parcels.py obj_pricing CTE (карточка конкурента units_sold/available)
- special_indices._ARTIFICIAL_DEMAND_SQL
- parcels.py district price block + geo-radius median (sample_size/n)
- concepts._OBJECTIVE_MEDIAN_SQL (гейт n≥10)
- landing KPI3 (% квартир с ценой)
- admin_scrape coverage: `lots` оставлен сырым (ETL-fidelity vs SQLite), добавлен
  `lots_physflat`
#1959 inline-дедуп в market_metrics НЕ рефакторим — добавлен комментарий об общем
physflat-ключе с view.

STEP 3: report_assembler._deal_count теперь = unit_velocity × window_months
(оконные продажи), НЕ кумулятивный n_sold. confidence_engine помечает фактор
«за 6 мес» и гейтит порогами окна (high≥50) — кумулятив (прод EKB ~380 921) делал
гейт бессмысленным и подпись лживой; оконное (~24 876 за 6 мес) честно.

Тесты: +guard'ы (L1/sold-count читают view, deal_count оконный). 963 passed.
2026-06-28 04:27:43 +05:00
..
__init__.py feat(forecasting): monthly macro series + regime classifier (#951b) (#1007) 2026-06-03 05:37:43 +00:00
test_affordability.py fix(week-review): backend-аудит v2 — 82 фиксов (#1660) 2026-06-17 17:13:38 +00:00
test_confidence_engine.py fix(report): human RU microcopy in Site Finder Section 6 (#1963) 2026-06-27 17:42:27 +05:00
test_demand_normalization.py feat(forecasting): wire Almon-ADL rate estimator into §9.6 consumers (#978) 2026-06-04 10:33:31 +00:00
test_demand_supply_forecast.py fix(forecast): посегментный+дедуплицированный индекс дефицита (#1959) 2026-06-27 22:50:58 +05:00
test_macro_coefficient.py feat(macro): CBR inflation (ИПЦ YoY) -> macro_indicator + activate §9.5 channel (#946) 2026-06-08 11:41:14 +05:00
test_macro_series.py feat(macro): CBR inflation (ИПЦ YoY) -> macro_indicator + activate §9.5 channel (#946) 2026-06-08 11:41:14 +05:00
test_normalize.py fix(forecasting): count non-zero observations in normalize guard, not zero-filled buckets (#1638) 2026-06-17 20:39:00 +03:00
test_orchestrator.py fix(forecasting): honest scenarios collapse when β rate-sensitivity gate fails (audit #1871 P1) 2026-06-22 19:06:22 +05:00
test_product_scoring.py refactor(forecasting): rename commercial_share_pct → commercial_sell_through_pct (#1635) 2026-06-17 13:32:03 +05:00
test_rate_sensitivity.py feat(forecasting): §9.6 key-rate sensitivity module (#951d, advisory) (#1009) 2026-06-03 06:06:16 +00:00
test_recommendation.py fix(forecast): посегментный+дедуплицированный индекс дефицита (#1959) 2026-06-27 22:50:58 +05:00
test_regression.py feat(forecasting): wire Almon-ADL rate estimator into §9.6 consumers (#978) 2026-06-04 10:33:31 +00:00
test_report.py feat(forecasting): §13 SiteFinderReport object (#987, 955-A1) (#1019) 2026-06-03 08:33:01 +00:00
test_report_assembler.py fix(objective): physflat-dedup current-state consumers + honest n_sold window (#1964) 2026-06-28 04:27:43 +05:00
test_sales_series.py feat(forecast): resolve admin district -> micro set in §9.x market/supply/sales filters 2026-06-05 07:03:37 +05:00
test_scenarios.py fix(forecasting): honest scenarios collapse when β rate-sensitivity gate fails (audit #1871 P1) 2026-06-22 19:06:22 +05:00
test_special_indices.py fix(forecasting): correct _geo_weight decay/floor so far projects get low weight (#1633) 2026-06-17 20:44:00 +03:00
test_what_to_build.py feat(forecasting): what-to-build ranker + MAI proxy (#981, 952-B) (#1013) 2026-06-03 07:07:17 +00:00