Skip to content

Count dependents' other medical expenses in Idaho's claimant medical worksheet - #10278

Draft
MaxGhenis wants to merge 3 commits into
fix-schedule-a-dependent-paid-premiumsfrom
id-worksheet-dependent-medical
Draft

MaxGhenis wants to merge 3 commits into
fix-schedule-a-dependent-paid-premiumsfrom
id-worksheet-dependent-medical

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Idaho's Form 39R claimant medical worksheet (id_health_insurance_premiums_medical_deduction, from #10023) summed other_medical_expenses over the head and spouse only. So every dependent's medical bills were left out of the premium overlap and, through id_itemized_deductions, out of Idaho itemized deductions, while the federal Schedule A subtotal counted them. This PR counts every member's other medical expenses in the worksheet. Premiums stay filer-only.

Stacked on #10270 (base branch fix-schedule-a-dependent-paid-premiums). #10270 sets the input contract this PR relies on and edits the same Idaho test files. Once #10270 lands, rebase onto main: git rebase --onto upstream/main <#10270's final head> (currently 2e5fccfd1f).

Law and input contract

What changes

  • id_health_insurance_premiums_medical_deduction: other_medical_expenses is summed over every member (tax_unit_non_dep_add(..., include_dependents=["other_medical_expenses"])). The documentation and comments now state the two attributions: premiums on the payer, other costs on the person cared for. Premiums still come from id_qualified_health_insurance_premiums, the head's and spouse's own payments.
  • id_itemized_deductions: one comment, which said the medical correction keeps "dependent-paid costs" out, now says what the correction does after this PR (below).

From derived inputs the worksheet now equals the federal medical_expense_deduction: both take the filers' premiums less the self-employed deduction, plus every member's other costs, less 7.5% of AGI. The worksheet and the federal deduction differ only when a caller supplies an Idaho amount (id_qualified_health_insurance_premiums or the worksheet itself) or an intermediate federal one (itemized_medical_expenses_excluded_premiums). So id_itemized_deductions' medical correction is zero from derived inputs.

Household before and after

