Skip to content

Add reported health coverage rule inputs#7821

Open
daphnehanse11 wants to merge 2 commits intomainfrom
codex/7816-health-coverage-rules
Open

Add reported health coverage rule inputs#7821
daphnehanse11 wants to merge 2 commits intomainfrom
codex/7816-health-coverage-rules

Conversation

@daphnehanse11
Copy link
Collaborator

Closes #7816

Summary

  • add person-level reported_*_health_coverage_at_interview input variables for the CPS current-coverage data imported in policyengine-us-data
  • default has_esi, has_marketplace_health_coverage, and receives_medicaid from the new reported current-coverage inputs so existing rules can consume the CPS signals without mutating them
  • add ACA-facing summary variables for qualifying non-Marketplace coverage and Marketplace/report-model conflicts, plus a Medicaid continuous-coverage regression test using reported Medicaid coverage

Testing

  • uv run policyengine-core test policyengine_us/tests/policy/baseline/gov/aca/eligibility/has_qualifying_non_marketplace_health_coverage_at_interview.yaml policyengine_us/tests/policy/baseline/gov/aca/eligibility/coverage_report_model_conflict.yaml policyengine_us/tests/policy/baseline/gov/hhs/medicaid/receives_medicaid.yaml policyengine_us/tests/policy/baseline/gov/hhs/medicaid/medicaid_enrolled.yaml -c policyengine_us
  • ./.venv/bin/python -m py_compile policyengine_us/variables/input/health_coverage.py policyengine_us/variables/gov/aca/eligibility/has_esi.py policyengine_us/variables/household/expense/health/has_marketplace_health_coverage.py policyengine_us/variables/gov/hhs/medicaid/receives_medicaid.py policyengine_us/variables/gov/aca/eligibility/has_qualifying_non_marketplace_health_coverage_at_interview.py policyengine_us/variables/gov/aca/eligibility/coverage_report_model_conflict.py

@baogorek
Copy link
Collaborator

Nice work — the mixin pattern keeps the input definitions clean, and the test coverage looks solid.

Two things worth double-checking before merge:

  1. has_marketplace_health_coverage default flips from True to False. Previously every person defaulted to having marketplace coverage, which fed into is_aca_ptc_eligible. Now it defaults to False (via the reported flag). That's more correct for microsim, but in the web app where users build individual households and don't set the reported flag, this could silently zero out ACA PTC for everyone. Worth confirming that pathway still works as expected.

  2. receives_medicaid was an explicit input variable (docstring says it "anchors takeup calibration"). Adding a formula that delegates to the reported flag changes it from a user-settable input to a derived value. Same question: does direct assignment still take priority over the formula in contexts that depend on it?

label = "Person has qualifying non-Marketplace health coverage at interview"
definition_period = YEAR

def formula(person, period, parameters):
Copy link
Contributor

Choose a reason for hiding this comment

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

use adds

Copy link
Contributor

Choose a reason for hiding this comment

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

one variable per file

from policyengine_us.model_api import *


class ReportedHealthCoverageAtInterview:
Copy link
Contributor

Choose a reason for hiding this comment

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

frame around reality not surveys. what insurance do they have at the moment?

label = "Reported public health coverage at interview"


class reported_is_insured_at_interview(ReportedHealthCoverageAtInterview, Variable):
Copy link
Contributor

Choose a reason for hiding this comment

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

this would be a formula right

label = "Reported Marketplace health coverage at interview"


class reported_has_subsidized_marketplace_health_coverage_at_interview(
Copy link
Contributor

Choose a reason for hiding this comment

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

isnt this a formula? marketplace + aca_ptc>0? but we should just remove it

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 98.55072% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.85%. Comparing base (19ec305) to head (fb98831).
⚠️ Report is 163 commits behind head on main.

Files with missing lines Patch % Lines
.../expense/health/has_marketplace_health_coverage.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main    #7821      +/-   ##
===========================================
- Coverage   100.00%   98.85%   -1.15%     
===========================================
  Files            3        6       +3     
  Lines           33       87      +54     
===========================================
+ Hits            33       86      +53     
- Misses           0        1       +1     
Flag Coverage Δ
unittests 98.85% <98.55%> (-1.15%) ⬇️

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.

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.

Add effective health coverage variables separate from reported CPS coverage

3 participants