feat(tradein): backfill deals.lat/lon из house street-центроидов (#569 Step 2) #614
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#614
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-geocode-deals-from-houses"
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?
Summary
Закрывает основную часть #569 — делает реальные ДКП-сделки видимыми для эстиматора.
Проблема:
deals(49,791 ДКП Росреестра) на 100% без координат (geom NULL)._fetch_dealsматчит черезST_DWithin(geom)→ ни одна сделка не находится →actual_dealsвсегда пустой. Это корень #571 («deals disabled») и потеря ground-truth для точности.Решение (street-centroid join, zero внешних вызовов): строим per-street центроиды из ~8.6k уже геокодированных
houses, проставляемlat/lonкаждой сделке по нормализованному ключу улицы.geomавто-заполняется триггеромdeals_set_geom_trg. Street-level точности достаточно (радиус эстиматора 1-2км).Changes
scripts/geocode_deals_from_houses.py_street_keyнормализация, per-street центроиды (AVG), per-row SAVEPOINT,--dry-run/--limit, resume черезgeocode_tried_at, топ-10 unmatched улицtests/scripts/test_geocode_deals_from_houses.py+1031 LOC.
Pre-push review (code-reviewer) — поймал data-corruption баг
_APT_SUFFIX_REбез правого якоря жрал реальные улицы на кв/корп/оф/пом/стр («Строителей» →'ул.'garbage key → неверный центроид → неверные координаты в прод). Fixed: требовать цифру после суффикс-токена (\d.*$) + регресс-тест на «Строителей/Офицеров/Корпусная/Помолова/Стрелочников». Verdict после фикса: ✅.Tests
street-key (3-variant collapse, numeric streets «8 Марта», region/house-number strip, ё→е, apt-suffix regression), centroid AVG, matched UPDATE, no_street_match, --dry-run no-op, SAVEPOINT isolation, geom-not-manual. Ruff clean. (6 pre-existing unrelated fails: WeasyPrint/auth/cache/quota — не затронуты.)
Deploy plan
Миграций нет (использует существующие
deals.lat/lon+deals_set_geom_trg+geocode_tried_at). После merge:--dry-runна проде → замерить projected coverage % + глянуть топ-10 unmatched улиц (убедиться что'ул.'/'пр.'НЕ среди matched-ключей)deals WHERE lat IS NULLдолжно упасть существенноFollow-ups (план #569)
Closes часть #569 (Step 2 of 4).