feat(postcodes/FI): 3,748 Posti.fi PCF codes (#1039)#1513
Merged
Conversation
Adds Finland's official 5-digit postal codes from Posti.fi's daily PCF (postal code file) export. Why --- Closes the FI gap on issue #1039. The previously-tracked launis/areadata source was a wrapper-only package with no bulk export. Posti's PCF DAT file is the canonical source but the URL is date-stamped (memory: known difficult). Auto-resolution of the URL via 30-day-back HEAD probe makes this a clean static fetch. Coverage -------- - 3,748 codes / 100% state FK - All 18 mainland Finnish maakunta covered - 37 Åland records skipped — they ship to AX (Åland Islands, separate CSC country) via a companion importer Source pipeline --------------- 1. URL probe back ~30 days for the latest PCF_<YYYYMMDD>.dat 2. ISO-8859-1 decode (Posti standard) 3. Fixed-width parse (220 chars/record per Posti spec) 4. Region name -> CSC iso2 via FI_REGION_TO_ISO2 (18-entry hand map — Finnish maakunta names; Helsinki-Uusimaa NUTS sub-region merges into Uusimaa per ISO 3166-2:FI) License ------- Source: Posti.fi PCF (free redistribution permitted with attribution). Each row: source: "posti-fi-pcf" Tier 5 per #1039 license-tier policy. Validation ---------- - python3 -m py_compile passes - 100% regex match (^(?:FI)*\d{5}$) - 100% state_id valid + state.country_id == 74 + 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>
Contributor
CSC Validation ReportPR Format
Labels applied:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Posti's PCF_*.dat file is canonical but URL is date-stamped — known difficult per memorySource
https://www.posti.fi/webpcode/unzip/PCF_<YYYYMMDD>.datFormat
Fixed-width ISO-8859-1, 220 chars/record. Importer parses positional fields per Posti's published spec (record id, postal code, postal name FI/SV, abbreviations, effective date, region code, region names FI/SV, municipality code, municipality names FI/SV, language).
State FK strategy
18-entry
FI_REGION_TO_ISO2maps Finnish maakunta names to CSC iso2:Helsinki-Uusimaa(NUTS sub-region) → CSC18Uusimaa per ISO 3166-2:FIÅland is shipped separately
The 37 source records with region
FI200 / Ahvenanmaabelong to Åland Islands, which is a separate CSC country (AX, country_id=2). They will be shipped via a companion AX importer.Distribution (top 5)
All 18 mainland regions covered.
Test plan
python3 -m py_compile bin/scripts/sync/import_finland_postcodes.py^(?:FI)*\d{5}$id,created_at,updated_at,flag)🤖 Generated with Claude Code