fix(site-finder): robust is_residential_zone detection for NSPD zone codes (#1353) #1681
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#1681
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/residential-zone-detect-1353"
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?
Проблема (#1353)
gate_verdict.pyis_residential_zone: prefix-проверкаЖ-/Ж1…наzone_codeи «жил» вzone_name— но из NSPD (layer 875838) оба поля всегда None (reg_numb_borderлежит вoptions, top-levelzone_code/zone_nameнет). → каждый NSPD-участок получалPZZ_NOT_RESIDENTIAL.Решение (3-уровневый детект)
^[Жж]наzone_code(PKK6/pzz_zones_ekb данные)raw_props["subcategory"] in {2,3}— основной дискриминатор NSPD (2=жилые 221 об., 3=смешанное 126; subcat=1 ИЖС исключён)zone_name— fallbackcompute_gate_verdictтеперь прокидываетnspd_zoning["raw_props"].Verify
ruffclean;pytest(gate/zone/verdict) → 170 passed, 3 skipped.Closes #1353
NSPD quarter-dump territorial_zones (layer 875838) does NOT store ПЗЗ letter codes in properties — zone_code receives the cadastral reg number ("66:41-7.14") or None, never a "Ж-1" style code. The old prefix check (startswith "Ж-"/"Ж1" …) therefore never matched real NSPD data, silently marking every dump-sourced parcel as non-residential (PZZ_NOT_RESIDENTIAL blocker). Fix: three-tier detection in is_residential_zone: 1. Regex ^Ж on zone_code — handles PKK6/pzz_zones_ekb sources ("Ж-1", "Жс") 2. NSPD subcategory from raw_props — subcategory=2 (Жилые зоны, 221 ЕКБ objects) and subcategory=3 (Смешанное использование, 126 objects) → residential; subcategory=1 (ИЖС) excluded — МКД not permitted there 3. zone_name substring "жил" — fallback for non-standard sources compute_gate_verdict now passes nspd_zoning["raw_props"] to is_residential_zone.