Skip to content
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:
fixed:
- Bug in handling downloads of UKMultiYearDataset from HuggingFace.
11 changes: 5 additions & 6 deletions policyengine_uk/data/dataset_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,11 @@ def validate_file_path(file_path: str):

# Check if the file contains datasets for multiple years
with h5py.File(file_path, "r") as f:
if not any(key.startswith("/person/") for key in f.keys()):
raise ValueError("No person dataset found in the file.")
if not any(key.startswith("/benunit/") for key in f.keys()):
raise ValueError("No benunit dataset found in the file.")
if not any(key.startswith("/household/") for key in f.keys()):
raise ValueError("No household dataset found in the file.")
for required_dataset in ["person", "benunit", "household"]:
if not any(f"{required_dataset}" in key for key in f.keys()):
raise ValueError(
f"Dataset '{required_dataset}' not found in the file: {file_path}"
)

def load(self):
data = {}
Expand Down
8 changes: 6 additions & 2 deletions policyengine_uk/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,13 @@ def __init__(self, *args, dataset=ENHANCED_FRS, **kwargs):
dataset = UKMultiYearDataset(
file_path=dataset_file_path
)
except:
except Exception as e:
pass
dataset = Dataset.from_file(dataset_file_path)

if not isinstance(
dataset, (UKSingleYearDataset, UKMultiYearDataset)
):
dataset = Dataset.from_file(dataset_file_path)

super().__init__(*args, dataset=dataset, **kwargs)

Expand Down
10 changes: 5 additions & 5 deletions policyengine_uk/tests/microsimulation/reforms_config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
reforms:
- name: Raise basic rate by 1pp
expected_impact: 7.6
expected_impact: 7.5
parameters:
gov.hmrc.income_tax.rates.uk[0].rate: 0.21
- name: Raise higher rate by 1pp
expected_impact: 4.8
expected_impact: 4.7
parameters:
gov.hmrc.income_tax.rates.uk[1].rate: 0.42
- name: Raise personal allowance by ~800GBP/year
Expand All @@ -16,18 +16,18 @@ reforms:
parameters:
gov.hmrc.child_benefit.amount.additional: 25
- name: Reduce Universal Credit taper rate to 20%
expected_impact: -36.5
expected_impact: -36.4
parameters:
gov.dwp.universal_credit.means_test.reduction_rate: 0.2
- name: Raise Class 1 main employee NICs rate to 10%
expected_impact: 12.3
parameters:
gov.hmrc.national_insurance.class_1.rates.employee.main: 0.1
- name: Raise VAT standard rate by 2pp
expected_impact: 18.8
expected_impact: 18.9
parameters:
gov.hmrc.vat.standard_rate: 0.22
- name: Raise additional rate by 3pp
expected_impact: 5.5
expected_impact: 5.3
parameters:
gov.hmrc.income_tax.rates.uk[2].rate: 0.48
Loading