Skip to content

Commit

Permalink
Fix Budget change reforms break on subset simulations #994 (#995)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilwoodruff authored Nov 5, 2024
1 parent 8934a4c commit db630cd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.15.1] - 2024-11-05 14:05:53

### Fixed

- Bug in budget change reforms.

## [2.15.0] - 2024-10-30 17:24:57

### Added
Expand Down Expand Up @@ -1591,6 +1597,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



[2.15.1]: https://github.com/PolicyEngine/openfisca-uk/compare/2.15.0...2.15.1
[2.15.0]: https://github.com/PolicyEngine/openfisca-uk/compare/2.14.1...2.15.0
[2.14.1]: https://github.com/PolicyEngine/openfisca-uk/compare/2.14.0...2.14.1
[2.14.0]: https://github.com/PolicyEngine/openfisca-uk/compare/2.13.2...2.14.0
Expand Down
5 changes: 5 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1335,3 +1335,8 @@
added:
- OBR Autumn 2024 EFO economic factors.
date: 2024-10-30 17:24:57
- bump: patch
changes:
fixed:
- Bug in budget change reforms.
date: 2024-11-05 14:05:53
34 changes: 20 additions & 14 deletions policyengine_uk/variables/contrib/policyengine/budget_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ class nhs_budget_change(Variable):
value_type = float

def formula(household, period, parameters):
budget_increase = (
parameters(period).gov.contrib.policyengine.budget.nhs * 1e9
)
if budget_increase == 0:
return 0
decile = household(
"pre_budget_change_ons_household_income_decile", period
)
Expand All @@ -195,9 +200,6 @@ def formula(household, period, parameters):

decile = pd.Series(decile)

budget_increase = (
parameters(period).gov.contrib.policyengine.budget.nhs * 1e9
)
budget_increase_per_decile = {
i: budget_increase * DECILE_INCIDENCE[i] for i in range(1, 11)
}
Expand All @@ -223,6 +225,12 @@ class education_budget_change(Variable):
value_type = float

def formula(household, period, parameters):

budget_increase = (
parameters(period).gov.contrib.policyengine.budget.education * 1e9
)
if budget_increase == 0:
return 0
decile = household(
"pre_budget_change_ons_household_income_decile", period
)
Expand All @@ -241,10 +249,6 @@ def formula(household, period, parameters):
}

decile = pd.Series(decile)

budget_increase = (
parameters(period).gov.contrib.policyengine.budget.education * 1e9
)
budget_increase_per_decile = {
i: budget_increase * DECILE_INCIDENCE[i] for i in range(1, 11)
}
Expand All @@ -270,6 +274,15 @@ class other_public_spending_budget_change(Variable):
value_type = float

def formula(household, period, parameters):

budget_increase = (
parameters(
period
).gov.contrib.policyengine.budget.other_public_spending
* 1e9
)
if budget_increase == 0:
return 0
decile = household(
"pre_budget_change_ons_household_income_decile", period
)
Expand All @@ -288,13 +301,6 @@ def formula(household, period, parameters):
}

decile = pd.Series(decile)

budget_increase = (
parameters(
period
).gov.contrib.policyengine.budget.other_public_spending
* 1e9
)
budget_increase_per_decile = {
i: budget_increase * DECILE_INCIDENCE[i] for i in range(1, 11)
}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="PolicyEngine-UK",
version="2.15.0",
version="2.15.1",
author="PolicyEngine",
author_email="[email protected]",
classifiers=[
Expand Down

0 comments on commit db630cd

Please sign in to comment.