Skip to content

Add modeled Medicaid variables#8535

Closed
hua7450 wants to merge 4 commits into
PolicyEngine:mainfrom
hua7450:codex/modeled-medicaid-cost
Closed

Add modeled Medicaid variables#8535
hua7450 wants to merge 4 commits into
PolicyEngine:mainfrom
hua7450:codex/modeled-medicaid-cost

Conversation

@hua7450
Copy link
Copy Markdown
Collaborator

@hua7450 hua7450 commented May 27, 2026

Summary

Adds parallel modeled Medicaid variables for API partner household calculations without changing the existing data-backed Medicaid cost path.

  • keeps medicaid_cost_if_enrolled and medicaid_cost as data-backed variables for datasets
  • adds modeled_medicaid_cost_if_enrolled using the pre-Make Medicaid cost if enrolled data-backed #8499 per-capita Medicaid formula
  • adds modeled_medicaid_cost gated by Medicaid enrollment
  • adds modeled_medicaid as the API partner-facing modeled Medicaid benefit amount, mirroring medicaid while using the modeled cost path
  • updates partner contract fixtures so partners request modeled_medicaid instead of sending medicaid_cost_if_enrolled
  • adds focused YAML tests and a changelog fragment

Root cause

PR #8499 made medicaid_cost_if_enrolled data-backed, which is correct for datasets but removed the formula-backed value API partner household calculations need when they do not provide a Medicaid cost input.

Partner contract

API partners should not send medicaid_cost_if_enrolled. When they want PolicyEngine to estimate Medicaid value for household calculations, they should request modeled_medicaid.

Validation

  • policyengine-core test policyengine_us/tests/policy/baseline/gov/hhs/medicaid/costs -c policyengine_us
  • policyengine-core test policyengine_us/tests/policy/baseline/partners/amplifi policyengine_us/tests/policy/baseline/partners/my_friend_ben policyengine_us/tests/policy/baseline/partners/impactica -c policyengine_us
  • Static scan confirms partner fixtures no longer contain medicaid_cost_if_enrolled, person-level medicaid, or modeled_medicaid_cost outputs.

Fixes #8533

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##              main     #8535    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            9         3     -6     
  Lines          149        32   -117     
==========================================
- Hits           149        32   -117     
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.

@hua7450 hua7450 changed the title [codex] Add modeled Medicaid cost variables [codex] Add modeled Medicaid variables May 28, 2026
@hua7450 hua7450 changed the title [codex] Add modeled Medicaid variables Add modeled Medicaid variables May 28, 2026
@hua7450 hua7450 marked this pull request as ready for review May 28, 2026 13:39
@hua7450 hua7450 requested a review from MaxGhenis May 28, 2026 13:40
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.

PolicyEngine Review: PR 8535

Recommendation: APPROVE

Findings

No findings.

Scope Reviewed

PR 8535 adds a parallel modeled Medicaid cost/value path for API partner household calculations:

  • modeled_medicaid_cost_if_enrolled
  • modeled_medicaid_cost
  • modeled_medicaid
  • focused Medicaid YAML tests
  • partner fixture updates from data-supplied medicaid/medicaid_cost_if_enrolled expectations to modeled_medicaid

This is an API/partner contract restoration, not a regulatory parameter update.

Validation

  • Compared the new modeled cost formula against the pre-data-backed medicaid_cost_if_enrolled implementation: it preserves the same per-capita helper path and Medicaid group handling under a new variable.
  • Reviewed PolicyEngine patterns for variable organization, aggregation, period handling, code style, references, and tests.
  • Confirmed partner fixtures no longer request/output person-level medicaid, medicaid_cost_if_enrolled, or modeled_medicaid_cost.
  • Confirmed current upstream/main has not changed the reviewed Medicaid or partner paths since the PR merge-base; the PR is mergeable despite being 52 commits behind.
  • GitHub CI is passing.

Local tests run in /private/tmp/policyengine-us-pr-8535-review with PYTHONPATH pinned to that temp checkout:

python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/hhs/medicaid/costs -c policyengine_us

Result: 26 passed, 1 warning.

python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/partners/amplifi policyengine_us/tests/policy/baseline/partners/my_friend_ben policyengine_us/tests/policy/baseline/partners/analytics_coverage -c policyengine_us

Result: 729 passed, 1 warning.

Notes

The warning in both local runs is a benign pytest plugin rewrite warning from the shared Python environment. No source files were edited.

@daphnehanse11 daphnehanse11 self-requested a review May 28, 2026 16:54
@hua7450 hua7450 closed this May 28, 2026
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 modeled Medicaid variable for API partner household calculations

2 participants