-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add increase switch for benefit actual amounts
- Loading branch information
1 parent
f29b176
commit 8d89f5f
Showing
4 changed files
with
127 additions
and
2 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
policyengine_uk/parameters/gov/contrib/benefit_uprating/inflation_adjustment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
description: Increase benefits subject to inflation uprating maximum amounts by this amount. This takes place over 2024. | ||
values: | ||
2000-01-01: 0 | ||
metadata: | ||
unit: /1 | ||
label: Benefit inflation adjustment |
2 changes: 1 addition & 1 deletion
2
policyengine_uk/parameters/gov/contrib/benefit_uprating/non_sp.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
from policyengine_uk.model_api import * | ||
from typing import Union, Optional | ||
|
||
|
||
def benefit_uprating_reform( | ||
rate: float, | ||
) -> Reform: | ||
# Applies an increase to actual benefit amounts. | ||
def modify_parameters(parameters): | ||
dwp = parameters.gov.dwp | ||
uc = dwp.universal_credit | ||
sa = uc.standard_allowance.amount | ||
pc = dwp.pension_credit | ||
aa = dwp.attendance_allowance | ||
pip = dwp.pip | ||
dla = dwp.dla | ||
hmrc = parameters.gov.hmrc | ||
esa = dwp.ESA | ||
jsa = dwp.JSA | ||
tc = dwp.tax_credits | ||
wtc = tc.working_tax_credit | ||
ctc = tc.child_tax_credit | ||
benefit_parameters = [ | ||
sa.SINGLE_YOUNG, | ||
sa.SINGLE_OLD, | ||
sa.COUPLE_YOUNG, | ||
sa.COUPLE_OLD, | ||
uc.elements.child.amount, | ||
uc.elements.child.first.higher_amount, | ||
uc.elements.child.disabled.amount, | ||
uc.elements.child.severely_disabled.amount, | ||
uc.elements.carer.amount, | ||
uc.elements.childcare.maximum.children["1"], | ||
uc.elements.childcare.maximum.children["2"], | ||
uc.means_test.work_allowance_with_housing, | ||
uc.means_test.work_allowance_without_housing, | ||
pc.guarantee_credit.minimum_guarantee.SINGLE, | ||
pc.guarantee_credit.minimum_guarantee.COUPLE, | ||
pc.savings_credit.threshold.SINGLE, | ||
pc.savings_credit.threshold.COUPLE, | ||
aa.higher, | ||
aa.lower, | ||
pip.daily_living.standard, | ||
pip.daily_living.enhanced, | ||
pip.mobility.standard, | ||
pip.mobility.enhanced, | ||
dla.mobility.lower, | ||
dla.mobility.higher, | ||
dla.self_care.lower, | ||
dla.self_care.higher, | ||
dla.self_care.middle, | ||
dwp.carers_allowance.rate, | ||
dwp.carer_premium.single, | ||
dwp.carer_premium.couple, | ||
dwp.sda.maximum, | ||
dwp.IIDB.maximum, | ||
hmrc.child_benefit.amount.eldest, | ||
hmrc.child_benefit.amount.additional, | ||
esa.income.amount_18_24, | ||
esa.income.amount_over_25, | ||
esa.income.couple, | ||
jsa.income.amount_18_24, | ||
jsa.income.amount_over_25, | ||
jsa.income.couple, | ||
wtc.elements.basic, | ||
wtc.elements.couple, | ||
wtc.elements.lone_parent, | ||
wtc.elements.worker, | ||
wtc.elements.disabled, | ||
wtc.elements.severely_disabled, | ||
ctc.elements.child_element, | ||
ctc.elements.dis_child_element, | ||
ctc.elements.severe_dis_child_element, | ||
tc.means_test.income_threshold, | ||
tc.means_test.income_threshold_CTC_only, | ||
] | ||
for parameter in benefit_parameters: | ||
print(parameter.name) | ||
for parameter_at_instant in parameter.values_list: | ||
parameter_at_instant.value *= rate | ||
|
||
for parameter in parameters.get_descendants(): | ||
if isinstance(parameter, ParameterNode): | ||
parameter._at_instant_cache = {} | ||
parameters._at_instant_cache = {} | ||
return parameters | ||
|
||
class reform(Reform): | ||
def apply(self): | ||
self.modify_parameters(modify_parameters) | ||
|
||
return reform | ||
|
||
|
||
def create_benefit_inflation_uprating_reform(parameters, period): | ||
uprating_amount = ( | ||
parameters.gov.contrib.benefit_uprating.inflation_adjustment(period) | ||
) | ||
if uprating_amount != 0: | ||
return benefit_uprating_reform( | ||
rate=1 + uprating_amount, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
from .cps import create_marriage_tax_reform | ||
from .benefit_inflation_uprating import ( | ||
create_benefit_inflation_uprating_reform, | ||
) | ||
from policyengine_core.model_api import * | ||
from policyengine_core import periods | ||
|
||
|
||
def create_structural_reforms_from_parameters(parameters, period): | ||
return create_marriage_tax_reform(parameters, period) | ||
period = periods.period(period) | ||
reforms = [ | ||
create_benefit_inflation_uprating_reform(parameters, period), | ||
create_marriage_tax_reform(parameters, period), | ||
] | ||
reforms = tuple(filter(lambda x: x is not None, reforms)) | ||
|
||
class combined_reform(Reform): | ||
def apply(self): | ||
for reform in reforms: | ||
reform.apply(self) | ||
|
||
return combined_reform |