feat(tradein): yandex address backfill — street → full address #554
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#554
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-yandex-address-backfill"
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
Standalone script
tradein-mvp/scripts/backfill-yandex-addresses-ekb.pyenricheslistings.addresswith house number for active EKB yandex listings whose address is currently street-only.Why
3354 active yandex listings (87% of EKB pool) have addresses like
улица Горького— Yandex valuation endpoint cant resolve them. Only 350/3704 (9.4%) had house numbers, limiting valuation sweep to ~123 distinct addresses.Detail page
<title>contains the full address:Script fetches detail via
curl_cffi chrome120(plain httpx returns CSR shell), regex-extracts address from title, UPDATEs DB.CLI
Smoke validated
улица Бориса Ельцина→Екатеринбург, улица Бориса Ельцина, 6улица Карла Маркса→Екатеринбург, улица Карла Маркса, 25улица Степана Разина→Екатеринбург, улица Степана Разина, 23Downstream
After full backfill (~3.5h at 3s delay × 3218 items), eligible pool for
sweep-yandex-valuation-ekb.py --require-house-numbergrows from 123 → ~3000+ houses. Idempotent (sweep uses ON CONFLICT + skip-recent).Deep Code Review — verdict APPROVE
Summary
7575999Scope
Standalone one-shot CLI
tradein-mvp/scripts/backfill-yandex-addresses-ekb.pythat:addresslacks a house number (regexaddress ~ ',\s*\d+'negated).source_urlviacurl_cffi chrome120 AsyncSession.<title>full address (Екатеринбург + street + house).listings.addressif changed (skip-unchanged, skip-failed).No backend/app code or DB schema changes. Self-contained ops script.
Correctness — clean
sweep-yandex-valuation-ekb.py(require_house_number=True), guaranteeing consistency between filters.Екатеринбург, улица Горького, 36→ capturedЖК Корица, Екатеринбург, улица Бориса Ельцина, 6→ captures address skipping ЖК prefix (optional non-greedy group works)проспект Ленина, 50/1→ slash preservedМосква, улица Тверская, 1→ no match (Екатеринбург-anchored)match_or_create_houseinteraction (#527 signature change irrelevant — script only writeslistings.address, no INSERT into houses).:addr/:idparams, no:x IS NOT NULLpredicates → psycopg v3 trap N/A.failed. HTTP non-200 reported. Logsflush=Truefor long-run monitor.Performance
SessionLocal()per UPDATE (3354 connections) — slightly wasteful but trivial against 3s sleep per row.Conventions
weasyprintstub block — same shape as siblingsweep-yandex-valuation-ekb.py.sys.pathinjection identical to peer.noqa: E402where needed).Minor observations (not blocking)
... — Екатеринбург, улица — id N(street only, missing house) would write back bareЕкатеринбург, улица. Script doesn't validate that the extracted address itself contains house digits. Unlikely in practice (Yandex titles consistently include house) and smoke validated 5/5 clean. Could add a post-extractif not RE_HOUSE_NUM.search(addr): return Nonefor safety, but acceptable as-is.... — ЖК Foo — Екатеринбург, ...): the optional ЖК prefix group uses[^—,]*?so won't span an em-dash. If Yandex changes title format, script silently skips those rows (failed counter) rather than corrupting data — fail-safe.with SessionLocal()over the loop, but at 3s/req the overhead is invisible.Test coverage
No unit tests. Acceptable for one-shot ops script with documented 5/5 smoke-dry-run validation in PR body.
Vault cross-check
require_house_number=Truepolicy (same regex).Verdict
APPROVE — focused, idempotent, conservative ops script. No security/correctness blockers. Auto-merging.