Skip to content

Commit

Permalink
Merge pull request #2216 from PolicyEngine/fix/public-uk-data
Browse files Browse the repository at this point in the history
Use new public Hugging Face model
  • Loading branch information
anth-volk authored Feb 28, 2025
2 parents 2edf784 + ba3a5e6 commit 04dbdfc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: patch
changes:
changed:
- Altered UK constituency data addresses to use new public Hugging Face model
2 changes: 1 addition & 1 deletion policyengine_api/country.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def build_microsimulation_options(self) -> dict:
options = dict()
if self.country_id == "uk":
constituency_names_path = download_huggingface_dataset(
repo="policyengine/policyengine-uk-data",
repo="policyengine/policyengine-uk-data-public",
repo_filename="constituencies_2024.csv",
)
constituency_names = pd.read_csv(constituency_names_path)
Expand Down
4 changes: 2 additions & 2 deletions policyengine_api/endpoints/economy/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ def uk_constituency_breakdown(
reform_hnet = reform["household_net_income"]

constituency_weights_path = download_huggingface_dataset(
repo="policyengine/policyengine-uk-data",
repo="policyengine/policyengine-uk-data-public",
repo_filename="parliamentary_constituency_weights.h5",
)
with h5py.File(constituency_weights_path, "r") as f:
Expand All @@ -579,7 +579,7 @@ def uk_constituency_breakdown(
] # {2025: array(650, 100180) where cell i, j is the weight of household record i in constituency j}

constituency_names_path = download_huggingface_dataset(
repo="policyengine/policyengine-uk-data",
repo="policyengine/policyengine-uk-data-public",
repo_filename="constituencies_2024.csv",
)
constituency_names = pd.read_csv(
Expand Down
4 changes: 2 additions & 2 deletions policyengine_api/jobs/calculate_economy_simulation_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ def _create_simulation_uk(
simulation.default_calculation_period = time_period
if region != "uk":
constituency_weights_path = download_huggingface_dataset(
repo="policyengine/policyengine-uk-data",
repo="policyengine/policyengine-uk-data-public",
repo_filename="parliamentary_constituency_weights.h5",
)
constituency_names_path = download_huggingface_dataset(
repo="policyengine/policyengine-uk-data",
repo="policyengine/policyengine-uk-data-public",
repo_filename="constituencies_2024.csv",
)
constituency_names = pd.read_csv(constituency_names_path)
Expand Down

0 comments on commit 04dbdfc

Please sign in to comment.