Skip to content

Conversation

@daphnehanse11
Copy link
Collaborator

Fixes #6365

@codecov
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #6541   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11         9    -2     
  Lines          146       151    +5     
=========================================
+ Hits           146       151    +5     
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.

- Introduced `dc_medicaid_cost` and `dc_medicaid_cost_if_enrolled` variables.
- Updated `healthcare_benefit_value` to include `dc_medicaid_cost`.
- Removed deprecated immigration eligibility tests and refined logic for DC Medicaid eligibility.
- Enhanced documentation for clarity on DC Health Care Alliance coverage.
daphnehanse11 added a commit to daphnehanse11/policyengine-us that referenced this pull request Dec 22, 2025
This PR should only contain Colorado OmniSalud implementation.
DC Medicaid/Alliance code is already in PR PolicyEngine#6541.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@daphnehanse11 daphnehanse11 marked this pull request as ready for review December 22, 2025 21:20
@daphnehanse11
Copy link
Collaborator Author

PR Review: DC Medicaid for Immigrants

🔴 Critical (Must Fix)

  1. Hard-coded age values in dc_medicaid_cost_if_enrolled.py:28-29:

    is_child = age < 19
    is_aged_disabled = is_disabled | (age >= 65)
    • Uses 19 for child threshold but income eligibility uses child_max_age parameter (=20)
    • Age 65 threshold should be parameterized
    • Fix: Reuse child_max_age parameter or create new parameters
  2. Mutation of parameter-derived value in dc_medicaid_cost_if_enrolled.py:110-112:

    per_capita = p.totals.per_capita[group]
    mask = enroll > 0
    per_capita[mask] = spend[mask] / enroll[mask]
    • Mutates array from parameters in-place (side effect risk)
    • Fix: Create new array: per_capita = np.zeros_like(spend, dtype=float)
  3. Broken reference URLs - Multiple parameter files cite 404 URLs:

    • https://dhcf.dc.gov/alliance → 404
    • The PDF link also returns 404
    • Fix: Update to working URL https://dhcf.dc.gov/node/1796971
  4. Missing primary source for 324% FPL values - child_income_limit.yaml and pregnant_income_limit.yaml need sources that explicitly state 324% FPL (KFF confirms value but should cite DHCF)

🟡 Should Address

  1. Test file naming convention - Files named *_test.yaml should be renamed to match variable name (e.g., dc_medicaid_age_eligible_test.yamldc_medicaid_age_eligible.yaml)

  2. Missing boundary tests - Add tests at exact thresholds:

    • Adult at exactly 215% FPL (2025)
    • Adult at exactly 138% FPL (2026)
    • Child at exactly 324% FPL
    • Age 26 new applicant in 2026 (not eligible)
    • Age 26 enrolled in 2026 (grandfathered)
  3. Missing income-age interaction tests:

    • Age 20 at 220% FPL (child, eligible)
    • Age 21 at 220% FPL (adult, NOT eligible)
  4. Missing 2026 transition test - Same person eligible in 2025, not in 2026:

    - name: Adult at 140% FPL eligible in 2025
      period: 2025
      input:
        age: 25
        medicaid_income_level: 1.4
        immigration_status: UNDOCUMENTED
        state_code: DC
      output:
        dc_medicaid_eligible: true  # Under 215%
    
    - name: Adult at 140% FPL NOT eligible in 2026
      period: 2026
      input:
        age: 25
        medicaid_income_level: 1.4
        immigration_status: UNDOCUMENTED
        state_code: DC
      output:
        dc_medicaid_eligible: false  # Above 138%
  5. Inconsistent child age definition:

    • Income eligibility: age <= 20 (parameterized)
    • Cost calculation: age < 19 (hard-coded)

🟢 Suggestions

  1. Consider adding cost tests for age boundary (18 vs 19, 64 vs 65)
  2. Add zero income test case
  3. Add pregnant woman at exactly 324% FPL boundary test

Validation Summary

Check Result
Regulatory Accuracy 4/6 claims verified, 2 need primary sources
Reference Quality 5/6 files have broken URLs
Code Patterns 2 critical (hard-coded ages, mutation)
Test Coverage ~15 edge cases missing
CI Status ✅ All checks passing

