Skip to content

Draft: Port selected loss.py targets into unified calibration #945

@anth-volk

Description

@anth-volk

Branch: codex/add-loss-py-targets-unified

Context

Legacy policyengine_us_data/utils/loss.py still contains calibration target families that were not selected by the newer unified calibration target set. We audited the legacy target families against policyengine_us_data/calibration/target_config.yaml and identified a narrow set that are distinct from existing unified targets, were not recently removed by Max Ghenis, and are not just slight variants of already-selected targets.

What this branch does

This branch ports the recommended target families into unified calibration:

  • Adds SOI taxable AGI-grid income targets for:
    • irs_employment_income, mapped from SOI employment_income, matching the legacy loss.py concept.
    • pension_income, mapped from SOI total_pension_income.
    • social_security, mapped from SOI total_social_security.
  • Selects existing IRS workbook target rows for:
    • refundable American Opportunity Credit amount and claimant count.
    • nonrefundable education tax credit amount and claimant count.
  • Adds state EITC claimant-count targets from IRS EITC Central controls.
  • Selects state SNAP household-count targets already loaded by SNAP ETL.
  • Selects LIHEAP household-count targets already loaded by national target ETL.
  • Adds and selects state ACS rent targets from acs_housing_costs_YEAR.csv.
  • Selects positive real-estate-tax itemizer count targets nationally and by state.
  • Adds and selects Medicare Part B premium age-bucket targets from healthcare_spending.csv.

Files touched

  • policyengine_us_data/calibration/target_config.yaml
  • policyengine_us_data/db/create_field_valid_values.py
  • policyengine_us_data/db/etl_irs_soi.py
  • policyengine_us_data/db/etl_national_targets.py
  • tests/unit/calibration/test_target_config.py
  • tests/unit/test_etl_irs_soi_overlay.py
  • tests/unit/test_etl_national_targets.py

Verification so far

Passed locally:

  • python3 -m py_compile policyengine_us_data/db/etl_irs_soi.py policyengine_us_data/db/etl_national_targets.py policyengine_us_data/db/create_field_valid_values.py tests/unit/test_etl_irs_soi_overlay.py tests/unit/test_etl_national_targets.py tests/unit/calibration/test_target_config.py
  • ruff check policyengine_us_data/db/etl_irs_soi.py policyengine_us_data/db/etl_national_targets.py tests/unit/test_etl_irs_soi_overlay.py tests/unit/test_etl_national_targets.py tests/unit/calibration/test_target_config.py
  • git diff --check

Blocked locally:

  • uv run pytest tests/unit/test_etl_irs_soi_overlay.py tests/unit/test_etl_national_targets.py tests/unit/calibration/test_target_config.py

The pytest command is blocked on this macOS x86_64 environment because the lock currently resolves torch==2.9.1, which has no wheel for this platform.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions