From c1af549f9c240b3c8eb86ec71a4f41575629aef9 Mon Sep 17 00:00:00 2001 From: Ziming Date: Wed, 30 Sep 2026 17:48:41 -0400 Subject: [PATCH 1/2] Share lagged federal poverty guideline calculation --- changelog.d/liheap-fpg-helper.changed.md | 1 + .../gov/states/ma/doer/liheap/ma_liheap_fpg.yaml | 12 ++++++++++++ policyengine_us/variables/gov/hhs/tax_unit_fpg.py | 11 +++++++++-- .../gov/states/ma/doer/liheap/ma_liheap_fpg.py | 10 ++++------ 4 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 changelog.d/liheap-fpg-helper.changed.md diff --git a/changelog.d/liheap-fpg-helper.changed.md b/changelog.d/liheap-fpg-helper.changed.md new file mode 100644 index 00000000000..75f29f7bcdb --- /dev/null +++ b/changelog.d/liheap-fpg-helper.changed.md @@ -0,0 +1 @@ +Extend the federal poverty guideline helper to support lagged guideline years and reuse it for Massachusetts LIHEAP without changing its October lookup date. diff --git a/policyengine_us/tests/policy/baseline/gov/states/ma/doer/liheap/ma_liheap_fpg.yaml b/policyengine_us/tests/policy/baseline/gov/states/ma/doer/liheap/ma_liheap_fpg.yaml index 144447ba730..121bfaa6750 100644 --- a/policyengine_us/tests/policy/baseline/gov/states/ma/doer/liheap/ma_liheap_fpg.yaml +++ b/policyengine_us/tests/policy/baseline/gov/states/ma/doer/liheap/ma_liheap_fpg.yaml @@ -21,3 +21,15 @@ state_code: MA output: ma_liheap_fpg: 30_000 + +- name: Case 4, LIHEAP uses the prior guideline and SPM size while tax units use the current guideline. + period: 2026 + input: + state_code: [MA, MA, MA] + spm_unit_size: [1, 4, 9] + tax_unit_size: [2, 3, 1] + output: + # LIHEAP uses the 2025 guideline, including its additional-person amount. + ma_liheap_fpg: [15_650, 32_150, 59_650] + # The existing helper default continues using the 2026 guideline. + tax_unit_fpg: [21_640, 27_320, 15_960] diff --git a/policyengine_us/variables/gov/hhs/tax_unit_fpg.py b/policyengine_us/variables/gov/hhs/tax_unit_fpg.py index f492918fcbb..51714218342 100644 --- a/policyengine_us/variables/gov/hhs/tax_unit_fpg.py +++ b/policyengine_us/variables/gov/hhs/tax_unit_fpg.py @@ -1,8 +1,15 @@ from policyengine_us.model_api import * +from policyengine_core.periods import instant -def fpg(unit_size, state_group, period, parameters): - p_fpg = parameters(period).gov.hhs.fpg +def fpg(unit_size, state_group, period, parameters, year_lag=0): + """Return the annual guideline for the supplied size and guideline year. + + Lag only the parameter date, preserving its month and day. Callers supply + the current household size and apply any caps, policy rates, or rounding. + """ + guideline_date = instant(period).offset(-int(year_lag), "year") + p_fpg = parameters(guideline_date).gov.hhs.fpg p1 = p_fpg.first_person[state_group] pn = p_fpg.additional_person[state_group] return p1 + pn * (unit_size - 1) diff --git a/policyengine_us/variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py b/policyengine_us/variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py index 341fcfdc512..1be399218f5 100644 --- a/policyengine_us/variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py +++ b/policyengine_us/variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py @@ -1,4 +1,5 @@ from policyengine_us.model_api import * +from policyengine_us.variables.gov.hhs.tax_unit_fpg import fpg class ma_liheap_fpg(Variable): @@ -12,9 +13,6 @@ class ma_liheap_fpg(Variable): def formula(spm_unit, period, parameters): n = spm_unit("spm_unit_size", period.this_year) state_group = spm_unit.household("state_group_str", period.this_year) - year = period.start.year - instant_str = f"{year - 1}-10-01" - p_fpg = parameters(instant_str).gov.hhs.fpg - p1 = p_fpg.first_person[state_group] - pn = p_fpg.additional_person[state_group] - return p1 + pn * (n - 1) + # Preserve the October guideline date for the preceding heating season. + guideline_date = f"{period.start.year}-10-01" + return fpg(n, state_group, guideline_date, parameters, year_lag=1) From f4192ac94626d77bb8224621e86341459721094e Mon Sep 17 00:00:00 2001 From: Ziming Date: Wed, 30 Sep 2026 18:33:47 -0400 Subject: [PATCH 2/2] Specify currency unit for Massachusetts LIHEAP FPG --- .../variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py | 1 + 1 file changed, 1 insertion(+) diff --git a/policyengine_us/variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py b/policyengine_us/variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py index 1be399218f5..c149a39075f 100644 --- a/policyengine_us/variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py +++ b/policyengine_us/variables/gov/states/ma/doer/liheap/ma_liheap_fpg.py @@ -5,6 +5,7 @@ class ma_liheap_fpg(Variable): value_type = float entity = SPMUnit + unit = USD label = "Massachusetts LIHEAP federal poverty guideline" definition_period = YEAR defined_for = StateCode.MA