Add UK geography asset resolution#373
Merged
Merged
Conversation
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.
Fixes #372
Summary
Adds a shared UK geography asset resolver for constituency and local-authority outputs.
The resolver:
weight_matrix_pathand lookup CSV path behavior;download_missing_assets=Falsefor local/cache-only canonical asset resolution;This wires the resolver into
compute_uk_constituency_impactsandcompute_uk_local_authority_impacts, updates docs, and adds focused unit coverage. It also centralizes the canonical UK geography asset bucket and filenames so the output resolver and UK region registry use the same source of truth.Testing
ruff check src/policyengine/data/__init__.py src/policyengine/data/uk_geography_assets.py src/policyengine/countries/uk/regions.py src/policyengine/outputs/uk_geography_assets.py src/policyengine/outputs/constituency_impact.py src/policyengine/outputs/local_authority_impact.py src/policyengine/outputs/__init__.py tests/test_uk_geography_assets.py tests/test_constituency_impact.py tests/test_local_authority_impact.py tests/test_uk_regions.pyruff format --check src/policyengine/data/__init__.py src/policyengine/data/uk_geography_assets.py src/policyengine/countries/uk/regions.py src/policyengine/outputs/uk_geography_assets.py src/policyengine/outputs/constituency_impact.py src/policyengine/outputs/local_authority_impact.py src/policyengine/outputs/__init__.py tests/test_uk_geography_assets.py tests/test_constituency_impact.py tests/test_local_authority_impact.py tests/test_uk_regions.pyPOLICYENGINE_SKIP_COUNTRY_IMPORTS=1 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .venv/bin/python -m pytest --noconftest tests/test_uk_geography_assets.py tests/test_constituency_impact.py tests/test_local_authority_impact.py tests/test_uk_regions.py -q(33 passed, 1 warning)Note: the focused pytest run uses
--noconftestlocally because the top-leveltests/conftest.pyeagerly imports country fixtures, which makes these output-only tests collect slowly in this environment.