Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/953-uk-local-authority-input.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Supply the engine's household `local_authority` input from the rowwise geography ladder (#953): every assigned April 2023 ONS local authority code resolves to its policyengine-uk `LocalAuthority` member name through the sha-pinned ONS names-and-codes resource (`local_authority_names.json`, `tools/generate_uk_local_authority_names.py`) and the mechanical key rule with one declared alias; the assignment refuses any code the roster does not carry, the ladder gate reports any row whose input disagrees with its code, and the clone verifies the assigned members against the installed engine, so council tax and the bespoke Council Tax Reduction schemes stop seeing the Maidstone default on Microcosm builds. The input is declared on the export allow-list rather than the coverage manifest, which measures the incumbent surface; the engine pin moves to policyengine-uk 2.100.0, the first release whose `LocalAuthority` enum carries the six April 2023 unitaries, so the roster-wide membership check is green at the pin.
10 changes: 10 additions & 0 deletions docs/shared-constants.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,13 @@ from microcosm.calibrate.geography_constants import (
Do not add another state FIPS/postal mapping to a country runtime or diagnostics
module. Extend the shared definition and its consistency test when supported
geographies change.

The engine's `local_authority` member names are not a constants table: the 361
April 2023 authority names are published ONS data, held in the sha-pinned
resource `microcosm/build/uk/local_authority_names.json` (regenerate with
`tools/generate_uk_local_authority_names.py`). Only the mechanical key rule and
its declared aliases are code, in
[`microcosm.build.uk_runtime.local_authority_input`](../packages/microcosm-build/src/microcosm/build/uk_runtime/local_authority_input.py);
derive an engine key through `local_authority_engine_key` rather than
re-implementing the rule, and resolve codes through
`resolve_local_authority_engine_keys`, which fails closed (microcosm#953).
2 changes: 1 addition & 1 deletion packages/microcosm-build/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ us = [
# The UK extra adds the rules engine for local metric generation from a
# Microcosm UK H5. Target tables remain explicit inputs, and the base package
# still does not import policyengine-uk at import time.
uk = ["policyengine-uk>=2.98.0", "h5py>=3", "tables>=3", "openpyxl>=3.1"]
uk = ["policyengine-uk>=2.100.0", "h5py>=3", "tables>=3", "openpyxl>=3.1"]

[project.scripts]
microcosm-export-us-l0-refit-h5 = "microcosm.build.us_runtime.l0_refit_export:main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@
"kind": "legacy_json",
"schema_id": "legacy_json"
},
{
"path": "local_authority_names.json",
"kind": "legacy_json",
"schema_id": "legacy_json"
},
{
"path": "target_references.json",
"kind": "legacy_json",
Expand Down
1 change: 1 addition & 0 deletions packages/microcosm-build/src/microcosm/build/uk/gates.json
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@
"household.household_is_cgt_band_donor",
"household.household_is_spi_synthetic",
"household.la_code_oa",
"household.local_authority",
"household.lsoa_code",
"household.mortgage_debt",
"household.msoa_code",
Expand Down
Loading
Loading