feat(sf): gknspecial_zone ИРД-harvest → ird_overlays (#1063/#1064/#1065/#1066) #1114
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#1114
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/gknspecial-ird-harvest"
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?
Что
Новый Celery harvest-task
harvest_gknspecial_zones, снимающий ЗОУИТ-слой ЕКБ-геопорталаportal_geo_gknspecial_zone(WFS, читаемый тип+ограничения+рег.№ в одном запросе) → существующая таблицаird_overlays. Один слой/один harvest закрывает 4 пункта эпика #1067 «GG-форсайт»:layer_kind=servitude, ~2344 фичи city-wide)Как
EKBGeoportalClient.features_by_cql()— новый публичный метод (произвольный CQLfull_name LIKE).full_name→layer_kind+ sentinelsource_layer_id(990001–990008; unmatched → 990099, не дропаем — defensive).geom_data_id= trailing int из WFSfeature_id; геометрия уже EPSG:4326 (без ST_Transform);zone_type_name/content(ограничения,решение,документ,дата) заполняются сразу (content_source=ekb_geoportal).zone_state_v) — кириллица в combined-CQL ломает запрос.(source_layer_id, geom_data_id), SAVEPOINT per-row. Без новой SQL-миграции (таблица на проде).parcel_ird_overlapsрасширен колонкойcontent→ новые overlap'ы всплывают в analyze без правок wiring.gknspecial-harvest-weekly(пн 05:30 МСК).Тесты
27 unit (классификация/regex/geom_data_id/активность/upsert-идемпотентность) + content-passthrough в lookup. Геопортал замокан, в сеть не ходят.
NB для reviewer / прогона
Точные
full_name-префиксы 3 типов (ОКН/ЗСО/приаэродром) не сверены живьём (локальный TLS). После merge — разовый ручной прогон task на проде, проверитьgknspecial_harvest: prefix=... fetched=N(нулевой fetched при непустом слое = неверный префикс, поправить map).Closes #1063 #1064 #1065 #1066 (частично — ЗОУИТ-часть; ОКН-объекты/ООПТ-лес/полнота приаэродром-подзон остаются).
✅ APPROVE — staff+ review (deep, 7 files / ~644 lines).
Verified against live prod DB:
ird_overlayscolumnscontent/content_source/content_fetched_at/geom_data_id/source_layer_id/raw_props/zone_type_nameall exist → no migration needed, claim holds.uq_ird_overlays_feature(source_layer_id, geom_data_id)exists →ON CONFLICTvalid.Correctness/conventions: SAVEPOINT-per-row (
begin_nested) + SessionLocal try/finally +CAST(:x AS type)(psycopg v3) mirrorird_harvest.pyexactly. CQL f-stringfull_name LIKE '{prefix}%'uses only hardcoded_PREFIX_MAPconstants — no injection vector. Prefixstartswithordering safe (ЗСО vs ОКН-зона no collision). Cross-prefix double-fetch deduped by ON CONFLICT (redundant traffic at worst). Sentinel range 990001–990099 doesn't collide with НСПД layer_ids. Vault research (EKB_Geoportal_IRD_Layers...Jun06) confirmsLIKE 'X%'works for all 8 types + documents the combined-Cyrillic-CQL breakage that justifies the client-sidezone_state_vfilter.🟡 MINOR (non-blocking, follow-up filed):
db.commit()—ird_harvest.pycommits incrementally; a Celery WorkerLost mid-run on the ~20k-feature first harvest would drop all written rows. Per-prefix commit recommended → follow-up issue.test_upsert_idempotency_no_duplicatesis vacuous (asserts execute-called-2x, doesn't exercise ON CONFLICT) — acceptable, real guarantee is the DB constraint.Post-merge (author's NB, acknowledged): first scheduled run (Mon 05:30 МСК) — check Celery logs
gknspecial_harvest: prefix=... fetched=N; zero N on non-empty layer = wrong prefix string for ОКН/ЗСО/приаэродром, fix_PREFIX_MAP.Merging (squash).