Skip to content

Commit d4a0a59

Browse files
authored
Move disability benefit reported amount mapping to UK data (#1656)
* Tighten child and qualifying young person benefit rules * Move PIP reported amount mapping to data * Move DLA and Attendance Allowance categories to data
1 parent d066b2f commit d4a0a59

13 files changed

Lines changed: 79 additions & 149 deletions

docs/book/assumptions/growthfactors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ We use the OBR's CPI projections to drive most benefit and consumption variables
1515
| Growth rate | 10.0% | 5.7% | 2.3% | 3.2% | 1.9% | 2.0% | 2.0% | 2.0% |
1616

1717
We apply CPI to these variables:
18-
- All reported benefits– `attendance_allowance_reported`, `carers_allowance_reported`, `child_benefit_reported`, `child_tax_credit_reported`, `dla_m_reported`, `dla_sc_reported`, `esa_contrib_reported`, `esa_income_reported`, `housing_benefit_reported`, `iidb_reported`, `incapacity_benefit_reported`, `income_support_reported`, `jsa_contrib_reported`, `jsa_income_reported`, `maternity_allowance_reported`, `pension_credit_reported`, `pip_dl_reported`, `pip_m_reported`, `sda_reported`, `state_pension_reported`, `universal_credit_reported`, `winter_fuel_allowance_reported`, `working_tax_credit_reported`
18+
- All reported benefits– `carers_allowance_reported`, `child_benefit_reported`, `child_tax_credit_reported`, `esa_contrib_reported`, `esa_income_reported`, `housing_benefit_reported`, `iidb_reported`, `incapacity_benefit_reported`, `income_support_reported`, `jsa_contrib_reported`, `jsa_income_reported`, `maternity_allowance_reported`, `pension_credit_reported`, `sda_reported`, `state_pension_reported`, `universal_credit_reported`, `winter_fuel_allowance_reported`, `working_tax_credit_reported`
1919
- All consumption categories– `alcohol_and_tobacco_consumption`, `clothing_and_footwear_consumption`, `communication_consumption`, `domestic_energy_consumption`, `education_consumption`, `food_and_non_alcoholic_beverages_consumption`, `health_consumption`, `household_furnishings_consumption`, `housing_water_and_electricity_consumption`, `miscellaneous_consumption`, `recreation_consumption`, `restaurants_and_hotels_consumption`, `transport_consumption`
2020
- Other variables– `afcs_reported`, `bsp_reported`, `childcare_expenses`, `diesel_spending`, `free_school_fruit_veg`, `free_school_meals`, `free_school_milk`, `maintenance_expenses`, `petrol_spending`, `statutory_maternity_pay`, `statutory_paternity_pay`, `statutory_sick_pay`, `state_pension`
2121

@@ -107,4 +107,4 @@ We use ONS population [projections](https://www.ons.gov.uk/peoplepopulationandco
107107
|-------------|------|------|------|------|------|------|------|------|
108108
| Growth rate | 0.3% | 1.4% | 1.0% | 1.1% | 0.7% | 0.8% | 0.4% | 0.5% |
109109

110-
We apply this to: `household_weight`
110+
We apply this to: `household_weight`

policyengine_uk/data/uprating_indices.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ gov.economic_assumptions.yoy_growth.obr.average_earnings:
88
gov.economic_assumptions.yoy_growth.obr.consumer_price_index:
99
- afcs_reported
1010
- alcohol_and_tobacco_consumption
11-
- attendance_allowance_reported
1211
- bsp_reported
1312
- carers_allowance_reported
1413
- child_benefit_reported
@@ -17,8 +16,6 @@ gov.economic_assumptions.yoy_growth.obr.consumer_price_index:
1716
- clothing_and_footwear_consumption
1817
- communication_consumption
1918
- diesel_spending
20-
- dla_m_reported
21-
- dla_sc_reported
2219
- domestic_energy_consumption
2320
- education_consumption
2421
- esa_contrib_reported
@@ -41,8 +38,6 @@ gov.economic_assumptions.yoy_growth.obr.consumer_price_index:
4138
- miscellaneous_consumption
4239
- pension_credit_reported
4340
- petrol_spending
44-
- pip_dl_reported
45-
- pip_m_reported
4641
- recreation_consumption
4742
- restaurants_and_hotels_consumption
4843
- sda_reported

policyengine_uk/tests/test_deterministic_variables.py

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"""
88

99
import pytest
10-
from policyengine_uk import Simulation
10+
from policyengine_uk import CountryTaxBenefitSystem, Simulation
1111

1212

1313
class TestDefaultValues:
@@ -79,6 +79,77 @@ def test_is_disabled_for_benefits_defaults_false(self):
7979
result = sim.calculate("is_disabled_for_benefits", 2024)
8080
assert result[0] == False
8181

82+
def test_pip_categories_default_to_none(self):
83+
sim = Simulation(
84+
situation={
85+
"people": {"person": {"age": {2024: 30}}},
86+
"benunits": {"benunit": {"members": ["person"]}},
87+
"households": {"household": {"members": ["person"]}},
88+
}
89+
)
90+
91+
assert sim.calculate("pip", 2024)[0] == 0
92+
93+
def test_pip_categories_can_be_set_directly(self):
94+
sim = Simulation(
95+
situation={
96+
"people": {
97+
"person": {
98+
"age": {2024: 30},
99+
"pip_dl_category": {2024: "ENHANCED"},
100+
"pip_m_category": {2024: "STANDARD"},
101+
}
102+
},
103+
"benunits": {"benunit": {"members": ["person"]}},
104+
"households": {"household": {"members": ["person"]}},
105+
}
106+
)
107+
pip_parameters = sim.tax_benefit_system.parameters(2024).gov.dwp.pip
108+
expected = (
109+
pip_parameters.daily_living.enhanced + pip_parameters.mobility.standard
110+
) * 52
111+
112+
assert sim.calculate("pip", 2024)[0] == pytest.approx(expected)
113+
114+
def test_pip_reported_amounts_are_not_model_inputs(self):
115+
system = CountryTaxBenefitSystem()
116+
117+
assert "pip_dl_reported" not in system.variables
118+
assert "pip_m_reported" not in system.variables
119+
120+
def test_disability_categories_can_be_set_directly(self):
121+
sim = Simulation(
122+
situation={
123+
"people": {
124+
"person": {
125+
"age": {2024: 30},
126+
"dla_sc_category": {2024: "MIDDLE"},
127+
"dla_m_category": {2024: "HIGHER"},
128+
"aa_category": {2024: "LOWER"},
129+
}
130+
},
131+
"benunits": {"benunit": {"members": ["person"]}},
132+
"households": {"household": {"members": ["person"]}},
133+
}
134+
)
135+
parameters = sim.tax_benefit_system.parameters(2024).gov.dwp
136+
expected_dla = (
137+
parameters.dla.self_care.middle + parameters.dla.mobility.higher
138+
) * 52
139+
expected_aa = parameters.attendance_allowance.lower * 52
140+
141+
assert sim.calculate("dla", 2024)[0] == pytest.approx(expected_dla)
142+
assert sim.calculate("attendance_allowance", 2024)[0] == pytest.approx(
143+
expected_aa
144+
)
145+
146+
def test_disability_reported_amounts_are_not_model_inputs(self):
147+
system = CountryTaxBenefitSystem()
148+
149+
assert "attendance_allowance_reported" not in system.variables
150+
assert "dla_sc_reported" not in system.variables
151+
assert "dla_m_reported" not in system.variables
152+
82153
def test_would_claim_marriage_allowance_defaults_true(self):
83154
sim = Simulation(
84155
situation={

policyengine_uk/variables/gov/dwp/aa_category.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,9 @@
66

77
class aa_category(Variable):
88
label = "Attendance Allowance category"
9+
documentation = "If you receive Attendance Allowance, you will be in one of the following categories: Lower or Higher. If not, select None. Survey reported amounts should be converted to this category in the data pipeline."
910
entity = Person
1011
definition_period = YEAR
1112
value_type = Enum
1213
possible_values = LowerOrHigher
1314
default_value = LowerOrHigher.NONE
14-
15-
def formula(person, period, parameters):
16-
aa = parameters(period).baseline.gov.dwp.attendance_allowance
17-
SAFETY_MARGIN = 0.1 # Survey reported values could be slightly below eligible values when they should be above due to data manipulation
18-
reported_weekly_aa = (
19-
person("attendance_allowance_reported", period) / WEEKS_IN_YEAR
20-
)
21-
return select(
22-
[
23-
reported_weekly_aa >= aa.higher * (1 - SAFETY_MARGIN),
24-
reported_weekly_aa >= aa.lower * (1 - SAFETY_MARGIN),
25-
],
26-
[LowerOrHigher.HIGHER, LowerOrHigher.LOWER],
27-
default=LowerOrHigher.NONE,
28-
)

policyengine_uk/variables/gov/dwp/attendance_allowance_reported.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

policyengine_uk/variables/gov/dwp/dla/dla_m_reported.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

policyengine_uk/variables/gov/dwp/dla/dla_sc_reported.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

policyengine_uk/variables/gov/dwp/pip/pip_dl_reported.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

policyengine_uk/variables/gov/dwp/pip/pip_m_reported.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

policyengine_uk/variables/input/dla_m_category.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,9 @@
66

77
class dla_m_category(Variable):
88
label = "DLA (mobility) category"
9-
documentation = "If you receive the mobility component of Disability Living Allowance, you will be in one of the following categories: Lower, Higher. If not, select None."
9+
documentation = "If you receive the mobility component of Disability Living Allowance, you will be in one of the following categories: Lower, Higher. If not, select None. Survey reported amounts should be converted to this category in the data pipeline."
1010
entity = Person
1111
definition_period = YEAR
1212
value_type = Enum
1313
possible_values = LowerOrHigher
1414
default_value = LowerOrHigher.NONE
15-
16-
def formula(person, period, parameters):
17-
dla_m = parameters(period).baseline.gov.dwp.dla.mobility
18-
SAFETY_MARGIN = 0.1 # Survey reported values could be slightly below eligible values when they should be above due to data manipulation
19-
reported_weekly_dla_m = person("dla_m_reported", period) / WEEKS_IN_YEAR
20-
return select(
21-
[
22-
reported_weekly_dla_m >= dla_m.higher * (1 - SAFETY_MARGIN),
23-
reported_weekly_dla_m >= dla_m.lower * (1 - SAFETY_MARGIN),
24-
True,
25-
],
26-
[
27-
LowerOrHigher.HIGHER,
28-
LowerOrHigher.LOWER,
29-
LowerOrHigher.NONE,
30-
],
31-
)

0 commit comments

Comments
 (0)