Skip to content

Model Medicare enrollment as eligible take-up#8255

Draft
MaxGhenis wants to merge 2 commits into
mainfrom
fix-medicare-takeup-enrollment
Draft

Model Medicare enrollment as eligible take-up#8255
MaxGhenis wants to merge 2 commits into
mainfrom
fix-medicare-takeup-enrollment

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Summary

  • Model medicare_enrolled as an eligibility-gated take-up variable, matching the Medicaid enrollment pattern.
  • Add takes_up_medicare_if_eligible, defaulting to true for eligible people.
  • Update Medicare cost, Part D surcharge, and ACA coverage-conflict fixtures to use take-up rather than directly forcing medicare_enrolled.

Root Cause

Previously, medicare_enrolled had defined_for = "is_medicare_eligible" and default_value = True. When a dataset omitted medicare_enrolled, PolicyEngine could treat enrollment as a direct default input instead of a calculated eligibility-and-take-up result, which made downstream datasets vulnerable to overcounting enrollment.

Validation

  • git diff --check
  • uv run python -m py_compile policyengine_us/variables/gov/hhs/medicare/takes_up_medicare_if_eligible.py
  • uv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/hhs/medicare policyengine_us/tests/policy/baseline/gov/aca/eligibility -c policyengine_us (171 passed, 1 warning)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (623a65c) to head (17c2b3b).
⚠️ Report is 156 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main     #8255    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           12         2    -10     
  Lines          173        17   -156     
  Branches         4         0     -4     
==========================================
- Hits           173        17   -156     
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.

@MaxGhenis MaxGhenis requested a review from daphnehanse11 May 11, 2026 02:07
Copy link
Copy Markdown
Collaborator

@daphnehanse11 daphnehanse11 left a comment

Choose a reason for hiding this comment

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

codex and i say looks good!

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