feat(22begh): schema extension — flats+6 / objects+30 / developers+4 / metro_top3 #306
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#306
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/22b-e-g-h-schema-extension-worktree"
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
Issue #297 sub-tasks 22b + 22e + 22g + 22h combined (5d). Все touch
domrf_kn.py+ 1 SQL migration. Combined чтобы избежать конфликтов в scraper file.Changes
data/sql/113_22begh_kn_schema_extension.sql(NN renamed 112→113, collision с PR #305 22i):domrf_kn_flats+6 cols: section_no, finishing_type, ceiling_height_m, key_handover_dt, catalog_updated_at, catalog_url_hashdomrf_kn_objects+30 cols: building specs (8) + apartment summary (3) + yard infra (4) + ОВЗ (3) + catalog/UI (9) + metro & scores (5) + developer split (1)metro_top3 jsonb,metro_nearest_name,metro_nearest_walk_minutes— склеено с 22e (1 ALTER)domrf_developers+4 metrics: houses_building / houses_building_delayed / houses_delivered / houses_delivered_delayedADD COLUMN IF NOT EXISTS(idempotent)backend/app/services/scrapers/domrf_kn.py:_norm_flat()— добавлен mapping для 6 новых flat fields (NULL для catalog-only fields до 22d catalog scraper)_norm_object()— mapping для 30 новых object fields (NULL для fields где payload пусто)UPSERT_FLAT_SQL+UPSERT_OBJECT_SQL— ON CONFLICT clause с COALESCE для новых полей (preserves existing при NULL incoming)Notes
metro_top3 jsonbбудет заполняться когда payload audit показывает metro key (если нет в kn-API — нужен запрос на /metro endpoint, future task).Test plan
\d domrf_kn_objectsпоказывает все 30 новых колонокRelated: issue #297 sub-tasks 22b/22e/22g/22h · Phase 2-3 schema · ~5 days effort
Merged via deep-code-reviewer — verdict APPROVE.
Что проверено:
113_sequential (после112_22i), BEGIN/COMMIT, всеADD COLUMN IF NOT EXISTS— идемпотентно.ALTER TABLE ... ADD COLUMNдля nullable без default — constant-time, таблицу не rewrite'ит.metro_top3 jsonbparsing safe: guard наisinstance(dict)+metro.name,float(raw_time)в try/except,json.dumps(..., ensure_ascii=False)+CAST(:metro_top3 AS jsonb)(no::trap)._g()/_to_date()/_to_bool()defensive — корректно вернут None на пустом payload.COALESCE(EXCLUDED.X, table.X)— preserves existing values при NULL incoming (тот же pattern что в PR #302).v_domrf_objects_with_salesиспользуетSELECT o.*— PostgreSQL re-resolves*at query time, новые колонки visible после ALTER без rebuild VIEW.:x::typetrap.Cross-file impact: PR #292 VIEW
v_domrf_objects_with_sales— OK, PR #302 fields (flat_number/living_area/wall_type/energy_eff) — no collision (отдельные колонки), PR #305 (22i) — naming113_корректный.Smoke после deploy:
\d domrf_kn_flats— все 6 новых колонок (section_no, finishing_type, ceiling_height_m, key_handover_dt, catalog_updated_at, catalog_url_hash).\d domrf_kn_objects— все 30 новых колонок.\d domrf_developers— все 4 metrics.obj_id=65136: какие из 22e fields заполнились (audit на coverage). Ожидаемо заполнятся:section_count,project_declaration_num,project_published_at,price_min_rub,dev_group_name,metro_nearest_name,metro_nearest_walk_minutes,metro_top3.finishing_type,elevators_*,parking_total_slots,domrf_score_*,houses_*) останутся NULL — будут заполнены в 22d catalog scraper.