Sweden (SE) build pipeline
Single-source GeoNames SE rebuild, with a dedicated provenance-diff step
(diff_provenance.py) that compares the current live GeoNames export against the
originally-scraped set to distinguish "upstream grew" from "something's wrong" —
run it whenever the rebuilt row count doesn't match R2 exactly, before assuming a bug.
Run order
python3 fetch_source.py # GeoNames SE.txt
python3 build_base.py
python3 diff_provenance.py # compares against the original scrape, explains any drift
python3 integrity_checker.py
python3 package.py
python3 publish_r2.py # written this session — did not exist before. dry run by default.
Sources
- GeoNames
SEpostal export — CC BY 4.0
Verification (2026-08-19)
Reproducible, integrity check PASS (0 duplicates). Not byte-identical — 18,887 rows rebuilt vs 18,858 live on R2, but this is a confirmed, benign upstream-growth gap, not an error:
diff_provenance.py shows 29 postal codes exist only in the current GeoNames export
(added upstream since the original scrape); 0 rows exist only in the live scrape —
i.e. the rebuild is a strict superset. The 18,858 rows both sides share agree on every
field 99.89%+ of the time, confirming genuine common provenance rather than a different
source entirely. Safe to treat the +29 as upstream freshness, not a defect — but
document the new row count if publishing.