feat(tradein): geocode leftover deals via Nominatim (#569 Step 3) #615
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#615
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-geocode-deals-nominatim"
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 до acceptance. Step 2 (#614) покрыл 86% сделок street-центроидами; остаются ~14% на улицах без геокодированных домов — centroid-join их не достанет, нужен реальный geocoder.
scripts/geocode_deals_nominatim.pyгеокодит остаток черезgeocoder.geocode()(cache → Cadastral FDW → Yandex → Nominatim, 1 req/s). Дедуп по адресу → distinct улицы определяют число вызовов, не 7k строк.geocode_tried_atстампится на каждой попытке → un-geocodable не крутятся.Changes
scripts/geocode_deals_nominatim.pytests/scripts/test_geocode_deals_nominatim.pyReview
code-reviewer: ✅ APPROVE, no critical. Проверено: SQL-safety (psycopg v3 CAST), no-infinite-reloop (mark-tried на clean miss / no-stamp на raised exception + staleness filter),--limitwindow-cap bounded, geom-not-manual (trigger), dedup (UPDATE все строки адреса), async loop. Transaction-handling с per-address SAVEPOINT — безопаснее sibling'а.Tests
17 passed · sibling+task 37 passed · full suite 791 passed / 6 pre-existing unrelated. Ruff clean.
Deploy
Миграций нет. После merge:
--dry-run→ замер hit-rate, потом реальный прогон--limit 2000батчами. Acceptance #569:deals WHERE lat IS NULL< 5% (street-level точности достаточно для радиуса 1-2км).Closes #569.
Добавляет scripts/geocode_deals_nominatim.py для ~14% сделок всё ещё lat IS NULL после house-centroid прохода (Step 2) — улицы без геокодированных домов, которые centroid-join не покрывает. Переиспользует geocoder.geocode (cache → Cadastral FDW → Yandex → Nominatim), дедупит по адресу (distinct улицы определяют число вызовов, не 7k строк), и стампит geocode_tried_at на КАЖДОЙ попытке (успех И чистый промах) чтобы un-geocodable строки не крутились по 1 req/s. Resume: lat IS NULL + 30-day staleness, per-address SAVEPOINT, --limit/--dry-run/--batch/--stale-days. Pre-push review (code-reviewer): ✅ APPROVE, no critical — проверены SQL-safety, no-infinite-reloop (mark-tried на miss, no-stamp на raised exc), window-cap, geom-not-manual, dedup, async. Tests: 17 passed. Ruff clean.