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

South Carolina retirement deduction #2927

Merged
merged 33 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f87cc59
Merge branch 'PolicyEngine:master' into master
hua7450 Aug 10, 2023
3e891c2
South Carolina retirement deduction & military retirement deduction
hua7450 Aug 31, 2023
14f4c1c
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
hua7450 Aug 31, 2023
05cb8cb
South Carolina retirement deduction & military retirement deduction,m…
hua7450 Sep 4, 2023
536626e
update version
hua7450 Sep 4, 2023
67c5ae4
add sc_retirement_deduction_survivors.py,
hua7450 Sep 7, 2023
9919028
update version
hua7450 Sep 7, 2023
252f684
format
hua7450 Sep 9, 2023
ee0f9e2
update version
hua7450 Sep 9, 2023
bf7c1c6
add sc_military_deduction, fix code
hua7450 Sep 11, 2023
0d30319
minor fix on code
hua7450 Sep 11, 2023
90ad80b
code fixes on python and test files
hua7450 Sep 13, 2023
d143818
update version
hua7450 Sep 13, 2023
15e267e
fix code
hua7450 Sep 13, 2023
cb29ae0
Update changelog_entry.yaml
PavelMakarchuk Sep 18, 2023
f91a93d
add comment about law reference,
hua7450 Sep 18, 2023
670f702
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
hua7450 Sep 18, 2023
c8acca6
Merge branch 'hua7450/issue2926' of https://github.com/hua7450/policy…
hua7450 Sep 18, 2023
2fcc9fe
minor change
hua7450 Sep 19, 2023
0ab15e4
Merge branch 'master' of https://github.com/PolicyEngine/policyengine…
hua7450 Sep 19, 2023
0f75628
South Carolina retirement deduction & military retirement deduction
hua7450 Sep 20, 2023
e310124
rename folder, add comment in code
hua7450 Oct 11, 2023
a8c9d2b
update verison
hua7450 Oct 11, 2023
3b5c3f3
make format
hua7450 Oct 11, 2023
7f4eef0
update version
hua7450 Nov 5, 2023
f2c8bd5
fix code, unify parameter files into one cap.yaml
hua7450 Nov 7, 2023
1232058
update version
hua7450 Nov 7, 2023
553b046
fix code on __indv.py
hua7450 Nov 7, 2023
1a70d9e
make format
hua7450 Nov 7, 2023
66e2bf3
make the __survivors.py to person level,
hua7450 Nov 7, 2023
53bfc53
add test yaml for cap parameter
hua7450 Nov 7, 2023
e0035e1
fix the parameter problem
hua7450 Nov 8, 2023
e83a274
update version
hua7450 Nov 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- bump: minor
changes:
added:
- South Carolina retirement deduction.
- South Carolina military retirement deduction.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
description: South Carolina caps the retirement deduction at this amount, based on age.

metadata:
threshold_unit: year
amount_unit: currency_USD
type: single_amount
reference:
- title: South Carolina State SECTION 12-6-1170(B)
href: https://www.scstatehouse.gov/code/t12c006.php
- title: South Carolina State SECTION 12-6-1170(A)(1)
href: https://www.scstatehouse.gov/code/t12c006.php
- title: South Carolina State SECTION 12-6-1170(A)(1)
href: https://www.scstatehouse.gov/code/t12c006.php
- title: Instructions for Form SC-1040 (line 3p)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=16
- title: SC-1040 2021
href: https://dor.sc.gov/forms-site/Forms/SC1040_2021.pdf#page=2
- title: SC-1040 2022
href: https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=2
period: year
label: South Carolina retirement deduction cap

