Skip to content

Commit

Permalink
Montana itemized deduction (PolicyEngine#3265)
Browse files Browse the repository at this point in the history
* Montana Itemized Deduction
Fixes PolicyEngine#2432

* added legislation

* legislation

* Fixed mt_itemized_deduction

* created miscellaneous deduction umbrella

* rename files, adding file

* specify legal code section
Co-authored-by: Pinyan <[email protected]>

* fix references

* minor change

* make format

* rename files and variable names

* changelog_entry fix

* add
"mt_child_dependent_care_expense_deduction"
as a source of miscellaneous deductions

* fix the test file,
mt_child_dependent_care_expense_deduction is not merged yet

* add a palceholder file
Fixes PolicyEngine#3068

* replace reference link
Fixes PolicyEngine#3169

* make format

* add mt_medical_expense_deduction
Fixes PolicyEngine#3068

* add mt_salt_deduction, adjust code

Co-authored-by: Pavel Makarchuk <[email protected]>

* Update policyengine_us/variables/gov/states/mt/tax/income/deductions/itemized/mt_salt_deduction.py

---------

Co-authored-by: Yinan0409 <[email protected]>
Co-authored-by: Pavel Makarchuk <[email protected]>
Co-authored-by: Max Ghenis <[email protected]>
  • Loading branch information
4 people authored Nov 30, 2023
1 parent 93548f1 commit 7753cd7
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: minor
changes:
added:
- Montana itemized deductions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
description: Montana counts these sources as miscellaneous deductions.
values:
2021-01-01:
- mt_child_dependent_care_expense_deduction
- casualty_loss_deduction


metadata:
unit: list
label: Montana miscellaneous deductions
period: year
reference:
- title: Montana Individual Income Tax Return (Form 2) 2022
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 Individual Income Tax Return (Form 2) 2021
href: https://mtrevenue.gov/wp-content/uploads/mdocs/form%202%202021.pdf#page=7
- title: Montana Tax From Instructions 2021
href: https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2022/12/Form-2-2022-Instructions.pdf#page=32
- title: MT Code § 15-30-2131 (2022) (1)(a)&(c)
href: https://law.justia.com/codes/montana/2022/title-15/chapter-30/part-21/section-15-30-2131/
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
- name: Test case 1 # filing separate
period: 2021
input:
filing_status: SEPARATE
charitable_deduction: 800
interest_deduction: 265
mt_salt_deduction: 5_000
mt_medical_expense_deduction: 1_000
casualty_loss_deduction: 400
mt_child_dependent_care_expense_deduction: 123
state_code: MT
output:
mt_itemized_deductions: 7_588

- name: Test case 2 #salt has a cap of 10000 for single, head of household and joint
period: 2022
input:
filing_status: HEAD_OF_HOUSEHOLD
charitable_deduction: 0
interest_deduction: 1_234
mt_salt_deduction: 10_000
mt_medical_expense_deduction: 3_000
casualty_loss_deduction: 0
mt_child_dependent_care_expense_deduction: 0
state_code: MT
output:
mt_itemized_deductions: 14_234

- name: Test case 3 #sum all terms
period: 2021
input:
filing_status: SINGLE
charitable_deduction: 1_000
interest_deduction: 34
mt_salt_deduction: 1_035
mt_medical_expense_deduction: 3_000
casualty_loss_deduction: 745
mt_child_dependent_care_expense_deduction: 1_004
state_code: MT
output:
mt_itemized_deductions: 6_818
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
- name: Test case 1, medical_expense higher than 0.075 of agi.
period: 2021
input:
medical_expense: 1_000
mt_agi: 10_000
state_code: MT
output:
mt_medical_expense_deduction: 250

- name: Test case 21, medical_expense less than 0.075 of agi.
period: 2021
input:
medical_expense: 1_000
mt_agi: 20_000
state_code: MT
output:
mt_medical_expense_deduction: 0

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
- name: Test case 1, filing separate, higher than cap
period: 2021
input:
filing_status: SEPARATE
real_estate_taxes: 6_000
state_code: MT
output:
mt_salt_deduction: 5_000

- name: Test case 2, filing single, less than cap
period: 2021
input:
filing_status: SINGLE
real_estate_taxes: 3_000
state_code: MT
output:
mt_salt_deduction: 3_000


- name: Test case 3, filing jointly, lower than cap
period: 2021
input:
filing_status: JOINT
real_estate_taxes: 6_000
state_code: MT
output:
mt_salt_deduction: 6_000

- name: Test case 4, filing jointly, higher than cap
period: 2021
input:
filing_status: JOINT
real_estate_taxes: 11_000
state_code: MT
output:
mt_salt_deduction: 10_000

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from policyengine_us.model_api import *


class mt_child_dependent_care_expense_deduction(Variable):
value_type = float
entity = TaxUnit
label = "Montana child dependent care expense deduction"
unit = USD
definition_period = YEAR
defined_for = StateCode.MT
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from policyengine_us.model_api import *


class mt_itemized_deductions(Variable):
value_type = float
entity = TaxUnit
label = "Montana itemized deductions"
unit = USD
definition_period = YEAR
reference = (
"https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf#page=7"
"https://law.justia.com/codes/montana/2022/title-15/chapter-30/part-21/section-15-30-2131/"
# MT Code § 15-30-2131 (2022) (1)
)
defined_for = StateCode.MT

def formula(tax_unit, period, parameters):
p = parameters(period).gov.irs.deductions
itm_deds = [
deduction
for deduction in p.itemized_deductions
if deduction
not in [
"salt_deduction",
"casualty_loss_deduction",
"medical_expense_deduction",
]
]
return add(
tax_unit,
period,
itm_deds
+ [
"mt_misc_deductions",
"mt_medical_expense_deduction",
"mt_salt_deduction",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from policyengine_us.model_api import *


class mt_medical_expense_deduction(Variable):
value_type = float
entity = TaxUnit
definition_period = YEAR
label = "Montana medical expense deduction"
reference = (
"https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf#page=7",
"https://law.justia.com/codes/montana/2022/title-15/chapter-30/part-21/section-15-30-2131/"
# MT Code § 15-30-2131 (2022) (1)(g)(i)
)
unit = USD
defined_for = StateCode.MT

def formula(tax_unit, period, parameters):
expense = add(tax_unit, period, ["medical_expense"])
medical = parameters(period).gov.irs.deductions.itemized.medical
# Law does not define Montana AGI as the cap.
# Tax form points to page 1, line 14, which is Montana AGI.
medical_floor = medical.floor * tax_unit("mt_agi", period)
return max_(0, expense - medical_floor)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from policyengine_us.model_api import *


class mt_misc_deductions(Variable):
value_type = float
entity = TaxUnit
label = "Montana miscellaneous deductions"
unit = USD
definition_period = YEAR
reference = (
"https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf#page=7"
"https://law.justia.com/codes/montana/2022/title-15/chapter-30/part-21/section-15-30-2131/"
# Montana Code Annotated MT Code § 15-30-2131 (2022) (1)(a)&(c)
)
defined_for = StateCode.MT

adds = "gov.states.mt.tax.income.deductions.itemized.misc_deductions"
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from policyengine_us.model_api import *


class mt_salt_deduction(Variable):
value_type = float
entity = TaxUnit
label = "Montana state and local tax deduction"
unit = USD
definition_period = YEAR
reference = (
"https://mtrevenue.gov/wp-content/uploads/dlm_uploads/2023/05/Montana-Idividiual-Income-Tax-Return-Form-2-2022v6.2.pdf#page=7"
"https://law.justia.com/codes/montana/2022/title-15/chapter-30/part-21/section-15-30-2131/"
# Montana Code Annotated MT Code § 15-30-2131 (2022) (1)(a)
)
defined_for = StateCode.MT

def formula(tax_unit, period, parameters):
p = parameters(period).gov.irs.deductions
filing_status = tax_unit("filing_status", period)
real_estate_tax = add(tax_unit, period, ["real_estate_taxes"])
return min_(
real_estate_tax,
p.itemized.salt_and_real_estate.cap[filing_status],
)

0 comments on commit 7753cd7

Please sign in to comment.