gendesign/backend/app/services/site_finder
lekss361 e1a2a779e4 feat(analytics): mv_quarter_price_per_m2 MV + refresh helper (#33 D1 PR A)
Per-cad_quarter price aggregation из 6.83M rosreestr_deals.

Source verification (postgres MCP):
- rosreestr_deals total: 6 830 001
- price_per_sqm filled 99.9% (fallback deal_price/area)
- quarter_cad_number (NOT cad_quarter), period_start_date, realestate_type_code

SQL (95_mv_quarter_price.sql, ~124 LOC):
- Filter realestate_type_code='002001003000' (новостройки) + outlier 30K..800K
- Percentile p25/median/p75 + mean + temporal slices (6m/12m/24m)
- 24-month window, HAVING COUNT(*)>=3
- WITH NO DATA + REFRESH after INDEX (#194 pattern)
- UNIQUE INDEX (quarter_cad_number) для CONCURRENTLY
- ~52 492 quarters в MV (all-Russia; EKB subset ~9700)

Python helper (quarter_price_refresh.py, ~65 LOC):
- refresh_quarter_price(db, concurrently=True) с try/except fallback

Phase B (analyze integration — quarter median вместо district) — отдельный PR.
2026-05-16 14:06:57 +03:00
..
__init__.py init 2026-04-25 13:45:19 +03:00
best_layouts.py feat(parcels): best-layouts endpoint + service (#113 PR C) (#196) 2026-05-16 09:10:06 +00:00
cadastre_fetch.py feat(site-finder): auto-fetch cadastre geometry on-demand (#93) (#95) 2026-05-12 09:02:17 +03:00
competitors.py feat(parcels): competitors endpoint (Forgejo #112 Phase 1 backend) (#191) 2026-05-15 22:21:05 +00:00
filters.py init 2026-04-25 13:45:19 +03:00
gate_verdict.py feat(site-finder): gate verdict aggregator — can-build-MKD signal (#32 G5 sub-PR 1/2) (#142) 2026-05-15 00:59:53 +03:00
layout_signature.py feat(parcels): layout signature schemas + extractor (#113 PR A) (#193) 2026-05-16 07:52:34 +00:00
layout_velocity_refresh.py feat(analytics): mv_layout_velocity MV + refresh helper (#113 PR B) (#194) 2026-05-16 08:26:59 +00:00
noise_loader.py feat(site-finder): isochrones UI + networks VKH + OSM substations 2026-05-11 21:48:21 +03:00
parser.py init 2026-04-25 13:45:19 +03:00
poi_loader.py feat(site-finder): v3.1 — cad_parcels_geom, analyze fallback, POI lat/lon, OSM expand 2026-05-11 19:52:19 +03:00
pzz_loader.py fix(pzz_loader): replace bare db.rollback() with SAVEPOINT per-row (#124) 2026-05-14 23:29:23 +03:00
quarter_dump_lookup.py feat(parcels): connection-points endpoint (Forgejo #115 Phase 1 backend) (#190) 2026-05-16 05:58:27 +00:00
quarter_price_refresh.py feat(analytics): mv_quarter_price_per_m2 MV + refresh helper (#33 D1 PR A) 2026-05-16 14:06:57 +03:00
scorer.py init 2026-04-25 13:45:19 +03:00
velocity.py feat(velocity): per-room-bucket breakdown in VelocityResult (#163) 2026-05-15 10:09:03 +03:00
weight_profiles.py feat(site-finder): inline POI weights pass-through в /analyze (#201 Phase 1) (#206) 2026-05-16 11:00:41 +00:00