Skip to content

Add UK official geography crosswalk sources#136

Merged
MaxGhenis merged 1 commit into
mainfrom
codex/uk-official-crosswalk-20260619
Jun 19, 2026
Merged

Add UK official geography crosswalk sources#136
MaxGhenis merged 1 commit into
mainfrom
codex/uk-official-crosswalk-20260619

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Summary

  • add public-source helpers for complete UK row-wise geography crosswalks without importing policyengine-uk-data
  • update England/Wales OA rows to LAD23 and append Northern Ireland DZ2021 rows as OA-equivalent geography
  • infer NI DZ -> Westminster constituency by active-postcode modal PCON, with source-vintage diagnostics and strict source validation
  • export the source helpers from populace.build.uk and add regression coverage for missing/blank source joins, stale NI rows, and NI source set mismatches

Live validation

Using the incumbent GB OA crosswalk as input plus the public source helpers in this PR:

  • constituencies: 650/650 covered and sampleable
  • local authorities: 360/360 covered and sampleable
  • NI rows: 3,780 DZ2021 rows
  • NI constituency codes: 18
  • postcode vintage gap: 214 unmatched active NI postcodes out of 49,192 (0.4350%), under the 1% guard

Checks

  • uv run --frozen --package populace-build --group dev python -m pytest packages/populace-build/tests/test_uk_geography_sources.py packages/populace-build/tests/test_uk_rowwise_geography.py -q
  • uv run --frozen ruff check .
  • git diff --check
  • uv run --frozen --all-packages --group dev python -m pytest -q
  • env -u UV_FROZEN uv lock --check
  • live source validation script against public ONS/NISRA sources and policyengine-uk-data target code lists

Review cycle

  • First read-only review found stale NI filtering, lax E/W lookup coverage, incomplete NI source joins, and postcode source-vintage drift; fixed and retested.
  • Second read-only review found blank LAD23 lookup values could leak through; fixed with explicit validation and a regression test.

@MaxGhenis MaxGhenis merged commit dc58bae into main Jun 19, 2026
4 checks passed
@MaxGhenis MaxGhenis deleted the codex/uk-official-crosswalk-20260619 branch June 19, 2026 16:13
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