feat(22c): domrf_kn_flat_plans new table + parser stub #308
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#308
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/22c-flat-plans-v2"
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-task 22c (2d). NEW table
domrf_kn_flat_plans+ parser stub для plan images per-flat.Payload audit (obj_id=65136)
Plan image URL ОТСУТСТВУЕТ в kn-API payload. Проверено:
kn_object_place_66(2.3 MB): ILIKE%planImage%,%plan_image%,%planUrl%,%layoutImage%,%imageUrl%→ всеFALSEdomrf_raw_endpoints; поляplanImageUrl/layoutUrlотсутствуютИсточник: только SSR-HTML страницы
/сервисы/каталог-квартир/квартира/{hash}→ нужен 22d catalog scraper (PR #307) для извлечения plan_image_url.Changes
data/sql/114_22c_flat_plans.sql(renamed from 100 — collision с merged 100_fix_mv_layout_velocity):backend/app/services/scrapers/flat_plans.py(NEW, +241 lines):extract_flat_plans(raw_payload) -> list[dict]— parse plan image URLs (from catalog HTML when 22d wired)upsert_flat_plans(db, obj_id, plans)— UPSERT с COALESCE для local_path/downloaded_atdownload_plan_image_stub()—NotImplementedErrorplaceholder (Celery task — follow-up PR)fixes/Fix_BUG22c_FlatPlans_NewTable_May17.mddomrf_kn.pyНЕ trog'нут.Wiring TODO (separate PR)
Требует merge 22d catalog scraper (PR #307) для извлечения
plan_image_urlиз SSR HTML. Затем wiring + Celery task для download images.Test plan
Related: issue #297 sub-task 22c · depends on 22d for source
- data/sql/100_22c_flat_plans.sql: CREATE TABLE domrf_kn_flat_plans (ods_id PK, obj_id, plan_image_url, local_path, dimensions, snapshot_date) + index on obj_id. - backend/app/services/scrapers/flat_plans.py (NEW): * extract_flat_plans(raw_payload) — reserved stub; kn-API audit confirms plan images are NOT in portal/table payload, only in catalog SSR HTML. Function probes planImageUrl/layoutImageUrl/planUrl/layoutUrl/imageUrl for forward-compat if API ever adds the field. * upsert_flat_plans(db, obj_id, plans, snapshot_date) — UPSERT with COALESCE guard for local_path/downloaded_at/dimensions. * download_plan_image_stub() — NotImplementedError placeholder; real downloader is a future Celery task (#299 / 22d-track). Audit (obj_id=65136): plan_image absent from kn_object_place_66 payload (2.3 MB, checked planImage/planUrl/layoutImage/imageUrl — all FALSE). Source is catalog flat page SSR only. Wiring domrf_kn.py — separate PR. Issue #297 sub-task 22c.Deep review APPROVE — merged squash (
b37e011).Что проверено:
data/sql/114_22c_flat_plans.sql— sequential после113_22begh_*,BEGIN/COMMIT+IF NOT EXISTSидемпотентно, COMMENT'ы корректные. Nit: header still says "Migration 100" после rename — не блокер.extract_flat_plans()— None-safe (or []), tries multiple возможных field names, debug log при пустом результате.upsert_flat_plans()— SAVEPOINT per row черезdb.begin_nested(), named binds (:param, psycopg v3 OK), COALESCE наlocal_path/downloaded_at/width_px/height_px/size_bytes— скачанные артефакты не перезаписываются при re-scrape.download_plan_image_stub()—NotImplementedErrorс descriptive message, без silent fallback.Blast radius: zero —
domrf_kn.pyне trog'нут, no callers, новая таблица без FK.Smoke после deploy:
Follow-up (после PR #309 catalog scraper merge):
extract_flat_plans← SSR-HTML parserdownload_plan_image_stub(issue #299)