policyengine-us 1.364.0__py3-none-any.whl → 1.365.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of policyengine-us might be problematic. Click here for more details.
- policyengine_us/parameters/gov/contrib/states/mi/surtax/in_effect.yaml +10 -0
- policyengine_us/parameters/gov/contrib/states/mi/surtax/rate/joint.yaml +18 -0
- policyengine_us/parameters/gov/contrib/states/mi/surtax/rate/single.yaml +18 -0
- policyengine_us/reforms/reforms.py +6 -1
- policyengine_us/reforms/states/mi/__init__.py +3 -0
- policyengine_us/reforms/states/mi/surtax.py +64 -0
- policyengine_us/tests/policy/contrib/states/mi/mi_surtax.yaml +91 -0
- policyengine_us/tests/utilities/test_ucgid_hierarchical.py +68 -5
- policyengine_us/variables/household/demographic/geographic/ucgid/ucgid.py +68 -71
- policyengine_us/variables/household/demographic/geographic/ucgid/ucgid_str.py +18 -1
- {policyengine_us-1.364.0.dist-info → policyengine_us-1.365.1.dist-info}/METADATA +1 -1
- {policyengine_us-1.364.0.dist-info → policyengine_us-1.365.1.dist-info}/RECORD +15 -9
- {policyengine_us-1.364.0.dist-info → policyengine_us-1.365.1.dist-info}/WHEEL +0 -0
- {policyengine_us-1.364.0.dist-info → policyengine_us-1.365.1.dist-info}/entry_points.txt +0 -0
- {policyengine_us-1.364.0.dist-info → policyengine_us-1.365.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
description: The proposed Michigan surtax is in effect, if this is true.
|
|
2
|
+
values:
|
|
3
|
+
0000-01-01: false
|
|
4
|
+
metadata:
|
|
5
|
+
unit: bool
|
|
6
|
+
period: year
|
|
7
|
+
label: Michigan surtax in effect
|
|
8
|
+
reference:
|
|
9
|
+
- title: Invest in Our Kids ballot initiative text
|
|
10
|
+
href: https://www.michigan.gov/sos/-/media/Project/Websites/sos/BSC-Announcements/Invest-in-MI-Kids-Petition.pdf
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
description: Invest in Our Kids proposed a ballot initiative to implement a surtax on joint filers with taxable income above this threshold.
|
|
2
|
+
metadata:
|
|
3
|
+
type: marginal_rate
|
|
4
|
+
threshold_unit: currency-USD
|
|
5
|
+
rate_unit: /1
|
|
6
|
+
label: Michigan surtax joint rate
|
|
7
|
+
reference:
|
|
8
|
+
- title: Invest in Our Kids ballot initiative text
|
|
9
|
+
href: https://www.michigan.gov/sos/-/media/Project/Websites/sos/BSC-Announcements/Invest-in-MI-Kids-Petition.pdf
|
|
10
|
+
brackets:
|
|
11
|
+
- threshold:
|
|
12
|
+
2027-01-01: 0
|
|
13
|
+
rate:
|
|
14
|
+
2027-01-01: 0
|
|
15
|
+
- threshold:
|
|
16
|
+
2027-01-01: 1_000_000
|
|
17
|
+
rate:
|
|
18
|
+
2027-01-01: 0.05
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
description: Invest in Our Kids proposed a ballot initiative to implement a surtax on single filers with taxable income above this threshold.
|
|
2
|
+
metadata:
|
|
3
|
+
type: marginal_rate
|
|
4
|
+
threshold_unit: currency-USD
|
|
5
|
+
rate_unit: /1
|
|
6
|
+
label: Michigan surtax single rate.
|
|
7
|
+
reference:
|
|
8
|
+
- title: Invest in Our Kids ballot initiative text
|
|
9
|
+
href: https://www.michigan.gov/sos/-/media/Project/Websites/sos/BSC-Announcements/Invest-in-MI-Kids-Petition.pdf
|
|
10
|
+
brackets:
|
|
11
|
+
- threshold:
|
|
12
|
+
2027-01-01: 0
|
|
13
|
+
rate:
|
|
14
|
+
2027-01-01: 0
|
|
15
|
+
- threshold:
|
|
16
|
+
2027-01-01: 500_000
|
|
17
|
+
rate:
|
|
18
|
+
2027-01-01: 0.05
|
|
@@ -92,6 +92,9 @@ from .congress.afa import (
|
|
|
92
92
|
from .reconciliation import (
|
|
93
93
|
create_reconciled_ssn_for_llc_and_aoc_reform,
|
|
94
94
|
)
|
|
95
|
+
from .states.mi.surtax import (
|
|
96
|
+
create_mi_surtax_reform,
|
|
97
|
+
)
|
|
95
98
|
from .additional_tax_bracket import (
|
|
96
99
|
create_additional_tax_bracket_reform,
|
|
97
100
|
)
|
|
@@ -214,10 +217,11 @@ def create_structural_reforms_from_parameters(parameters, period):
|
|
|
214
217
|
ctc_additional_bracket = create_ctc_additional_bracket_reform(
|
|
215
218
|
parameters, period
|
|
216
219
|
)
|
|
217
|
-
|
|
218
220
|
additional_tax_bracket = create_additional_tax_bracket_reform(
|
|
219
221
|
parameters, period
|
|
220
222
|
)
|
|
223
|
+
mi_surtax = create_mi_surtax_reform(parameters, period)
|
|
224
|
+
|
|
221
225
|
american_worker_rebate_act = create_american_worker_rebate_act_reform(
|
|
222
226
|
parameters, period
|
|
223
227
|
)
|
|
@@ -263,6 +267,7 @@ def create_structural_reforms_from_parameters(parameters, period):
|
|
|
263
267
|
afa_other_dependent_credit,
|
|
264
268
|
reconciled_ssn_for_llc_and_aoc,
|
|
265
269
|
ctc_additional_bracket,
|
|
270
|
+
mi_surtax,
|
|
266
271
|
additional_tax_bracket,
|
|
267
272
|
american_worker_rebate_act,
|
|
268
273
|
]
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
from policyengine_core.periods import period as period_
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def create_mi_surtax() -> Reform:
|
|
6
|
+
class mi_surtax(Variable):
|
|
7
|
+
value_type = float
|
|
8
|
+
entity = TaxUnit
|
|
9
|
+
label = "Michigan surtax"
|
|
10
|
+
defined_for = StateCode.MI
|
|
11
|
+
unit = USD
|
|
12
|
+
definition_period = YEAR
|
|
13
|
+
|
|
14
|
+
def formula(tax_unit, period, parameters):
|
|
15
|
+
taxable_income = tax_unit("mi_taxable_income", period)
|
|
16
|
+
joint = tax_unit("tax_unit_is_joint", period)
|
|
17
|
+
p = parameters(period).gov.contrib.states.mi.surtax.rate
|
|
18
|
+
return where(
|
|
19
|
+
joint,
|
|
20
|
+
p.joint.calc(taxable_income),
|
|
21
|
+
p.single.calc(taxable_income),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
class mi_income_tax(Variable):
|
|
25
|
+
value_type = float
|
|
26
|
+
entity = TaxUnit
|
|
27
|
+
label = "Michigan income tax"
|
|
28
|
+
unit = USD
|
|
29
|
+
definition_period = YEAR
|
|
30
|
+
defined_for = StateCode.MI
|
|
31
|
+
|
|
32
|
+
adds = ["mi_income_tax_before_refundable_credits", "mi_surtax"]
|
|
33
|
+
subtracts = ["mi_refundable_credits"]
|
|
34
|
+
|
|
35
|
+
class reform(Reform):
|
|
36
|
+
def apply(self):
|
|
37
|
+
self.update_variable(mi_income_tax)
|
|
38
|
+
self.update_variable(mi_surtax)
|
|
39
|
+
|
|
40
|
+
return reform
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def create_mi_surtax_reform(parameters, period, bypass: bool = False):
|
|
44
|
+
if bypass:
|
|
45
|
+
return create_mi_surtax()
|
|
46
|
+
|
|
47
|
+
p = parameters.gov.contrib.states.mi.surtax
|
|
48
|
+
|
|
49
|
+
reform_active = False
|
|
50
|
+
current_period = period_(period)
|
|
51
|
+
|
|
52
|
+
for i in range(5):
|
|
53
|
+
if p(current_period).in_effect:
|
|
54
|
+
reform_active = True
|
|
55
|
+
break
|
|
56
|
+
current_period = current_period.offset(1, "year")
|
|
57
|
+
|
|
58
|
+
if reform_active:
|
|
59
|
+
return create_mi_surtax()
|
|
60
|
+
else:
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
mi_surtax = create_mi_surtax_reform(None, None, bypass=True)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
- name: Single filer below threshold in 2027
|
|
2
|
+
period: 2027
|
|
3
|
+
reforms: policyengine_us.reforms.states.mi.surtax.mi_surtax
|
|
4
|
+
input:
|
|
5
|
+
gov.contrib.states.mi.surtax.in_effect: True
|
|
6
|
+
mi_taxable_income: 400_000
|
|
7
|
+
filing_status: SINGLE
|
|
8
|
+
state_code: MI
|
|
9
|
+
output:
|
|
10
|
+
mi_surtax: 0
|
|
11
|
+
|
|
12
|
+
- name: Single filer at threshold in 2027
|
|
13
|
+
period: 2027
|
|
14
|
+
reforms: policyengine_us.reforms.states.mi.surtax.mi_surtax
|
|
15
|
+
input:
|
|
16
|
+
gov.contrib.states.mi.surtax.in_effect: True
|
|
17
|
+
mi_taxable_income: 500_000
|
|
18
|
+
filing_status: SINGLE
|
|
19
|
+
state_code: MI
|
|
20
|
+
output:
|
|
21
|
+
mi_surtax: 0
|
|
22
|
+
|
|
23
|
+
- name: Single filer above threshold in 2027
|
|
24
|
+
period: 2027
|
|
25
|
+
reforms: policyengine_us.reforms.states.mi.surtax.mi_surtax
|
|
26
|
+
input:
|
|
27
|
+
gov.contrib.states.mi.surtax.in_effect: True
|
|
28
|
+
mi_taxable_income: 600_000
|
|
29
|
+
filing_status: SINGLE
|
|
30
|
+
state_code: MI
|
|
31
|
+
output:
|
|
32
|
+
# (600_000 - 500_000) * 0.05 = 100_000 * 0.05 = 5_000
|
|
33
|
+
mi_surtax: 5_000
|
|
34
|
+
|
|
35
|
+
- name: Single filer well above threshold in 2027
|
|
36
|
+
period: 2027
|
|
37
|
+
reforms: policyengine_us.reforms.states.mi.surtax.mi_surtax
|
|
38
|
+
input:
|
|
39
|
+
gov.contrib.states.mi.surtax.in_effect: True
|
|
40
|
+
mi_taxable_income: 1_000_000
|
|
41
|
+
filing_status: SINGLE
|
|
42
|
+
state_code: MI
|
|
43
|
+
output:
|
|
44
|
+
# (1_000_000 - 500_000) * 0.05 = 500_000 * 0.05 = 25_000
|
|
45
|
+
mi_surtax: 25_000
|
|
46
|
+
|
|
47
|
+
- name: Joint filer below threshold in 2027
|
|
48
|
+
period: 2027
|
|
49
|
+
reforms: policyengine_us.reforms.states.mi.surtax.mi_surtax
|
|
50
|
+
input:
|
|
51
|
+
gov.contrib.states.mi.surtax.in_effect: True
|
|
52
|
+
mi_taxable_income: 800_000
|
|
53
|
+
filing_status: JOINT
|
|
54
|
+
state_code: MI
|
|
55
|
+
output:
|
|
56
|
+
mi_surtax: 0
|
|
57
|
+
|
|
58
|
+
- name: Joint filer at threshold in 2027
|
|
59
|
+
period: 2027
|
|
60
|
+
reforms: policyengine_us.reforms.states.mi.surtax.mi_surtax
|
|
61
|
+
input:
|
|
62
|
+
gov.contrib.states.mi.surtax.in_effect: True
|
|
63
|
+
mi_taxable_income: 1_000_000
|
|
64
|
+
filing_status: JOINT
|
|
65
|
+
state_code: MI
|
|
66
|
+
output:
|
|
67
|
+
mi_surtax: 0
|
|
68
|
+
|
|
69
|
+
- name: Joint filer above threshold in 2027
|
|
70
|
+
period: 2027
|
|
71
|
+
reforms: policyengine_us.reforms.states.mi.surtax.mi_surtax
|
|
72
|
+
input:
|
|
73
|
+
gov.contrib.states.mi.surtax.in_effect: True
|
|
74
|
+
mi_taxable_income: 1_200_000
|
|
75
|
+
filing_status: JOINT
|
|
76
|
+
state_code: MI
|
|
77
|
+
output:
|
|
78
|
+
# (1_200_000 - 1_000_000) * 0.05 = 200_000 * 0.05 = 10_000
|
|
79
|
+
mi_surtax: 10_000
|
|
80
|
+
|
|
81
|
+
- name: Joint filer well above threshold in 2027
|
|
82
|
+
period: 2027
|
|
83
|
+
reforms: policyengine_us.reforms.states.mi.surtax.mi_surtax
|
|
84
|
+
input:
|
|
85
|
+
gov.contrib.states.mi.surtax.in_effect: True
|
|
86
|
+
mi_taxable_income: 2_000_000
|
|
87
|
+
filing_status: JOINT
|
|
88
|
+
state_code: MI
|
|
89
|
+
output:
|
|
90
|
+
# (2_000_000 - 1_000_000) * 0.05 = 1_000_000 * 0.05 = 50_000
|
|
91
|
+
mi_surtax: 50_000
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Test script demonstrating UCGID hierarchical functionality.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
import numpy as np
|
|
5
6
|
from policyengine_us import Microsimulation
|
|
6
7
|
from policyengine_us.variables.household.demographic.geographic.ucgid.ucgid_enum import (
|
|
7
8
|
UCGID,
|
|
@@ -18,19 +19,16 @@ class TestUCGIDHierarchical:
|
|
|
18
19
|
# Test Congressional District (CA_23)
|
|
19
20
|
ca_23 = UCGID.CA_23
|
|
20
21
|
ca_23_codes = ca_23.get_hierarchical_codes()
|
|
21
|
-
print(f"CA_23 hierarchical codes: {ca_23_codes}")
|
|
22
22
|
assert ca_23_codes == ["5001800US0623", "0400000US06", "0100000US"]
|
|
23
23
|
|
|
24
24
|
# Test State (CA)
|
|
25
25
|
ca = UCGID.CA
|
|
26
26
|
ca_codes = ca.get_hierarchical_codes()
|
|
27
|
-
print(f"CA hierarchical codes: {ca_codes}")
|
|
28
27
|
assert ca_codes == ["0400000US06", "0100000US"]
|
|
29
28
|
|
|
30
29
|
# Test US
|
|
31
30
|
us = UCGID.US
|
|
32
31
|
us_codes = us.get_hierarchical_codes()
|
|
33
|
-
print(f"US hierarchical codes: {us_codes}")
|
|
34
32
|
assert us_codes == ["0100000US"]
|
|
35
33
|
|
|
36
34
|
# Test hierarchy matching
|
|
@@ -50,9 +48,74 @@ class TestUCGIDHierarchical:
|
|
|
50
48
|
# Convert the string back to enum to access hierarchical methods
|
|
51
49
|
ucgid_enum = UCGID[ucgid_string]
|
|
52
50
|
hierarchical_codes = ucgid_enum.get_hierarchical_codes()
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
|
|
52
|
+
# Should have 2 hierarchical codes for state-level UCGIDs: [state, US]
|
|
53
|
+
assert len(hierarchical_codes) == 2
|
|
54
|
+
assert (
|
|
55
|
+
hierarchical_codes[1] == "0100000US"
|
|
56
|
+
) # Second code should always be US
|
|
57
|
+
assert hierarchical_codes[0].startswith(
|
|
58
|
+
"0400000US"
|
|
59
|
+
) # First should be state-level
|
|
55
60
|
|
|
56
61
|
# Test hierarchy matching in simulation context
|
|
57
62
|
is_in_us = ucgid_enum.matches_hierarchy("0100000US")
|
|
58
63
|
assert is_in_us == True
|
|
64
|
+
|
|
65
|
+
def test_ucgid_str_variable(self):
|
|
66
|
+
"""Test the UCGID string variable functionality."""
|
|
67
|
+
simulation = Microsimulation()
|
|
68
|
+
ucgid_str_values = simulation.calculate("ucgid_str", "2024")
|
|
69
|
+
|
|
70
|
+
# The UCGID string variable should return a string representation
|
|
71
|
+
ucgid_str = ucgid_str_values.iloc[0]
|
|
72
|
+
assert type(ucgid_str) == str
|
|
73
|
+
assert (
|
|
74
|
+
ucgid_str.startswith("0100000US")
|
|
75
|
+
| ucgid_str.startswith("0400000US")
|
|
76
|
+
| ucgid_str.startswith("5001800US")
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Create a basic simulation to test with specific input values
|
|
80
|
+
from policyengine_us import Simulation
|
|
81
|
+
|
|
82
|
+
simulation = Simulation(
|
|
83
|
+
situation={
|
|
84
|
+
"people": {"person": {}},
|
|
85
|
+
"households": {"household": {"members": ["person"]}},
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Set a specific UCGID value for testing (CA_23)
|
|
90
|
+
simulation.set_input("ucgid", 2024, UCGID.CA_23)
|
|
91
|
+
|
|
92
|
+
# Calculate the ucgid_str value
|
|
93
|
+
ucgid_str_values = simulation.calculate("ucgid_str", 2024)
|
|
94
|
+
ucgid_str = ucgid_str_values[0]
|
|
95
|
+
|
|
96
|
+
# Verify it contains all three hierarchical codes
|
|
97
|
+
assert ucgid_str == "5001800US0623,0400000US06,0100000US"
|
|
98
|
+
|
|
99
|
+
def test_ucgid_microsimulation_input_override(self):
|
|
100
|
+
"""Test setting UCGID input for all households in a microsimulation."""
|
|
101
|
+
microsim = Microsimulation()
|
|
102
|
+
|
|
103
|
+
# Get initial values
|
|
104
|
+
ucgid_before = microsim.calculate("ucgid", 2024)
|
|
105
|
+
num_households = len(ucgid_before)
|
|
106
|
+
|
|
107
|
+
# Set all households to CA_23
|
|
108
|
+
input_array = np.array([UCGID.CA_23] * num_households)
|
|
109
|
+
microsim.set_input("ucgid", 2024, input_array)
|
|
110
|
+
|
|
111
|
+
# Verify the input was set
|
|
112
|
+
ucgid_after = microsim.calculate("ucgid", 2024)
|
|
113
|
+
after_values = ucgid_after.values
|
|
114
|
+
assert all(val == "CA_23" for val in after_values)
|
|
115
|
+
assert len(set(after_values)) == 1
|
|
116
|
+
|
|
117
|
+
# Test that ucgid_str now returns hierarchical codes for all households
|
|
118
|
+
ucgid_str_values = microsim.calculate("ucgid_str", 2024)
|
|
119
|
+
expected_str = "5001800US0623,0400000US06,0100000US"
|
|
120
|
+
str_values = ucgid_str_values.values
|
|
121
|
+
assert all(str_val == expected_str for str_val in str_values)
|
|
@@ -20,78 +20,75 @@ class ucgid(Variable):
|
|
|
20
20
|
def formula(household, period, parameters):
|
|
21
21
|
simulation: Simulation = household.simulation
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
|
|
23
|
+
# Check if this variable has been set as input
|
|
24
|
+
if simulation.get_holder("ucgid").get_known_periods():
|
|
25
|
+
return household("ucgid", period)
|
|
25
26
|
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
# Try to derive from state_code
|
|
28
|
+
state_code_enum = household("state_code", period)
|
|
29
|
+
state_code_strings = state_code_enum.decode_to_str()
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
31
|
+
# Map state codes to UCGID state values
|
|
32
|
+
state_mapping = {
|
|
33
|
+
"AL": UCGID.AL,
|
|
34
|
+
"AK": UCGID.AK,
|
|
35
|
+
"AZ": UCGID.AZ,
|
|
36
|
+
"AR": UCGID.AR,
|
|
37
|
+
"CA": UCGID.CA,
|
|
38
|
+
"CO": UCGID.CO,
|
|
39
|
+
"CT": UCGID.CT,
|
|
40
|
+
"DE": UCGID.DE,
|
|
41
|
+
"DC": UCGID.DC,
|
|
42
|
+
"FL": UCGID.FL,
|
|
43
|
+
"GA": UCGID.GA,
|
|
44
|
+
"HI": UCGID.HI,
|
|
45
|
+
"ID": UCGID.ID,
|
|
46
|
+
"IL": UCGID.IL,
|
|
47
|
+
"IN": UCGID.IN,
|
|
48
|
+
"IA": UCGID.IA,
|
|
49
|
+
"KS": UCGID.KS,
|
|
50
|
+
"KY": UCGID.KY,
|
|
51
|
+
"LA": UCGID.LA,
|
|
52
|
+
"ME": UCGID.ME,
|
|
53
|
+
"MD": UCGID.MD,
|
|
54
|
+
"MA": UCGID.MA,
|
|
55
|
+
"MI": UCGID.MI,
|
|
56
|
+
"MN": UCGID.MN,
|
|
57
|
+
"MS": UCGID.MS,
|
|
58
|
+
"MO": UCGID.MO,
|
|
59
|
+
"MT": UCGID.MT,
|
|
60
|
+
"NE": UCGID.NE,
|
|
61
|
+
"NV": UCGID.NV,
|
|
62
|
+
"NH": UCGID.NH,
|
|
63
|
+
"NJ": UCGID.NJ,
|
|
64
|
+
"NM": UCGID.NM,
|
|
65
|
+
"NY": UCGID.NY,
|
|
66
|
+
"NC": UCGID.NC,
|
|
67
|
+
"ND": UCGID.ND,
|
|
68
|
+
"OH": UCGID.OH,
|
|
69
|
+
"OK": UCGID.OK,
|
|
70
|
+
"OR": UCGID.OR,
|
|
71
|
+
"PA": UCGID.PA,
|
|
72
|
+
"RI": UCGID.RI,
|
|
73
|
+
"SC": UCGID.SC,
|
|
74
|
+
"SD": UCGID.SD,
|
|
75
|
+
"TN": UCGID.TN,
|
|
76
|
+
"TX": UCGID.TX,
|
|
77
|
+
"UT": UCGID.UT,
|
|
78
|
+
"VT": UCGID.VT,
|
|
79
|
+
"VA": UCGID.VA,
|
|
80
|
+
"WA": UCGID.WA,
|
|
81
|
+
"WV": UCGID.WV,
|
|
82
|
+
"WI": UCGID.WI,
|
|
83
|
+
"WY": UCGID.WY,
|
|
84
|
+
}
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
result[i] = UCGID.US
|
|
86
|
+
# Convert state code strings to UCGID values
|
|
87
|
+
result = np.empty(len(state_code_strings), dtype=object)
|
|
88
|
+
for i, state_str in enumerate(state_code_strings):
|
|
89
|
+
if state_str in state_mapping:
|
|
90
|
+
result[i] = state_mapping[state_str]
|
|
91
|
+
else:
|
|
92
|
+
result[i] = UCGID.US
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
# Default fallback
|
|
97
|
-
return np.full(household.count, UCGID.US, dtype=object)
|
|
94
|
+
return result
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
from policyengine_us.model_api import *
|
|
2
|
+
from policyengine_us.variables.household.demographic.geographic.ucgid.ucgid_enum import (
|
|
3
|
+
UCGID,
|
|
4
|
+
)
|
|
2
5
|
|
|
3
6
|
|
|
4
7
|
class ucgid_str(Variable):
|
|
@@ -9,4 +12,18 @@ class ucgid_str(Variable):
|
|
|
9
12
|
definition_period = YEAR
|
|
10
13
|
|
|
11
14
|
def formula(household, period, parameters):
|
|
12
|
-
|
|
15
|
+
import numpy as np
|
|
16
|
+
|
|
17
|
+
ucgid_enum_names = household("ucgid", period).decode_to_str()
|
|
18
|
+
|
|
19
|
+
# Convert each enum name to its hierarchical codes
|
|
20
|
+
result = []
|
|
21
|
+
for enum_name in ucgid_enum_names:
|
|
22
|
+
# Get the enum instance from its name
|
|
23
|
+
ucgid_enum = UCGID[enum_name]
|
|
24
|
+
|
|
25
|
+
# Get all hierarchical codes and join with commas
|
|
26
|
+
hierarchical_codes = ucgid_enum.get_hierarchical_codes()
|
|
27
|
+
result.append(",".join(hierarchical_codes))
|
|
28
|
+
|
|
29
|
+
return np.array(result)
|
|
@@ -240,6 +240,9 @@ policyengine_us/parameters/gov/contrib/states/dc/property_tax/income_limit/elder
|
|
|
240
240
|
policyengine_us/parameters/gov/contrib/states/dc/property_tax/income_limit/non_elderly.yaml,sha256=EP-FHIU74pRZDzFsloLCdekB12FblZpUElJgWMUOKUs,1139
|
|
241
241
|
policyengine_us/parameters/gov/contrib/states/dc/property_tax/phase_out/applies.yaml,sha256=_P9RtcHpXLRmDfaLH0CTu8lvfWvGbux3s-sQaEzylUw,236
|
|
242
242
|
policyengine_us/parameters/gov/contrib/states/dc/property_tax/phase_out/rate.yaml,sha256=aQ2MZLZ38DD2FCHT_FCMfsYR0g2GRrmEjwnDz45IYB4,223
|
|
243
|
+
policyengine_us/parameters/gov/contrib/states/mi/surtax/in_effect.yaml,sha256=JrcQCFWEBf-A43PBtf3Vj8ohMf0jr_CZPrNZyMXzCT4,362
|
|
244
|
+
policyengine_us/parameters/gov/contrib/states/mi/surtax/rate/joint.yaml,sha256=8gKQEf3wb9xBmo4TYTBZExDNHDrO8ZLLXvqk7WyAyAo,595
|
|
245
|
+
policyengine_us/parameters/gov/contrib/states/mi/surtax/rate/single.yaml,sha256=m0dZ9g_ViK8J1YFXoiSysrchBxRNAJ-AfwkNiHnz90s,596
|
|
243
246
|
policyengine_us/parameters/gov/contrib/states/mn/walz/hf1938/repeal.yaml,sha256=cqJhAAodges-MNKNeyZAR_EnAHGOkfwlQ_-Id7Ck020,200
|
|
244
247
|
policyengine_us/parameters/gov/contrib/states/mt/ctc/README.md,sha256=TRI937j56he0xD-7rMRuHeehLoJwbJX3N2kozuxmVdk,18
|
|
245
248
|
policyengine_us/parameters/gov/contrib/states/mt/ctc/amount.yaml,sha256=HtIsSZilx_9d6vMYZIMRk9Qe98PqNnE-yOboJUeiXBU,563
|
|
@@ -3055,7 +3058,7 @@ policyengine_us/params_on_demand/gov/hhs/medicaid/geography/medicaid_rating_area
|
|
|
3055
3058
|
policyengine_us/reforms/__init__.py,sha256=FPV8k2633kzUhbKUK8jC6yJONbnZ5n9zLAq2UL57KH4,113
|
|
3056
3059
|
policyengine_us/reforms/dc_kccatc.py,sha256=LyGMfEKe-0TgQ-2vCYGOD8W-EGEW8_DgIqCQP89qDyg,4283
|
|
3057
3060
|
policyengine_us/reforms/dc_tax_threshold_joint_ratio.py,sha256=G-5E1EJFGZ3VeUl_fuyj82nMIttHRNRdlT-x98koJrk,1633
|
|
3058
|
-
policyengine_us/reforms/reforms.py,sha256=
|
|
3061
|
+
policyengine_us/reforms/reforms.py,sha256=n6hBdmlke2QPjB15YDu8yuxxQhc6RrOP-n-DxL6RiK4,9502
|
|
3059
3062
|
policyengine_us/reforms/taxsim.py,sha256=bXNFWfjBX5USld1C7fziT6BBmRy-avz00QtL8WmCHy0,5276
|
|
3060
3063
|
policyengine_us/reforms/winship.py,sha256=_q74Af1nkmoh0-M6PZJ2FcJAn6v5zf5sAEgvxjwHwyA,3069
|
|
3061
3064
|
policyengine_us/reforms/additional_tax_bracket/__init__.py,sha256=087GDzojnzkbARUgGTQDMNVWJzjtNZvBGr46jfu1kXc,89
|
|
@@ -3120,6 +3123,8 @@ policyengine_us/reforms/state_dependent_exemptions/__init__.py,sha256=qF3SRSDntS
|
|
|
3120
3123
|
policyengine_us/reforms/state_dependent_exemptions/repeal_state_dependent_exemptions.py,sha256=Asi9vxgvsx3_GKY3Lyee_hZexfB3TLCzd-3hSTosdv4,22610
|
|
3121
3124
|
policyengine_us/reforms/states/dc/property_tax/__init__.py,sha256=yEfVK0QtATzjmj7WekqGXd0RIdNPDIW7Uy_t4jAFKSA,73
|
|
3122
3125
|
policyengine_us/reforms/states/dc/property_tax/dc_property_tax_reform.py,sha256=SA2R0cqg7jR4c2f4M3dZHV1m_FkYD0q8jiO8XP9C40o,5097
|
|
3126
|
+
policyengine_us/reforms/states/mi/__init__.py,sha256=QA0f8Kz0mJKgquLh_pojuDlEnUvo3y99LY0FT7zgm-g,53
|
|
3127
|
+
policyengine_us/reforms/states/mi/surtax.py,sha256=pQm1Mk5-A63BRJA2o7Ki1sxMus0vp1dlqda9KWHvnG4,1791
|
|
3123
3128
|
policyengine_us/reforms/states/mn/walz/__init__.py,sha256=i4-uKPdqTZ99GHsBLnb3pB0ePj1A76eMz57c-QMRDeE,73
|
|
3124
3129
|
policyengine_us/reforms/states/mn/walz/mn_walz_hf1938.py,sha256=LTYBqTKQ6z1ia8OKK0Ept2tuLxNPd_Im8bMnjt1R9cY,9774
|
|
3125
3130
|
policyengine_us/reforms/states/mt/ctc/__init__.py,sha256=i2LhiD6XvP-twVhjs1P9g80QUZHEAgeVRUSy8wqRlzg,50
|
|
@@ -5111,6 +5116,7 @@ policyengine_us/tests/policy/contrib/snap_ea/mid_year_snap_ea_reform.py,sha256=A
|
|
|
5111
5116
|
policyengine_us/tests/policy/contrib/snap_ea/snap_ca_ea_reform.yaml,sha256=7ivYCiPdnT3XxVP7o-aJzer9gdM8Ot_f_zyFCZptBxc,540
|
|
5112
5117
|
policyengine_us/tests/policy/contrib/state_dependent_exemptions/repeal_state_dependent_exemptions.yaml,sha256=6CgLgOtzdJ7WUoqW-gLU9wG1rABNlsDVT9lEwuCuxzs,2031
|
|
5113
5118
|
policyengine_us/tests/policy/contrib/states/dc/property_tax/dc_property_tax_credit.yaml,sha256=GylamIRxoQ3IUrWIYqb-2Ix8X26QvQ2f_wqsfr3EEMo,5745
|
|
5119
|
+
policyengine_us/tests/policy/contrib/states/mi/mi_surtax.yaml,sha256=XQ2_X2XMihcuLNWMWfdAfeEglM-e19VY2pBnHCWYQeE,2541
|
|
5114
5120
|
policyengine_us/tests/policy/contrib/states/mn/walz/mn_walz_hf1938.yaml,sha256=5T1QsbKqOf52Vjk8vv1ZruEo8RWR9pKXBqcc0Dazcds,2958
|
|
5115
5121
|
policyengine_us/tests/policy/contrib/states/mt/ctc/mt_ctc.yaml,sha256=WYTHmavj-lmZjVB2foKqFnWnza4fqWPspj1Oieqm9is,3129
|
|
5116
5122
|
policyengine_us/tests/policy/contrib/states/ny/ny_working_families_tax_credit.yaml,sha256=XPIBSvoA_fbz56jj5oyphaglco44oMwSvLPB5yJNhMM,8232
|
|
@@ -5130,7 +5136,7 @@ policyengine_us/tests/policy/contrib/ubi_center/flat_tax.yaml,sha256=O6krfJ2rovW
|
|
|
5130
5136
|
policyengine_us/tests/policy/reform/ctc_expansion.yaml,sha256=soq-LqWwbb7fNQJFphx_1gSc8uDGOhtr-5P93oY2Mpg,1596
|
|
5131
5137
|
policyengine_us/tests/policy/reform/winship.yaml,sha256=OPfsoZ0NrlPU25hJadZXycrYLaM0wPUGXjBrn6_8gR4,1706
|
|
5132
5138
|
policyengine_us/tests/utilities/test_load_county_fips_dataset.py,sha256=QAURDL6IMN5gafUOcTri1PUet6khLNZ_Bov6NdW_pMM,4397
|
|
5133
|
-
policyengine_us/tests/utilities/test_ucgid_hierarchical.py,sha256=
|
|
5139
|
+
policyengine_us/tests/utilities/test_ucgid_hierarchical.py,sha256=WZYqWHw6-QQAv0Wd3bGgAcgPgZ0ILhOxpC-kgo4HRkU,4532
|
|
5134
5140
|
policyengine_us/tests/variables/gov/states/vt/tax/income/vt_eitc.yaml,sha256=gE-ZtclGqoFKs87k9VUgKEoVO2iZkFBq4k-ixGtde14,2341
|
|
5135
5141
|
policyengine_us/tests/variables/gov/states/vt/tax/income/adjusted_gross_income/subtractions/retirement_income_exemption/vt_military_retirement_income_based_exemption.yaml,sha256=b5I5ekAoDCrojCLwEZMoBEDdUX9zDw1bM-4iQLmyTng,3267
|
|
5136
5142
|
policyengine_us/tests/variables/gov/states/vt/tax/income/credits/vt_veteran_tax_credit.yaml,sha256=51NtThz2bNwVD7o-2VXZqplDjKUAYzIiIzyL1PfXK94,3244
|
|
@@ -7779,9 +7785,9 @@ policyengine_us/variables/household/demographic/geographic/county/county_str.py,
|
|
|
7779
7785
|
policyengine_us/variables/household/demographic/geographic/county/first_county_in_state.py,sha256=yXCj-LVjxPeILIg42ijefTmi_j4NxJwX0kMtoE47xic,1578
|
|
7780
7786
|
policyengine_us/variables/household/demographic/geographic/state/average_home_energy_use_in_state.py,sha256=aaGYAXLU7tsx-A9NW4nyLij5J5mp0WTRXsyObngekvY,319
|
|
7781
7787
|
policyengine_us/variables/household/demographic/geographic/state/in_state.py,sha256=o3ksZCOHtlJ1JGHIXAPlqcs5-rVbTgOCcDdN1-fYqmA,551
|
|
7782
|
-
policyengine_us/variables/household/demographic/geographic/ucgid/ucgid.py,sha256=
|
|
7788
|
+
policyengine_us/variables/household/demographic/geographic/ucgid/ucgid.py,sha256=SwONHVRvHmUFHvPZQMYY7Y9e7gz74kisLjJICpHdyKg,2874
|
|
7783
7789
|
policyengine_us/variables/household/demographic/geographic/ucgid/ucgid_enum.py,sha256=dkeusTBI1j4xAGmRFkfSsyT3Hq5gHZwRUkSeISeNbx0,15636
|
|
7784
|
-
policyengine_us/variables/household/demographic/geographic/ucgid/ucgid_str.py,sha256=
|
|
7790
|
+
policyengine_us/variables/household/demographic/geographic/ucgid/ucgid_str.py,sha256=GnIRg2tc0376YazPX7wm7YQgMQaYPm2Au47vc1E5JcM,914
|
|
7785
7791
|
policyengine_us/variables/household/demographic/geographic/zip_code/three_digit_zip_code.py,sha256=7q0FQRahTOINiK2vlAyHEa5xIKowM5Kgl60-kR3ZuWU,426
|
|
7786
7792
|
policyengine_us/variables/household/demographic/geographic/zip_code/zip_code.py,sha256=PZiLb84BgKQ_Suvd6iUiEnzySu3Vtiv8FOlfB4rnagQ,1691
|
|
7787
7793
|
policyengine_us/variables/household/demographic/household/bedrooms.py,sha256=4ltdIRLdmeuTKAskn4pdgxZuxEE-4rz0ffPnIKobc-o,164
|
|
@@ -8230,8 +8236,8 @@ policyengine_us/variables/input/farm_income.py,sha256=BEKxYmHNNnWJAAvULl5qZJigy5
|
|
|
8230
8236
|
policyengine_us/variables/input/geography.py,sha256=XmBlgXhzBoLRKk6R8taVZHqUw1eU8MbNeGS9iJ7_l44,4506
|
|
8231
8237
|
policyengine_us/variables/input/self_employment_income.py,sha256=PwsGz8R4lRikKWUYOhsC0qosNNLXq4f5SQmfw4S3mk8,511
|
|
8232
8238
|
policyengine_us/variables/input/self_employment_income_before_lsr.py,sha256=E8fcX9Nlyqz8dziHhQv_euutdmoIwFMMWePUwbbwv_w,379
|
|
8233
|
-
policyengine_us-1.
|
|
8234
|
-
policyengine_us-1.
|
|
8235
|
-
policyengine_us-1.
|
|
8236
|
-
policyengine_us-1.
|
|
8237
|
-
policyengine_us-1.
|
|
8239
|
+
policyengine_us-1.365.1.dist-info/METADATA,sha256=HOpqZAHTPNFrdBmVMwFA27fcbSixBqddzUTZwqQ9qk8,1693
|
|
8240
|
+
policyengine_us-1.365.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8241
|
+
policyengine_us-1.365.1.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
|
|
8242
|
+
policyengine_us-1.365.1.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
|
|
8243
|
+
policyengine_us-1.365.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|