Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed circularity issues for CO and MO #67

Merged
merged 12 commits into from
Oct 24, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
absolute_error_margin: 0
input:
filing_status: SINGLE
state_income_tax: 0
prior_year_state_income_tax_paid: 0
state_code: MO
output:
mo_net_state_income_taxes: 0.0
Expand All @@ -13,7 +13,7 @@
absolute_error_margin: 0.01
input:
filing_status: SINGLE
state_income_tax: 23_000
prior_year_state_income_tax_paid: 23_000
state_code: MO
output:
mo_net_state_income_taxes: 10_000
Expand All @@ -24,7 +24,7 @@
input:
filing_status: SINGLE
real_estate_taxes: 4_000
state_income_tax: 3_000
prior_year_state_income_tax_paid: 3_000
state_code: MO
output:
mo_net_state_income_taxes: 3_000
Expand All @@ -35,7 +35,7 @@
input:
filing_status: JOINT
real_estate_taxes: 4_000
state_income_tax: 8_000
prior_year_state_income_tax_paid: 8_000
state_code: MO
output:
mo_net_state_income_taxes: 6_666.67 # = 10_000 * 2/3
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,27 @@ class co_state_addback(Variable):
unit = USD
definition_period = YEAR
reference = (
"https://tax.colorado.gov/sites/tax/files/documents/DR_104_Book_2021.pdf#page=5"
"https://tax.colorado.gov/sites/tax/files/documents/DR_104_Book_2022.pdf#page=5"
"https://tax.colorado.gov/sites/tax/files/documents/DR_104_Book_2021.pdf#page=5",
"https://tax.colorado.gov/sites/tax/files/documents/DR_104_Book_2022.pdf#page=5",
"https://tax.colorado.gov/sites/tax/files/documents/ITT_State_Income_Tax_Addback_Jan_2023.pdf",
)
defined_for = StateCode.CO

def formula(tax_unit, period, parameters):
federal_itemizer = tax_unit("tax_unit_itemizes", period)
state_inctax = max_(0, tax_unit("state_income_tax", period))
property_taxes = add(tax_unit, period, ["real_estate_taxes"])
# follow worksheet on page 5 of 2021 Book cited above:
irs_schA_line_5d = state_inctax + property_taxes
irs_schA_line_5e = tax_unit("salt_deduction", period)
ws_line_a = where(
irs_schA_line_5d > irs_schA_line_5e,
max_(0, irs_schA_line_5e - property_taxes),
state_inctax,

salt_deduct = tax_unit("salt_deduction", period)
local_taxes = add(
tax_unit, period, ["prior_year_local_income_tax_paid"]
)
property_taxes = add(tax_unit, period, ["real_estate_taxes"])
state_addback = max_(0, salt_deduct - local_taxes - property_taxes)

# return the max between the "extra" itemized deductions above the std
# and the state taxes included in the SALT deduction
p = parameters(period).gov.irs.deductions
ws_line_b = add(tax_unit, period, p.itemized_deductions)
ws_line_c = tax_unit("standard_deduction", period)
ws_line_d = max_(0, ws_line_b - ws_line_c)
return federal_itemizer * min_(ws_line_a, ws_line_d)
item_deducts = add(tax_unit, period, p.itemized_deductions)
std_deducts = tax_unit("standard_deduction", period)
alt_addback = max_(0, item_deducts - std_deducts)

return federal_itemizer * min_(state_addback, alt_addback)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def formula(tax_unit, period, parameters):
p = parameters(period).gov.irs.deductions.itemized
salt_cap = p.salt_and_real_estate.cap[filing_status]

uncapped_itax = max_(0, add(tax_unit, period, ["state_income_tax"]))
uncapped_itax = max_(
0, add(tax_unit, period, ["prior_year_state_income_tax_paid"])
)
uncapped_ptax = add(tax_unit, period, ["real_estate_taxes"])
uncapped_salt = uncapped_itax + uncapped_ptax

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class state_income_tax(Variable):
adds = [
# state income tax variables listed in alphabetical order:
"ca_income_tax",
# "co_income_tax", --- activating will cause circular logic errors
"co_income_tax",
"dc_income_tax",
"ia_income_tax",
"il_income_tax",
Expand All @@ -23,7 +23,7 @@ class state_income_tax(Variable):
"me_income_tax",
"mn_income_tax",
"mt_income_tax",
# "mo_income_tax", --- activating will cause circular logic errors
"mo_income_tax",
"nc_income_tax",
"nd_income_tax",
"ne_income_tax",
Expand Down
Loading