UK local-area exports: add the `constituency_code_oa`, `la_code_oa` and `region_code_oa` columns that policyengine.py and the simulation API read, and record the area-code frames in the release manifest
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #1115 di @juaristi22 — integrata
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- data-engineering
Direzione di ricerca
Start at graph_terminal._tables and read how UK area-code columns are exported and dropped; then inspect the release manifest metadata and terminal_gates.py. Add a release-contract test for UK releases with area codes. Done means dense and local releases have all three _oa aliases equal to their ladder columns and non-empty for every household, with the area-code frames recorded in the manifest.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Why
policyengine.py finds UK constituencies and local authorities through two household columns, constituency_code_oa and la_code_oa:
- its constituency and local-authority regions filter on them (
countries/uk/regions.py); - its constituency and local-authority impact outputs group on them (
outputs/constituency_impact.py,outputs/local_authority_impact.py); - it copies them, with
oa_code,lsoa_code,msoa_codeandregion_code_oa, into every UK output dataset (UK_HOUSEHOLD_PASSTHROUGH_COLUMNS).
The simulation API reads the same pair for geographic reports (UK_GEOGRAPHIC_DATASET_VARIABLES in policyengine-sim-api's stage12_runtime/output_planning.py). These are the names the incumbent enhanced FRS carries; 1.56.16 has all six.
Our full-build exports carry the ladder names instead: the ladder columns (UK_GEOGRAPHY_LADDER_COLUMNS) leave through graph_terminal._tables, with none of the _oa names. The last staged local candidate (staged/uk-local-candidate-f100-s42-20260919T154920Z-1d33cff6, 55,361 households) has oa_code, lsoa_code, msoa_code, local_authority_code, ward_code, constituency_code, region_code and itl1_code to itl3_code. On a Microcosm file, every constituency or local-authority run in policyengine.py therefore raises Variable 'constituency_code_oa' not found in household data. Renaming on the consumer side would break the enhanced FRS and the API; writing the aliases here keeps every consumer working.
The codes themselves already line up with policyengine.py:
- Constituencies: the July 2024 Westminster frame, all 650 including Northern Ireland's 18. The enhanced FRS covers the 632 in Great Britain, all shared.
- Local authorities: the April 2023 LAD frame, 361 codes (
LAD23_COUNT).- policyengine.py's list (
local_authorities_2021.csv, on the same frame despite its name) has 360 of them. It lacks Ards and North Down (N09000011), which PolicyEngine/policyengine.py#553 adds. - The enhanced FRS is on the pre-2023 frame: 363 codes in Great Britain, 17 of them for districts abolished in 2023.
- policyengine.py's list (
Proposed change
-
Write three alias columns at the single-year export boundary (
graph_terminal._tables, where the nation-native aliases are already dropped), on every UK release that carries area codes (the dense and local lines):constituency_code_oa=constituency_codela_code_oa=local_authority_coderegion_code_oa=region_code
Keep the ladder columns: our gates, diagnostics and target compilation read them. The
_oasuffix is the consumers' name only. Northern Irish households are placed through data zones rather than output areas, and the codes are the same either way.UK_ALLOWED_EXTRA_EXPORT_COLUMNSinterminal_gates.pyalready admits all three names. -
Record the frames in the release manifest's
metadata, for example"area_code_frames": {"constituency": "westminster_2024", "local_authority": "lad_2023_04"}. policyengine.py can then check that its area lists match before it wires a local release in. The next frame change to watch is the 1 April 2025 Barnsley/Sheffield recode, which the LAD lookups we pin do not carry yet. -
Add a release-contract test: a UK release with area codes carries the three aliases, each equal to its ladder column and non-empty for every household.
The national line needs no change. It carries region only, and policyengine.py will scope nations and regions from region (PolicyEngine/policyengine.py#553).
Done when
- The next staged dense or local candidate carries the three aliases.
- policyengine.py's constituency and local-authority row filters find households in all 650 constituencies and all 361 local authorities of that candidate.
Related:
- PolicyEngine/policyengine.py#553: certifying a Microcosm national dataset in policyengine.py, with separate national and local-area datasets.
- PolicyEngine/policyengine.py#552: regional dataset defaults.
🤖 Generated with Claude Code
- Lingua principale
- Python
- Stelle
- 0
- Fork
- 5
- Merge medio
- 1g 19h
- PR unite (30g)
- 115
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PolicyEngine/microcosm
-
Update two stale comments about the export-mass reviewed-exclusion registerForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
PolicyEngine/microcosm#1108 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
PolicyEngine/microcosm#475 ·
I maintainer di solito rispondono entro 1 giorno
-
Generate complete WIC participation in the ACS local-area buildForse già presa @anth-volk l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
PolicyEngine/microcosm#1155 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
PolicyEngine/microcosm#1154 ·
I maintainer di solito rispondono entro 1 giorno
-
Delegate telemetry and completed Orrery publication to microcosm-local-providerForse già presa @anth-volk l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
PolicyEngine/microcosm#1152 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di PolicyEngine/microcosm
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
pyjanitor-devs/pyjanitor#1758 ·
I maintainer di solito rispondono entro 1 giorno
-
bug ready for review
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
odysseus-dev/odysseus#6641 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
happypawspillaro/happypaws#78 ·
I maintainer di solito rispondono entro 4 giorni
-
pydanty:is-working
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
pydantic/pydantic-ai#10020 ·
I maintainer di solito rispondono entro 1 giorno
-
stdlib type-bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
python/cpython#159044 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno