feat(postcodes/PA): 87 Correos de Panamá codes (#1039)#1504
Conversation
Adds Panama's alphanumeric postal codes (1-letter + 4-digit format, e.g. B7241) from the viquezr-dev/codigos_postales geojson mirror. Why --- Closes the PA gap on issue #1039. Panama uses a non-standard alphanumeric system that the original numeric regex would have rejected. Coverage -------- - 87 estafetas / 100% state FK on covered records - 10 of 14 CSC PA states covered (10 provinces + 0 of 4 comarcas; source predates 2020 and ships only assigned codes — 65 of 152 features are 'POR DEFINIR' / unassigned, mostly comarcas) State FK strategy ----------------- 13-entry PROV_NOMB_TO_ISO2 maps source's uppercase Spanish names (with diacritics) to CSC iso2. KUNA_YALA -> KY (older spelling for Guna), NGÄBE BUGLÉ -> NB, EMBERA -> EM. Regex fix --------- Before this PR, countries.json had PA regex `^\d{5}$` (5-digit numeric). Panama's actual Correos de Panamá codes are 1-letter + 4-digit alphanumeric. Updated to `^[A-Z]\d{4}$` / format `@####`. The old regex would have rejected 100% of legitimate codes. Centroid -------- Source ships MultiPolygon geometries; importer computes the unweighted vertex mean for representative lat/lng (within ~1 km of strict area-weighted centroid for postal-zone-sized polygons). License ------- Source: viquezr-dev/codigos_postales (no formal LICENSE). Upstream: Correos de Panamá publicly published delivery zones. Tier 5 per #1039 license-tier policy. Each row: source: "correos-panama-via-viquezr" Coverage gap ------------ Source predates 2020 — Naso Tjër Di Comarca (CSC iso2 NT, created 2020) is not represented. Idempotent merge contract allows future coverage to layer in. Validation ---------- - python3 -m py_compile passes - 100% regex match (^[A-Z]\d{4}$) - 100% state_id valid + state.country_id == 170 + state_code agrees - No auto-managed fields (id, created_at, updated_at, flag) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CSC Validation ReportPR Format
Labels applied: Schema Validation (337 records)Errors (blocking):
Warnings:
Cross-Reference Validation✅ 174 reference(s) verified Geo-Bounds Check✅ All 87 coordinate(s) within expected country bounds Duplicate Detection
Source URL Verification✅ 2 source URL(s) accessible ❌ 1000 error(s), 1500 warning(s) | Status: Changes required Please fix the errors above and push a new commit. Refer to our Contribution Guidelines for details. |
Weekly data-quality review (2026-05-04)Verdict: clean Checks
Note on CI "needs-changes" labelThe 1,000 CI schema errors ( 🤖 Automated weekly review — Claude (sonnet-4-6). Generated by Claude Code |
Summary
^\d{5}$→^[A-Z]\d{4}$(old regex rejected 100% of legitimate codes)Source
viquezr-dev/codigos_postales—estafetas.geojson(3.3 MB)Coverage
State FK strategy
13-entry
PROV_NOMB_TO_ISO2maps source's uppercase Spanish names (with diacritics) to CSC iso2:KUNA_YALA→KY(older spelling — CSC name is "Guna")NGÄBE BUGLÉ→NBEMBERA→EMRegex fix
Old:
^\d{5}$(5-digit numeric — would reject 100% of actual Panama codes)New:
^[A-Z]\d{4}$/ format@####Centroid
Source ships MultiPolygon geometries (not centroids). Importer computes unweighted vertex mean — within ~1 km of strict area-weighted centroid for postal-zone-sized polygons.
Test plan
python3 -m py_compile bin/scripts/sync/import_panama_postcodes.py^[A-Z]\d{4}$id,created_at,updated_at,flag)🤖 Generated with Claude Code