Repository navigation
Conversation
compute_longwise_uk_geography_impacts no longer copies each area's x and y hex-map position from the lookup CSV into its result row, so compute_uk_constituency_impacts, compute_uk_local_authority_impacts, ConstituencyImpact and LocalAuthorityImpact return rows with only the code, name, income changes and population. The app places areas on its hex maps from its own layout files. A lookup CSV passed as constituency_csv_path or local_authority_csv_path may still have x and y columns; they are ignored. Tests first: the result rows of both outputs must have exactly those keys, whether the lookup is a custom CSV with x and y, the packaged list, or missing. They failed because every row had extra x and y keys. Refs #726 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
constituencies_2024.csv now has code,name,region,country and local_authorities_2023.csv has code,name. Nothing in the package reads the hex-map positions any more, and the app places areas on its hex maps from its own layout files. Every row, code, name and the row order are unchanged, checked by comparing each file with origin/main's after dropping x and y. SOURCES.md, the area list comment, the UK region module docstring and the regions docs no longer describe hex positions. Tests first: each list's header must be exactly its expected columns, and the check that no two areas share a hex is removed. They failed because both headers still had x and y. Refs #726 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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 #726
Summary
.py's constituency and local-authority results and its packaged UK area lists no longer carry
xandy, each area's integer position on a hex map. The PolicyEngine app places areas on its hex maps from its own layout files, so nothing downstream should depend on positions from .py.Two commits, each with one behaviour change:
xandyout of constituency and local-authority results.compute_longwise_uk_geography_impactsreads onlycodeandnamefrom the lookup CSV, so the rows ofcompute_uk_constituency_impacts,compute_uk_local_authority_impacts,ConstituencyImpactandLocalAuthorityImpacthave exactly<area>_code,<area>_name,average_household_income_change,relative_household_income_changeandpopulation. A lookup CSV passed asconstituency_csv_pathorlocal_authority_csv_pathmay still havexandycolumns; they are ignored._optional_int, used only for the positions, is deleted. The two functions' docstrings anddocs/outputs.mdanddocs/regions.mdno longer mention map coordinates.xandycolumns from the packaged area lists.constituencies_2024.csvnow hascode,name,region,countryandlocal_authorities_2023.csvhascode,name. Every row, code, name and the row order are unchanged: I compared each file withorigin/main's after droppingxandy(pandas.testing.assert_frame_equal, all values read as strings).SOURCES.mdrecords that the columns were removed and still names the source files and their SHA-256s; the area list comment inuk_geography_assets.py, the UK region module docstring anddocs/regions.mdno longer describe hex positions.The changelog fragment is
changelog.d/726.removed.md, which makes the next release a minor version. Callers that readxoryfrom these rows or files lose them; if maintainers treat that as a breaking change, the fragment can be renamed to726.breaking.md.Who reads these files and fields
xandyfrom .py's constituency list and requires them on every UK area record until Stop sending x and y on UK area results policyengine-sim-api#919 is deployed (hence the merge requirement). It only picks up this change when it pins a .py release that contains it.namecolumn of these two files.xandyon those results is removed by Remove the app's handling of x and y on UK area results policyengine-app-v2#1436, which #919 waits for.countries/uk/regions.pyreads onlycodeandname, and nothing else reads the two files.Deployment and environment variables
No CI/CD workflow, Dockerfile, Terraform or other deployment code changes, and no environment variable is added, removed or read differently. The only packaged files that change are the two CSVs and
SOURCES.mdundersrc/policyengine/data/uk_geography/.Testing
Written red-green: for each commit the tests were written first and seen failing for the expected reason, then the code was written and both were committed together.
tests/test_constituency_impact.pyandtests/test_local_authority_impact.pynow require each result row to have exactly the five keys above, with a custom lookup that hasxandy, with the packaged list, and with no lookup. All six failed withExtra items in the left set: 'x', 'y'.tests/test_uk_area_lists.pyrequires each list's header to be exactly its expected columns, and drops the check that no two areas share a hex. Both parametrised cases failed because the headers still hadxandy(['code', 'name', 'x', 'y'] == ['code', 'name']).Commands run locally:
uv run --frozen pytest tests/test_constituency_impact.py tests/test_local_authority_impact.py tests/test_uk_area_lists.py tests/test_uk_regions.py tests/test_disclosure_estimate.py: all pass.ruff format --check .andruff check .(ruff 0.16.8, as CI installs the latest ruff): pass.uv run --frozen mypy --python-version 3.13on the changed modules: no new errors (the same 13 existing errors in the output modules before and after).towncrier check --compare-with origin/mainandtowncrier build --draft: the fragment renders under "Removed".🤖 Generated with Claude Code