Skip to content
Draft
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
3 changes: 3 additions & 0 deletions changelog.d/726.removed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Constituency and local-authority result rows (`compute_uk_constituency_impacts`, `compute_uk_local_authority_impacts`, `ConstituencyImpact` and `LocalAuthorityImpact`) no longer have `x` and `y` keys, the hex-map positions copied from the area lists. A lookup CSV passed as `constituency_csv_path` or `local_authority_csv_path` may still have `x` and `y` columns; they are ignored.

The packaged UK area lists no longer have `x` and `y` columns: `data/uk_geography/constituencies_2024.csv` now has `code,name,region,country` and `local_authorities_2023.csv` has `code,name`, with every row, code, name and the row order unchanged.
2 changes: 1 addition & 1 deletion docs/outputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ microdata.
Constituency and local-authority breakdowns group household output rows by
dataset-provided longwise geography columns. Constituencies use
`constituency_code_oa`; local authorities use `la_code_oa`. Optional metadata
CSVs add names and map coordinates when available.
CSVs add names when available. Result rows carry no map positions.

```python
from policyengine.outputs import compute_uk_constituency_impacts
Expand Down
12 changes: 6 additions & 6 deletions docs/regions.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ national UK dataset.

The package ships the area lists: the 650 parliamentary constituencies (2024
boundaries, including Northern Ireland) and the 361 local authority districts
(April 2023, including Ards and North Down, `N09000011`), each with a name and
a hex-map position (`src/policyengine/data/uk_geography/`, sources in its
`SOURCES.md`). Building these regions needs no network access.
(April 2023, including Ards and North Down, `N09000011`), each with a name
(`src/policyengine/data/uk_geography/`, sources in its `SOURCES.md`). The lists
have no hex-map positions. Building these regions needs no network access.

Constituency regions (`constituency/<code>`) row-filter `constituency_code_oa`
and local-authority regions (`local_authority/<code>`) row-filter `la_code_oa`.
Expand Down Expand Up @@ -136,9 +136,9 @@ The functions in this section and the next are deprecated: their output is
not disclosure-controlled.

Constituency-level impacts group household output rows by the longwise
`constituency_code_oa` column carried by the dataset. Names and map coordinates
come from the packaged constituency list; codes it does not list use the code
as the label.
`constituency_code_oa` column carried by the dataset. Names come from the
packaged constituency list; codes it does not list use the code as the label.
Result rows carry no map positions.

```python
from policyengine.outputs import compute_uk_constituency_impacts
Expand Down
4 changes: 2 additions & 2 deletions src/policyengine/countries/uk/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
default dataset. They load the dataset the certified bundle routes them to
(``region_datasets``), and the national dataset when it routes none.

Their codes, names and hex positions come from the area lists shipped with the
package (``data/uk_geography``), so building them needs no network access.
Their codes and names come from the area lists shipped with the package
(``data/uk_geography``), so building them needs no network access.
"""

import csv
Expand Down
36 changes: 21 additions & 15 deletions src/policyengine/data/uk_geography/SOURCES.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# UK area lists

Codes, names and hex-map positions for the UK area regions and the labels of
geography outputs. They are not the lookup CSVs paired with the legacy
weight matrices, whose row order indexes those matrices.
Codes and names for the UK area regions and the labels of geography outputs.
They are not the lookup CSVs paired with the legacy weight matrices, whose row
order indexes those matrices.

The lists carry no hex-map positions. The PolicyEngine app places areas on its
hex maps from its own layout files; earlier versions of these lists had `x`
and `y` columns, removed in PolicyEngine/policyengine.py#726 without changing
any row, code, name or the row order.

## `local_authorities_2023.csv`

Columns `code,name,x,y`; 361 local authority districts on the April 2023 frame:
Columns `code,name`; 361 local authority districts on the April 2023 frame:
296 in England, 22 in Wales, 32 in Scotland and 11 in Northern Ireland,
including Ards and North Down (`N09000011`) and the four unitaries created on
1 April 2023 (`E06000063`–`E06000066`), and none of the 17 districts they
Expand All @@ -16,23 +21,24 @@ replaced.
in the United Kingdom (columns `LAD23CD`, `LAD23NM`), ONS Open Geography
Portal item `e8b361ba9e98418ba8ff2f892d00c352`. Contains public sector
information licensed under the Open Government Licence v3.0.
- Hex positions: PolicyEngine's April 2023 local-authority hex layout, from
PolicyEngine/policyengine-sim-api
- Built from PolicyEngine/policyengine-sim-api
`projects/policyengine-simulation-executor/src/policyengine_simulation_executor/static_runtime_files/uk_local_authorities/`
at commit `3ac09cf9205bc66a5809e70a634c457362d1a887`:
- `names.csv` sha256 `9e183902e54383d56f7f311d0eaac6a9ee92522a5f21c58ce5118265ae3f1bf4`
- `coordinates_lad23.csv` sha256 `b1489a5b0101ff6d91ef9262e992cca19b59359edb42d012c305a21a04571f64`
- Built by joining `coordinates_lad23.csv` to `names.csv` on `code`, sorted by
code. The names match the ONS file exactly. Against policyengine-uk-data's
`local_authorities_2021.csv` (360 rows on the same frame), this adds
`N09000011` and replaces the shared (0, 0) placeholder of the four 2023
unitaries with their own hexes.

The codes are those of `coordinates_lad23.csv` (the April 2023 frame),
joined to `names.csv` on `code` and sorted by code; the `x` and `y` columns
that file supplied are no longer kept. The names match the ONS file exactly.
Against policyengine-uk-data's `local_authorities_2021.csv` (360 rows on the
same frame), this adds `N09000011`.

## `constituencies_2024.csv`

Columns `code,name,x,y,region,country`; the 650 parliamentary constituencies
of the 2024 boundaries: 543 in England, 57 in Scotland, 32 in Wales and 18 in
Northern Ireland. Copied unchanged from PolicyEngine/policyengine-uk-data
Columns `code,name,region,country`; the 650 parliamentary constituencies of
the 2024 boundaries: 543 in England, 57 in Scotland, 32 in Wales and 18 in
Northern Ireland. Copied from PolicyEngine/policyengine-uk-data
`policyengine_uk_data/storage/constituencies_2024.csv` at commit
`26ccdd1fd1aff6665704fda37388a86adecb5122` (sha256 `f4f35d61ffc004190c438a7e1583caefd85054f962671a00069aedd0a1b5b737`).
`26ccdd1fd1aff6665704fda37388a86adecb5122` (sha256 `f4f35d61ffc004190c438a7e1583caefd85054f962671a00069aedd0a1b5b737`),
with its `x` and `y` columns removed and every other value unchanged.
Codes and names: ONS (Open Government Licence v3.0).
Loading
Loading