What's Good

  • ✅ Proper vectorization throughout (uses select(), boolean operators)
  • ✅ Correct use of StateCode.DC enum
  • ✅ Proper adds pattern for cost aggregation
  • ✅ Income limits verified: 215%→138% adult, 324% child/pregnant
  • ✅ Age restriction verified: 26+ not eligible in 2026
  • ✅ Grandfathering logic for existing enrollees

Next Steps

To auto-fix critical issues: /fix-pr 6541

Or address manually:

  1. Parameterize age values in cost file
  2. Fix array mutation issue
  3. Update broken reference URLs
  4. Add boundary tests

🤖 Generated with Claude Code

- Replace hard-coded age < 19 with child_max_age parameter in cost file
- Fix array mutation bug by using where() instead of in-place assignment
- Update broken reference URLs (dhcf.dc.gov/alliance → dhcf.dc.gov/node/1796971)
- Add KFF references to corroborate 324% FPL values for children/pregnant
- Rename test files to match convention (*_test.yaml → *.yaml)
- Add 14 boundary tests for income limits and age transitions
- Update cost tests to reflect DC's child_max_age of 20 (not 19)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@daphnehanse11
Copy link
Collaborator Author

Fixes Applied

All issues from the review have been addressed:

🔴 Critical Issues Fixed

  1. Hard-coded age values → Now uses child_max_age parameter (=20) instead of hard-coded 19

    • dc_medicaid_cost_if_enrolled.py:28-31
  2. Array mutation bug → Fixed by using where() pattern instead of in-place assignment

    • dc_medicaid_cost_if_enrolled.py:113-121
  3. Broken reference URLs → Updated all 6 parameter files + 2 variable files

    • Changed dhcf.dc.gov/alliancedhcf.dc.gov/node/1796971
  4. Missing primary sources for 324% FPL → Added KFF references

    • child_income_limit.yaml - KFF children eligibility limits
    • pregnant_income_limit.yaml - KFF pregnant women eligibility limits

🟡 Should Address Fixed

  1. Test file naming → Renamed *_test.yaml*.yaml

    • dc_medicaid_age_eligible_test.yamldc_medicaid_age_eligible.yaml
    • dc_medicaid_eligible_test.yamldc_medicaid_eligible.yaml
  2. Boundary tests added (+14 tests):

    • Income: just below 215% FPL (2025), 216% (over), 138% (2026), 139% (over)
    • Income: 323% FPL child, 325% (over), 323% pregnant, 325% (over)
    • Age cliff: 20 at 220% FPL (child), 21 at 220% FPL (adult - ineligible)
    • Policy transition: 140% FPL eligible 2025, ineligible 2026
    • Age boundary: 26 new applicant (ineligible), 26 grandfathered (eligible), newborn
  3. Cost tests updated → Reflect DC's child_max_age=20

    • Age 19 now correctly returns child cost, not adult cost
    • Added age 21 test for adult cost

Test Results

All 66 tests pass for DC Medicaid.

Files Modified

Category Files
Parameters 6 files (references updated)
Variables 2 files (references + code fixes)
Tests 4 files (renamed + boundary tests added)

🤖 Generated with Claude Code

daphnehanse11 and others added 5 commits December 23, 2025 10:27
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts in:
- policyengine_us/variables/gov/hhs/medicaid/eligibility/is_medicaid_eligible.py
- uv.lock (regenerated)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Upgraded uv to match CI version, fixes revision mismatch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@@ -0,0 +1,16 @@
description: DC limits Medicaid/Alliance for adults (21+) to this percentage of the Federal Poverty Level
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
description: DC limits Medicaid/Alliance for adults (21+) to this percentage of the Federal Poverty Level
description: The District of Columbia limits Medicaid/Alliance for adults (21+) to this percentage of the Federal Poverty Level.

And other description in parameter files.

2021-01-01: false
DC:
2021-01-01: true
2021-01-01: false # DC now handles undocumented coverage through dc_medicaid_eligible
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a new rule starting in 2021-01? I am thinking may be we should put it as
20xx-01-01: true
2021-01-01: false

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

2021 is just when we start the parameters from, this false means that we use state specific logic. the real start dates are in the dc folder.

)


class dc_medicaid_cost_if_enrolled(Variable):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This variable is too long, consider file an issue to refactor the medicaid_cost_if_enrolled, then we can reuse the same logic without so many duplicates code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok

daphnehanse11 and others added 2 commits December 29, 2025 16:32
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

DC Medicaid program for immigrants over 21

3 participants