Conversation
`is_severely_disabled_for_benefits` is what policyengine-uk uses for the Child Tax Credit and Working Tax Credit severe disability elements (CTC Regs 2002 reg 8; WTC Regs 2002 reg 17). Those count the DLA care component at the highest rate, the PIP daily living component at the enhanced rate, higher-rate Attendance Allowance (WTC) and Armed Forces Independence Payment. The stored flag also counted lower-rate Attendance Allowance and FRS code 8, which covers every Armed Forces Compensation Scheme payment (including war disablement pensions and guaranteed income payments), not Armed Forces Independence Payment, which the FRS does not code. The legacy severe disability premium's wider list (any Attendance Allowance, DLA care middle rate, PIP daily living standard rate) is now read from the benefit categories in policyengine-uk rather than from this flag. A grid test pins the stored flag to the tax credit condition on the categories the same amounts map to. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 30, 2026
… model The stored flag and the benefit categories used two different floating-point comparisons, which disagreed at exactly the GBP 1/week tolerance edge (for example survey year 2022 at rate minus GBP 1.00). The flag now uses the category derivation itself, so the two agree by construction. The grid test covers survey years 2019-2026 and offsets either side of the tolerance edge, and fails on the old comparison. A differential test checks the stored flag against policyengine-uk's formula for the same categories; it skips on policyengine-uk releases that predate PolicyEngine/policyengine-uk#1946. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
marked this pull request as draft
September 30, 2026 20:31
The differential test between the stored flag and policyengine-uk's formula no longer skips on older policyengine-uk releases: it fails until the lock includes PolicyEngine/policyengine-uk#1946, which keeps the new flag from shipping with a model that still reads it for the severe disability premium. The code comment and changelog now describe the flag as the tax credit condition and note that UC's higher disabled child addition, which is also keyed on it, differs (UC Regs reg 24(2)(b)). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 tasks
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
add_disability_benefit_flags_from_reported_amountsstoredis_severely_disabled_for_benefitsas:policyengine-uk uses that flag for three things:
Until PolicyEngine/policyengine-uk#1946 it also drove the legacy severe disability premium, which has a wider list. The stored flag served neither correctly:
The fix:
_reaches_weekly_ratereuses_category_from_reported_amount), so it agrees with the storedaa_category,dla_sc_categoryandpip_dl_categoryby construction. The earlier amount comparison disagreed with the categories at exactly the £1/week tolerance edge, for example in survey year 2022 at rate minus £1.00.receives_severe_disability_premium_qualifying_benefit, which reads those categories, not this flag.is_severely_disabled_for_benefitsthis definition, so the stored value and the formula agree.Law re-verified on legislation.gov.uk (current revised text) on 2026-09-30. The FRS code frame was checked against the UKDA data dictionary for study 9563 and the DWP FRS 2024-25 benefits documentation.
Tests
test_attendance_allowance_feeds_stronger_disability_flags: lower-rate AA is no longer severe; higher-rate AA is.test_armed_forces_compensation_scheme_is_not_a_severe_disability:afcs_reportedalone setsis_disabled_for_benefitsbut not the severe flag.test_severe_flag_is_the_tax_credit_condition_on_the_categories: an exhaustive grid of AA, DLA care and PIP daily living amounts for survey years 2019 to 2026.aa_category == HIGHER | dla_sc_category == HIGHER | pip_dl_category == ENHANCEDon the categories the same amounts map to.test_severe_flag_matches_the_policyengine_uk_formula: a differential test between the stored flag and policyengine-uk's formula for every category combination on the grid.PYTHONPATH).test_disability_benefits.pygives 11 passed and the intended differential failure.test_frs_only_imputation.pyandtest_legacy_benefit_proxies.pypass.Effect
Measured with real policyengine-uk
Microsimulationruns on the Enhanced FRS 2024-25, against a copy whose stored flag was recomputed from the stored categories with this definition. The script ismake_flag_dataset.py; it touches no other column. The copy was compared with the unchanged dataset.Follow-up
The FRS codes for Adult Disability Payment (117, 118) and Child Disability Payment (121, 122) are not mapped, so Scottish recipients have no disability benefit in the model: #500.
🤖 Generated with Claude Code