policyengine-us 1.381.3__py3-none-any.whl → 1.383.0__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/states/id/tax/income/credits/2022_rebate/floor.yaml +10 -0
- policyengine_us/parameters/gov/states/id/tax/income/credits/2022_rebate/rate.yaml +10 -0
- policyengine_us/parameters/gov/states/id/tax/income/credits/refundable.yaml +10 -3
- policyengine_us/parameters/gov/states/id/tax/income/credits/special_seasonal_rebate/floor.yaml +22 -0
- policyengine_us/parameters/gov/states/id/tax/income/credits/special_seasonal_rebate/rate.yaml +10 -0
- policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_2022_rebate.yaml +17 -0
- policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_2022_rebate_floor.yaml +21 -0
- policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_special_season_rebate.yaml +17 -0
- policyengine_us/variables/gov/states/id/tax/income/credits/2022_rebate/id_2022_rebate.py +18 -0
- policyengine_us/variables/gov/states/id/tax/income/credits/2022_rebate/id_2022_rebate_floor.py +11 -0
- policyengine_us/variables/gov/states/id/tax/income/credits/id_special_season_rebate.py +21 -0
- policyengine_us/variables/input/geography.py +24 -0
- {policyengine_us-1.381.3.dist-info → policyengine_us-1.383.0.dist-info}/METADATA +1 -1
- {policyengine_us-1.381.3.dist-info → policyengine_us-1.383.0.dist-info}/RECORD +17 -11
- policyengine_us/tests/utilities/test_ucgid_hierarchical.py +0 -121
- policyengine_us/variables/household/demographic/geographic/ucgid/ucgid.py +0 -94
- policyengine_us/variables/household/demographic/geographic/ucgid/ucgid_enum.py +0 -551
- policyengine_us/variables/household/demographic/geographic/ucgid/ucgid_str.py +0 -29
- {policyengine_us-1.381.3.dist-info → policyengine_us-1.383.0.dist-info}/WHEEL +0 -0
- {policyengine_us-1.381.3.dist-info → policyengine_us-1.383.0.dist-info}/entry_points.txt +0 -0
- {policyengine_us-1.381.3.dist-info → policyengine_us-1.383.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
description: Idaho provides the following minimum 2022 rebate amount for each filer and dependent.
|
|
2
|
+
values:
|
|
3
|
+
2022-01-01: 75
|
|
4
|
+
metadata:
|
|
5
|
+
unit: currency-USD
|
|
6
|
+
period: year
|
|
7
|
+
label: Idaho 2022 rebate floor
|
|
8
|
+
reference:
|
|
9
|
+
- title: Idaho Statutes 63-3024B (3)
|
|
10
|
+
href: https://legislature.idaho.gov/statutesrules/idstat/title63/t63ch30/sect63-3024b/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
description: Idaho provides a 2022 rebate amount of this percentage of the state income tax liability.
|
|
2
|
+
values:
|
|
3
|
+
2022-01-01: 0.12
|
|
4
|
+
metadata:
|
|
5
|
+
unit: currency-USD
|
|
6
|
+
period: year
|
|
7
|
+
label: Idaho 2022 rebate floor
|
|
8
|
+
reference:
|
|
9
|
+
- title: Idaho Statutes 63-3024B (3)
|
|
10
|
+
href: https://legislature.idaho.gov/statutesrules/idstat/title63/t63ch30/sect63-3024b/
|
|
@@ -12,7 +12,14 @@ metadata:
|
|
|
12
12
|
|
|
13
13
|
values:
|
|
14
14
|
2002-01-01:
|
|
15
|
-
- id_aged_or_disabled_credit
|
|
15
|
+
- id_aged_or_disabled_credit
|
|
16
16
|
2021-01-01:
|
|
17
|
-
- id_grocery_credit
|
|
18
|
-
- id_aged_or_disabled_credit
|
|
17
|
+
- id_grocery_credit
|
|
18
|
+
- id_aged_or_disabled_credit
|
|
19
|
+
2022-01-01:
|
|
20
|
+
- id_grocery_credit
|
|
21
|
+
- id_aged_or_disabled_credit
|
|
22
|
+
- id_2022_rebate
|
|
23
|
+
2023-01-01:
|
|
24
|
+
- id_grocery_credit
|
|
25
|
+
- id_aged_or_disabled_credit
|
policyengine_us/parameters/gov/states/id/tax/income/credits/special_seasonal_rebate/floor.yaml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
description: Idaho provides the following minimum special seasonal rebate amount, based on filing status.
|
|
2
|
+
|
|
3
|
+
metadata:
|
|
4
|
+
unit: currency-USD
|
|
5
|
+
period: year
|
|
6
|
+
breakdown:
|
|
7
|
+
- filing_status
|
|
8
|
+
label: Idaho special seasonal rebate floor
|
|
9
|
+
reference:
|
|
10
|
+
- title: Idaho Statutes 63-3024B (4)
|
|
11
|
+
href: https://legislature.idaho.gov/statutesrules/idstat/title63/t63ch30/sect63-3024b/
|
|
12
|
+
|
|
13
|
+
SINGLE:
|
|
14
|
+
2022-01-01: 300
|
|
15
|
+
JOINT:
|
|
16
|
+
2022-01-01: 600
|
|
17
|
+
SEPARATE:
|
|
18
|
+
2022-01-01: 300
|
|
19
|
+
SURVIVING_SPOUSE:
|
|
20
|
+
2022-01-01: 300
|
|
21
|
+
HEAD_OF_HOUSEHOLD:
|
|
22
|
+
2022-01-01: 300
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
description: Idaho provides a special seasonal rebate amount of this percentage of the state income tax liability.
|
|
2
|
+
values:
|
|
3
|
+
2022-01-01: 0.1
|
|
4
|
+
metadata:
|
|
5
|
+
unit: currency-USD
|
|
6
|
+
period: year
|
|
7
|
+
label: Idaho special seasonal rebate rate
|
|
8
|
+
reference:
|
|
9
|
+
- title: Idaho Statutes 63-3024B (4)
|
|
10
|
+
href: https://legislature.idaho.gov/statutesrules/idstat/title63/t63ch30/sect63-3024b/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
- name: Floor over rate
|
|
2
|
+
period: 2022
|
|
3
|
+
input:
|
|
4
|
+
id_income_tax_before_non_refundable_credits: 1_000
|
|
5
|
+
state_code: ID
|
|
6
|
+
id_2022_rebate_floor: 300
|
|
7
|
+
output:
|
|
8
|
+
id_2022_rebate: 300
|
|
9
|
+
|
|
10
|
+
- name: Rate over floor
|
|
11
|
+
period: 2022
|
|
12
|
+
input:
|
|
13
|
+
id_income_tax_before_non_refundable_credits: 1_000
|
|
14
|
+
state_code: ID
|
|
15
|
+
id_2022_rebate_floor: 0
|
|
16
|
+
output:
|
|
17
|
+
id_2022_rebate: 120
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_2022_rebate_floor.yaml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
- name: One person in ID
|
|
2
|
+
period: 2022
|
|
3
|
+
input:
|
|
4
|
+
state_code: ID
|
|
5
|
+
output:
|
|
6
|
+
id_2022_rebate_floor: 75
|
|
7
|
+
|
|
8
|
+
- name: Two people
|
|
9
|
+
period: 2022
|
|
10
|
+
input:
|
|
11
|
+
people:
|
|
12
|
+
person1:
|
|
13
|
+
age: 40
|
|
14
|
+
person2:
|
|
15
|
+
age: 40
|
|
16
|
+
households:
|
|
17
|
+
household:
|
|
18
|
+
members: [person1, person2]
|
|
19
|
+
state_code: ID
|
|
20
|
+
output:
|
|
21
|
+
id_2022_rebate_floor: [75, 75]
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_special_season_rebate.yaml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
- name: Floor over rate
|
|
2
|
+
period: 2022
|
|
3
|
+
input:
|
|
4
|
+
id_income_tax_before_non_refundable_credits: 1_000
|
|
5
|
+
state_code: ID
|
|
6
|
+
filing_status: SINGLE
|
|
7
|
+
output:
|
|
8
|
+
id_special_season_rebate: 300
|
|
9
|
+
|
|
10
|
+
- name: Rate over floor
|
|
11
|
+
period: 2022
|
|
12
|
+
input:
|
|
13
|
+
id_income_tax_before_non_refundable_credits: 10_000
|
|
14
|
+
state_code: ID
|
|
15
|
+
filing_status: SINGLE
|
|
16
|
+
output:
|
|
17
|
+
id_special_season_rebate: 1_000
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class id_2022_rebate(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = TaxUnit
|
|
7
|
+
label = "Idaho 2022 rebate"
|
|
8
|
+
definition_period = YEAR
|
|
9
|
+
defined_for = StateCode.ID
|
|
10
|
+
|
|
11
|
+
def formula(tax_unit, period, parameters):
|
|
12
|
+
p = parameters(period).gov.states.id.tax.income.credits["2022_rebate"]
|
|
13
|
+
income_tax_before_credits = tax_unit(
|
|
14
|
+
"id_income_tax_before_non_refundable_credits", period
|
|
15
|
+
)
|
|
16
|
+
percentage_credit = p.rate * income_tax_before_credits
|
|
17
|
+
floor = add(tax_unit, period, ["id_2022_rebate_floor"])
|
|
18
|
+
return max_(percentage_credit, floor)
|
policyengine_us/variables/gov/states/id/tax/income/credits/2022_rebate/id_2022_rebate_floor.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class id_2022_rebate_floor(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = Person
|
|
7
|
+
label = "Idaho 2022 rebate floor"
|
|
8
|
+
definition_period = YEAR
|
|
9
|
+
defined_for = StateCode.ID
|
|
10
|
+
|
|
11
|
+
adds = ["gov.states.id.tax.income.credits.2022_rebate.floor"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from policyengine_us.model_api import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class id_special_season_rebate(Variable):
|
|
5
|
+
value_type = float
|
|
6
|
+
entity = TaxUnit
|
|
7
|
+
label = "Idaho special seasonal rebate"
|
|
8
|
+
definition_period = YEAR
|
|
9
|
+
defined_for = StateCode.ID
|
|
10
|
+
|
|
11
|
+
def formula(tax_unit, period, parameters):
|
|
12
|
+
p = parameters(
|
|
13
|
+
period
|
|
14
|
+
).gov.states.id.tax.income.credits.special_seasonal_rebate
|
|
15
|
+
income_tax_before_credits = tax_unit(
|
|
16
|
+
"id_income_tax_before_non_refundable_credits", period
|
|
17
|
+
)
|
|
18
|
+
percentage_credit = p.rate * income_tax_before_credits
|
|
19
|
+
filing_status = tax_unit("filing_status", period)
|
|
20
|
+
floor = p.floor[filing_status]
|
|
21
|
+
return max_(percentage_credit, floor)
|
|
@@ -142,3 +142,27 @@ class state_fips(Variable):
|
|
|
142
142
|
definition_period = YEAR
|
|
143
143
|
documentation = "State FIPS code"
|
|
144
144
|
default_value = 6
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class congressional_district_geoid(Variable):
|
|
148
|
+
value_type = int
|
|
149
|
+
label = "Congressional district GEOID"
|
|
150
|
+
entity = Household
|
|
151
|
+
definition_period = YEAR
|
|
152
|
+
documentation = """Congressional district geographic identifier stored as an integer.
|
|
153
|
+
|
|
154
|
+
Format: SSDD where SS is the 2-digit state FIPS code and DD is the 2-digit district number.
|
|
155
|
+
|
|
156
|
+
Examples:
|
|
157
|
+
- Alabama (FIPS 01) district 01 is stored as 101
|
|
158
|
+
- Alabama (FIPS 01) district 07 is stored as 107
|
|
159
|
+
- North Carolina (FIPS 37) district 01 is stored as 3701
|
|
160
|
+
- California (FIPS 06) district 52 is stored as 652
|
|
161
|
+
|
|
162
|
+
To extract components:
|
|
163
|
+
- State FIPS: geoid // 100
|
|
164
|
+
- District number: geoid % 100
|
|
165
|
+
|
|
166
|
+
Note: Leading zeros are not preserved in the integer storage (e.g., 0101 becomes 101),
|
|
167
|
+
but the value remains unique and unambiguous since the format is always interpreted as SSDD."""
|
|
168
|
+
default_value = 0
|
|
@@ -1531,7 +1531,9 @@ policyengine_us/parameters/gov/states/ia/tax/income/taxable_income/additions.yam
|
|
|
1531
1531
|
policyengine_us/parameters/gov/states/ia/tax/income/taxable_income/subtractions.yaml,sha256=xvzYg1pZwnbhPCJnCkpe0EQ1uM_BQqPciyJzD29oizE,1311
|
|
1532
1532
|
policyengine_us/parameters/gov/states/id/README.md,sha256=kvtjNiUwpLs4_9k916xh9jLgIzvTylItPpMJLmJZREY,7
|
|
1533
1533
|
policyengine_us/parameters/gov/states/id/tax/income/credits/non_refundable.yaml,sha256=DFvGtl8YZyzYPxNmbFr_rhuG8Ts59YJ55sePKS6HJxg,641
|
|
1534
|
-
policyengine_us/parameters/gov/states/id/tax/income/credits/refundable.yaml,sha256
|
|
1534
|
+
policyengine_us/parameters/gov/states/id/tax/income/credits/refundable.yaml,sha256=mfvsOxpHPh2EIyTBX9_61SVA90ZRk9HkA9oa4Vu7yA4,984
|
|
1535
|
+
policyengine_us/parameters/gov/states/id/tax/income/credits/2022_rebate/floor.yaml,sha256=G0o8nti3DsIBGskQGaYutFXQTh08-2_lv32W9G_BeEs,350
|
|
1536
|
+
policyengine_us/parameters/gov/states/id/tax/income/credits/2022_rebate/rate.yaml,sha256=mUlgcUQUDEIuXoTBUtc4lOp4RPGat6zQwaJSOoIadqA,356
|
|
1535
1537
|
policyengine_us/parameters/gov/states/id/tax/income/credits/aged_or_disabled/age_threshold.yaml,sha256=WKPHZLm1j4umAXhJOHzWEEMag94u4Auhnk5QYWwk22Y,1269
|
|
1536
1538
|
policyengine_us/parameters/gov/states/id/tax/income/credits/aged_or_disabled/amount.yaml,sha256=vDZ9mCNywpPArOj1npful07Ldh9D0D8Wg9cKKaBAGI8,1282
|
|
1537
1539
|
policyengine_us/parameters/gov/states/id/tax/income/credits/aged_or_disabled/person_cap.yaml,sha256=aVT8BHsHPy6OBUQ1e6Cc_dERBw9-ZW7ATC63-pFefKo,1290
|
|
@@ -1542,6 +1544,8 @@ policyengine_us/parameters/gov/states/id/tax/income/credits/grocery/aged/age_thr
|
|
|
1542
1544
|
policyengine_us/parameters/gov/states/id/tax/income/credits/grocery/aged/amount.yaml,sha256=J_NorjR2OQrMx5MRtlCFqtUDKlkOEEt2eB9VZ1wMLfA,1470
|
|
1543
1545
|
policyengine_us/parameters/gov/states/id/tax/income/credits/grocery/aged/in_effect.yaml,sha256=LX-UMYdBk-PUxAve5ClqOwvvsHakJn7tHxIv7oObCJM,1504
|
|
1544
1546
|
policyengine_us/parameters/gov/states/id/tax/income/credits/grocery/base/amount.yaml,sha256=2JDsT4NJqI3dvq4DAeo2D1fa_7X80Je54_TZebaac4c,1574
|
|
1547
|
+
policyengine_us/parameters/gov/states/id/tax/income/credits/special_seasonal_rebate/floor.yaml,sha256=yH00DE9jZgXxLHeaHPEmLLN9Jms0eKejz9yWwt_UVEo,531
|
|
1548
|
+
policyengine_us/parameters/gov/states/id/tax/income/credits/special_seasonal_rebate/rate.yaml,sha256=TsdFTB2Ye3_EkgOFXRtnvEN9JbSjgdxDyKbC_xLyIuo,378
|
|
1545
1549
|
policyengine_us/parameters/gov/states/id/tax/income/deductions/capital_gains/percentage.yaml,sha256=ycrvMenEutCPG-4iVRRjcvG0q2uZRS3a3TDHJlbk1qM,1021
|
|
1546
1550
|
policyengine_us/parameters/gov/states/id/tax/income/deductions/dependent_care_expenses/cap.yaml,sha256=NEoYQo8rglFbkVmKjRK93B6f2O-z_Cn-jqb9MW_5cuc,1053
|
|
1547
1551
|
policyengine_us/parameters/gov/states/id/tax/income/deductions/retirement_benefits/cap.yaml,sha256=a9c3vtiGMnIfRLJyoBmUUcP_gEzBL-abEzJE-g36MhI,2043
|
|
@@ -4010,9 +4014,12 @@ policyengine_us/tests/policy/baseline/gov/states/id/tax/income/id_salt_deduction
|
|
|
4010
4014
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/id_taxable_income.yaml,sha256=CzTxtnk9qVtJoY30V2jVOk3O40KDtTHSnbVSnDpN050,579
|
|
4011
4015
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/id_withheld_income_tax.yaml,sha256=hZGxW9CVVHUfVnlrpQZpix5LYkgRu3hh8zk0eX1C1Do,720
|
|
4012
4016
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/integration.yaml,sha256=FjFVklhKYM_3vc9dvWETfRaDE-hBxdsWMKQsD6MGFqc,4766
|
|
4017
|
+
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_2022_rebate.yaml,sha256=9d8oNWSDIYMsp-uDCOplCU9JJcfFCS1922L8qzM05pA,371
|
|
4018
|
+
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_2022_rebate_floor.yaml,sha256=DcNyo7Wrhimm-ojCC0RiT3XtAc9WUDOdglx6YahPfBs,363
|
|
4013
4019
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_aged_or_disabled_credit.yaml,sha256=ypo7VOLXqf5UNF9nxTXD32M5Ow6GHg__cn7lqv8sWsI,2108
|
|
4014
4020
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_aged_or_disabled_credit_eligible_person.yaml,sha256=_K8Ku_C5eM1nfS99xLtxj5o5CHut8XhqMuK76mgXcx4,6195
|
|
4015
4021
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_ctc.yaml,sha256=k9dtZYJCiDXIbWQqf6dWhxgdIINQWvu4XL_DFnyMm48,370
|
|
4022
|
+
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/id_special_season_rebate.yaml,sha256=QaUYpsFKzrrVo9appi0UOfmTKc3sE7xxu3nE1Yjdj2M,388
|
|
4016
4023
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/grocery/id_grocery_credit.yaml,sha256=vXX3ybmcX0idJicBBjwfsc8EK3mLXQQrMj1xPa2IYiE,2335
|
|
4017
4024
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/grocery/id_grocery_credit_aged.yaml,sha256=DQBH7vI1lfl8W_IPy4WSbT84A4ngTqpnLr3QHKsoe4A,1810
|
|
4018
4025
|
policyengine_us/tests/policy/baseline/gov/states/id/tax/income/credits/grocery/id_grocery_credit_base.yaml,sha256=7mZ2mI7yXQsit2ZcVghgZAxsPlLL0E4RQj0pQrBjI0w,447
|
|
@@ -5179,7 +5186,6 @@ policyengine_us/tests/policy/contrib/ubi_center/flat_tax.yaml,sha256=O6krfJ2rovW
|
|
|
5179
5186
|
policyengine_us/tests/policy/reform/ctc_expansion.yaml,sha256=soq-LqWwbb7fNQJFphx_1gSc8uDGOhtr-5P93oY2Mpg,1596
|
|
5180
5187
|
policyengine_us/tests/policy/reform/winship.yaml,sha256=OPfsoZ0NrlPU25hJadZXycrYLaM0wPUGXjBrn6_8gR4,1706
|
|
5181
5188
|
policyengine_us/tests/utilities/test_load_county_fips_dataset.py,sha256=QAURDL6IMN5gafUOcTri1PUet6khLNZ_Bov6NdW_pMM,4397
|
|
5182
|
-
policyengine_us/tests/utilities/test_ucgid_hierarchical.py,sha256=WZYqWHw6-QQAv0Wd3bGgAcgPgZ0ILhOxpC-kgo4HRkU,4532
|
|
5183
5189
|
policyengine_us/tests/variables/gov/states/vt/tax/income/vt_eitc.yaml,sha256=gE-ZtclGqoFKs87k9VUgKEoVO2iZkFBq4k-ixGtde14,2341
|
|
5184
5190
|
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
|
|
5185
5191
|
policyengine_us/tests/variables/gov/states/vt/tax/income/credits/vt_veteran_tax_credit.yaml,sha256=51NtThz2bNwVD7o-2VXZqplDjKUAYzIiIzyL1PfXK94,3244
|
|
@@ -6432,6 +6438,9 @@ policyengine_us/variables/gov/states/id/tax/income/id_withheld_income_tax.py,sha
|
|
|
6432
6438
|
policyengine_us/variables/gov/states/id/tax/income/credits/id_aged_or_disabled_credit.py,sha256=PJHgc8u8-l38_L15zPIRPkdCeMkqLlSpbBPYPaQuNhs,1128
|
|
6433
6439
|
policyengine_us/variables/gov/states/id/tax/income/credits/id_aged_or_disabled_credit_eligible_person.py,sha256=R7Cjs8LqLatmO3GzCNnLzUNKbfDlrIvT_2v3v4kKy4w,1253
|
|
6434
6440
|
policyengine_us/variables/gov/states/id/tax/income/credits/id_ctc.py,sha256=f7c3cnPzeUDddGq04y9bePYGMEO5LgGf7X68u_vLQAY,723
|
|
6441
|
+
policyengine_us/variables/gov/states/id/tax/income/credits/id_special_season_rebate.py,sha256=NSG10Fs-Q353bxUjz7Xkjlcwp46NLci8ShBBgYIqRGI,718
|
|
6442
|
+
policyengine_us/variables/gov/states/id/tax/income/credits/2022_rebate/id_2022_rebate.py,sha256=YqeOhvCLtYkqsSORenn-jUvomeGshB7ooPhmjq0hXzc,632
|
|
6443
|
+
policyengine_us/variables/gov/states/id/tax/income/credits/2022_rebate/id_2022_rebate_floor.py,sha256=2eiEbuiXBKTSccvwRYeoRWXijsMtosEnND0yHN8QkME,288
|
|
6435
6444
|
policyengine_us/variables/gov/states/id/tax/income/credits/grocery/id_grocery_credit.py,sha256=UTAAx1T9gIFWPCjFXs2vhQ2rXlEOM0RnvkjXRzBQC9k,1064
|
|
6436
6445
|
policyengine_us/variables/gov/states/id/tax/income/credits/grocery/id_grocery_credit_aged.py,sha256=Ounu9koUqG6guzJJpxHRPr3XSV5t6qjhduTJq_hbVLM,850
|
|
6437
6446
|
policyengine_us/variables/gov/states/id/tax/income/credits/grocery/id_grocery_credit_base.py,sha256=0LIGHITHapIepN2WpJvnX8FDr9T-dm49SI6OwGacnVw,606
|
|
@@ -7845,9 +7854,6 @@ policyengine_us/variables/household/demographic/geographic/county/county_str.py,
|
|
|
7845
7854
|
policyengine_us/variables/household/demographic/geographic/county/first_county_in_state.py,sha256=yXCj-LVjxPeILIg42ijefTmi_j4NxJwX0kMtoE47xic,1578
|
|
7846
7855
|
policyengine_us/variables/household/demographic/geographic/state/average_home_energy_use_in_state.py,sha256=aaGYAXLU7tsx-A9NW4nyLij5J5mp0WTRXsyObngekvY,319
|
|
7847
7856
|
policyengine_us/variables/household/demographic/geographic/state/in_state.py,sha256=o3ksZCOHtlJ1JGHIXAPlqcs5-rVbTgOCcDdN1-fYqmA,551
|
|
7848
|
-
policyengine_us/variables/household/demographic/geographic/ucgid/ucgid.py,sha256=SwONHVRvHmUFHvPZQMYY7Y9e7gz74kisLjJICpHdyKg,2874
|
|
7849
|
-
policyengine_us/variables/household/demographic/geographic/ucgid/ucgid_enum.py,sha256=dkeusTBI1j4xAGmRFkfSsyT3Hq5gHZwRUkSeISeNbx0,15636
|
|
7850
|
-
policyengine_us/variables/household/demographic/geographic/ucgid/ucgid_str.py,sha256=GnIRg2tc0376YazPX7wm7YQgMQaYPm2Au47vc1E5JcM,914
|
|
7851
7857
|
policyengine_us/variables/household/demographic/geographic/zip_code/three_digit_zip_code.py,sha256=7q0FQRahTOINiK2vlAyHEa5xIKowM5Kgl60-kR3ZuWU,426
|
|
7852
7858
|
policyengine_us/variables/household/demographic/geographic/zip_code/zip_code.py,sha256=3J8RfnIIsmw4_5gF5yZHmATt2cNskyKQR0lncCvOQx0,1691
|
|
7853
7859
|
policyengine_us/variables/household/demographic/household/bedrooms.py,sha256=4ltdIRLdmeuTKAskn4pdgxZuxEE-4rz0ffPnIKobc-o,164
|
|
@@ -8295,11 +8301,11 @@ policyengine_us/variables/household/income/tax_unit/us_govt_interest.py,sha256=L
|
|
|
8295
8301
|
policyengine_us/variables/input/employment_income.py,sha256=f85M5Jy8kHmkDId0j9lCE30R6htNQ-Hg74ko9cLupmI,505
|
|
8296
8302
|
policyengine_us/variables/input/employment_income_before_lsr.py,sha256=X4PBfylDs40hw6jwHPL_B0JcBkqrKCFU-beQEDFoJTE,364
|
|
8297
8303
|
policyengine_us/variables/input/farm_income.py,sha256=BEKxYmHNNnWJAAvULl5qZJigy58ap_bmQB6iHdXLGuo,427
|
|
8298
|
-
policyengine_us/variables/input/geography.py,sha256=
|
|
8304
|
+
policyengine_us/variables/input/geography.py,sha256=Ux0ueAf0rhZaflyEqz81UuXP3xKCKBDvoO3CrKhiQEc,5421
|
|
8299
8305
|
policyengine_us/variables/input/self_employment_income.py,sha256=PwsGz8R4lRikKWUYOhsC0qosNNLXq4f5SQmfw4S3mk8,511
|
|
8300
8306
|
policyengine_us/variables/input/self_employment_income_before_lsr.py,sha256=E8fcX9Nlyqz8dziHhQv_euutdmoIwFMMWePUwbbwv_w,379
|
|
8301
|
-
policyengine_us-1.
|
|
8302
|
-
policyengine_us-1.
|
|
8303
|
-
policyengine_us-1.
|
|
8304
|
-
policyengine_us-1.
|
|
8305
|
-
policyengine_us-1.
|
|
8307
|
+
policyengine_us-1.383.0.dist-info/METADATA,sha256=OHHi_sCwaJcw2LBrsw8bG5acWDrtPQB6Yn6DKyxNSec,1649
|
|
8308
|
+
policyengine_us-1.383.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
8309
|
+
policyengine_us-1.383.0.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
|
|
8310
|
+
policyengine_us-1.383.0.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
|
|
8311
|
+
policyengine_us-1.383.0.dist-info/RECORD,,
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Test script demonstrating UCGID hierarchical functionality.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import numpy as np
|
|
6
|
-
from policyengine_us import Microsimulation
|
|
7
|
-
from policyengine_us.variables.household.demographic.geographic.ucgid.ucgid_enum import (
|
|
8
|
-
UCGID,
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class TestUCGIDHierarchical:
|
|
13
|
-
"""Test class for UCGID hierarchical functionality."""
|
|
14
|
-
|
|
15
|
-
def test_ucgid_enum_hierarchical_methods(self):
|
|
16
|
-
"""Test the hierarchical methods on UCGID enum values directly."""
|
|
17
|
-
print("\n=== Testing UCGID Enum Hierarchical Methods ===")
|
|
18
|
-
|
|
19
|
-
# Test Congressional District (CA_23)
|
|
20
|
-
ca_23 = UCGID.CA_23
|
|
21
|
-
ca_23_codes = ca_23.get_hierarchical_codes()
|
|
22
|
-
assert ca_23_codes == ["5001800US0623", "0400000US06", "0100000US"]
|
|
23
|
-
|
|
24
|
-
# Test State (CA)
|
|
25
|
-
ca = UCGID.CA
|
|
26
|
-
ca_codes = ca.get_hierarchical_codes()
|
|
27
|
-
assert ca_codes == ["0400000US06", "0100000US"]
|
|
28
|
-
|
|
29
|
-
# Test US
|
|
30
|
-
us = UCGID.US
|
|
31
|
-
us_codes = us.get_hierarchical_codes()
|
|
32
|
-
assert us_codes == ["0100000US"]
|
|
33
|
-
|
|
34
|
-
# Test hierarchy matching
|
|
35
|
-
assert ca_23.matches_hierarchy("0400000US06") == True
|
|
36
|
-
assert ca_23.matches_hierarchy("0100000US") == True
|
|
37
|
-
assert ca.matches_hierarchy("5001800US0623") == False
|
|
38
|
-
|
|
39
|
-
def test_ucgid_simulation_usage(self):
|
|
40
|
-
"""Test how UCGID is used in a PolicyEngine simulation."""
|
|
41
|
-
simulation = Microsimulation()
|
|
42
|
-
ucgid_values = simulation.calculate("ucgid", "2024")
|
|
43
|
-
|
|
44
|
-
# The UCGID value should be a string (enum name)
|
|
45
|
-
ucgid_string = ucgid_values.iloc[0] # First household
|
|
46
|
-
assert type(ucgid_string) == str
|
|
47
|
-
|
|
48
|
-
# Convert the string back to enum to access hierarchical methods
|
|
49
|
-
ucgid_enum = UCGID[ucgid_string]
|
|
50
|
-
hierarchical_codes = ucgid_enum.get_hierarchical_codes()
|
|
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
|
|
60
|
-
|
|
61
|
-
# Test hierarchy matching in simulation context
|
|
62
|
-
is_in_us = ucgid_enum.matches_hierarchy("0100000US")
|
|
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)
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
from policyengine_us.model_api import *
|
|
2
|
-
from policyengine_core.simulations import Simulation
|
|
3
|
-
from policyengine_us.variables.household.demographic.geographic.ucgid.ucgid_enum import (
|
|
4
|
-
UCGID,
|
|
5
|
-
)
|
|
6
|
-
import numpy as np
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ucgid(Variable):
|
|
10
|
-
value_type = Enum
|
|
11
|
-
possible_values = UCGID
|
|
12
|
-
default_value = UCGID.US
|
|
13
|
-
entity = Household
|
|
14
|
-
label = "Unified Congressional Geographic Identifier (UCGID)"
|
|
15
|
-
definition_period = YEAR
|
|
16
|
-
documentation = """
|
|
17
|
-
Unified Congressional Geographic Identifier (UCGID) for the household as defined by the U.S. Census Bureau.
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
def formula(household, period, parameters):
|
|
21
|
-
simulation: Simulation = household.simulation
|
|
22
|
-
|
|
23
|
-
# Check if this variable has been set as input
|
|
24
|
-
if simulation.get_holder("ucgid").get_known_periods():
|
|
25
|
-
return household("ucgid", period)
|
|
26
|
-
|
|
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()
|
|
30
|
-
|
|
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
|
-
}
|
|
85
|
-
|
|
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
|
-
|
|
94
|
-
return result
|
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
from policyengine_us.model_api import *
|
|
2
|
-
from typing import List
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class UCGID(Enum):
|
|
6
|
-
US = "0100000US"
|
|
7
|
-
AL = "0400000US01"
|
|
8
|
-
AK = "0400000US02"
|
|
9
|
-
AZ = "0400000US04"
|
|
10
|
-
AR = "0400000US05"
|
|
11
|
-
CA = "0400000US06"
|
|
12
|
-
CO = "0400000US08"
|
|
13
|
-
CT = "0400000US09"
|
|
14
|
-
DE = "0400000US10"
|
|
15
|
-
DC = "0400000US11"
|
|
16
|
-
FL = "0400000US12"
|
|
17
|
-
GA = "0400000US13"
|
|
18
|
-
HI = "0400000US15"
|
|
19
|
-
ID = "0400000US16"
|
|
20
|
-
IL = "0400000US17"
|
|
21
|
-
IN = "0400000US18"
|
|
22
|
-
IA = "0400000US19"
|
|
23
|
-
KS = "0400000US20"
|
|
24
|
-
KY = "0400000US21"
|
|
25
|
-
LA = "0400000US22"
|
|
26
|
-
ME = "0400000US23"
|
|
27
|
-
MD = "0400000US24"
|
|
28
|
-
MA = "0400000US25"
|
|
29
|
-
MI = "0400000US26"
|
|
30
|
-
MN = "0400000US27"
|
|
31
|
-
MS = "0400000US28"
|
|
32
|
-
MO = "0400000US29"
|
|
33
|
-
MT = "0400000US30"
|
|
34
|
-
NE = "0400000US31"
|
|
35
|
-
NV = "0400000US32"
|
|
36
|
-
NH = "0400000US33"
|
|
37
|
-
NJ = "0400000US34"
|
|
38
|
-
NM = "0400000US35"
|
|
39
|
-
NY = "0400000US36"
|
|
40
|
-
NC = "0400000US37"
|
|
41
|
-
ND = "0400000US38"
|
|
42
|
-
OH = "0400000US39"
|
|
43
|
-
OK = "0400000US40"
|
|
44
|
-
OR = "0400000US41"
|
|
45
|
-
PA = "0400000US42"
|
|
46
|
-
RI = "0400000US44"
|
|
47
|
-
SC = "0400000US45"
|
|
48
|
-
SD = "0400000US46"
|
|
49
|
-
TN = "0400000US47"
|
|
50
|
-
TX = "0400000US48"
|
|
51
|
-
UT = "0400000US49"
|
|
52
|
-
VT = "0400000US50"
|
|
53
|
-
VA = "0400000US51"
|
|
54
|
-
WA = "0400000US53"
|
|
55
|
-
WV = "0400000US54"
|
|
56
|
-
WI = "0400000US55"
|
|
57
|
-
WY = "0400000US56"
|
|
58
|
-
AL_01 = "5001800US0101"
|
|
59
|
-
AL_02 = "5001800US0102"
|
|
60
|
-
AL_03 = "5001800US0103"
|
|
61
|
-
AL_04 = "5001800US0104"
|
|
62
|
-
AL_05 = "5001800US0105"
|
|
63
|
-
AL_06 = "5001800US0106"
|
|
64
|
-
AL_07 = "5001800US0107"
|
|
65
|
-
AK_01 = "5001800US0200"
|
|
66
|
-
AZ_01 = "5001800US0401"
|
|
67
|
-
AZ_02 = "5001800US0402"
|
|
68
|
-
AZ_03 = "5001800US0403"
|
|
69
|
-
AZ_04 = "5001800US0404"
|
|
70
|
-
AZ_05 = "5001800US0405"
|
|
71
|
-
AZ_06 = "5001800US0406"
|
|
72
|
-
AZ_07 = "5001800US0407"
|
|
73
|
-
AZ_08 = "5001800US0408"
|
|
74
|
-
AZ_09 = "5001800US0409"
|
|
75
|
-
AR_01 = "5001800US0501"
|
|
76
|
-
AR_02 = "5001800US0502"
|
|
77
|
-
AR_03 = "5001800US0503"
|
|
78
|
-
AR_04 = "5001800US0504"
|
|
79
|
-
CA_01 = "5001800US0601"
|
|
80
|
-
CA_02 = "5001800US0602"
|
|
81
|
-
CA_03 = "5001800US0603"
|
|
82
|
-
CA_04 = "5001800US0604"
|
|
83
|
-
CA_05 = "5001800US0605"
|
|
84
|
-
CA_06 = "5001800US0606"
|
|
85
|
-
CA_07 = "5001800US0607"
|
|
86
|
-
CA_08 = "5001800US0608"
|
|
87
|
-
CA_09 = "5001800US0609"
|
|
88
|
-
CA_10 = "5001800US0610"
|
|
89
|
-
CA_11 = "5001800US0611"
|
|
90
|
-
CA_12 = "5001800US0612"
|
|
91
|
-
CA_13 = "5001800US0613"
|
|
92
|
-
CA_14 = "5001800US0614"
|
|
93
|
-
CA_15 = "5001800US0615"
|
|
94
|
-
CA_16 = "5001800US0616"
|
|
95
|
-
CA_17 = "5001800US0617"
|
|
96
|
-
CA_18 = "5001800US0618"
|
|
97
|
-
CA_19 = "5001800US0619"
|
|
98
|
-
CA_20 = "5001800US0620"
|
|
99
|
-
CA_21 = "5001800US0621"
|
|
100
|
-
CA_22 = "5001800US0622"
|
|
101
|
-
CA_23 = "5001800US0623"
|
|
102
|
-
CA_24 = "5001800US0624"
|
|
103
|
-
CA_25 = "5001800US0625"
|
|
104
|
-
CA_26 = "5001800US0626"
|
|
105
|
-
CA_27 = "5001800US0627"
|
|
106
|
-
CA_28 = "5001800US0628"
|
|
107
|
-
CA_29 = "5001800US0629"
|
|
108
|
-
CA_30 = "5001800US0630"
|
|
109
|
-
CA_31 = "5001800US0631"
|
|
110
|
-
CA_32 = "5001800US0632"
|
|
111
|
-
CA_33 = "5001800US0633"
|
|
112
|
-
CA_34 = "5001800US0634"
|
|
113
|
-
CA_35 = "5001800US0635"
|
|
114
|
-
CA_36 = "5001800US0636"
|
|
115
|
-
CA_37 = "5001800US0637"
|
|
116
|
-
CA_38 = "5001800US0638"
|
|
117
|
-
CA_39 = "5001800US0639"
|
|
118
|
-
CA_40 = "5001800US0640"
|
|
119
|
-
CA_41 = "5001800US0641"
|
|
120
|
-
CA_42 = "5001800US0642"
|
|
121
|
-
CA_43 = "5001800US0643"
|
|
122
|
-
CA_44 = "5001800US0644"
|
|
123
|
-
CA_45 = "5001800US0645"
|
|
124
|
-
CA_46 = "5001800US0646"
|
|
125
|
-
CA_47 = "5001800US0647"
|
|
126
|
-
CA_48 = "5001800US0648"
|
|
127
|
-
CA_49 = "5001800US0649"
|
|
128
|
-
CA_50 = "5001800US0650"
|
|
129
|
-
CA_51 = "5001800US0651"
|
|
130
|
-
CA_52 = "5001800US0652"
|
|
131
|
-
CO_01 = "5001800US0801"
|
|
132
|
-
CO_02 = "5001800US0802"
|
|
133
|
-
CO_03 = "5001800US0803"
|
|
134
|
-
CO_04 = "5001800US0804"
|
|
135
|
-
CO_05 = "5001800US0805"
|
|
136
|
-
CO_06 = "5001800US0806"
|
|
137
|
-
CO_07 = "5001800US0807"
|
|
138
|
-
CO_08 = "5001800US0808"
|
|
139
|
-
CT_01 = "5001800US0901"
|
|
140
|
-
CT_02 = "5001800US0902"
|
|
141
|
-
CT_03 = "5001800US0903"
|
|
142
|
-
CT_04 = "5001800US0904"
|
|
143
|
-
CT_05 = "5001800US0905"
|
|
144
|
-
DE_01 = "5001800US1000"
|
|
145
|
-
DC_01 = "5001800US1198"
|
|
146
|
-
FL_01 = "5001800US1201"
|
|
147
|
-
FL_02 = "5001800US1202"
|
|
148
|
-
FL_03 = "5001800US1203"
|
|
149
|
-
FL_04 = "5001800US1204"
|
|
150
|
-
FL_05 = "5001800US1205"
|
|
151
|
-
FL_06 = "5001800US1206"
|
|
152
|
-
FL_07 = "5001800US1207"
|
|
153
|
-
FL_08 = "5001800US1208"
|
|
154
|
-
FL_09 = "5001800US1209"
|
|
155
|
-
FL_10 = "5001800US1210"
|
|
156
|
-
FL_11 = "5001800US1211"
|
|
157
|
-
FL_12 = "5001800US1212"
|
|
158
|
-
FL_13 = "5001800US1213"
|
|
159
|
-
FL_14 = "5001800US1214"
|
|
160
|
-
FL_15 = "5001800US1215"
|
|
161
|
-
FL_16 = "5001800US1216"
|
|
162
|
-
FL_17 = "5001800US1217"
|
|
163
|
-
FL_18 = "5001800US1218"
|
|
164
|
-
FL_19 = "5001800US1219"
|
|
165
|
-
FL_20 = "5001800US1220"
|
|
166
|
-
FL_21 = "5001800US1221"
|
|
167
|
-
FL_22 = "5001800US1222"
|
|
168
|
-
FL_23 = "5001800US1223"
|
|
169
|
-
FL_24 = "5001800US1224"
|
|
170
|
-
FL_25 = "5001800US1225"
|
|
171
|
-
FL_26 = "5001800US1226"
|
|
172
|
-
FL_27 = "5001800US1227"
|
|
173
|
-
FL_28 = "5001800US1228"
|
|
174
|
-
GA_01 = "5001800US1301"
|
|
175
|
-
GA_02 = "5001800US1302"
|
|
176
|
-
GA_03 = "5001800US1303"
|
|
177
|
-
GA_04 = "5001800US1304"
|
|
178
|
-
GA_05 = "5001800US1305"
|
|
179
|
-
GA_06 = "5001800US1306"
|
|
180
|
-
GA_07 = "5001800US1307"
|
|
181
|
-
GA_08 = "5001800US1308"
|
|
182
|
-
GA_09 = "5001800US1309"
|
|
183
|
-
GA_10 = "5001800US1310"
|
|
184
|
-
GA_11 = "5001800US1311"
|
|
185
|
-
GA_12 = "5001800US1312"
|
|
186
|
-
GA_13 = "5001800US1313"
|
|
187
|
-
GA_14 = "5001800US1314"
|
|
188
|
-
HI_01 = "5001800US1501"
|
|
189
|
-
HI_02 = "5001800US1502"
|
|
190
|
-
ID_01 = "5001800US1601"
|
|
191
|
-
ID_02 = "5001800US1602"
|
|
192
|
-
IL_01 = "5001800US1701"
|
|
193
|
-
IL_02 = "5001800US1702"
|
|
194
|
-
IL_03 = "5001800US1703"
|
|
195
|
-
IL_04 = "5001800US1704"
|
|
196
|
-
IL_05 = "5001800US1705"
|
|
197
|
-
IL_06 = "5001800US1706"
|
|
198
|
-
IL_07 = "5001800US1707"
|
|
199
|
-
IL_08 = "5001800US1708"
|
|
200
|
-
IL_09 = "5001800US1709"
|
|
201
|
-
IL_10 = "5001800US1710"
|
|
202
|
-
IL_11 = "5001800US1711"
|
|
203
|
-
IL_12 = "5001800US1712"
|
|
204
|
-
IL_13 = "5001800US1713"
|
|
205
|
-
IL_14 = "5001800US1714"
|
|
206
|
-
IL_15 = "5001800US1715"
|
|
207
|
-
IL_16 = "5001800US1716"
|
|
208
|
-
IL_17 = "5001800US1717"
|
|
209
|
-
IN_01 = "5001800US1801"
|
|
210
|
-
IN_02 = "5001800US1802"
|
|
211
|
-
IN_03 = "5001800US1803"
|
|
212
|
-
IN_04 = "5001800US1804"
|
|
213
|
-
IN_05 = "5001800US1805"
|
|
214
|
-
IN_06 = "5001800US1806"
|
|
215
|
-
IN_07 = "5001800US1807"
|
|
216
|
-
IN_08 = "5001800US1808"
|
|
217
|
-
IN_09 = "5001800US1809"
|
|
218
|
-
IA_01 = "5001800US1901"
|
|
219
|
-
IA_02 = "5001800US1902"
|
|
220
|
-
IA_03 = "5001800US1903"
|
|
221
|
-
IA_04 = "5001800US1904"
|
|
222
|
-
KS_01 = "5001800US2001"
|
|
223
|
-
KS_02 = "5001800US2002"
|
|
224
|
-
KS_03 = "5001800US2003"
|
|
225
|
-
KS_04 = "5001800US2004"
|
|
226
|
-
KY_01 = "5001800US2101"
|
|
227
|
-
KY_02 = "5001800US2102"
|
|
228
|
-
KY_03 = "5001800US2103"
|
|
229
|
-
KY_04 = "5001800US2104"
|
|
230
|
-
KY_05 = "5001800US2105"
|
|
231
|
-
KY_06 = "5001800US2106"
|
|
232
|
-
LA_01 = "5001800US2201"
|
|
233
|
-
LA_02 = "5001800US2202"
|
|
234
|
-
LA_03 = "5001800US2203"
|
|
235
|
-
LA_04 = "5001800US2204"
|
|
236
|
-
LA_05 = "5001800US2205"
|
|
237
|
-
LA_06 = "5001800US2206"
|
|
238
|
-
ME_01 = "5001800US2301"
|
|
239
|
-
ME_02 = "5001800US2302"
|
|
240
|
-
MD_01 = "5001800US2401"
|
|
241
|
-
MD_02 = "5001800US2402"
|
|
242
|
-
MD_03 = "5001800US2403"
|
|
243
|
-
MD_04 = "5001800US2404"
|
|
244
|
-
MD_05 = "5001800US2405"
|
|
245
|
-
MD_06 = "5001800US2406"
|
|
246
|
-
MD_07 = "5001800US2407"
|
|
247
|
-
MD_08 = "5001800US2408"
|
|
248
|
-
MA_01 = "5001800US2501"
|
|
249
|
-
MA_02 = "5001800US2502"
|
|
250
|
-
MA_03 = "5001800US2503"
|
|
251
|
-
MA_04 = "5001800US2504"
|
|
252
|
-
MA_05 = "5001800US2505"
|
|
253
|
-
MA_06 = "5001800US2506"
|
|
254
|
-
MA_07 = "5001800US2507"
|
|
255
|
-
MA_08 = "5001800US2508"
|
|
256
|
-
MA_09 = "5001800US2509"
|
|
257
|
-
MI_01 = "5001800US2601"
|
|
258
|
-
MI_02 = "5001800US2602"
|
|
259
|
-
MI_03 = "5001800US2603"
|
|
260
|
-
MI_04 = "5001800US2604"
|
|
261
|
-
MI_05 = "5001800US2605"
|
|
262
|
-
MI_06 = "5001800US2606"
|
|
263
|
-
MI_07 = "5001800US2607"
|
|
264
|
-
MI_08 = "5001800US2608"
|
|
265
|
-
MI_09 = "5001800US2609"
|
|
266
|
-
MI_10 = "5001800US2610"
|
|
267
|
-
MI_11 = "5001800US2611"
|
|
268
|
-
MI_12 = "5001800US2612"
|
|
269
|
-
MI_13 = "5001800US2613"
|
|
270
|
-
MN_01 = "5001800US2701"
|
|
271
|
-
MN_02 = "5001800US2702"
|
|
272
|
-
MN_03 = "5001800US2703"
|
|
273
|
-
MN_04 = "5001800US2704"
|
|
274
|
-
MN_05 = "5001800US2705"
|
|
275
|
-
MN_06 = "5001800US2706"
|
|
276
|
-
MN_07 = "5001800US2707"
|
|
277
|
-
MN_08 = "5001800US2708"
|
|
278
|
-
MS_01 = "5001800US2801"
|
|
279
|
-
MS_02 = "5001800US2802"
|
|
280
|
-
MS_03 = "5001800US2803"
|
|
281
|
-
MS_04 = "5001800US2804"
|
|
282
|
-
MO_01 = "5001800US2901"
|
|
283
|
-
MO_02 = "5001800US2902"
|
|
284
|
-
MO_03 = "5001800US2903"
|
|
285
|
-
MO_04 = "5001800US2904"
|
|
286
|
-
MO_05 = "5001800US2905"
|
|
287
|
-
MO_06 = "5001800US2906"
|
|
288
|
-
MO_07 = "5001800US2907"
|
|
289
|
-
MO_08 = "5001800US2908"
|
|
290
|
-
MT_01 = "5001800US3001"
|
|
291
|
-
MT_02 = "5001800US3002"
|
|
292
|
-
NE_01 = "5001800US3101"
|
|
293
|
-
NE_02 = "5001800US3102"
|
|
294
|
-
NE_03 = "5001800US3103"
|
|
295
|
-
NV_01 = "5001800US3201"
|
|
296
|
-
NV_02 = "5001800US3202"
|
|
297
|
-
NV_03 = "5001800US3203"
|
|
298
|
-
NV_04 = "5001800US3204"
|
|
299
|
-
NH_01 = "5001800US3301"
|
|
300
|
-
NH_02 = "5001800US3302"
|
|
301
|
-
NJ_01 = "5001800US3401"
|
|
302
|
-
NJ_02 = "5001800US3402"
|
|
303
|
-
NJ_03 = "5001800US3403"
|
|
304
|
-
NJ_04 = "5001800US3404"
|
|
305
|
-
NJ_05 = "5001800US3405"
|
|
306
|
-
NJ_06 = "5001800US3406"
|
|
307
|
-
NJ_07 = "5001800US3407"
|
|
308
|
-
NJ_08 = "5001800US3408"
|
|
309
|
-
NJ_09 = "5001800US3409"
|
|
310
|
-
NJ_10 = "5001800US3410"
|
|
311
|
-
NJ_11 = "5001800US3411"
|
|
312
|
-
NJ_12 = "5001800US3412"
|
|
313
|
-
NM_01 = "5001800US3501"
|
|
314
|
-
NM_02 = "5001800US3502"
|
|
315
|
-
NM_03 = "5001800US3503"
|
|
316
|
-
NY_01 = "5001800US3601"
|
|
317
|
-
NY_02 = "5001800US3602"
|
|
318
|
-
NY_03 = "5001800US3603"
|
|
319
|
-
NY_04 = "5001800US3604"
|
|
320
|
-
NY_05 = "5001800US3605"
|
|
321
|
-
NY_06 = "5001800US3606"
|
|
322
|
-
NY_07 = "5001800US3607"
|
|
323
|
-
NY_08 = "5001800US3608"
|
|
324
|
-
NY_09 = "5001800US3609"
|
|
325
|
-
NY_10 = "5001800US3610"
|
|
326
|
-
NY_11 = "5001800US3611"
|
|
327
|
-
NY_12 = "5001800US3612"
|
|
328
|
-
NY_13 = "5001800US3613"
|
|
329
|
-
NY_14 = "5001800US3614"
|
|
330
|
-
NY_15 = "5001800US3615"
|
|
331
|
-
NY_16 = "5001800US3616"
|
|
332
|
-
NY_17 = "5001800US3617"
|
|
333
|
-
NY_18 = "5001800US3618"
|
|
334
|
-
NY_19 = "5001800US3619"
|
|
335
|
-
NY_20 = "5001800US3620"
|
|
336
|
-
NY_21 = "5001800US3621"
|
|
337
|
-
NY_22 = "5001800US3622"
|
|
338
|
-
NY_23 = "5001800US3623"
|
|
339
|
-
NY_24 = "5001800US3624"
|
|
340
|
-
NY_25 = "5001800US3625"
|
|
341
|
-
NY_26 = "5001800US3626"
|
|
342
|
-
NC_01 = "5001800US3701"
|
|
343
|
-
NC_02 = "5001800US3702"
|
|
344
|
-
NC_03 = "5001800US3703"
|
|
345
|
-
NC_04 = "5001800US3704"
|
|
346
|
-
NC_05 = "5001800US3705"
|
|
347
|
-
NC_06 = "5001800US3706"
|
|
348
|
-
NC_07 = "5001800US3707"
|
|
349
|
-
NC_08 = "5001800US3708"
|
|
350
|
-
NC_09 = "5001800US3709"
|
|
351
|
-
NC_10 = "5001800US3710"
|
|
352
|
-
NC_11 = "5001800US3711"
|
|
353
|
-
NC_12 = "5001800US3712"
|
|
354
|
-
NC_13 = "5001800US3713"
|
|
355
|
-
NC_14 = "5001800US3714"
|
|
356
|
-
ND_01 = "5001800US3800"
|
|
357
|
-
OH_01 = "5001800US3901"
|
|
358
|
-
OH_02 = "5001800US3902"
|
|
359
|
-
OH_03 = "5001800US3903"
|
|
360
|
-
OH_04 = "5001800US3904"
|
|
361
|
-
OH_05 = "5001800US3905"
|
|
362
|
-
OH_06 = "5001800US3906"
|
|
363
|
-
OH_07 = "5001800US3907"
|
|
364
|
-
OH_08 = "5001800US3908"
|
|
365
|
-
OH_09 = "5001800US3909"
|
|
366
|
-
OH_10 = "5001800US3910"
|
|
367
|
-
OH_11 = "5001800US3911"
|
|
368
|
-
OH_12 = "5001800US3912"
|
|
369
|
-
OH_13 = "5001800US3913"
|
|
370
|
-
OH_14 = "5001800US3914"
|
|
371
|
-
OH_15 = "5001800US3915"
|
|
372
|
-
OK_01 = "5001800US4001"
|
|
373
|
-
OK_02 = "5001800US4002"
|
|
374
|
-
OK_03 = "5001800US4003"
|
|
375
|
-
OK_04 = "5001800US4004"
|
|
376
|
-
OK_05 = "5001800US4005"
|
|
377
|
-
OR_01 = "5001800US4101"
|
|
378
|
-
OR_02 = "5001800US4102"
|
|
379
|
-
OR_03 = "5001800US4103"
|
|
380
|
-
OR_04 = "5001800US4104"
|
|
381
|
-
OR_05 = "5001800US4105"
|
|
382
|
-
OR_06 = "5001800US4106"
|
|
383
|
-
PA_01 = "5001800US4201"
|
|
384
|
-
PA_02 = "5001800US4202"
|
|
385
|
-
PA_03 = "5001800US4203"
|
|
386
|
-
PA_04 = "5001800US4204"
|
|
387
|
-
PA_05 = "5001800US4205"
|
|
388
|
-
PA_06 = "5001800US4206"
|
|
389
|
-
PA_07 = "5001800US4207"
|
|
390
|
-
PA_08 = "5001800US4208"
|
|
391
|
-
PA_09 = "5001800US4209"
|
|
392
|
-
PA_10 = "5001800US4210"
|
|
393
|
-
PA_11 = "5001800US4211"
|
|
394
|
-
PA_12 = "5001800US4212"
|
|
395
|
-
PA_13 = "5001800US4213"
|
|
396
|
-
PA_14 = "5001800US4214"
|
|
397
|
-
PA_15 = "5001800US4215"
|
|
398
|
-
PA_16 = "5001800US4216"
|
|
399
|
-
PA_17 = "5001800US4217"
|
|
400
|
-
RI_01 = "5001800US4401"
|
|
401
|
-
RI_02 = "5001800US4402"
|
|
402
|
-
SC_01 = "5001800US4501"
|
|
403
|
-
SC_02 = "5001800US4502"
|
|
404
|
-
SC_03 = "5001800US4503"
|
|
405
|
-
SC_04 = "5001800US4504"
|
|
406
|
-
SC_05 = "5001800US4505"
|
|
407
|
-
SC_06 = "5001800US4506"
|
|
408
|
-
SC_07 = "5001800US4507"
|
|
409
|
-
SD_01 = "5001800US4600"
|
|
410
|
-
TN_01 = "5001800US4701"
|
|
411
|
-
TN_02 = "5001800US4702"
|
|
412
|
-
TN_03 = "5001800US4703"
|
|
413
|
-
TN_04 = "5001800US4704"
|
|
414
|
-
TN_05 = "5001800US4705"
|
|
415
|
-
TN_06 = "5001800US4706"
|
|
416
|
-
TN_07 = "5001800US4707"
|
|
417
|
-
TN_08 = "5001800US4708"
|
|
418
|
-
TN_09 = "5001800US4709"
|
|
419
|
-
TX_01 = "5001800US4801"
|
|
420
|
-
TX_02 = "5001800US4802"
|
|
421
|
-
TX_03 = "5001800US4803"
|
|
422
|
-
TX_04 = "5001800US4804"
|
|
423
|
-
TX_05 = "5001800US4805"
|
|
424
|
-
TX_06 = "5001800US4806"
|
|
425
|
-
TX_07 = "5001800US4807"
|
|
426
|
-
TX_08 = "5001800US4808"
|
|
427
|
-
TX_09 = "5001800US4809"
|
|
428
|
-
TX_10 = "5001800US4810"
|
|
429
|
-
TX_11 = "5001800US4811"
|
|
430
|
-
TX_12 = "5001800US4812"
|
|
431
|
-
TX_13 = "5001800US4813"
|
|
432
|
-
TX_14 = "5001800US4814"
|
|
433
|
-
TX_15 = "5001800US4815"
|
|
434
|
-
TX_16 = "5001800US4816"
|
|
435
|
-
TX_17 = "5001800US4817"
|
|
436
|
-
TX_18 = "5001800US4818"
|
|
437
|
-
TX_19 = "5001800US4819"
|
|
438
|
-
TX_20 = "5001800US4820"
|
|
439
|
-
TX_21 = "5001800US4821"
|
|
440
|
-
TX_22 = "5001800US4822"
|
|
441
|
-
TX_23 = "5001800US4823"
|
|
442
|
-
TX_24 = "5001800US4824"
|
|
443
|
-
TX_25 = "5001800US4825"
|
|
444
|
-
TX_26 = "5001800US4826"
|
|
445
|
-
TX_27 = "5001800US4827"
|
|
446
|
-
TX_28 = "5001800US4828"
|
|
447
|
-
TX_29 = "5001800US4829"
|
|
448
|
-
TX_30 = "5001800US4830"
|
|
449
|
-
TX_31 = "5001800US4831"
|
|
450
|
-
TX_32 = "5001800US4832"
|
|
451
|
-
TX_33 = "5001800US4833"
|
|
452
|
-
TX_34 = "5001800US4834"
|
|
453
|
-
TX_35 = "5001800US4835"
|
|
454
|
-
TX_36 = "5001800US4836"
|
|
455
|
-
TX_37 = "5001800US4837"
|
|
456
|
-
TX_38 = "5001800US4838"
|
|
457
|
-
UT_01 = "5001800US4901"
|
|
458
|
-
UT_02 = "5001800US4902"
|
|
459
|
-
UT_03 = "5001800US4903"
|
|
460
|
-
UT_04 = "5001800US4904"
|
|
461
|
-
VT_01 = "5001800US5000"
|
|
462
|
-
VA_01 = "5001800US5101"
|
|
463
|
-
VA_02 = "5001800US5102"
|
|
464
|
-
VA_03 = "5001800US5103"
|
|
465
|
-
VA_04 = "5001800US5104"
|
|
466
|
-
VA_05 = "5001800US5105"
|
|
467
|
-
VA_06 = "5001800US5106"
|
|
468
|
-
VA_07 = "5001800US5107"
|
|
469
|
-
VA_08 = "5001800US5108"
|
|
470
|
-
VA_09 = "5001800US5109"
|
|
471
|
-
VA_10 = "5001800US5110"
|
|
472
|
-
VA_11 = "5001800US5111"
|
|
473
|
-
WA_01 = "5001800US5301"
|
|
474
|
-
WA_02 = "5001800US5302"
|
|
475
|
-
WA_03 = "5001800US5303"
|
|
476
|
-
WA_04 = "5001800US5304"
|
|
477
|
-
WA_05 = "5001800US5305"
|
|
478
|
-
WA_06 = "5001800US5306"
|
|
479
|
-
WA_07 = "5001800US5307"
|
|
480
|
-
WA_08 = "5001800US5308"
|
|
481
|
-
WA_09 = "5001800US5309"
|
|
482
|
-
WA_10 = "5001800US5310"
|
|
483
|
-
WV_01 = "5001800US5401"
|
|
484
|
-
WV_02 = "5001800US5402"
|
|
485
|
-
WI_01 = "5001800US5501"
|
|
486
|
-
WI_02 = "5001800US5502"
|
|
487
|
-
WI_03 = "5001800US5503"
|
|
488
|
-
WI_04 = "5001800US5504"
|
|
489
|
-
WI_05 = "5001800US5505"
|
|
490
|
-
WI_06 = "5001800US5506"
|
|
491
|
-
WI_07 = "5001800US5507"
|
|
492
|
-
WI_08 = "5001800US5508"
|
|
493
|
-
WY_01 = "5001800US5600"
|
|
494
|
-
|
|
495
|
-
def get_hierarchical_codes(self) -> List[str]:
|
|
496
|
-
"""
|
|
497
|
-
Returns all applicable UCGID codes for this enum value in hierarchical order.
|
|
498
|
-
|
|
499
|
-
Returns:
|
|
500
|
-
List of UCGID codes from most specific to least specific
|
|
501
|
-
|
|
502
|
-
Examples:
|
|
503
|
-
UCGID.CA_23.get_hierarchical_codes() -> ["5001800US0623", "0400000US06", "0100000US"]
|
|
504
|
-
UCGID.CA.get_hierarchical_codes() -> ["0400000US06", "0100000US"]
|
|
505
|
-
UCGID.US.get_hierarchical_codes() -> ["0100000US"]
|
|
506
|
-
"""
|
|
507
|
-
code = self.value
|
|
508
|
-
codes_list = [code]
|
|
509
|
-
|
|
510
|
-
# If it's a district code (Congressional District format: 5001800US + state + district)
|
|
511
|
-
if code.startswith("5001800US"):
|
|
512
|
-
# Extract state code from district code
|
|
513
|
-
state_code_num = code[9:11] # Extract 2-digit state code
|
|
514
|
-
state_code = f"0400000US{state_code_num}"
|
|
515
|
-
|
|
516
|
-
# Add state code if it exists in the enum
|
|
517
|
-
for state_enum in UCGID:
|
|
518
|
-
if state_enum.value == state_code:
|
|
519
|
-
codes_list.append(state_code)
|
|
520
|
-
break
|
|
521
|
-
|
|
522
|
-
# Add US code
|
|
523
|
-
codes_list.append("0100000US")
|
|
524
|
-
|
|
525
|
-
# If it's a state code (State format: 0400000US + state code)
|
|
526
|
-
elif code.startswith("0400000US"):
|
|
527
|
-
# Add US code
|
|
528
|
-
codes_list.append("0100000US")
|
|
529
|
-
|
|
530
|
-
# If it's already the US code, return as-is
|
|
531
|
-
# (US code: "0100000US")
|
|
532
|
-
|
|
533
|
-
return codes_list
|
|
534
|
-
|
|
535
|
-
def matches_hierarchy(self, target_code: str) -> bool:
|
|
536
|
-
"""
|
|
537
|
-
Check if this UCGID code matches a target code in the hierarchy.
|
|
538
|
-
|
|
539
|
-
Args:
|
|
540
|
-
target_code: The target code to match against
|
|
541
|
-
|
|
542
|
-
Returns:
|
|
543
|
-
True if this code belongs to the target code's hierarchy
|
|
544
|
-
|
|
545
|
-
Examples:
|
|
546
|
-
UCGID.CA_23.matches_hierarchy("0400000US06") -> True (CA_23 is in CA)
|
|
547
|
-
UCGID.CA_23.matches_hierarchy("0100000US") -> True (CA_23 is in US)
|
|
548
|
-
UCGID.CA.matches_hierarchy("5001800US0623") -> False (CA is not CA_23)
|
|
549
|
-
"""
|
|
550
|
-
hierarchical_codes = self.get_hierarchical_codes()
|
|
551
|
-
return target_code in hierarchical_codes
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
from policyengine_us.model_api import *
|
|
2
|
-
from policyengine_us.variables.household.demographic.geographic.ucgid.ucgid_enum import (
|
|
3
|
-
UCGID,
|
|
4
|
-
)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ucgid_str(Variable):
|
|
8
|
-
value_type = str
|
|
9
|
-
entity = Household
|
|
10
|
-
label = "UCGID (string)"
|
|
11
|
-
documentation = "UCGID variable, stored as a string"
|
|
12
|
-
definition_period = YEAR
|
|
13
|
-
|
|
14
|
-
def formula(household, period, parameters):
|
|
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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|