[codex] Add LIHEAP targets to local calibration DB#688
Merged
Conversation
6580abf to
0dfa53f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This PR adds LIHEAP recipient-household targets to the shared national calibration target pipeline and makes the legacy national
EnhancedCPSreweighting path consume those targets frompolicy_data.db.It does three things:
policyengine_us_data/db/etl_national_targets.pyperson_countvariables, which LIHEAP uses ashousehold_countbuild_loss_matrix()bridge inpolicyengine_us_data/utils/loss.pythat reads active LIHEAP targets fromstorage/calibration/policy_data.dbIt also clarifies in the repo docs that there are still two calibration tracks in-tree:
policy_data.dbcalibration pipelineEnhancedCPS/build_loss_matrix()path kept for legacy reproductionWhy
LIHEAP was already present in CPS/SPM reported values, but it was not represented as a calibration target in either:
EnhancedCPSreweighting pathThat meant we could not calibrate LIHEAP recipient counts in either path, despite having CPS/SPM baseline LIHEAP receipt in the data.
Scope note
This PR calibrates LIHEAP recipient households only. It does not calibrate LIHEAP dollars.
That is intentional for now: the CPS/SPM concept is a pooled annual reported energy-assistance amount (
spm_unit_energy_subsidy_reported), while LIHEAP administrative dollars are split across heating, cooling, crisis, and weatherization. Recipient-household counts are a cleaner crosswalk than national dollars.Follow-up issue: #689 tracks options for national LIHEAP dollar targeting.
Impact
make database/etl_national_targets.pynow loads national LIHEAP household-count targets intopolicy_data.dbbuild_loss_matrix()runs can pick those LIHEAP targets up from the DB when presentValidation
python3 -m py_compile policyengine_us_data/db/etl_national_targets.py policyengine_us_data/utils/loss.pyI also attempted:
python3 -m pytest tests/unit/test_etl_national_targets.py -qThat pytest invocation did not run in this shell because the environment is missing
torch, which is imported from the repo test setup.