Skip to content

Align Medicare Part B premium modeling with enrollment targets#8697

Open
daphnehanse11 wants to merge 3 commits into
PolicyEngine:mainfrom
daphnehanse11:codex/8677-medicare-part-b-enrollment
Open

Align Medicare Part B premium modeling with enrollment targets#8697
daphnehanse11 wants to merge 3 commits into
PolicyEngine:mainfrom
daphnehanse11:codex/8677-medicare-part-b-enrollment

Conversation

@daphnehanse11

Copy link
Copy Markdown
Collaborator

Summary

  • Add gross_medicare_part_b_premium_if_enrolled for enrollment-consistent CMS premiums-from-enrollees calibration targets.
  • Add medicare_irmaa_magi_two_years_prior as an explicit current-year input with fallback to AGI plus tax-exempt interest from two years prior.
  • Route Part B and Part D IRMAA through the shared lagged MAGI variable and use the enrollment-gated gross Part B premium in Medicare cost.

Tests

  • make format
  • uv run pytest policyengine_us/tests/policy/baseline/gov/hhs/medicare/test_part_b_msp_offset.py
  • uv run policyengine-core test policyengine_us/tests/policy/baseline/gov/hhs/medicare/eligibility/income_adjusted_part_d_premium_surcharge.yaml -c policyengine_us
  • uv run pytest policyengine_us/tests/test_system_import.py

Closes #8677

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e59df75) to head (753003d).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #8697   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         5    +4     
  Lines           13        86   +73     
=========================================
+ Hits            13        86   +73     
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 Harness.
📢 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 force-pushed the codex/8677-medicare-part-b-enrollment branch from f6c02cf to ce96789 Compare July 6, 2026 19:54
@daphnehanse11 daphnehanse11 marked this pull request as ready for review July 6, 2026 20:10
@daphnehanse11 daphnehanse11 requested a review from MaxGhenis July 6, 2026 20:11
…bles

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@MaxGhenis MaxGhenis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed the full diff against issue #8677 and checked the mechanics rather than trusting the summary (agent-assisted). This is clean.

What I verified:

  • The medicare_irmaa_magi_two_years_prior extraction is exactly behavior-preserving: the old inline tax_unit(tax_exempt_interest_income, prior_period) already summed the person-level component to the tax unit, so the new add(tax_unit, prior_period, [...]) is identical. Both IRMAA consumers route through it, and a grep confirms no other file still inlines the two-years-prior pattern.
  • gross_medicare_part_b_premium_if_enrolled isn't a bare wrapper — defined_for = medicare_enrolled is the point, gating the gross premium to enrolled beneficiaries so CMS premiums map to an enrollment-consistent calibration total.
  • Test values hand-check out: MAGI 106,002 → 3,108 (a deliberate $1-over-threshold boundary), 500,000 → 7,546.80, Part D 500,000 → 1,029.60, and medicare_cost 12,280/10,060. Params are untouched here but line up with CMS 2026 (standard 202.90, first single IRMAA threshold above 109k).

One note: the medicare_cost switch to the enrollment-gated premium is numerically inert today (it's already defined_for = medicare_enrolled, and the two premiums are equal on that subset) — harmless, good for clarity.

I retyped the changelog fragment from .changed to .added on the branch since this adds two public variables (minor bump).

Heads up that #8532 also appends to test_part_b_msp_offset.py, so whichever lands second needs a trivial rebase; base is ~160 commits behind main, worth a rebase before merge.

Approving.

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.

Align Medicare Part B premium modeling with enrollment targets and lagged IRMAA MAGI

2 participants