-
Notifications
You must be signed in to change notification settings - Fork 201
Description
Summary
The current az_agi variable incorrectly subtracts Arizona exemptions (aged, blind, etc.) as part of AGI. Per Arizona Form 140 and tax statutes, exemptions are subtracted after AGI is calculated, not as part of AGI itself.
This causes issues for any calculation that uses az_agi expecting it to be true Arizona AGI.
Current Implementation
File: policyengine_us/variables/gov/states/az/tax/income/az_agi.py
def formula(tax_unit, period, parameters):
adjusted_gross_income = tax_unit("adjusted_gross_income", period)
additions = tax_unit("az_additions", period)
subtractions = tax_unit("az_subtractions", period)
exemptions = tax_unit("az_exemptions", period) # <-- WRONG
return max_(
0, adjusted_gross_income + additions - subtractions - exemptions # <-- WRONG
)What Arizona Form 140 Shows
| Line | Description | Formula |
|---|---|---|
| 12 | Federal AGI | - |
| 13-36 | Additions and Subtractions | - |
| 37 | Arizona AGI | Fed AGI + additions - subtractions |
| 38-42 | Exemptions | - |
| 43 | AZ AGI minus exemptions | Line 37 - exemptions |
| 44 | Deductions | - |
| 45 | Taxable Income | Line 43 - deductions |
Impact
1. Family Tax Credit (ARS 43-1073)
The statute says eligibility is based on:
"Arizona adjusted gross income, plus the amount subtracted for exemptions"
This means the Family Tax Credit should use true Arizona AGI (before exemptions). But currently it uses az_agi which already has exemptions subtracted, resulting in incorrect eligibility calculations.
File: policyengine_us/variables/gov/states/az/tax/income/credits/family_tax_credit/az_family_tax_credit_eligible.py
2. Any other variable using az_agi
Any variable expecting true Arizona AGI will get the wrong value.
Suggested Fix
Option 1: Rename and create new variable (Recommended)
- Rename
az_agitoaz_agi_less_exemptions(or similar) - Create new
az_agithat equalsFed AGI + additions - subtractions(no exemptions) - Update
az_taxable_incometo useaz_agi_less_exemptions - Update
az_family_tax_credit_eligibleto use the new trueaz_agi
Option 2: Fix in place
- Remove exemptions from
az_agicalculation - Create
az_agi_less_exemptionsfor use inaz_taxable_income - Update downstream variables accordingly
Files to Modify
policyengine_us/variables/gov/states/az/tax/income/az_agi.pypolicyengine_us/variables/gov/states/az/tax/income/az_taxable_income.pypolicyengine_us/variables/gov/states/az/tax/income/credits/family_tax_credit/az_family_tax_credit_eligible.py- Tests in
policyengine_us/tests/policy/baseline/gov/states/az/tax/income/
References
- Arizona Form 140 Instructions
- ARS 43-1073 - Family Income Tax Credit
- Related PR: Fix AZ property tax credit income definition (exclude exemptions) #6957 (Property Tax Credit fix)
Instructions for Bot
To fix this issue:
-
Create a new variable
az_agi_less_exemptionsthat equalsaz_agi - az_exemptions(using the corrected az_agi) -
Update
az_agi.pyto NOT subtract exemptions:return max_(0, adjusted_gross_income + additions - subtractions)
-
Update
az_taxable_income.pyto use the new flow:az_agi = tax_unit("az_agi", period) exemptions = tax_unit("az_exemptions", period) deductions = tax_unit("az_deductions", period) return max_(0, az_agi - exemptions - deductions)
-
Update
az_family_tax_credit_eligible.py- it should now work correctly with the fixedaz_agi -
Update tests in
az_agi.yamlto reflect the new calculation (without exemptions) -
Run all Arizona tests to ensure nothing breaks:
policyengine-core test policyengine_us/tests/policy/baseline/gov/states/az/ -c policyengine_us -
Add changelog entry describing the fix