Skip to content

Fix MAGI Medicaid household construction#8169

Open
daphnehanse11 wants to merge 4 commits intoPolicyEngine:mainfrom
daphnehanse11:codex/issue-5907-explore
Open

Fix MAGI Medicaid household construction#8169
daphnehanse11 wants to merge 4 commits intoPolicyEngine:mainfrom
daphnehanse11:codex/issue-5907-explore

Conversation

@daphnehanse11
Copy link
Copy Markdown
Collaborator

Fixes #5907

What this does

  • replace the MAGI Medicaid tax-unit proxy with person-specific tax-filer and non-filer household rules
  • exclude child and dependent income only when it is below the Medicaid filing-threshold rule
  • add targeted Medicaid household tests and make affected ACA fixtures explicit about parent-child relationships
  • model the full-time-student-under-21 household rule as an explicit state option switch instead of a faux default threshold

Known gaps

  • the non-custodial-parent exception still needs custody data
  • dependents claimed elsewhere still do not have claimant-tax-unit linkage
  • state-by-state backfill is still needed for the full-time-student-under-21 option
  • pregnancy treatment for other household members remains unparameterized

Validation

  • uv run --with ruff ruff format .
  • uv run --with ruff ruff check .
  • uv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_uses_non_filer_rules.yaml policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_income_level.yaml policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/tax_unit_medicaid_income_level.yaml policyengine_us/tests/policy/baseline/gov/hhs/chip policyengine_us/tests/policy/baseline/gov/aca/eligibility/aca_magi.yaml policyengine_us/tests/policy/baseline/gov/aca/ptc/integration.yaml policyengine_us/tests/policy/baseline/gov/aca/ptc/separate_esi.yaml -c policyengine_us

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (f9a4a0f) to head (98d472a).
⚠️ Report is 1154 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #8169   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7        16    +9     
  Lines          215       224    +9     
  Branches         6         2    -4     
=========================================
+ Hits           215       224    +9     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

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.

@daphnehanse11 daphnehanse11 requested a review from MaxGhenis April 28, 2026 16:55
@daphnehanse11 daphnehanse11 marked this pull request as ready for review April 28, 2026 16:55
@daphnehanse11
Copy link
Copy Markdown
Collaborator Author

Initial read-only review via gh/PR diff before edits.

What I checked:

  • Person-specific Medicaid MAGI household size/income rules against the tax-filer, tax-dependent-exception, and non-filer household structure.
  • Child/dependent filing-threshold income exclusion path and the new Medicaid tests.
  • Variable metadata, parameter metadata, period handling, and changed healthcare/ACA test expectations.

Findings I am patching in a fresh /tmp worktree:

  • medicaid_non_filer_child_age_eligible parameterizes the under-19 non-student child limit but still hardcodes the under-21 full-time-student option. I will add a student age-limit parameter so both legal thresholds live in parameters.
  • medicaid_person_is_required_to_file hardcodes the $5 gross-income threshold for married dependents whose spouse itemizes. I will parameterize that IRS filing-rule threshold instead of leaving a legal dollar amount in formula code.

I do not see a broader blocker in the submitted diff yet; these look like focused PolicyEngine-style fixes before merge.

Copy link
Copy Markdown
Collaborator Author

Follow-up after the initial patch: Codecov was still flagging missing patch coverage in medicaid_adjusted_gross_income_person.py, so I added a focused Medicaid AGI-person test covering the single-vs-joint shared ALD split, taxable basic income handling, and the dependent/no-shared-allocation path.

Local verification:

  • policyengine_command test policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income/medicaid_adjusted_gross_income_person.yaml -c policyengine_us: 2 passed
  • policyengine_command test policyengine_us/tests/policy/baseline/gov/hhs/medicaid/income -c policyengine_us: 19 passed
  • local coverage for medicaid_adjusted_gross_income_person.py: 100% line and branch coverage
  • ruff check on the modified Medicaid Python files: passed
  • git diff --check: passed

Pushed follow-up commit: 98d472a78d.

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.

Whose income counts in the a household for Medicaid income calculations?

1 participant