feat(tradein): DaData on-demand enrichment в estimate flow (PR Q1) #604
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#604
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-dadata-enrichment"
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
Интегрирует DaData /clean/address в estimate flow для on-demand enrichment целевого адреса — добавляет canonical-форму,
kadastr_num(ДОМА),house_fias_id, ближайшие станции метро в response эстимейта.Это foundation для будущего T0_per_house tier matching сделок Росреестра (см. PR M / #564 Phase 3): сейчас все rosreestr deals = T1_per_street потому что open dataset не отдаёт
kadastr_num. С DaData enrichment у каждого estimate появляется canonical cadnum таргета — можно matchить deals по кадастру если они будут.Изменения
backend/app/services/dadata.pybackend/tests/services/test_dadata.pybackend/data/sql/069_trade_in_estimates_dadata_fields.sqlbackend/app/services/estimator.pybackend/app/schemas/trade_in.pybackend/app/core/config.py.env.exampleDEPLOY.md8 файлов, +682 LOC.
Архитектура
clean_address(address)→DadataAddressResult | None(slots-based frozen dataclass). ВозвращаетNonegracefully при: отсутствии creds / коротком адресе / network fail / 4xx/5xx / пустом response / address-not-recognized.estimator.estimate_quality: вызывается один раз послеgeocode(), перед house-metadata enrichment. Результат пишется вtrade_in_estimatesтеми же 6 новыми nullable-колонками в основной INSERT (без отдельной транзакции).DADATA_API_TOKEN+DADATA_API_SECRET(auto env-var derivation).Quota
/clean/address. Хватит на low-traffic prod (~1 estimate в час) и все наши тесты.None, estimator продолжит без enrichment — никаких сбоев flow.Тесты
Покрыто:
Zero real DaData API calls — все mocked через
httpx.MockTransport. Существующие estimator-тесты (cian/cohort/floor/imv/yandex 46 тестов) ⇒ без регрессий.Migration
069 — добавляет 6 nullable columns в
trade_in_estimates(canonical_address,house_cadnum,house_fias_id,dadata_qc_geo,dadata_qc_house,dadata_metrojsonb). Идемпотентна (IF NOT EXISTS).ENV
Хранится в vault
meta/00_credentials.md. Перед merge нужно добавить на VPS:Follow-ups
geocode_cacheили отдельной таблице (90-day TTL) — экономия quota_fetch_deals/_fetch_analogsILIKE-фильтрах вместо raw payload.address