Skip to content

Commit c121290

Browse files
MaxGhenisclaude
andcommitted
Populate spm_unit_pre_subsidy_childcare_expenses from CPS ASEC
MP exported spm_unit_pre_subsidy_childcare_expenses as zero, so the national childcare target (spm_unit_capped_work_childcare_expenses) read $0 against a ~$348B baseline. eCPS reads the input directly from the CPS ASEC SPM field SPM_CHILDCAREXPNS. Wire SPM_CHILDCAREXPNS -> spm_unit_pre_subsidy_childcare_expenses through the same path as spm_unit_energy_subsidy: the PERSON_VARIABLES rename, the nonnegative and zero-default value-column lists, and the spm_unit source-column aggregation. PolicyEngine computes spm_unit_capped_work_childcare_expenses from this input, so the computed variable is not exported (the frozen export contract deliberately excludes it as formula-owned). Mirror the existing energy-subsidy mapping and entity-aggregation tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fdb25b6 commit c121290

4 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/microplex_us/data_sources/cps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@
117117
"WICYN": "_receives_wic",
118118
"SPM_CAPHOUSESUB": "_spm_capped_housing_subsidy",
119119
"SPM_ENGVAL": "spm_unit_energy_subsidy",
120+
# Capped work childcare expenses are a PolicyEngine-computed variable
121+
# (derived from this pre-subsidy input), so only the input is exported.
122+
"SPM_CHILDCAREXPNS": "spm_unit_pre_subsidy_childcare_expenses",
120123
# Person relationship-to-householder code (eCPS cps.py:190-195, :1219).
121124
# Codes 43/44/46/47 mark an unmarried partner of the household head.
122125
"PERRP": "_person_relationship_to_householder",
@@ -200,6 +203,7 @@
200203
"social_security_survivors",
201204
"social_security_dependents",
202205
"spm_unit_energy_subsidy",
206+
"spm_unit_pre_subsidy_childcare_expenses",
203207
)
204208

205209
PERSON_ZERO_DEFAULT_VALUE_COLUMNS = (
@@ -216,6 +220,7 @@
216220
"social_security_survivors",
217221
"social_security_dependents",
218222
"spm_unit_energy_subsidy",
223+
"spm_unit_pre_subsidy_childcare_expenses",
219224
)
220225

221226
PERSON_CACHE_REQUIRED_COLUMNS = (

src/microplex_us/pipelines/us.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9887,6 +9887,7 @@ def _attach_spm_unit_source_columns(
98879887
"takes_up_snap_if_eligible": "max",
98889888
"takes_up_tanf_if_eligible": "max",
98899889
"spm_unit_energy_subsidy": "first",
9890+
"spm_unit_pre_subsidy_childcare_expenses": "first",
98909891
}
98919892
aggregations = {
98929893
column: aggregation

tests/pipelines/test_us.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ def test_build_policyengine_entity_tables_preserves_spm_source_inputs(
10141014
"takes_up_housing_assistance_if_eligible": [False, True, False],
10151015
"takes_up_snap_if_eligible": [False, True, False],
10161016
"spm_unit_energy_subsidy": [90.0, 90.0, 0.0],
1017+
"spm_unit_pre_subsidy_childcare_expenses": [1500.0, 1500.0, 0.0],
10171018
}
10181019
)
10191020

@@ -1028,6 +1029,10 @@ def test_build_policyengine_entity_tables_preserves_spm_source_inputs(
10281029
]
10291030
assert spm_units["takes_up_snap_if_eligible"].tolist() == [True, False]
10301031
assert spm_units["spm_unit_energy_subsidy"].tolist() == [90.0, 0.0]
1032+
assert spm_units["spm_unit_pre_subsidy_childcare_expenses"].tolist() == [
1033+
1500.0,
1034+
0.0,
1035+
]
10311036

10321037
def test_build_policyengine_entity_tables_adds_deterministic_snap_takeup(
10331038
self,

tests/test_cps_source_provider.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ def test_load_cps_asec_derives_policyengine_value_inputs(tmp_path):
447447
"WICYN": [1, 2],
448448
"SPM_CAPHOUSESUB": [700, 0],
449449
"SPM_ENGVAL": [90, -1],
450+
"SPM_CHILDCAREXPNS": [1500, -1],
450451
"PHIP_VAL": [900, -1],
451452
"POTC_VAL": [120, -1],
452453
"PMED_VAL": [450, -1],
@@ -474,6 +475,7 @@ def test_load_cps_asec_derives_policyengine_value_inputs(tmp_path):
474475
assert persons["receives_housing_assistance"].tolist() == [True, False]
475476
assert persons["takes_up_housing_assistance_if_eligible"].tolist() == [True, False]
476477
assert persons["spm_unit_energy_subsidy"].tolist() == [90, 0]
478+
assert persons["spm_unit_pre_subsidy_childcare_expenses"].tolist() == [1500, 0]
477479
assert persons["health_insurance_premiums_without_medicare_part_b"].tolist() == [900, 0]
478480
assert persons["over_the_counter_health_expenses"].tolist() == [120, 0]
479481
assert persons["other_medical_expenses"].tolist() == [450, 0]

0 commit comments

Comments
 (0)