Skip to content

feat: add Portugal postal coordinate lookup - #107

Closed
jkrenge wants to merge 1 commit into
masterfrom
codex/prt-postal-geocoding
Closed

jkrenge wants to merge 1 commit into
masterfrom
codex/prt-postal-geocoding

Conversation

@jkrenge

@jkrenge jkrenge commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Superseded by consolidated postal geocoding PR #124. This PR's head commit is retained in the combined branch. Combined CI passes on Node.js 24/26 and static checks.


Summary

Add Portugal postal coordinates for approximate delivery-to-return distance analysis.

PRT full postal code → normalize separator → representative GeoNames point

Add 197,772 unique full postal codes from 206,942 GeoNames PT rows, retrieved 2026-11-04 (archive export 2026-11-04). Source: https://download.geonames.org/export/zip/PT.zip, CC BY 4.0; attribution and reproducible converter in docs/geocode-PRT.md. Average distinct coordinate pairs per code without weighting duplicate rows. These are estimated representative points, not postal centroids. Mainland, Madeira, and Azores are represented; national completeness is not established.

PRT accepts hyphenated, compact, and single-space-separated full codes. Return values retain legacy string coordinates in longitude/latitude order. Other countries keep their behavior.

Evidence

  • Before: PRT coordinate lookup returns undefined.
  • After: actual lookup tests pass for Lisboa, rural Mértola, Funchal, and Ponta Delgada, plus formats and unknown codes. Primary CTT/municipal locality references are in the source note.
  • All 98 tests pass; npm run lint, npm run format:check, and npm run validate:data pass. Validation retains two existing AUT/BEL warnings. The converter assertion verifies averaging without duplicate weight; tests validate all unique keys and coordinate bounds.

Merge Danger

Door: two-way

Blast Radius: PRT

No merge or deployment performed. Shared overlap: lib/geocode.js allowlist and country-specific normalization. Full postal codes often share locality coordinates; exact positional accuracy and national completeness were not independently audited. Data adds roughly 20 MB of JSON and lookup remains a linear scan.

@jkrenge
jkrenge requested a review from a team as a code owner November 4, 2026 22:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T22:03:55.578185Z 59fa74e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jkrenge jkrenge closed this Nov 4, 2026
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.

1 participant