Skip to content

feat(postcodes/HU): 3,569 Magyar Posta codes (#1039)#1486

Merged
dr5hn merged 1 commit into
masterfrom
feat/postcodes-hungary
Apr 27, 2026
Merged

feat(postcodes/HU): 3,569 Magyar Posta codes (#1039)#1486
dr5hn merged 1 commit into
masterfrom
feat/postcodes-hungary

Conversation

@dr5hn

@dr5hn dr5hn commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Imports 3,569 Hungarian postal codes from Magyar Posta + KSH gazetteer (Feb 2026 refresh)
  • 100% state FK resolution across all 19 megyék + Budapest

Source

  • ferenci-tamas/IrszHnk — joins Magyar Posta workbook with KSH Helységnévtár (Hungarian Central Statistics Office gazetteer)
  • File: IrszHnk.csv (semicolon-delimited)
  • License: no formal license file — upstream is official HU government open data; Tier 5 per Can we add a postcode for this? #1039 license-tier policy (free redistribution permitted, no formal licence)

State FK strategy

The CSV's Vármegye.megnevezése column gives the megye/county name. CSC has 43 HU iso2 entries (19 megyék + Budapest + 23 cities of county rank); since the CSV authoritatively reports megye, we map to those 20 county-level entries via a hand-curated SOURCE_TO_ISO2.

Two name drifts handled:

  • 'főváros' (lit. "the capital") → CSC BU Budapest
  • 'Csongrád-Csanád' (2020 rename) → CSC older CS "Csongrád County"

Cities of county rank (Pécs, Szeged, Debrecen, ...) resolve to their containing megye since the source has no city-of-county-rank flag in the postcode dataset.

Distribution

megye rows
Borsod-Abaúj-Zemplén (BZ) 392
Baranya (BA) 323
Zala (ZA) 267
Somogy (SO) 251
Szabolcs-Szatmár-Bereg (SZ) 242
Veszprém (VE) 232
Vas (VA) 225
Győr-Moson-Sopron (GS) 211
Pest (PE) 195
Budapest (BU) 161
... ...

Test plan

  • python3 -m py_compile bin/scripts/sync/import_hungary_postcodes.py
  • All 3,569 codes match ^\d{4}$
  • 100% state_id valid; state.country_id == 99; state_code == state.iso2
  • No auto-managed fields (id, created_at, updated_at, flag)
  • Idempotent merge (re-run produces no diff)

🤖 Generated with Claude Code

Adds the full Magyar Posta + KSH Helységnévtár postal-code dataset
joined by ferenci-tamas/IrszHnk (Feb 2026 refresh).

Why
---
Closes the HU gap on issue #1039. The single-file CSV from the
ferenci-tamas mirror joins the official Magyar Posta workbook with
the KSH gazetteer, giving postcode + settlement + sub-district +
megye in one row.

Coverage
--------
- 3,569 codes / 100% state FK resolution
- All 19 megyék + Budapest covered (20 of 43 CSC HU iso2 entries)
- Cities of county rank (Pécs, Szeged, Debrecen, ...) are CSC-only
  iso2 entries; the source authoritatively reports megye, so those
  cities resolve to their containing megye

State FK strategy
-----------------
20-entry hand-curated SOURCE_TO_ISO2 handles two name drifts:
- 'főváros' (lit. "the capital") -> CSC 'BU' Budapest
- 'Csongrád-Csanád' (2020 rename) -> CSC older 'CS' Csongrád County

License
-------
Repo has no LICENSE file. Upstream is official Hungarian government
open data (Magyar Posta + KSH). Tier 5 per #1039 license-tier policy
(free redistribution permitted, no formal licence).

Each row: source: "magyar-posta-via-ferenci-tamas".

Validation
----------
- python3 -m py_compile passes
- 100% regex match (^\d{4}$)
- 100% state_id valid + state.country_id == 99 + 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>
Copilot AI review requested due to automatic review settings April 27, 2026 15:47

Copilot AI left a comment

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.

Copilot wasn't able to review any files in this pull request.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 27, 2026
@dosubot dosubot Bot added the enhancement New feature or request label Apr 27, 2026
@dr5hn dr5hn merged commit fc44938 into master Apr 27, 2026
1 check passed
@dr5hn dr5hn deleted the feat/postcodes-hungary branch April 27, 2026 15:48
@github-actions

Copy link
Copy Markdown
Contributor

CSC Validation Report

PR Format

  • ✅ Description provided
  • ✅ Data source linked
  • ✅ Issue linked (recommended for data changes)
  • ✅ Justification / context provided

Labels applied: data:postcodes, large-contribution

⚠️ Large Contribution

This PR contains 3569 records. Large contributions require manual review.

Schema Validation (3569 records)

✅ All records passed validation

Cross-Reference Validation

✅ 7138 reference(s) verified

Source URL Verification

✅ 2 source URL(s) accessible


All checks passed | Status: Ready for review

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

Labels

data:postcodes enhancement New feature or request large-contribution ready-for-review size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants