From f044be297086b01799658550e9919e55db12b72f Mon Sep 17 00:00:00 2001 From: Anthony Volk <14987227+anth-volk@users.noreply.github.com> Date: Fri, 9 Oct 2026 04:39:31 +0400 Subject: [PATCH] Apply Housing Benefit main-phase ESA allowance exception --- changelog.d/hb-esa-allowance.added.md | 1 + .../housing_benefit_esa_allowance.yaml | 312 ++++++++++++++++++ .../housing_benefit_applicable_amount.py | 7 +- .../housing_benefit_has_main_phase_esa.py | 25 ++ ...fit_main_phase_esa_allowance_adjustment.py | 41 +++ 5 files changed, 385 insertions(+), 1 deletion(-) create mode 100644 changelog.d/hb-esa-allowance.added.md create mode 100644 policyengine_uk/tests/policy/baseline/finance/benefit/family/housing_benefit/housing_benefit_esa_allowance.yaml create mode 100644 policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_main_phase_esa.py create mode 100644 policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_main_phase_esa_allowance_adjustment.py diff --git a/changelog.d/hb-esa-allowance.added.md b/changelog.d/hb-esa-allowance.added.md new file mode 100644 index 0000000000..48b37c6828 --- /dev/null +++ b/changelog.d/hb-esa-allowance.added.md @@ -0,0 +1 @@ +- Added the higher Housing Benefit personal allowance for pre-assessed main-phase ESA claimants without double counting the ordinary allowance. diff --git a/policyengine_uk/tests/policy/baseline/finance/benefit/family/housing_benefit/housing_benefit_esa_allowance.yaml b/policyengine_uk/tests/policy/baseline/finance/benefit/family/housing_benefit/housing_benefit_esa_allowance.yaml new file mode 100644 index 0000000000..dcba95192d --- /dev/null +++ b/policyengine_uk/tests/policy/baseline/finance/benefit/family/housing_benefit/housing_benefit_esa_allowance.yaml @@ -0,0 +1,312 @@ +- name: Main-phase allowance honours a reform reducing the older allowance + period: 2024 + absolute_error_margin: 0.01 + input: + gov.dwp.housing_benefit.allowances.single.older: 60 + gov.dwp.housing_benefit.allowances.single.younger: 80 + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 22 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: -20 * 52 + housing_benefit_applicable_amount: 60 * 52 + +- name: ENGLAND single age 22 assessment phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: ENGLAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: false + eldest_claimant_or_partner_age: 22 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 71.7 * 52 + +- name: ENGLAND lone_parent age 17 assessment phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: ENGLAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: false + eldest_claimant_or_partner_age: 17 + is_single_person: false + is_couple: false + is_lone_parent: true + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 71.7 * 52 + +- name: ENGLAND couple age 17 assessment phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: ENGLAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: false + eldest_claimant_or_partner_age: 17 + is_single_person: false + is_couple: true + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 108.3 * 52 + +- name: ENGLAND single age 30 assessment phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: ENGLAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: false + eldest_claimant_or_partner_age: 30 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 90.5 * 52 + +- name: ENGLAND single age 22 main phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: ENGLAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 22 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 18.799999999999997 * 52 + housing_benefit_applicable_amount: 90.5 * 52 + +- name: ENGLAND lone_parent age 17 main phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: ENGLAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 17 + is_single_person: false + is_couple: false + is_lone_parent: true + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 18.799999999999997 * 52 + housing_benefit_applicable_amount: 90.5 * 52 + +- name: ENGLAND couple age 17 main phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: ENGLAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 17 + is_single_person: false + is_couple: true + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 33.95 * 52 + housing_benefit_applicable_amount: 142.25 * 52 + +- name: ENGLAND single age 30 main phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: ENGLAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 30 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 90.5 * 52 + +- name: NORTHERN_IRELAND single age 22 assessment phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: NORTHERN_IRELAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: false + eldest_claimant_or_partner_age: 22 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 71.7 * 52 + +- name: NORTHERN_IRELAND lone_parent age 17 assessment phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: NORTHERN_IRELAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: false + eldest_claimant_or_partner_age: 17 + is_single_person: false + is_couple: false + is_lone_parent: true + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 71.7 * 52 + +- name: NORTHERN_IRELAND couple age 17 assessment phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: NORTHERN_IRELAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: false + eldest_claimant_or_partner_age: 17 + is_single_person: false + is_couple: true + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 108.3 * 52 + +- name: NORTHERN_IRELAND single age 30 assessment phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: NORTHERN_IRELAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: false + eldest_claimant_or_partner_age: 30 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 90.5 * 52 + +- name: NORTHERN_IRELAND single age 22 main phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: NORTHERN_IRELAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 22 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 18.799999999999997 * 52 + housing_benefit_applicable_amount: 90.5 * 52 + +- name: NORTHERN_IRELAND lone_parent age 17 main phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: NORTHERN_IRELAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 17 + is_single_person: false + is_couple: false + is_lone_parent: true + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 18.799999999999997 * 52 + housing_benefit_applicable_amount: 90.5 * 52 + +- name: NORTHERN_IRELAND couple age 17 main phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: NORTHERN_IRELAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 17 + is_single_person: false + is_couple: true + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 33.95 * 52 + housing_benefit_applicable_amount: 142.25 * 52 + +- name: NORTHERN_IRELAND single age 30 main phase ESA allowance + period: 2024 + absolute_error_margin: 0.01 + input: + country: NORTHERN_IRELAND + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: false + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 30 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 * 52 + housing_benefit_applicable_amount: 90.5 * 52 + +- name: Missing ESA phase does not infer it from a reported award + period: 2024 + input: + esa_contrib_reported: 5000 + esa_income_reported: 1000 + output: + housing_benefit_has_main_phase_esa: false + +- name: ESA status does not alter the pension-age allowance + period: 2024 + input: + housing_benefit_eligible: true + housing_benefit_pension_age_regulations_apply: true + housing_benefit_has_main_phase_esa: true + eldest_claimant_or_partner_age: 75 + is_single_person: true + is_couple: false + is_lone_parent: false + benefits_premiums: 0 + output: + housing_benefit_main_phase_esa_allowance_adjustment: 0 + housing_benefit_applicable_amount: 235.20 * 52 diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_applicable_amount.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_applicable_amount.py index cba43eaafe..91f62985e2 100644 --- a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_applicable_amount.py +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_applicable_amount.py @@ -11,6 +11,8 @@ class housing_benefit_applicable_amount(Variable): reference = ( "https://www.legislation.gov.uk/uksi/2006/213/schedule/3", "https://www.legislation.gov.uk/uksi/2006/214/schedule/3", + "https://www.legislation.gov.uk/uksi/2006/213/schedule/3/paragraph/1A", + "https://www.legislation.gov.uk/nisr/2006/405/schedule/4/part/I", ) def formula(benunit, period, parameters): @@ -52,4 +54,7 @@ def formula(benunit, period, parameters): + lone_parent * lone_parent_personal_allowance ) * WEEKS_IN_YEAR premiums = benunit("benefits_premiums", period) - return personal_allowance + premiums + esa_adjustment = benunit( + "housing_benefit_main_phase_esa_allowance_adjustment", period + ) + return personal_allowance + premiums + esa_adjustment diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_main_phase_esa.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_main_phase_esa.py new file mode 100644 index 0000000000..ba3a0523ff --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_has_main_phase_esa.py @@ -0,0 +1,25 @@ +from policyengine_uk.model_api import * + + +class housing_benefit_has_main_phase_esa(Variable): + value_type = bool + entity = BenUnit + label = "Housing Benefit claimant entitled to main-phase ESA" + definition_period = YEAR + default_value = False + documentation = ( + "Pre-assessed main-phase ESA entitlement of the Housing Benefit " + "claimant personally, as defined in GB Schedule 3 paragraph 1A " + "or NI Schedule 4 paragraph 1A. A partner's entitlement alone does " + "not establish this personal-allowance exception. Includes the " + "specified converted-ESA/time-limit cases, not just current payment. " + "Existing ESA variables report amounts and apply capital screens; " + "they do not identify award phase. No dataset mapping is verified. " + "Missing input defaults to false, preserving the age-based " + "approximation and potentially understating qualifying allowances. " + "This is not a new ESA entitlement calculation." + ) + reference = ( + "https://www.legislation.gov.uk/uksi/2006/213/schedule/3/paragraph/1A", + "https://www.legislation.gov.uk/nisr/2006/405/schedule/4/part/I", + ) diff --git a/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_main_phase_esa_allowance_adjustment.py b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_main_phase_esa_allowance_adjustment.py new file mode 100644 index 0000000000..4f4bac751b --- /dev/null +++ b/policyengine_uk/variables/gov/dwp/housing_benefit/housing_benefit_main_phase_esa_allowance_adjustment.py @@ -0,0 +1,41 @@ +from policyengine_uk.model_api import * + + +class housing_benefit_main_phase_esa_allowance_adjustment(Variable): + value_type = float + entity = BenUnit + label = "Housing Benefit main-phase ESA personal allowance adjustment" + definition_period = YEAR + unit = GBP + documentation = ( + "Replaces the lower age-based working-age adult allowance with its " + "main-phase ESA amount, using the existing higher allowance parameters. " + "This is a difference, not an additional personal allowance. Pension-age " + "allowances and adult premiums are not modified." + ) + reference = ( + "https://www.legislation.gov.uk/uksi/2006/213/schedule/3/paragraph/1", + "https://www.legislation.gov.uk/nisr/2006/405/schedule/4/part/I", + ) + + def formula(benunit, period, parameters): + p = parameters(period).gov.dwp.housing_benefit.allowances + age = benunit("eldest_claimant_or_partner_age", period) + single = benunit("is_single_person", period) + lone_parent = benunit("is_lone_parent", period) + couple = benunit("is_couple", period) + qualifies = benunit("housing_benefit_has_main_phase_esa", period) & ~benunit( + "housing_benefit_pension_age_regulations_apply", period + ) + weekly_adjustment = ( + single * (age < p.age_threshold.older) * (p.single.older - p.single.younger) + + lone_parent + * (age < p.age_threshold.younger) + * (p.lone_parent.older - p.lone_parent.younger) + + couple + * (age < p.age_threshold.younger) + * (p.couple.older - p.couple.younger) + ) + # A reform can reduce a higher allowance below the younger amount. + # Preserve the signed difference rather than silently overriding it. + return where(qualifies, weekly_adjustment * WEEKS_IN_YEAR, 0)