Real model runs at b3c256be8d (#10270's head when this branch started; its later commit 2e5fccfd1f touches no Idaho or federal medical formula) and at this head, script and JSON in the review folder. In both, the parent pays the child's bills and Idaho itemizes.

2025: premiums 1,000; child's bills 6,000; AGI 60,000; interest 30,000 2026: premiums 40,000; child's bills 30,000; AGI 800,000; interest 30,000; single
before after before after
medical_expense_deduction 2,500 2,500 10,000 10,000
id_health_insurance_premiums_medical_deduction 0 2,500 0 10,000
id_itemized_deductions 30,000 32,500 28,378.38 37,837.84
id_health_insurance_premiums_subtraction 1,000 0 40,000 30,000
id_taxable_income 29,000 27,500 731,621.62 732,162.19
id_income_tax_before_refundable_credits 822.03 742.53 38,515.18 38,543.84

In 2026 Idaho tax rises $28.66. The child's 10,000 medical deduction now enters the itemized total, which IRC 68 (P.L. 119-21 sec. 70111) keeps at 35/37, and line 8 takes it in full off the premium subtraction. The combined reduction (itemized deductions plus subtraction) falls from 68,378.38 to 67,837.84, by 10,000 × 2/37 = 540.54. The model already treats the same bills this way when they sit on the parent's input. After this PR the two placements agree.

Invariants

These hold for every input; the property test checks 1-5 on generated returns.

  1. Differential. From derived inputs, id_health_insurance_premiums_medical_deduction = medical_expense_deduction = an independent oracle, max(0, max(0, filer premiums − self-employed deduction) + every member's other medical expenses − 7.5% × AGI). Form 39R line 6 is the Schedule A deduction.
  2. No-op correction. From derived inputs, id_itemized_deductions = itemized_taxable_income_deductions (with zero Idaho SALT), in 2025 and under the 2026 limitation.
  3. Relocation. Moving other medical expenses among the members of a tax unit (all onto the head, or all onto one dependent) changes none of: the worksheet, qualified premiums, Idaho itemized deductions, the itemization election, the premium subtraction, Idaho deductions. Setting every dependent's own premiums to 0 changes none of them either.
  4. Monotonicity. Raising a dependent's other medical expenses never lowers the worksheet.
  5. Bounds. 0 ≤ premium subtraction ≤ qualified premiums.

Intended non-invariant: Idaho taxable income is not monotone in medical expenses under the 2026 limitation (the witness above).

Tests

  • Fail before, pass after. Each new or rewritten case below fails on Count only filer-paid premiums in Schedule A medical expenses #10270's formula (at b3c256be8d) and passes here. The other 29 cases in the two files pass on both.
    • id_health_insurance_premiums_subtraction.yaml:
      • The case "Claimant medical overlap includes spouse expenses and excludes dependent expenses" is rewritten as "Claimant medical overlap counts bills for a dependent but not the dependent's own premiums". The dependent's other costs are 2,000 (was 4,000), so the expected subtraction is positive: 2,000. The old code gives 4,000.
      • New: "A bill a parent paid for a dependent's care enters the claimant worksheet" (subtraction 750, taxable income 9,250; old code 2,250 and 7,750).
    • id_itemized_deductions.yaml:
      • New: "A bill the parent paid counts the same on the parent's input or the child's", two tax units. The old code gives unit b a 0 worksheet, 20,000 of Idaho itemized deductions and 9,000 of taxable income; unit a gives 1,750, 21,750 and 8,250.
      • New: "A dependent's bills stay in the 2026 limited Idaho itemized total" (37,837.84; old code 28,378.38).
  • New property test. test_claimant_worksheet_counts_bills_paid_for_dependents is in tests/core/test_id_health_insurance_premiums.py (Hypothesis, derandomize=True, 8 examples). Each example runs one vectorized simulation for 2025 and one for 2026, covering invariants 1-5. It fails on the old formula and passes here. Over its 16 simulations, 14 have a positive medical deduction and 14 have dependents' bills, and 4 of the 8 for 2026 bind the IRC 68 limitation.
  • Deletion-provenance regression, repointed. Because the worksheet now equals the federal deduction from derived inputs, test_deleted_medical_input_recalculated_federal_first no longer separates a supplied from a recalculated federal medical deduction: both give the same Idaho amounts. Its dependent's other costs were the separator. The only remaining separator is a supplied Idaho premium amount below the Schedule A premiums, and on that input the derived worksheet departs from Form 39R line 6 (see known gaps), so a test built on it would assert a value the form contradicts.
    • The test is renamed test_deleted_itemized_input_recalculated_federal_first. It now covers the same Core defect on id_itemized_deductions, where a supplied federal itemized total is used as given and a derived one has its medical component replaced by an explicit Idaho claimant deduction. Recalculated federal total: 21,250; Idaho: 20,250.
    • A mutation that keeps the deleted input key, as Core < 3.32.27 does, makes it fail at the Idaho assertion (21,250).
    • The xfail(Core < 3.32.27) marker is kept, but the dependency floor is now >=3.32.27, so the test runs as a plain regression on every supported install.
  • Runs (local, policyengine-core 3.32.27, one process at a time):
    • The two edited YAML files: 33 passed at this head. On the old formula, the 4 cases above fail and 29 pass.
    • id_deductions.yaml, id_income_tax_before_refundable_credits.yaml (PolicyBench cells 007 and 053 unchanged), integration.yaml and id_taxable_income.yaml: 22 passed.
    • tests/core/test_id_health_insurance_premiums.py: 4 passed. On the old formula the property test fails.
  • Outside states/id/, no YAML file names an Idaho income tax variable or has an Idaho household with other medical expenses, and no partner contract test has an Idaho household with medical bills.
  • Cost (local macOS, isolated process, not CI). The file goes from 17.9 s wall / 1.09 GB peak footprint to 17.7 s / 1.17 GB. Over the file's other three tests, the property test adds about 2.5 s and 36 MB. It supplies the standard deduction and taxable income before itemized deductions, which don't depend on medical expenses. With both derived, it added 273 MB. The file is in the Rest Python core group (13.3 GB RSS in CI run 38141803955).

Known gaps (not changed here)

  • Form 39R line 6 with supplied Idaho premiums. When a caller supplies id_qualified_health_insurance_premiums below the Schedule A premiums, the derived worksheet is min(federal deduction, Idaho premiums + other costs − floor). Form 39R line 6 is the federal Schedule A deduction itself. This predates this PR (Fix Idaho health insurance premium subtraction #10023), and nothing in the repo supplies that input. Reading line 6 straight from medical_expense_deduction would fix it. Idaho's provenance checks and the itemized medical correction would then serve only an explicit Idaho override. Proposed as a follow-up.
  • Montana's separate-filing deduction (mt_medical_expense_deduction_indiv) has the same dependent gap. Another session is fixing it.

Impact

The US + core hub runs the microsimulation impact. Local runs are paused for disk.

axiom: us-id/statute/63-3022P TheAxiomFoundation/rulespec-us#1625 queued (extended: worksheet line 3 counts bills the claimant paid for dependents, with companion cases from the 2025 Form 39R and Schedule A instructions)

🤖 Generated with Claude Code

MaxGhenis and others added 3 commits October 19, 2026 10:44
Form 39R worksheet lines 3-6 take the medical expenses claimed on federal
Schedule A, and Schedule A line 1 counts bills the filers paid for their
dependents. other_medical_expenses sits on the person cared for (the CPS
ASEC asks each person's own care, paid by anyone in the household), so a
dependent's amount is the filers' payment. The worksheet summed it over the
head and spouse only, which dropped every dependent's bills from the premium
overlap and from Idaho itemized deductions. Premiums stay filer-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From derived inputs Idaho's claimant worksheet now equals the federal medical
deduction, so a deleted federal medical input changes no Idaho amount; the
only separator, a supplied Idaho premium amount below the Schedule A premiums,
is a case where the derived worksheet departs from Form 39R line 6. Test the
same provenance defect where it still shows: a derived federal itemized total,
whose medical component Idaho replaces with an explicit claimant deduction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The standard deduction and taxable income before itemized deductions do not
depend on medical expenses; deriving them pulled most of the federal tax graph
into the core test group. Supplying them cuts the property test's added peak
footprint from about 273 MB to about 36 MB locally, with the 2026 itemized
limitation still binding in half of its 2026 simulations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis force-pushed the id-worksheet-dependent-medical branch from fcdf73c to 14c9854 Compare October 19, 2026 14:44

This branch has not been deployed

No deployments
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.

1 participant