brackets:
- threshold:
2021-01-01: 0
amount:
2021-01-01: 3_000
- threshold:
2021-01-01: 65
amount:
2021-01-01: 10_000
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
description: South Carolina subtracts the survivors retirement deduction from the military retirement deduction if this is true.
metadata:
unit: bool
label: South Carolina choice to subtract survivors retirement deduction from military retirement deduction
reference:
- title: Instructions for Form SC-1040 (line 3p)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=17
- title: Instructions for Form SC-1040 (line 3p)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2022.pdf#page=19
- title: SC-1040 2021
href: https://dor.sc.gov/forms-site/Forms/SC1040_2021.pdf#page=2
- title: SC-1040 2022
href: https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=2
# The law indicates the 2022 case. We model calculation of the survivors retirement deduction in 2021 based on the tax form,
# where the retirement deduction is subtracts from military retirement deduction.
- title: South Carolina State SECTION 12-6-1170(C)(1)
href: https://www.scstatehouse.gov/code/t12c006.php

values:
2021-01-01: true
2022-01-01: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- name: Case 1, indiviaul is head or spouse with military retirement pay of $4,000.
period: 2022
input:
military_retirement_pay: 4_000
is_tax_unit_head_or_spouse: true
state_code: SC
output:
sc_military_deduction_indv: 4_000

- name: Case 2, indiviaul is neither head nor spouse with military retirement pay of $5,000.
period: 2022
input:
military_retirement_pay: 5_000
is_tax_unit_head_or_spouse: false
state_code: SC
output:
sc_military_deduction_indv: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: Case 1, one deceased spouse
period: 2022
input:
military_retirement_pay_survivors: 11_000
state_code: SC
output:
sc_military_deduction_survivors: 11_000
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: Case 1, above age threshold.
period: 2022
input:
age: 70
state_code: SC
output:
sc_retirement_cap: 10_000

- name: Case 2, below age threshold.
period: 2022
input:
age: 64
state_code: SC
output:
sc_retirement_cap: 3_000

- name: Case 3, at age threshold.
period: 2022
input:
age: 65
state_code: SC
output:
sc_retirement_cap: 10_000
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
- name: Case 1, above age threshold, military retirement deduction higher than cap.
period: 2022
input:
taxable_pension_income: 1_000
military_retirement_pay: 11_000
age: 70
is_tax_unit_head_or_spouse: true
state_code: SC
output:
sc_retirement_deduction_indv: 0

- name: Case 2, below age threshold, military retirement deduction higher than cap.
period: 2022
input:
taxable_pension_income: 1_000
military_retirement_pay: 4_000
age: 64
is_tax_unit_head_or_spouse: true
state_code: SC
output:
sc_retirement_deduction_indv: 0

- name: Case 3, above age threshold, military retirement deduction lower than cap.
period: 2022
input:
taxable_pension_income: 7_000
military_retirement_pay: 6_000
age: 70
is_tax_unit_head_or_spouse: true
state_code: SC
output:
sc_retirement_deduction_indv: 4_000

- name: Case 4, below age threshold, military retirement deduction lower than cap.
period: 2022
input:
taxable_pension_income: 500
military_retirement_pay: 2_000
age: 64
is_tax_unit_head_or_spouse: true
state_code: SC
output:
sc_retirement_deduction_indv: 500
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
- name: Case 1, in 2022, above age threshold
period: 2022
input:
pension_survivors: 1_000
military_retirement_pay_survivors: 4_000
age: 70
state_code: SC
output:
sc_retirement_deduction_survivors: 1_000

- name: Case 2, in 2022, below age threshold
period: 2022
input:
pension_survivors: 4_000
military_retirement_pay_survivors: 6_000
age: 64
state_code: SC
output:
sc_retirement_deduction_survivors: 3_000

- name: Case 3, in 2021, above age threshold
period: 2021
input:
pension_survivors: 2_000
military_retirement_pay_survivors: 4_000
age: 70
state_code: SC
output:
sc_retirement_deduction_survivors: 2_000

- name: Case 4, in 2021, below age threshold
period: 2021
input:
pension_survivors: 4_000
military_retirement_pay_survivors: 6_000
age: 64
state_code: SC
output:
sc_retirement_deduction_survivors: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from policyengine_us.model_api import *


class sc_military_deduction(Variable):
value_type = float
entity = TaxUnit
label = "South Carolina military retirement deduction"
defined_for = StateCode.SC
unit = USD
reference = (
"https://www.scstatehouse.gov/code/t12c006.php", # SECTION 12-6-1171(A)
"https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=17",
)
definition_period = YEAR

