fix(analytics): rolling 6mo/6mo окна в _district_velocity_trend (#1203) #1265

Merged
bot-backend merged 1 commit from fix/recommend-velocity-trend-rolling-window into main 2026-06-13 06:24:21 +00:00

1 commit

Author SHA1 Message Date
9ac924a9ee fix(analytics): rolling 6mo/6mo окна в _district_velocity_trend (#1203)
All checks were successful
CI / changes (push) Successful in 7s
CI / changes (pull_request) Successful in 6s
CI / frontend-tests (push) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / backend-tests (push) Successful in 6m31s
CI / backend-tests (pull_request) Successful in 6m30s
_district_velocity_trend сравнивал recent vs prior, но окна были
ЗАХАРДКОЖЕНЫ датами 2025:
  recent = report_month >= 2025-07-01           (без верхней границы!)
  prior  = report_month BETWEEN 2025-01-01 AND 2025-06-30

objective_corpus_room_month обновляется еженедельно (objective_etl,
period_month без капа). На 2026-06 recent-окно ≈ 11-12 месяцев vs
prior=6 → при плоском рынке ratio ≈ 1.83, дальше навсегда упирается
в clamp(_, 2.0) → trend_factor=2.0 → macro_velocity_mult ×2 →
bucket_velocity ×2 → months_to_sellout занижен в ~1.8-2x.
Искажение растёт с каждым месяцем; trend-сигнал мёртв.

Patch: rolling 6mo/6mo окна относительно NOW():
  recent = report_month >= NOW() - INTERVAL '6 months'
  prior  = report_month >= NOW() - INTERVAL '12 months'
           AND report_month < NOW() - INTERVAL '6 months'

Равные окна, plain rolling, без хардкода. 29/29 velocity_trend +
recommend_mix тестов зелёные. ruff clean.

Closes #1203
2026-06-13 11:09:26 +05:00