fix(sf-16): derive price_per_m2 from price_rub in _norm_flat + backfill SQL #298
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#298
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/sf-16-malevich-prices"
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?
Audit findings
status='free'price_avg(Jan 2026)/tableendpointRoot cause: DOM.РФ
/portal-kn/api/sales/portal/tableвозвращаетprice: nullдля большинства объектов. Цены на уровне квартиры — в отдельном catalog-квартир endpoint, ещё не scraped.Маппинг scraper-а корректен. Для Малевич этот PR не решает проблему (price_rub тоже NULL) — нужен новый scraper в follow-up (BUG #22 будет добавлен в FixList).
Changes
backend/app/services/scrapers/domrf_kn.py— defensive deriveprice_per_m2 = round(price_rub / total_area, 2)в_norm_flat()когда API даётprice_rubно неpricePerSquareMeter. Помогает для 849 partial-response cases (другие objs).data/sql/107_backfill_price_per_m2.sql— idempotent UPDATE для historical 849 rows.fixes/Fix_SF_Malevich_Prices_May17.mdTest plan
SELECT COUNT(*) FROM domrf_kn_flats WHERE price_per_m2 IS NOT NULL→ +849 (с 849 → ~1698)Follow-up (НЕ в этом PR)
BUG #22 — новый scraper
domrf_catalog.pyдля извлечения per-flat price из catalog endpoint. Закроет Малевич + другие 666 objects с NULL prices.Related: epic #271 item #16 · Wave 3 (P2) · last item списка 1-20 (BUG #22 будет добавлен)
Merged via deep-code-reviewer — verdict APPROVE.
Проверено:
_norm_flat()derive logic: guardtotal_area > 0+ приоритет APIpricePerSquareMeterсохранён. Defensive only.data/sql/107_*.sql:price_rub::numeric / total_area— inline cast на column expression, не CAST trap.BEGIN/COMMIT+ WHERE-guards = idempotent.price_per_m2 numeric(без явной precision) →ROUND(..., 2)совместим.price_rub bigint,total_area numeric→ деление промотируется в numeric (::numericcast явно). OK.107_sequential после106_backfill_obj_class_from_ai_description(#293 merged). Correct.fixes/Fix_SF_Malevich_Prices_May17.mdприсутствует, корректно документирует root cause + BUG #22 follow-up.Smoke после deploy:
Reminder: BUG #22 (catalog-квартир scraper
domrf_catalog.py) — обязательный follow-up для закрытия Малевич + 666 объектов с NULL ценами. Текущий PR покрывает только 0.2% partial-response cases.