Skip to content

Decompose SPM MOOP premiums#8178

Merged
MaxGhenis merged 14 commits intoPolicyEngine:mainfrom
daphnehanse11:codex/issue-8095-marketplace-spm-moop
Apr 29, 2026
Merged

Decompose SPM MOOP premiums#8178
MaxGhenis merged 14 commits intoPolicyEngine:mainfrom
daphnehanse11:codex/issue-8095-marketplace-spm-moop

Conversation

@daphnehanse11
Copy link
Copy Markdown
Collaborator

@daphnehanse11 daphnehanse11 commented Apr 28, 2026

Summary

  • Splits SPM MOOP into explicit premium and non-premium components, using adds= for the SPM aggregates.
  • Defines the SPM health insurance premium stack as other_health_insurance_premiums plus modeled Marketplace net, CHIP, Medicaid, and Medicare Part B premiums.
  • Renames the computed Part B premium to medicare_part_b_premium, removes the generic medical_out_of_pocket_expenses aggregate, and keeps statutory medical-expense wrappers separate from the SPM definition.
  • Adds medical_expense_health_insurance_premiums for SNAP/itemized/HUD/Medicaid-style medical expense definitions, while leaving health_insurance_premiums as a direct input used by pre-tax contribution and state-specific direct-premium logic.
  • Gives other_health_insurance_premiums the medical MOOP uprating path.
  • Bumps the package version to 1.673.0, which Derive other health insurance premiums policyengine-us-data#844 uses as its minimum clean MOOP dependency.

Addresses #8095 and part of #8168.

Definitions

  • SNAP allowable medical expenses follow 7 U.S.C. 2014(e)(5) and 7 CFR 273.9(d)(3): snap_allowable_medical_expenses is the SNAP medical-cost definition and adds allowable health insurance premiums plus other allowable medical costs before the excess-medical deduction threshold is applied.
  • Itemized medical expenses / itemized medical deduction inputs follow IRC Section 213(a) and 213(d)(1): itemized_medical_expenses is the tax medical-cost definition and adds allowable health insurance premiums plus other medical expenses before the AGI floor in medical_expense_deduction.
  • SPM MOOP is kept as its own household/SPM definition: health insurance premiums plus non-premium out-of-pocket medical costs, with computed premiums replacing the pieces we can model.

Notes

This should be reviewed alongside PolicyEngine/policyengine-us-data#844, which derives other_health_insurance_premiums from reported non-Medicare premiums net of baseline modeled Marketplace, CHIP, and Medicaid premiums. Medicare Part B is modeled directly rather than carried through a reported-premium input.

