Update SOI-backed calibration targets through TY2023#660
Draft
Update SOI-backed calibration targets through TY2023#660
Conversation
833aec1 to
96f7cc6
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
policyengine_us_data/storage/calibration_targets/soi_targets.csvthrough TY2023, and backfilled TY2022 so the tracked series no longer jumps directly from 2021 to 2023BP+BTinstead of silently collapsing them to the final component columnget_soi()to select the best available tracked year per variable for the requested simulation year instead of always taking the global latest year(stratum, variable, period)tupleWhy
The repo had drifted into an inconsistent SOI state:
This PR updates the available SOI-backed targets to the latest published IRS releases the repo can credibly use, and makes the refresh path less fragile going forward.
Scope and limits
This PR updates everything in the repo that can currently move to newer SOI data from published IRS sources.
Still intentionally left on older sources:
in54,in55cm, andincdfilesaca_ptcandrefundable_ctcin the DB-backed IRS SOI path still remain on the geography-backed source for now because the published national workbook tables do not line up cleanly enough with the currentincdcode definitions to switch them safely in this PRReview follow-up
After the initial PR draft, I followed up on the semantic-mapping review points directly against the IRS files.
soi_targets.csv, this follow-up did not change any stored target values; it corrected 144 lossy column specs in TY2022 and the same 144 in TY2023 so provenance now matches the actual workbook readsValidation
uv run pytest -q tests/test_refresh_soi_table_targets.py tests/test_etl_irs_soi_overlay.pyuv run pytest -q policyengine_us_data/tests/test_calibration/test_unified_matrix_builder.py policyengine_us_data/tests/test_calibration/test_unified_calibration.py policyengine_us_data/tests/test_schema_views_and_lookups.pyuv run python policyengine_us_data/storage/calibration_targets/refresh_soi_table_targets.py --source-year 2021 --target-year 2022 --validate-source-yearuv run python policyengine_us_data/storage/calibration_targets/refresh_soi_table_targets.py --source-year 2022 --target-year 2023 --validate-source-yearuv run python -m py_compile policyengine_us_data/storage/calibration_targets/refresh_soi_table_targets.py policyengine_us_data/utils/soi.py policyengine_us_data/db/etl_irs_soi.py policyengine_us_data/db/etl_national_targets.py policyengine_us_data/storage/calibration_targets/pull_soi_targets.py policyengine_us_data/storage/calibration_targets/soi_metadata.py tests/test_soi_utils.py tests/test_refresh_soi_table_targets.py tests/test_etl_irs_soi_overlay.pyuv run ruff check policyengine_us_data/storage/calibration_targets/refresh_soi_table_targets.py policyengine_us_data/db/etl_irs_soi.py tests/test_refresh_soi_table_targets.py tests/test_etl_irs_soi_overlay.pyCalibration impact
The main national SOI-backed targets that now move from TY2022 to TY2023 in the DB-backed path are materially different. A few examples from the updated aggregate workbook targets:
taxable_interest_income: about +135%dividend_income: about +22%tax_exempt_interest_income: about +19%taxable_social_security: about +15%net_capital_gains: about -24%So this is not just a bookkeeping refresh; it changes the national SOI-backed target surface in a meaningful way.