Skip to content

fix: refresh USA geocodes and support ZIP+4 lookup - #118

Closed
jkrenge wants to merge 1 commit into
masterfrom
codex/usa-geocode-refresh
Closed

jkrenge wants to merge 1 commit into
masterfrom
codex/usa-geocode-refresh

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

Return-location distance analysis needs current, documented USA postal points. Refresh only USA geocodes and add USA-only ZIP+4 normalization.

USA ZIP / ZIP+4 → five-digit ZIP → GeoNames representative point
Other countries → existing normalization

GeoNames US.zip, retrieved/exported 2026-11-04, is licensed under CC BY 4.0. The dataset contains 41,488 records and unique ZIP codes from 41,490 source rows. It adds 563 codes, changes 477 retained points and removes nine codes absent from this source. See docs/geocode-USA.md for exact removals, hashes, regeneration, license attribution and Census checks.

Distinct coordinate pairs are averaged without duplicate-row weighting. These are estimated locality representative points, not postal centroids. Keep coordinate strings, [longitude, latitude], existing exports/types and other-country behavior.

Evidence

  • Before: coordinates('USA', '00501-1234') returns undefined.
    After: returns ['-73.0451', '40.8154'], also for compact and spaced ZIP+4.
  • All 99 offline tests pass. Lint, format check and data validation pass. Data validation reports only the two existing AUT/BEL warnings.
  • Generator assertions pass. Reversed source order plus a duplicated Hawaii row produces the same SHA-256 output.
  • Checked urban, rural, leading-zero and Alaska points against the 2026 Census ZCTA Gazetteer. Rural/Alaska examples differ by several kilometres.

Merge Danger

Door: two-way

Blast Radius: USA

Partial postal coverage. Nine Pacific codes now return undefined; no territory source files are imported. Military-code points can lie overseas and are unreliable for physical parcel-location inference. No address-level accuracy or fraud decisions. USA malformed suffixes that previously matched by splitting at a space now return undefined.

Shared-file overlap: lib/geocode.js normalization may conflict with concurrent country PRs. This branch starts from master and includes no other country PR. No dependency, region mapping or allowlist change. Do not merge or publish as part of this task.

@jkrenge
jkrenge requested a review from a team as a code owner November 4, 2026 22:03
@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:04:18.672618Z fb5c19f 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