Tests

  • uv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/credits/property_tax/mo_property_tax_credit.yaml policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/deductions/mo_pension_and_ss_or_ssd_deduction/integration_tests/mo_pension_and_ss_or_ssd.yaml policyengine_us/tests/policy/baseline/gov/states/mo/tax/income/income_tax/integration.yaml -c policyengine_us
  • uv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/household/expense/health/medical_expense_health_insurance_premiums.yaml policyengine_us/tests/policy/baseline/gov/hud/hud_adjusted_income.yaml policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/credits/nm_medical_expense_credit.yaml policyengine_us/tests/policy/baseline/gov/states/nm/tax/income/exemptions/nm_medical_expense_exemption.yaml policyengine_us/tests/policy/baseline/gov/hhs/medicaid/eligibility/categories/medically_needy/is_medically_needy_for_medicaid.yaml policyengine_us/tests/policy/baseline/household/cliff_gap.yaml policyengine_us/tests/policy/baseline/gov/usda/snap/income/deductions/snap_excess_medical_expense_deduction.yaml policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/itemizing/itemized_medical_expenses.yaml policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/itemizing/medical_expense_deduction.yaml -c policyengine_us
  • uv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/hhs/medicare/eligibility/medicare_part_b_premium.yaml policyengine_us/tests/policy/baseline/gov/hhs/medicare/costs/medicare_cost.yaml policyengine_us/tests/policy/baseline/household/income/spm_unit/spm_unit_medical_out_of_pocket_expenses.yaml policyengine_us/tests/policy/baseline/household/income/spm_unit/spm_unit_medical_out_of_pocket_expenses_medicare_part_b.yaml policyengine_us/tests/policy/baseline/household/income/spm_unit/spm_unit_spm_expenses_chip_premium.yaml policyengine_us/tests/policy/baseline/gov/usda/snap/income/deductions/snap_excess_medical_expense_deduction.yaml policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/itemizing/itemized_medical_expenses.yaml policyengine_us/tests/policy/baseline/gov/irs/income/taxable_income/deductions/itemizing/medical_expense_deduction.yaml -c policyengine_us
  • bash -lc 'uv run coverage erase; FILES=$(gh pr diff 8178 --repo PolicyEngine/policyengine-us --name-only); SELECTIVE_TEST_MAX_TARGETS=25 SELECTIVE_TEST_MAX_FILES=250 uv run python policyengine_us/tests/run_selective_tests.py --coverage --files $FILES; uv run coverage report --fail-under=0 --skip-covered --skip-empty'
  • uv run ruff format --check policyengine_us/variables/gov/states/mo/tax/income/subtractions/mo_qualified_health_insurance_premiums.py && uv run ruff check policyengine_us/variables/gov/states/mo/tax/income/subtractions/mo_qualified_health_insurance_premiums.py
  • git diff --check

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d888043) to head (0d097cf).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##             main     #8178       +/-   ##
============================================
+ Coverage   86.04%   100.00%   +13.95%     
============================================
  Files           3        32       +29     
  Lines          43       500      +457     
  Branches        2         2               
============================================
+ Hits           37       500      +463     
+ Misses          6         0        -6     
Flag Coverage Δ
unittests 100.00% <100.00%> (+13.95%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator Author

Read-only review pass before patching:

The failing Full Suite - Baseline (irs-household) check is caused by the new marketplace_net_premium term flowing through spm_unit_medical_out_of_pocket_expenses into pre-existing household/SPM expense fixtures that were not setting ACA Marketplace inputs explicitly. The log shows:

  • policyengine_us/tests/policy/baseline/household/cliff_gap.yaml: the two TX spm_unit_net_income@2021 expectations are now lower by 6675.7188, consistent with an added Marketplace net premium expense.
  • policyengine_us/tests/policy/baseline/household/income/spm_unit/spm_unit_spm_expenses_chip_premium.yaml: spm_unit_spm_expenses@2024 now includes about 6294.821 of Marketplace net premium on top of the intended CHIP premium assertion.

I did not see a hardcoded-value, parameter metadata, or period-handling issue in the small formula diff itself. The focused fix is to isolate those existing non-Marketplace tests by explicitly setting Marketplace net premium/take-up to zero where the fixture is testing CHIP/cliff behavior, while leaving the new Marketplace SPM MOOP coverage intact.

Patching this now in a fresh detached worktree under /tmp.

@daphnehanse11 daphnehanse11 marked this pull request as ready for review April 28, 2026 18:33
@daphnehanse11 daphnehanse11 requested a review from MaxGhenis April 28, 2026 18:34
@MaxGhenis
Copy link
Copy Markdown
Contributor

This doublecounts marketplace premiums in MOOP and doesn't connect it to other MOOP use cases like SNAP and IMD. Fixing

@MaxGhenis MaxGhenis changed the title Add Marketplace premiums to SPM MOOP Decompose SPM MOOP premiums Apr 29, 2026
Copy link
Copy Markdown
Contributor

@MaxGhenis MaxGhenis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed MOOP decomposition and companion data sequencing; approving pending CI.

@MaxGhenis MaxGhenis merged commit c1b4bc5 into PolicyEngine:main Apr 29, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants