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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dist/*
**/*.h5
**/*.csv.gz
.env
.DS_Store

# Ignore generated credentials from google-github-actions/auth
gha-creds-*.json
Expand Down
5 changes: 5 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- bump: minor
changes:
added:
- Metadata for UK local authorities
- Calculation of UK local authority-level outputs
2 changes: 2 additions & 0 deletions policyengine_api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"national", # National level (e.g., "uk")
"country", # UK countries (e.g., "country/england", "country/scotland")
"constituency", # UK parliamentary constituencies (e.g., "constituency/Aldershot")
"local_authority", # UK local authorities (e.g., "local_authority/Maidstone")
)

# Valid region prefixes for each country
Expand All @@ -51,6 +52,7 @@
"uk": [
"country/", # UK countries (e.g., "country/england", "country/scotland")
"constituency/", # UK parliamentary constituencies (e.g., "constituency/Aldershot")
"local_authority/", # UK local authorities (e.g., "local_authority/Maidstone")
],
}

Expand Down
14 changes: 14 additions & 0 deletions policyengine_api/country.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def build_microsimulation_options(self) -> dict:
Path(__file__).parent / "data" / "constituencies_2024.csv"
)
constituency_names = pd.read_csv(constituency_names_path)
constituency_names = constituency_names.sort_values("name")
region = [
dict(name="uk", label="the UK", type="national"),
dict(name="country/england", label="England", type="country"),
Expand All @@ -92,6 +93,19 @@ def build_microsimulation_options(self) -> dict:
type="constituency",
)
)
local_authority_names_path = (
Path(__file__).parent / "data" / "local_authorities_2021.csv"
)
local_authority_names = pd.read_csv(local_authority_names_path)
local_authority_names = local_authority_names.sort_values("name")
for i in range(len(local_authority_names)):
region.append(
dict(
name=f"local_authority/{local_authority_names.iloc[i]['name']}",
label=local_authority_names.iloc[i]["name"],
type="local_authority",
)
)
time_period = [
dict(name=2024, label="2024"),
dict(name=2025, label="2025"),
Expand Down
Loading
Loading