Skip to content

Commit

Permalink
Merge pull request #67 from mitchellpound/circularity
Browse files Browse the repository at this point in the history
Merging
  • Loading branch information
rickecon authored Oct 24, 2023
2 parents 66c48e7 + 17e52bc commit fe6d7e4
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 23 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.4] - 2023-10-24 10:00:00

### Added

- Fixed circularity in CO tax logic
- Fixed circularity in MO tax logic

## [0.2.3] - 2023-10-13 16:00:00

### Added
Expand Down Expand Up @@ -171,6 +178,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First prototype version based off of openfisca-us and tax-calculator.


[0.2.4]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.3...v0.2.4
[0.2.3]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.2...v0.2.3
[0.2.2]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.0...v0.2.1
Expand Down
6 changes: 6 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,9 @@
- adjusted `salt_deduction.py` to calculate based on the added variables
- Adds three files `prior_year_state_income_tax_paid.py`, `prior_year_local_income_tax_paid.py`, and `sales_or_prior_year_state_and_local_income_tax.py`
date: 2023-10-13 16:00:00
- bump: patch
changes:
added:
- Fixed circularity in CO tax logic
- Fixed circularity in MO tax logic
date: 2023-10-24 10:00:00
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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name="fiscalsim-us",
version="0.2.3",
version="0.2.4",
author="Center for Growth and Opportunity at Utah State University (CGO)",
author_email="fiscalsim@thecgo.org",
long_description=readme,
Expand Down

0 comments on commit fe6d7e4

Please sign in to comment.