Skip to content

feat: expand and refresh postal geocoding across 29 countries - #124

Open
jkrenge wants to merge 62 commits into
masterfrom
codex/consolidated-postal-geocoding
Open

jkrenge wants to merge 62 commits into
masterfrom
codex/consolidated-postal-geocoding

Conversation

@jkrenge

@jkrenge jkrenge commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Expand postal geocoding from ten to 29 countries for return-network location analysis, consolidating source PRs #95–123 into one review. Refresh ten datasets and add nineteen. Retain source/license documentation, generators, tests, and all source commits.

country + postcode
  → country-specific normalization
  → compact country JSON, coordinates rounded to four significant digits
  → [longitude, latitude] strings, or undefined

All 603,127 geocode records keep their postal codes and row order. Coordinate values are rounded to four significant digits (not four decimal places); unnecessary trailing zeros and JSON indentation are removed. Runtime schemas and return types are unchanged. Run npm run geocode:compact after any country generator; tests enforce the distributed precision and compact encoding. Source fixtures and generator calculations retain their original precision.

Country/source manifest and limits. Brazil, India, Russia, and Turkey remain excluded because source-quality blockers are unresolved.

Evidence

  • All 176 combined tests pass, including rounding boundaries, invalid coordinates, idempotence, and every distributed file's encoding/precision.
  • Lint, formatting, data validation, and diff checks pass. GitHub CI passes for static checks and Node.js 24/26. Validation retains only the existing AUT/BEL region-name warnings.
  • Before compaction, the integration audit verified all 29 source heads, unchanged country assets, and 604,260 normalization inputs against the source branches. Compaction preserves postal codes, row order, and all non-coordinate fields across all 603,127 records.
  • Finland and UK generators use Node.js built-in modules. Their CLI outputs reproduce all 6,020 existing compact coordinates from the downloaded source data. Tests cover duplicate weighting, rounding, invalid source rows, polygon holes, and disconnected areas; no distributed data changed in this conversion.
  • Three cross-country tests now use the refreshed German dataset; country lookup expectations reflect four significant digits.
  • Measured with npm pack --ignore-scripts --json, same packaging rules and no publication. Decimal MB; package figures exclude separately installed dependencies:
Size Base: 10 countries Expanded: 29 countries Compact: 29 countries
Geocode JSON 18.15 MB 51.49 MB 34.20 MB
npm download 2.78 MB 5.03 MB 3.76 MB
Unpacked package 26.56 MB 60.10 MB 42.82 MB

Compact npm download is 1.27 MB (25.3%) smaller than the expanded version, and 0.98 MB (35.2%) larger than base. Unpacked increase over base: 16.26 MB (61.2%).

Merge Danger

Door: two-way

Blast Radius: geocoding

Four-significant-digit rounding moves stored points by a median 0.424 km, 95th percentile 3.884 km, and maximum 5.547 km. These are displacements from the previous stored points, not source-accuracy estimates. Two rounded endpoints can compound distance error.

Source replacement also changes legacy lookup coverage, particularly France, Belgium, Germany, and US Pacific codes. Granularity varies by country. Runtime lookup remains a linear scan; production performance was not measured.

No master merge, package publication, deployment, or production tracking-data change is included.

@ilin-andrey

ilin-andrey commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor
Screenshot 2026-11-05 at 09 55 17

did you just unlock a new level?

Comment thread update/fin.py Outdated
@@ -0,0 +1,60 @@
"""Build FIN coordinates from a downloaded Paavo 2026 WGS84 GeoJSON file."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why python? is not it a js package?

Comment thread scripts/build-gbr-geocode.py Outdated
@@ -0,0 +1,48 @@
"""Build GBR district representative points from GeoNames GB.txt (CC BY 4.0)."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question, it is a nodejs repo, why is it in python?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants