feat(sql): ekb_district_alias micro→admin vocab bridge (131) — forecast wiring Step 1 #1053
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#1053
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/district-vocab-reconciliation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What — Step 1 of the §9.x forecast wiring (the gate)
Adds
ekb_district_alias— a curated micro→admin district vocabulary bridge.Why: §9.x forecast metrics filter
objective_lots.district(informal MICRO-districts, 35 distinct: ВИЗ, Уралмаш, Уктус…) but/analyzeresolves the official ADMIN district fromekb_districts(8 polygons: Кировский, Ленинский…). Admin name → 0 rows → silent empty forecast (ground-truthed:market_metrics('Кировский')→obj_count=0; the test parcel sits in Академический which exists in both vocabularies, masking the bug).How — curated seed, NOT spatial
Spatial via
complexeswas verified unreliable and rejected:objective_lots.complex_id = complexes.idjoins only ~28% of rows;complexesis multi-city (coords span beyond ЕКБ) →ST_Containsscatters every micro across all 8 admins. So the 35 micros are mapped to their PRIMARY admin by ЕКБ administrative geography (spatial used only as a sanity-check; conflicts documented per-row).ekb_district_alias(admin_district, micro_district UNIQUE, note)— idempotent (CREATE TABLE IF NOT EXISTS+INSERT … ON CONFLICT DO NOTHING, BEGIN/COMMIT, additive, no DROP/TRUNCATE).objective_lotsdata-quality gap) bucketed into onenote='cross-city:…'row, trivially filterable (WHERE note IS NULL).Applied to prod + registered in
_schema_migrations(idempotent re-apply confirmedINSERT 0 0) → deploy-gate will no-op on merge.Step 2 (wire the resolver into
market_metrics/the §9.x orchestrator) is a separate PR. Refs #969 #949.§9.x forecast metrics filter objective_lots.district (informal micro-districts) but /analyze resolves the official admin district from ekb_districts → admin name matched 0 rows → silent empty forecast (market_metrics('Кировский')→0). Add a curated micro→admin alias table seeding all 35 micro values to their primary admin (8 EKB admins). Curated not spatial: complex_id join hits only ~28% of rows and complexes is multi-city, so ST_Contains scatters micros uniformly. 4 cross-city values (Н.Тагил/Каменск) contained in one noted bucket. Coverage: 8/8 admins resolve, 35/35 mapped, 0 unmapped. Idempotent + additive (CREATE TABLE IF NOT EXISTS + INSERT ON CONFLICT DO NOTHING); applied to prod + registered in _schema_migrations. Resolver/fallback documented in header; market_metrics wiring is Step 2 (separate PR). Refs #969 #949.