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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#1118
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/page-reservation-parser"
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?
Что
MVP-скаффолд для ИРД-5 (#1062 изъятие/резервирование ЗУ) эпика #1067. Геометрии зон изъятия нет ни в одном spatial-источнике — перечень ЗУ существует только текстом в постановлениях. Парсим PDF → кад-номера → join к
cad_parcelsза геометрией → per-parcel флаг «в действующем постановлении №X».Состав
data/sql/136_land_reservation.sql— таблицаland_reservation(cad_num, reservation_kind, basis_act, act_number, act_date, purpose, doc_url, is_active, raw_excerpt, …), UNIQUE(cad_num, act_number), idempotent (auto-apply deploy).page_reservation_parser.py—extract_reservations(text)/extract_from_pdf(bytes)(pdfplumber): regex кад-номеров\d{2}:\d{2}:\d{6,7}:\d+, kind (изъятие/резервирование), act_number/date, purpose best-effort, raw_excerpt.reservation_ingest.py— Celery taskingest_reservations(docs), seed = 509-ПП (Татищева). Ручной/on-demand (beat НЕ добавлен — постановления редки). httpx-fetch graceful per-doc.reservation_lookup.py—parcel_reservations(db, cad_num)graceful read-side.НЕ входит (намеренно)
Врезка
parcel_reservationsвbuild_ird_analyze_block— follow-up после merge #1115 (избегаем конфликта поird_analyze.py).VERIFY перед прод-прогоном
_SEED_DOCS[0]["url"]= placeholderpravo.gov66.ru/.../509-pp— уточнить точный URL.ekb_geoportal_client.Часть #1062 / #1091 / #1067.
✅ APPROVE — staff+ review (9 files / ~926 lines, MVP scaffold).
Verified against live prod (deploy-safety gate):
136_land_reservation.sql:land_reservationabsent,136not in_schema_migrations(prod max=135) → next-free, applies once.cad_parcelspresent (read-side join target).pg_constraintDO-block (mirrors м.132). No data inserts.ingest_reservationsis a no-op until manually triggered. Merge risk = migration only (verified safe).Conventions: SAVEPOINT-per-row + SessionLocal try/finally +
CAST(:x AS type)(psycopg v3) mirrorird_harvest.py;parcel_reservationsgraceful-degrade (OperationalError/ProgrammingError→[]) mirrorsird_overlay_lookup.py.verify=Falsefor pravo.gov66.ru matches existing repo precedent (ekburg_permits.py/pzz_loader.py— Russian Минцифры CA). uv.lock consistent with pyproject (pdfplumber 0.11.9 + pypdfium2 5.9.0 manylinux x86_64 wheels → Docker build OK). Vault research consistent (no spatial source for изъятие/резервирование zones).🟡 MINOR findings → consolidated hardening follow-up #1120 (fix BEFORE first real ingest run):
_RE_ACT_NUMBER(page_reservation_parser.py:31) — nested quantifier(?:[chars]+[sep]?)*+ suffix alternation → exponential backtracking (~2.2s @ 25 chars) on№ <digits>not followed by a valid suffix (common in PDF preamble). Mitigated short-term:.searchreturns on first header match (fast for well-formed docs). Fix: mandatory separator between tokens / cap search to header.UNIQUE(cad_num, act_number)doesn't dedupe NULL act_number (NULL≠NULL) → dup rows on re-ingest when act parse fails. Fix: partial unique idx(cad_num) WHERE act_number IS NULL.verify=Falseacceptable for MVP (public read-only PDF, no creds); track repo-wide Russian-CA-bundle env var._MONTH_MAPinsertion-order dep —"март"must precede"ма"(startswith); correct now but fragile to dict re-sort. Fix: explicit stems.Also: vault entry for the PDF-parse approach +
land_reservationgrain (CLAUDE.md rule 6) — folded into follow-up.None block: migration safe + task inert. Merging (squash); findings tracked in #1120 (p2, must-fix-before-go-live).