Restore medical_out_of_pocket_expenses as deprecated alias#8236
Closed
hua7450 wants to merge 1 commit into
Closed
Conversation
PR PolicyEngine#8178 (1.673.0) removed the umbrella `medical_out_of_pocket_expenses` variable in favor of program-specific aggregates. Existing API partners who pass the legacy variable as input now hit `VariableNotFoundError` without warning. Re-add the variable as a Person input that forwards into `other_medical_expenses` via `adds`. PolicyEngine input-override semantics keep already-migrated callers (who pass `other_medical_expenses` or the new premium inputs directly) on the new path. The label and documentation mark the variable deprecated; partners with premium spend folded into the legacy value should migrate to `health_insurance_premiums` to retain correct downstream behavior. This shim is a temporary migration aid and will be removed in a future release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8236 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 12 2 -10
Lines 173 17 -156
Branches 4 0 -4
==========================================
- Hits 173 17 -156
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #8178 (shipped in
policyengine-us1.673.0) removed the umbrellamedical_out_of_pocket_expensesPerson variable in favor of program-specific aggregates (itemized_medical_expenses,snap_allowable_medical_expenses,hud_medical_expenses,medicaid_medically_needy_medical_expenses,pa_ccw_medical_expenses) plus decomposed inputs (health_insurance_premiums,other_medical_expenses,over_the_counter_health_expenses,medicare_part_b_premium, ...).Household-API partners that still pass
medical_out_of_pocket_expensesas input now hitVariableNotFoundError(HTTP 500) without prior notice — see PolicyEngine/policyengine-household-api#1493 for the MyFriendBen fixture migration that surfaced this.This PR re-adds
medical_out_of_pocket_expensesas a deprecation alias that forwards intoother_medical_expenses, giving partners a window to migrate.Approach
medical_out_of_pocket_expenses(default 0). Label and documentation mark it deprecated.other_medical_expensesnow declaresadds = [\"medical_out_of_pocket_expenses\"]. PolicyEngine input-override semantics mean partners who already passother_medical_expenses(or the new premium inputs) directly are unaffected — direct input always wins overadds. Pattern matches existing variables that combineupratingandadds(e.g.employment_income,self_employment_income).Tradeoff
This is an alias to
other_medical_expensesonly — the non-premium catch-all. For partners whose legacymedical_out_of_pocket_expensesvalue previously included health insurance premiums, the shim silently routes those dollars into the non-premium path; they will need to migrate that portion tohealth_insurance_premiumsto retain correct downstream calculations. Of the three customer-input fixtures in policyengine-household-api (my_friend_ben,amplifi,impactica), only MyFriendBen passed the legacy variable, and they don't pass any premium inputs — so the simple alias is correct for them.Removal plan
The shim is a temporary migration aid. We should track its removal as a follow-up issue and pull it after partners have had at least one minor-version cycle to migrate.
Files
policyengine_us/variables/household/expense/health/medical_out_of_pocket_expenses.py(new)policyengine_us/variables/household/expense/health/other_medical_expenses.py(modified)policyengine_us/tests/policy/baseline/household/expense/health/medical_out_of_pocket_expenses.yaml(new)changelog.d/restore-medical-oop-expenses-alias.added.md(new)Test plan
other_medical_expensesother_medical_expensesinput overrides the alias🤖 Generated with Claude Code