feat(sf): ИРД-harvest Celery task → ird_overlays (#1067 B5) #1090
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#1090
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/ird-harvest-worker"
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?
Что
backend/app/workers/tasks/ird_harvest.py— периодический harvest готовых НСПД ИРД-слоёв по кварталам ЕКБ → upsert вird_overlays(м.132, PR #1078). Keystone overlay-движка; analyze читает overlap черезST_Intersects.Как
nspd_client.LAYERS): ЗОУИТ37577-37581, ПЗЗ-границы875838, ОКН875840, ООПТ875845, лесничества875866, береговые875832/875835.layer_kind= ключ LAYERS.DISTINCT quarter_cad_numberизcad_parcels(66:41:%); либо явный список (arg).search_by_cad(thematic_id=2)→ bbox →get_features_in_bbox_gridпо каждому слою → upsert по(source_layer_id, geom_data_id).ST_Transform(ST_SetSRID(ST_GeomFromGeoJSON(...),3857),4326).begin_nested) — битая фича не валит батч; сбой квартала/слоя изолирован; commit один раз.Регистрация
celery_app.include+=ird_harvest. Beatird-harvest-weekly(Mon 05:00 МСК — до supply-layers 06:00, не конкурирует со scrape_kn 04:15).Тесты
3 passed: grid-walk loop (1 квартал × N слоёв → upsert), skip пустого квартала, skip фич без geom/geom_data_id. ruff + ruff-format clean.
Refs #1067 (B5). Next: B6 (сид кварталов + VPS smoke прогон), D9 (parcel overlap → analyze), C8 (content-резолв через геопортал).
✅ APPROVE
Keystone harvest-task связывает ird_overlays (м.132) ← nspd_client. Проверено досканально:
LAYERSdict (zouit_okn/engineering/natural/protected/other=37577-81, territorial_zones=875838, okn_territory=875840, protected_areas=875845, forestries=875866, coast_lines_river/sea=875832/35); несуществующий → warning+skip, не падает.search_by_cad(cad, thematic_id=2),qres.first(@property),get_features_in_bbox_grid(layer_id, bbox),_geojson_bbox_3857(module-level, None→continue).begin_nested+ try/except) зеркалитsupply_layers_refresh.py; commit один раз;SessionLocal()try/finally close. Битая фича /int(geom_data_id)ValueError / CHECK geom_data_id>0 — изолированы SAVEPOINT'ом.CAST(:x AS type), ни одного::. INSERT-колонки = DDL м.132; content_* исключены из ON CONFLICT (резолвер D9 не перетирается).0 5 * * mon—_parse_cronподдерживаетmon(5 существующих задач), 05:00 свободно (scrape_kn 04:15 / supply 06:00). celery_app.include корректен.Advisory (не блок): scale ~400-600 кварталов × 11 слоёв × grid (~1.5ч weekly) — NSPDBulkClient уже throttle'ит rate_ms=600; прод-прогон деферится в B6 smoke. Приватный импорт
_geojson_bbox_3857— приемлемо at scale.Merge → deploy-verify.