Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…to id
  • Loading branch information
sydneybeutler committed Nov 28, 2023
2 parents c37b14b + f5eadc6 commit d874aa0
Show file tree
Hide file tree
Showing 78 changed files with 976 additions and 302 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
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ 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.6] - 2023-11-14 17:00:00

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

### Added
Expand Down Expand Up @@ -171,6 +191,9 @@ 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.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
17 changes: 17 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,20 @@
- 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:
- Updates Montana tax logic
date: 2023-11-14 17:00:00
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,24 @@
description: Montana deductions from taxable income if itemizing (that are not available if not itemizing).
values:
2022-01-01:
- mt_medical_and_dental_expenses_deduction
- mt_medical_premiums_deduction
- mt_long_term_care_premiums_deduction
- mt_federal_income_tax_deduction
- mt_state_local_tax_deduction
- mt_light_vehicle_registration_deduction
- mt_per_capita_livestock_deduction
- mt_other_taxes_paid_deduction
- mt_home_mortage_interest_deduction
- mt_investment_interest_deduction
- mt_charitable_cash_deduction
- mt_charitable_noncash_deduction
- mt_charitable_carryover_deduction
- mt_child_care_expense_deduction
- mt_casualty_loss_deduction
- mt_political_contributions_deduction
- mt_gambling_loss_deduction
- mt_other_deduction
metadata:
unit: variable
label: montana itemized deductions
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description: Montana percentage of adjusted gross income that your medical and dental expenses are subject to.
values:
2022-01-01: 0.075
metadata:
unit: year
label: Montana itemized medical and dental rate
reference:
title: Montana Individual Tax Return Form 2 | Itemized Deductions Scedule | Line 1c
href: https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
description: Montana cap that the political contributions and limited by per taxpayer
values:
2022-01-01: 100
metadata:
unit: year
label: Montana political contributions cap
reference:
title: Montana Individual Tax Return Form 2 | Itemized Deductions Scedule | Line 16
href: https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
description: Maximum amount of state and local income, sales and real estate tax deductions allowed in montana.
metadata:
unit: currency-USD
period: year
name: mt_salt_cap
label: Montana SALT cap
HEAD_OF_HOUSEHOLD:
values:
2022-01-01: 10_000
JOINT:
values:
2022-01-01: 10_000
SEPARATE:
values:
2022-01-01: 5_000
SINGLE:
values:
2022-01-01: 10000
WIDOW:
values:
2022-01-01: 10000
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
description: Montana provides this maximum standard deduction amount, based on filing status.

metadata:
label: Montana standard deduction max amount
period: year
Expand All @@ -8,7 +9,7 @@ metadata:
reference:
- title: MT Code, Income Tax - Deductions, § 42-15-523 (2)
href: https://rules.mt.gov/gateway/RuleNo.asp?RN=42%2E15%2E523
- title: Montana Tax Form 2022 | Standard Deduction | Line 3
- title: This refers to line 3 of the standard deduction worksheet on Montana tax form 2. | Montana Tax Form 2022 | Standard Deduction | Line 3
href: https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf#page=7
- title: Montana Tax Form 2021 | Standard Deduction | Line 3
href: https://mtrevenue.gov/wp-content/uploads/mdocs/form%202%202021.pdf#page=7
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
description: Montana provides a minimum standard deduction of this amount, based on filing status.

metadata:
label: Montana minimum standard deduction
period: year
unit: currency-USD
breakdown:
- filing_status
reference:
- title: Increase each year with inflation (repealed effective January 1, 2024)
href: https://leg.mt.gov/bills/mca/title_0150/chapter_0300/part_0210/section_0320/0150-0300-0210-0320.html
- title: Title 15 Chapter 30 Individual Income Tax Part 21. Rate and General Provisions, Standard Deduction Rule 15-30-2132
href: https://leg.mt.gov/bills/mca/title_0150/chapter_0300/part_0210/section_0320/0150-0300-0210-0320.html
- title: MT Code, Income Tax - Deductions, § 42-15-523 (2)
href: https://rules.mt.gov/gateway/RuleNo.asp?RN=42%2E15%2E523
- title: Montana Tax Form 2022 | Standard Deduction | Line 5
- title: This refers to line 5 of the standard deduction worksheet on Montana tax form 2 | Montana Tax Form 2022 | Standard Deduction | Line 5
href: https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf#page=7
- title: Montana Tax Form 2021 | Standard Deduction | Line 5
href: https://mtrevenue.gov/wp-content/uploads/mdocs/form%202%202021.pdf#page=7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ values:
2022-01-01: 2_710
metadata:
reference:
- title: Defined in the law as $1900 beginning after December 31, 2004, indexed by inflation. (Repealed effective January 1, 2024)
href: https://leg.mt.gov/bills/mca/title_0150/chapter_0300/part_0210/section_0140/0150-0300-0210-0140.html
- title: "Montana Tax Form 2021 | Exemptions | Line 16"
href: https://mtrevenue.gov/wp-content/uploads/mdocs/form%202%202021.pdf#page=1
- title: "Montana Tax Form 2022 | Exemptions | Line 16"
Expand Down
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
@@ -0,0 +1,16 @@
from fiscalsim_us.model_api import *


class mt_additions_to_income(Variable):
"""
Line 12 on Montana 2022 Individual Income Tax return form 2. These
additions to income include the categories that are listed
in Montana Additions Schedule on page 4 of Montana 2022 Individual Income Tax return form 2
"""

value_type = float
entity = TaxUnit
label = "MT additions to income"
unit = USD
definition_period = YEAR
defined_for = StateCode.MT
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from fiscalsim_us.model_api import *


class mt_subtractions_to_income(Variable):
"""
Line 13 on Montana 2022 Individual Income Tax return form 2. These
subtractions to income include the categories that are listed
in Montana Subtractions Schedule on page 5 of Montana 2022 Individual Income Tax return form 2
"""

value_type = float
entity = TaxUnit
label = "MT subtractions to income"
unit = USD
definition_period = YEAR
defined_for = StateCode.MT
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from fiscalsim_us.model_api import *


class mt_nonrefundable_credits(Variable):
"""
Line 19 of Montana state individual tax return form 2
"""

value_type = float
entity = TaxUnit
label = "Montana refundable credits"
unit = USD
definition_period = YEAR
defined_for = StateCode.MT

adds = "gov.states.mt.tax.income.credits.non_refundable"
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@


class mt_refundable_credits(Variable):
"""
Line 22 on Montana individual tax return form 2
"""

value_type = float
entity = TaxUnit
label = "Montana refundable credits"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from fiscalsim_us.model_api import *


class mt_tax_after_nonrefundable_credits(Variable):
"""
Line 20 on Montana individual tax return form 2
"""

value_type = float
entity = TaxUnit
label = "Montana refundable credits"
unit = USD
definition_period = YEAR
defined_for = StateCode.MT

def formula(tax_unit, period, parameter):
nonrefundable = tax_unit("mt_nonrefundable_credits")
incometaxbeforecredits = tax_unit(
"mt_income_tax_before_refundable_credits"
)
return incometaxbeforecredits - nonrefundable
Loading

0 comments on commit d874aa0

Please sign in to comment.