Skip to content

feat: add Japan postal geocodes - #111

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

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

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 approximate postal-code lookup for Japan for return-location distance analysis.

JPN postal code (1234567 or 123-4567)
  → 142,577 full-code records
  → [longitude, latitude] strings, or undefined

Source: GeoNames JP.zip, retrieved 2026-11-04, export dated 2026-11-04, CC BY 4.0. The 146,883 source rows cover 47 prefecture entries. Duplicate coordinate pairs are removed; 16 multi-point codes use an unweighted mean of distinct points. Source, license, checksum, generation steps, and Japan Post assignment checks are in docs/geocode-JPN.md.

This is source coverage, not complete national coverage. GeoNames points are estimates, often shared across locality codes. Four decimals do not establish accuracy. No measured distance-error bound is available. These are not postal-area centroids or scan/building locations.

Evidence

  • Before: JPN is unsupported and returns undefined.
    After: coordinates('JPN', '100-0001') returns ['139.7521', '35.6841'].
  • Offline tests cover compact/hyphenated formats, leading zero, Tokyo, Rebun, Yonaguni, duplicate-independent averaging, malformed/unknown codes, full dataset shape and finite ranges.
  • npm test: 99 pass. npm run lint, npm run format:check, and npm run validate:data: pass. Data validation retains the two existing AUT/BEL warnings.
  • Generator assertions pass. No dependencies added. Other countries retain their normalization and data.

Merge Danger

Door: two-way

Blast Radius: JPN

The shared lib/geocode.js allowlist and normalization lines can overlap with concurrent country PRs. Only JPN changes are included. The dataset adds about 12.2 MB of JSON and lookup retains the existing linear scan. No merge, publication, or deployment is included.

@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:04:03.567428Z 56a959e 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