policyengine 3.1.2__py3-none-any.whl → 3.1.3__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.
- policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
- policyengine/tax_benefit_models/uk/model.py +68 -68
- policyengine/tax_benefit_models/us/model.py +54 -54
- {policyengine-3.1.2.dist-info → policyengine-3.1.3.dist-info}/METADATA +1 -1
- {policyengine-3.1.2.dist-info → policyengine-3.1.3.dist-info}/RECORD +8 -8
- {policyengine-3.1.2.dist-info → policyengine-3.1.3.dist-info}/WHEEL +0 -0
- {policyengine-3.1.2.dist-info → policyengine-3.1.3.dist-info}/licenses/LICENSE +0 -0
- {policyengine-3.1.2.dist-info → policyengine-3.1.3.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
@@ -44,6 +44,73 @@ class PolicyEngineUKLatest(TaxBenefitModelVersion):
|
|
|
44
44
|
upload_time
|
|
45
45
|
)
|
|
46
46
|
|
|
47
|
+
entity_variables: dict[str, list[str]] = {
|
|
48
|
+
"person": [
|
|
49
|
+
# IDs and weights
|
|
50
|
+
"person_id",
|
|
51
|
+
"benunit_id",
|
|
52
|
+
"household_id",
|
|
53
|
+
"person_weight",
|
|
54
|
+
# Demographics
|
|
55
|
+
"age",
|
|
56
|
+
"gender",
|
|
57
|
+
"is_adult",
|
|
58
|
+
"is_SP_age",
|
|
59
|
+
"is_child",
|
|
60
|
+
# Income
|
|
61
|
+
"employment_income",
|
|
62
|
+
"self_employment_income",
|
|
63
|
+
"pension_income",
|
|
64
|
+
"private_pension_income",
|
|
65
|
+
"savings_interest_income",
|
|
66
|
+
"dividend_income",
|
|
67
|
+
"property_income",
|
|
68
|
+
"total_income",
|
|
69
|
+
"earned_income",
|
|
70
|
+
# Benefits
|
|
71
|
+
"universal_credit",
|
|
72
|
+
"child_benefit",
|
|
73
|
+
"pension_credit",
|
|
74
|
+
"income_support",
|
|
75
|
+
"working_tax_credit",
|
|
76
|
+
"child_tax_credit",
|
|
77
|
+
# Tax
|
|
78
|
+
"income_tax",
|
|
79
|
+
"national_insurance",
|
|
80
|
+
],
|
|
81
|
+
"benunit": [
|
|
82
|
+
# IDs and weights
|
|
83
|
+
"benunit_id",
|
|
84
|
+
"benunit_weight",
|
|
85
|
+
# Structure
|
|
86
|
+
"family_type",
|
|
87
|
+
# Income and benefits
|
|
88
|
+
"universal_credit",
|
|
89
|
+
"child_benefit",
|
|
90
|
+
"working_tax_credit",
|
|
91
|
+
"child_tax_credit",
|
|
92
|
+
],
|
|
93
|
+
"household": [
|
|
94
|
+
# IDs and weights
|
|
95
|
+
"household_id",
|
|
96
|
+
"household_weight",
|
|
97
|
+
# Income measures
|
|
98
|
+
"household_net_income",
|
|
99
|
+
"hbai_household_net_income",
|
|
100
|
+
"equiv_hbai_household_net_income",
|
|
101
|
+
"household_market_income",
|
|
102
|
+
"household_gross_income",
|
|
103
|
+
# Benefits and tax
|
|
104
|
+
"household_benefits",
|
|
105
|
+
"household_tax",
|
|
106
|
+
"vat",
|
|
107
|
+
# Housing
|
|
108
|
+
"rent",
|
|
109
|
+
"council_tax",
|
|
110
|
+
"tenure_type",
|
|
111
|
+
],
|
|
112
|
+
}
|
|
113
|
+
|
|
47
114
|
def __init__(self, **kwargs: dict):
|
|
48
115
|
super().__init__(**kwargs)
|
|
49
116
|
from policyengine_core.enums import Enum
|
|
@@ -153,80 +220,13 @@ class PolicyEngineUKLatest(TaxBenefitModelVersion):
|
|
|
153
220
|
)
|
|
154
221
|
modifier(microsim)
|
|
155
222
|
|
|
156
|
-
entity_variables = {
|
|
157
|
-
"person": [
|
|
158
|
-
# IDs and weights
|
|
159
|
-
"person_id",
|
|
160
|
-
"benunit_id",
|
|
161
|
-
"household_id",
|
|
162
|
-
"person_weight",
|
|
163
|
-
# Demographics
|
|
164
|
-
"age",
|
|
165
|
-
"gender",
|
|
166
|
-
"is_adult",
|
|
167
|
-
"is_SP_age",
|
|
168
|
-
"is_child",
|
|
169
|
-
# Income
|
|
170
|
-
"employment_income",
|
|
171
|
-
"self_employment_income",
|
|
172
|
-
"pension_income",
|
|
173
|
-
"private_pension_income",
|
|
174
|
-
"savings_interest_income",
|
|
175
|
-
"dividend_income",
|
|
176
|
-
"property_income",
|
|
177
|
-
"total_income",
|
|
178
|
-
"earned_income",
|
|
179
|
-
# Benefits
|
|
180
|
-
"universal_credit",
|
|
181
|
-
"child_benefit",
|
|
182
|
-
"pension_credit",
|
|
183
|
-
"income_support",
|
|
184
|
-
"working_tax_credit",
|
|
185
|
-
"child_tax_credit",
|
|
186
|
-
# Tax
|
|
187
|
-
"income_tax",
|
|
188
|
-
"national_insurance",
|
|
189
|
-
],
|
|
190
|
-
"benunit": [
|
|
191
|
-
# IDs and weights
|
|
192
|
-
"benunit_id",
|
|
193
|
-
"benunit_weight",
|
|
194
|
-
# Structure
|
|
195
|
-
"family_type",
|
|
196
|
-
# Income and benefits
|
|
197
|
-
"universal_credit",
|
|
198
|
-
"child_benefit",
|
|
199
|
-
"working_tax_credit",
|
|
200
|
-
"child_tax_credit",
|
|
201
|
-
],
|
|
202
|
-
"household": [
|
|
203
|
-
# IDs and weights
|
|
204
|
-
"household_id",
|
|
205
|
-
"household_weight",
|
|
206
|
-
# Income measures
|
|
207
|
-
"household_net_income",
|
|
208
|
-
"hbai_household_net_income",
|
|
209
|
-
"equiv_hbai_household_net_income",
|
|
210
|
-
"household_market_income",
|
|
211
|
-
"household_gross_income",
|
|
212
|
-
# Benefits and tax
|
|
213
|
-
"household_benefits",
|
|
214
|
-
"household_tax",
|
|
215
|
-
"vat",
|
|
216
|
-
# Housing
|
|
217
|
-
"rent",
|
|
218
|
-
"council_tax",
|
|
219
|
-
"tenure_type",
|
|
220
|
-
],
|
|
221
|
-
}
|
|
222
|
-
|
|
223
223
|
data = {
|
|
224
224
|
"person": pd.DataFrame(),
|
|
225
225
|
"benunit": pd.DataFrame(),
|
|
226
226
|
"household": pd.DataFrame(),
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
for entity, variables in entity_variables.items():
|
|
229
|
+
for entity, variables in self.entity_variables.items():
|
|
230
230
|
for var in variables:
|
|
231
231
|
data[entity][var] = microsim.calculate(
|
|
232
232
|
var, period=simulation.dataset.year, map_to=entity
|
|
@@ -45,6 +45,59 @@ class PolicyEngineUSLatest(TaxBenefitModelVersion):
|
|
|
45
45
|
version: str = None
|
|
46
46
|
created_at: datetime.datetime = None
|
|
47
47
|
|
|
48
|
+
entity_variables: dict[str, list[str]] = {
|
|
49
|
+
"person": [
|
|
50
|
+
# IDs and weights
|
|
51
|
+
"person_id",
|
|
52
|
+
"marital_unit_id",
|
|
53
|
+
"family_id",
|
|
54
|
+
"spm_unit_id",
|
|
55
|
+
"tax_unit_id",
|
|
56
|
+
"household_id",
|
|
57
|
+
"person_weight",
|
|
58
|
+
# Demographics
|
|
59
|
+
"age",
|
|
60
|
+
# Income
|
|
61
|
+
"employment_income",
|
|
62
|
+
# Benefits
|
|
63
|
+
"ssi",
|
|
64
|
+
"social_security",
|
|
65
|
+
"medicaid",
|
|
66
|
+
"unemployment_compensation",
|
|
67
|
+
],
|
|
68
|
+
"marital_unit": [
|
|
69
|
+
"marital_unit_id",
|
|
70
|
+
"marital_unit_weight",
|
|
71
|
+
],
|
|
72
|
+
"family": [
|
|
73
|
+
"family_id",
|
|
74
|
+
"family_weight",
|
|
75
|
+
],
|
|
76
|
+
"spm_unit": [
|
|
77
|
+
"spm_unit_id",
|
|
78
|
+
"spm_unit_weight",
|
|
79
|
+
"snap",
|
|
80
|
+
"tanf",
|
|
81
|
+
"spm_unit_net_income",
|
|
82
|
+
],
|
|
83
|
+
"tax_unit": [
|
|
84
|
+
"tax_unit_id",
|
|
85
|
+
"tax_unit_weight",
|
|
86
|
+
"income_tax",
|
|
87
|
+
"employee_payroll_tax",
|
|
88
|
+
"eitc",
|
|
89
|
+
"ctc",
|
|
90
|
+
],
|
|
91
|
+
"household": [
|
|
92
|
+
"household_id",
|
|
93
|
+
"household_weight",
|
|
94
|
+
"household_net_income",
|
|
95
|
+
"household_benefits",
|
|
96
|
+
"household_tax",
|
|
97
|
+
"household_market_income",
|
|
98
|
+
],
|
|
99
|
+
}
|
|
100
|
+
|
|
48
101
|
def __init__(self, **kwargs: dict):
|
|
49
102
|
# Lazy-load package metadata if not provided
|
|
50
103
|
if "version" not in kwargs or kwargs.get("version") is None:
|
|
@@ -156,59 +209,6 @@ class PolicyEngineUSLatest(TaxBenefitModelVersion):
|
|
|
156
209
|
)
|
|
157
210
|
modifier(microsim)
|
|
158
211
|
|
|
159
|
-
entity_variables = {
|
|
160
|
-
"person": [
|
|
161
|
-
# IDs and weights
|
|
162
|
-
"person_id",
|
|
163
|
-
"marital_unit_id",
|
|
164
|
-
"family_id",
|
|
165
|
-
"spm_unit_id",
|
|
166
|
-
"tax_unit_id",
|
|
167
|
-
"household_id",
|
|
168
|
-
"person_weight",
|
|
169
|
-
# Demographics
|
|
170
|
-
"age",
|
|
171
|
-
# Income
|
|
172
|
-
"employment_income",
|
|
173
|
-
# Benefits
|
|
174
|
-
"ssi",
|
|
175
|
-
"social_security",
|
|
176
|
-
"medicaid",
|
|
177
|
-
"unemployment_compensation",
|
|
178
|
-
],
|
|
179
|
-
"marital_unit": [
|
|
180
|
-
"marital_unit_id",
|
|
181
|
-
"marital_unit_weight",
|
|
182
|
-
],
|
|
183
|
-
"family": [
|
|
184
|
-
"family_id",
|
|
185
|
-
"family_weight",
|
|
186
|
-
],
|
|
187
|
-
"spm_unit": [
|
|
188
|
-
"spm_unit_id",
|
|
189
|
-
"spm_unit_weight",
|
|
190
|
-
"snap",
|
|
191
|
-
"tanf",
|
|
192
|
-
"spm_unit_net_income",
|
|
193
|
-
],
|
|
194
|
-
"tax_unit": [
|
|
195
|
-
"tax_unit_id",
|
|
196
|
-
"tax_unit_weight",
|
|
197
|
-
"income_tax",
|
|
198
|
-
"employee_payroll_tax",
|
|
199
|
-
"eitc",
|
|
200
|
-
"ctc",
|
|
201
|
-
],
|
|
202
|
-
"household": [
|
|
203
|
-
"household_id",
|
|
204
|
-
"household_weight",
|
|
205
|
-
"household_net_income",
|
|
206
|
-
"household_benefits",
|
|
207
|
-
"household_tax",
|
|
208
|
-
"household_market_income",
|
|
209
|
-
],
|
|
210
|
-
}
|
|
211
|
-
|
|
212
212
|
data = {
|
|
213
213
|
"person": pd.DataFrame(),
|
|
214
214
|
"marital_unit": pd.DataFrame(),
|
|
@@ -259,7 +259,7 @@ class PolicyEngineUSLatest(TaxBenefitModelVersion):
|
|
|
259
259
|
data["person"][target_col] = person_input_df[col].values
|
|
260
260
|
|
|
261
261
|
# Then calculate non-ID, non-weight variables from simulation
|
|
262
|
-
for entity, variables in entity_variables.items():
|
|
262
|
+
for entity, variables in self.entity_variables.items():
|
|
263
263
|
for var in variables:
|
|
264
264
|
if var not in id_columns and var not in weight_columns:
|
|
265
265
|
data[entity][var] = microsim.calculate(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
policyengine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
policyengine/__pycache__/__init__.cpython-313.pyc,sha256=
|
|
2
|
+
policyengine/__pycache__/__init__.cpython-313.pyc,sha256=JgRxC9Ak_RvgoWALgjD5XZYdps4sZpi5eMtD4-xsIjY,175
|
|
3
3
|
policyengine/core/__init__.py,sha256=KBVhkqzkvjWLDDwk96vquQKL63ZFuLen5AzBOBnO9pg,912
|
|
4
4
|
policyengine/core/dataset.py,sha256=SFicjsZgMeKgJjlt8z98fOUWG2dfod0Q9NBy_m9PSc8,15506
|
|
5
5
|
policyengine/core/dataset_version.py,sha256=6KeFCRGQto_Yyl4QY4Vo2JFythjaXrNAOHQiwRGESyM,378
|
|
@@ -21,19 +21,19 @@ policyengine/tax_benefit_models/us.py,sha256=d6rdhW2awoUvk5Ldp9mHAUiHqlnSfEQR318
|
|
|
21
21
|
policyengine/tax_benefit_models/uk/__init__.py,sha256=1L1HBbOTflRefjOcU5vgEYkn6wLWOt_uG9G_PF089S0,732
|
|
22
22
|
policyengine/tax_benefit_models/uk/analysis.py,sha256=O4eYJYF7tsgiuLuiWMU0OXq7ss6U8-vzlg6nC2U8sgU,3175
|
|
23
23
|
policyengine/tax_benefit_models/uk/datasets.py,sha256=Cn3sBvIBQ_-s5pEM9TDp2FwdVIo20h3do_8biVJLyKI,5748
|
|
24
|
-
policyengine/tax_benefit_models/uk/model.py,sha256
|
|
24
|
+
policyengine/tax_benefit_models/uk/model.py,sha256=tcetdBRSVhrDVNyGZMoYAcJNhrJwFX5-46FIHjdUdZw,9246
|
|
25
25
|
policyengine/tax_benefit_models/uk/outputs.py,sha256=2mYLwQW4QNvrOHtHfm_ACqE9gbmuLxvcCyldRU46s0o,3543
|
|
26
26
|
policyengine/tax_benefit_models/us/__init__.py,sha256=ClBkFwRa_nFQ3YU003uxBKiMG3pktaUb8jRvhzfR0vE,968
|
|
27
27
|
policyengine/tax_benefit_models/us/analysis.py,sha256=Xf-DT0QjVySs0QG_koCwgvOeWI_scLtv3S3SP8u8ZWc,3253
|
|
28
28
|
policyengine/tax_benefit_models/us/datasets.py,sha256=StvHtliqhYSIzI2ARqadLxTkp6xDYnf_qquB7aeH55Y,11994
|
|
29
|
-
policyengine/tax_benefit_models/us/model.py,sha256=
|
|
29
|
+
policyengine/tax_benefit_models/us/model.py,sha256=ASuApBtRhWXRi_jOWoxtWs77vaJnC9kOYuwogultct0,16055
|
|
30
30
|
policyengine/tax_benefit_models/us/outputs.py,sha256=GT8Eur8DfB9cPQRbSljEl9RpKSNHW80Fq_CBXCybvIU,3519
|
|
31
31
|
policyengine/utils/__init__.py,sha256=1X-VYAWLyB9A0YRHwsGWrqQHns1WfeZ7ISC6DMU5myM,140
|
|
32
32
|
policyengine/utils/dates.py,sha256=HnAqyl8S8EOYp8ibsnMTmECYoDWCSqwL-7A2_qKgxSc,1510
|
|
33
33
|
policyengine/utils/parametric_reforms.py,sha256=4P3U39-4pYTU4BN6JjgmVLUkCkBhRfZJ6UIWTlsjyQE,1155
|
|
34
34
|
policyengine/utils/plotting.py,sha256=ZAzTWz38vIaW0c3Nt4Un1kfrNoXLyHCDd1pEJIlsRg4,5335
|
|
35
|
-
policyengine-3.1.
|
|
36
|
-
policyengine-3.1.
|
|
37
|
-
policyengine-3.1.
|
|
38
|
-
policyengine-3.1.
|
|
39
|
-
policyengine-3.1.
|
|
35
|
+
policyengine-3.1.3.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
36
|
+
policyengine-3.1.3.dist-info/METADATA,sha256=MPxVNjBlodeO0vwpcu5dJJM287SbH_RKK_Acy_HL2fY,45889
|
|
37
|
+
policyengine-3.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
38
|
+
policyengine-3.1.3.dist-info/top_level.txt,sha256=_23UPobfkneHQkpJ0e0OmDJfhCUfoXj_F2sTckCGOH4,13
|
|
39
|
+
policyengine-3.1.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|