Skip to content

Commit

Permalink
Merge in new PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
finpaul committed Nov 14, 2023
2 parents 4a55560 + 8d3baf3 commit ad6d65d
Show file tree
Hide file tree
Showing 31 changed files with 333 additions and 294 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10"]
python-version: ["3.10", "3.11"]

steps:
- name: Checkout
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Updates Montana tax logic.
## [0.2.5] - 2023-10-24 22:00:00

### Added

- Updated environment.yml and build_and_test.yml to allow for python 3.11
- Updated Virginia tax logic with correct mapping from federal filing status to state filing status.

## [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

Expand Down Expand Up @@ -178,6 +191,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0


[0.2.6]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.5...v0.2.6
[0.2.5]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.4...v0.2.5
[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
12 changes: 12 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,18 @@
- 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
- bump: patch
changes:
added:
- Updated environment.yml and build_and_test.yml to allow for python 3.11
- Updated Virginia tax logic with correct mapping from federal filing status to state filing status.
date: 2023-10-24 22:00:00
- bump: patch
changes:
added:
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: fiscalsim-us-dev
dependencies:
- python=3.10
- python>=3.10,<3.12
- pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
- name: LA subtractions from income
period: 2021
absolute_error_margin: 0
input:
filing_status: SINGLE
adjusted_gross_income: 100_000
us_govt_interest: 1_000
tax_unit_taxable_social_security: 1_000
la_state_employee_retirement_benefits: 1_000
la_state_teacher_retirement_benefits: 1_000
la_federal_retirement_benefits: 1_000
la_other_subtractions: 1_000
la_exemptions: 0
state_code: LA
output:
la_taxable_income: 94_000
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
7 changes: 4 additions & 3 deletions fiscalsim_us/variables/gov/states/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ If you do not write tests for new variables created, the code coverage tests wil

## Higher level variables to which you need to add (connect) your state variables
* [`state_income_tax`](https://github.com/TheCGO/fiscalsim-us/blob/main/fiscalsim_us/variables/gov/states/tax/income/state_income_tax.py): You need to add your state's `[2-letter-state-abbrev]_income_tax` variable to the list in the `adds` command.
* [`state_income_tax_before_refundable_credits`](https://github.com/TheCGO/fiscalsim-us/blob/main/fiscalsim_us/variables/gov/states/tax/income/state_income_tax_before_refundable_credits.py): You need to add your state's `[2-letter-state-abbrev]_income_tax_before_refundable_credits` variable to the list in the `adds` command.
* [`household_refundable_tax_credits`](https://github.com/TheCGO/fiscalsim-us/blob/main/fiscalsim_us/variables/household/income/household/household_refundable_tax_credits.py): You need to add your state's `[2-letter-state-abbrev]_refundable_credits` variable to the list in the `adds` command.
* [`household_tax_before_refundable_credits`](https://github.com/TheCGO/fiscalsim-us/blob/main/fiscalsim_us/variables/household/income/household/household_tax_before_refundable_credits.py): You need to add your state's `[2-letter-state-abbrev]_income_tax_before_refundable_credits` variable to the list in the `adds` command.
* [`state_income_tax_before_refundable_credits.py`](https://github.com/TheCGO/fiscalsim-us/blob/main/fiscalsim_us/variables/gov/states/tax/income/state_income_tax_before_refundable_credits.py): You need to add your state's `[2-letter-state-abbrev]_income_tax_before_refundable_credits` variable to the list in the `adds` command.
* [`household_refundable_tax_credits.py`](https://github.com/TheCGO/fiscalsim-us/blob/main/fiscalsim_us/variables/household/income/household/household_refundable_tax_credits.py): You need to add your state's `[2-letter-state-abbrev]_refundable_credits` variable to the list in the `adds` command.
* [`household_state_income_tax.py`](https://github.com/TheCGO/fiscalsim-us/blob/main/fiscalsim_us/variables/household/income/household/household_state_income_tax.py): You need to add your state's `[2-letter-state-abbrev]_income_tax_before_refundable_credits` variable to the list in the `adds` command and your state's `[2-letter-state-abbrev]_refundable_credits` variable to the list in the `subtracts` command.
* [`household_tax_before_refundable_credits.py`](https://github.com/TheCGO/fiscalsim-us/blob/main/fiscalsim_us/variables/household/income/household/household_tax_before_refundable_credits.py): You need to add your state's `[2-letter-state-abbrev]_income_tax_before_refundable_credits` variable to the list in the `adds` command.
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 All @@ -35,8 +35,9 @@ class state_income_tax(Variable):
"or_income_tax",
"pa_income_tax",
"ri_income_tax",
# "va_income_tax", --- temporarily deactivated until change if to where
"ut_income_tax",
"va_income_tax",
"vt_income_tax",
"wa_income_tax",
"wi_income_tax",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ class state_income_tax_before_refundable_credits(Variable):
unit = USD
definition_period = YEAR
adds = [
"ca_income_tax_before_refundable_credits",
"co_income_tax_before_refundable_credits",
"dc_income_tax_before_refundable_credits",
"ia_income_tax_before_refundable_credits",
"il_total_tax",
"in_income_tax_before_refundable_credits",
"ks_income_tax_before_refundable_credits",
"ky_income_tax_before_refundable_credits",
"la_income_tax_before_refundable_credits",
"ma_income_tax_before_refundable_credits",
"md_income_tax_before_refundable_credits",
"me_income_tax_before_refundable_credits",
"mn_income_tax_before_refundable_credits",
"mt_income_tax_before_refundable_credits",
"mo_income_tax_before_refundable_credits",
"nc_income_tax", # NC has no refundable credits.
"nd_income_tax_before_refundable_credits",
Expand All @@ -27,8 +30,10 @@ class state_income_tax_before_refundable_credits(Variable):
"nj_income_tax_before_refundable_credits",
"nm_income_tax_before_refundable_credits",
"ny_income_tax_before_refundable_credits",
"ok_income_tax_before_refundable_credits",
"or_income_tax_before_refundable_credits",
"pa_income_tax", # PA has no refundable credits.
"ri_income_tax_before_refundable_credits",
"ut_income_tax_before_refundable_credits",
"va_income_tax_before_refundable_credits",
"vt_income_tax_before_refundable_credits",
Expand Down
36 changes: 0 additions & 36 deletions fiscalsim_us/variables/gov/states/va/tax/income/calc_line_14.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ class va_additions_to_federal_agi(Variable):

def formula(tax_unit, period, parameters):
income_from_obligations_fed_exempt = tax_unit(
"income_from_obligations_fed_exempt", period
"va_income_from_obligations_fed_exempt", period
)

fixed_date_conformity_additions = tax_unit(
"fixed_date_conformity_additions", period
"va_fixed_date_conformity_additions", period
)

additions_to_fed_agi = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ class va_adj_gross_income(Variable):

def formula(tax_unit, period, parameters):
line3 = tax_unit("va_calc_line_3", period)

line8 = tax_unit("va_calc_line_8", period)

filing_status = tax_unit("filing_status", period)
filing_statuses = filing_status.possible_values

threshold = parameters(
period
Expand All @@ -24,18 +23,17 @@ def formula(tax_unit, period, parameters):

subtotal = line3 - line8

if filing_status == 1 or filing_status == 3:
if subtotal < single:
tax_owed = 0

return tax_owed

if filing_status == 2:
if subtotal < joint:
tax_owed = 0

return tax_owed

va_adj_gross_income = subtotal

return va_adj_gross_income
tax_owed = where(
(filing_status == filing_statuses.SINGLE)
| (filing_status == filing_statuses.SEPARATE)
| (filing_status == filing_statuses.HEAD_OF_HOUSEHOLD)
| (filing_status == filing_statuses.WIDOW),
where(subtotal < single, 0, subtotal),
where(
filing_status == filing_statuses.JOINT,
where(subtotal < joint, 0, subtotal),
subtotal,
),
)

return tax_owed
Loading

0 comments on commit ad6d65d

Please sign in to comment.