Skip to content

Add tax_unit_itemizes constraint for itemized deduction targets#639

Open
baogorek wants to merge 1 commit intomainfrom
fix/itemizer-stratum-constraint
Open

Add tax_unit_itemizes constraint for itemized deduction targets#639
baogorek wants to merge 1 commit intomainfrom
fix/itemizer-stratum-constraint

Conversation

@baogorek
Copy link
Collaborator

Summary

  • SOI targets (etl_irs_soi.py): For salt, real_estate_taxes, and medical_expense_deduction, append a tax_unit_itemizes == 1 stratum constraint alongside the existing variable > 0 constraint. SOI only reports these for the ~10% who itemize, but > 0 alone captures ~80-90% of filers with any economic exposure, causing massive overestimates (e.g. 11.3x SALT blowup).
  • JCT targets (etl_national_targets.py): Move salt_deduction, medical_expense_deduction, charitable_deduction, and interest_deduction into a new "United States - Itemizing Tax Filers" stratum with both tax_unit_is_filer == 1 and tax_unit_itemizes == 1 constraints. qualified_business_income_deduction stays in the plain filer stratum (above-the-line, not Schedule A).

Test plan

  • Run etl_irs_soi.py and verify new strata have tax_unit_itemizes == 1 constraint for salt, real_estate_taxes, medical_expense_deduction
  • Run etl_national_targets.py and verify "United States - Itemizing Tax Filers" stratum is created with correct constraints
  • Query database to confirm non-itemized-deduction targets are unchanged (no tax_unit_itemizes constraint)
  • Verify QBI deduction target remains in plain filer stratum

🤖 Generated with Claude Code

SOI targets for SALT, real estate taxes, and medical expense deduction
are reported only for the ~10% of filers who itemize, but the existing
`variable > 0` constraint captures everyone with economic exposure
(~80-90% of filers). This mismatch causes massive count and dollar
overestimates. Adding `tax_unit_itemizes == 1` fixes the population
alignment.

Changes:
- etl_irs_soi.py: For salt, real_estate_taxes, and
  medical_expense_deduction, append a `tax_unit_itemizes == 1`
  constraint to child strata in the generic target loop.
- etl_national_targets.py: Split JCT itemized deduction targets
  (salt_deduction, medical_expense_deduction, charitable_deduction,
  interest_deduction) into a separate itemizer_targets list loaded
  into a new "United States - Itemizing Tax Filers" stratum with
  both filer and itemizer constraints. QBI deduction remains in the
  plain filer stratum (above-the-line).

Co-Authored-By: Claude Opus 4.6 (1M context) <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.

1 participant