adds = [
"sc_military_deduction_indv", # p4, p5
"sc_military_deduction_survivors", # p6
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from policyengine_us.model_api import *


class sc_military_deduction_indv(Variable):
hua7450 marked this conversation as resolved.
Show resolved Hide resolved
value_type = float
entity = Person
label = "South Carolina military deduction for eligible individuals"
unit = USD
reference = (
"https://www.scstatehouse.gov/code/t12c006.php", # SECTION 12-6-1171(A)
"https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=17",
)
definition_period = YEAR

def formula(person, period, parameters):
head_or_spouse = person("is_tax_unit_head_or_spouse", period)
return person("military_retirement_pay", period) * head_or_spouse
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from policyengine_us.model_api import *


class sc_military_deduction_survivors(Variable):
value_type = float
entity = Person
label = "South Carolina military retirement deduction for survivors"
defined_for = StateCode.SC
unit = USD
reference = (
"https://www.scstatehouse.gov/code/t12c006.php", # SECTION 12-6-1171(C)
"https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=17",
)
definition_period = YEAR

def formula(person, period, parameters):
return person("military_retirement_pay_survivors", period)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from policyengine_us.model_api import *


class sc_retirement_cap(Variable):
value_type = float
entity = Person
unit = USD
definition_period = YEAR

def formula(person, period, parameters):
p = parameters(period).gov.states.sc.tax.income.subtractions.retirement
age = person("age", period)
return p.cap.calc(age)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from policyengine_us.model_api import *


class sc_retirement_deduction(Variable):
value_type = float
entity = TaxUnit
label = "South Carolina retirement deduction"
unit = USD
definition_period = YEAR
defined_for = StateCode.SC

adds = [
"sc_retirement_deduction_indv", # p1,p2
"sc_retirement_deduction_survivors", # p3
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from policyengine_us.model_api import *


class sc_retirement_deduction_indv(Variable):
value_type = float
entity = Person
label = "South Carolina retirement deduction for eligible individuals"
unit = USD
reference = (
"https://www.scstatehouse.gov/code/t12c006.php", # SECTION 12-6-1170(A)(1)
"https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=17",
)
definition_period = YEAR

def formula(person, period, parameters):
p = parameters(period).gov.states.sc.tax.income.subtractions.retirement
age = person("age", period)
head_or_spouse = person("is_tax_unit_head_or_spouse", period)
# line 1
max_deduction_allowed = p.cap.calc(age)
# line 2
military_retirement_pay = person("military_retirement_pay", period)
# line 3
retirement_deduction_available = max_(
max_deduction_allowed - military_retirement_pay, 0
)
# line 4
retirement_income = (
person("taxable_pension_income", period) * head_or_spouse
)
# line 5
return min_(retirement_deduction_available, retirement_income)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from policyengine_us.model_api import *


class sc_retirement_deduction_survivors(Variable):
value_type = float
entity = Person
label = "South Carolina retirement deduction for survivors"
defined_for = StateCode.SC
unit = USD
reference = (
"https://www.scstatehouse.gov/code/t12c006.php", # SECTION 12-6-1170(A)(1)
"https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=17",
)
definition_period = YEAR

def formula(person, period, parameters):
p = parameters(period).gov.states.sc.tax.income.subtractions.retirement
age = person("age", period)
# line 1
max_deduction_allowed = p.cap.calc(age)
# line 2
military_retirement_pay_survivors = person(
"military_retirement_pay_survivors", period
)
# line 3
retirement_deduction_available = max_(
max_deduction_allowed - military_retirement_pay_survivors, 0
)
# line 4
retirement_income_survivors = person("pension_survivors", period)
# In 2021, South Carolina subtracts the survivors retirement deduction from the military retirement deduction
# In 2022, it does not
cap = (
retirement_deduction_available
if p.subtract_military
else max_deduction_allowed
)
return min_(retirement_income_survivors, cap)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from policyengine_us.model_api import *


class military_retirement_pay_survivors(Variable):
value_type = float
entity = Person
label = "Military retirement income paid to surviving spouses"
unit = USD
definition_period = YEAR