Repository navigation
Draft: Integrate modeled state unemployment insurance into income flows - #8303
daphnehanse11 wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8303 +/- ##
============================================
- Coverage 100.00% 73.72% -26.28%
============================================
Files 12 15 +3
Lines 161 255 +94
Branches 0 9 +9
============================================
+ Hits 161 188 +27
- Misses 0 64 +64
- Partials 0 3 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Converted this to a draft umbrella PR for modeled state UI income-flow integration. The PA UC wiring is a useful first candidate, but we should not merge it into baseline |
Remove the adds wiring into unemployment_compensation (newer core rejects adds combined with uprating, and the integration is deferred to PolicyEngine#8303 pending policyengine-us-data support) and the coupled integration assertion. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 6198da9)
Builds on the PA UC integration: unemployment_compensation now adds the modeled state UI benefits for all currently-merged programs (al_ui, ny_ui, ok_ui, pa_uc, ut_ui). Adds a 'feeds unemployment compensation income flows' integration case to each state's UI suite (mirroring PA Case 8), asserting the benefit flows to unemployment_compensation / tax_unit_unemployment_compensation and the taxable_* pair. Rebased onto current main. State UI suites 47/47; taxable-UC + my_friend_ben and analytics-coverage partner signature tests unaffected (adds is inert where unemployment_compensation is a set input). See PR comment re: the baseline double-count / microsim question. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6198da9 to
926a7f2
Compare
|
@PavelMakarchuk — picking this draft up now that the AL/NY/OK/PA/UT UI programs are all merged. I've rebased onto current main and extended the wiring to every merged state UI program: But before this comes out of draft I want your call on two things — you lead US encoding so this is your decision, not something to escalate. 1. Should modeled state UI feed baseline
|
PavelMakarchuk
left a comment
There was a problem hiding this comment.
Requesting changes for one confirmed import regression at 926a7f2f6ea5d9dd825ec49b72b722af98ab83b3.
[P1] Resolve the incompatible computation modes in unemployment_compensation. The new adds on line 12 is combined with the existing uprating on line 11. Core rejects that combination during variable registration:
ValueError: Variable "unemployment_compensation" mixes computation modes: adds/subtracts and uprating.
This prevents the country package from importing, before any household calculation or state eligibility check runs. The head-matched smoke-import job installs successfully and then raises this error; the microsimulation job fails with the same exception. I reproduced it locally under Core 3.32.6 and checked the exact base/head variable definitions: the base initializes with uprating, while the head fails. Zero targeted YAML cases could execute.
Please use a compatible design for reported-income uprating and modeled state-benefit aggregation, then rerun package import and the five integration files. Also validate reported-benefit preservation, modeled fallback and future-year uprating against the intended microsimulation dataset; simply removing uprating would not establish that those semantics remain correct.
I am not treating draft status, branch staleness, or presumed loss of reported benefits as defects. The data review found CPS explicitly supplies reported unemployment compensation, and no population loss or double counting was demonstrated. The blocker here is the reproducible import failure.
Restores unemployment_compensation as the uprated reported input, adds modeled_state_unemployment_compensation aggregating the five state UI programs, and routes income flows through a total_unemployment_ compensation fallback (reported where present, else modeled), per review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH
|
@PavelMakarchuk Resolved the computation-mode conflict via Option A: |
|
Superseded by #9558 — rebased onto current main under new ownership (original author has left PolicyEngine). Pavel's mode-conflict blocker is resolved there; review history referenced in the new PR. |
* Integrate modeled state unemployment insurance into income flows Rebase of PR #8303 onto current main under new ownership (original author has left PolicyEngine). Adds modeled_state_unemployment_compensation (sums al_ui, nj_unemployment_insurance, ny_ui, ok_ui, pa_uc, ut_ui) and total_unemployment_compensation (reported-wins fallback), repoints the direct consumers of unemployment_compensation - including the household_benefits parameter list - and extends the five state UI integration suites with income-flow, reported-preservation, and no-double-count cases. Resolves the uprating/adds computation-mode conflict Pavel flagged on #8303 via Option A: unemployment_compensation stays a pure uprated survey input, so CPS-reported values and future-year uprating are untouched and modeled UI reaches income flows only when no reported amount is present. NJ UI, modeled on main after #8303 was opened, is included in the modeled aggregate as part of the rebase. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH * Route parameter-driven UI consumers through total unemployment compensation Per review: migrate every income-source list under parameters/gov/ (SNAP, TANF, SSI, WIC, school meals, Head Start, HUD, CBO, CCAP, state tax lists and the VA subtraction) and four contrib reform benefit lists from the reported unemployment_compensation input to total_unemployment_compensation. Document the reported-zero rule, fold two always-true source appends into direct substitutions, and add low-income SNAP, NJ, asymmetric-household, monthly and reported-zero tests. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH * Year-gate the modeled state unemployment insurance programs Sum modeled state UI through a year-gated parameter list so each program counts from its first verified year. Before 2022 the list is empty, so pre-2015 simulations (e.g. the 2010 Alabama SSP cases reached via SSI unearned income) no longer reach state UI parameters that start later. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH * Address review: pin the modeled-UI year gate and pass negative reports through Add year-gate tests for states before and after they enter the modeled-UI list (AL 2023 and 2010, NY 2024, OK 2022, and PA/UT/NJ excluded years), SSI/TANF and taxable-SS-MAGI flow tests, and treat any nonzero reported unemployment compensation (including negative amounts) as reported, as on main. Have Virginia subtract taxable UC, count strike benefits in Hawaii child care, fix a reference comma, and clarify the year-gate docs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH * Update modeled-UI SNAP tests for main's months-of-receipt UI exemption Main's #9716 limits the SNAP work-registration UI exemption to the months of receipt (26 weeks -> 6 months), so outside those months the PA adults in these cases hit the ABAWD time limit and 7 CFR 273.11(c)(2)(ii) prorates their income. Update the two expectations with the arithmetic; no code change. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH * List total_unemployment_compensation in the AR line-comment check Main's code-health test pins the AR1000F line for every Arkansas gross income source; the unemployment line (21 from 2018) now reads total_unemployment_compensation. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH * Route the remaining unemployment compensation readers through the total Thirteen readers that later merges of main brought in still read the reported-only unemployment_compensation input, so they missed modeled state UI when nothing was reported: - the student loan interest ALD MAGI and the two IRA deduction MAGI formulas (ira_219g_magi, ira_219g_taxable_social_security), which now append total_unemployment_compensation. The total never reaches AGI, so there is no cycle; - ten parameter source lists: NY HEAP, NJ LIHEAP, IN EAP, KS LIEAP, KY LIHEAP, MD MEAP, MO SAB, MS LIHEAP, NC LIEAP and OR LIHEAP. Each reader gets regression cases in its own test file: a modeled-UI case plus a reported-UI control where the state models UI (PA for the federal MAGI formulas, NY, NJ), and a reported-UI control elsewhere. The two IRA variables get new test files named for them. Add a code-health guard that fails when a parameter list entry or a Python string constant names the raw input, with an allowlist for uprating, the TAXSIM generator and the total's own formula. Add a microsimulation guard that modeled state UI is zero on the certified default build in 2025. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqCGPgxDukji8Bhs57c5rH --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Tracks #8301.
Purpose
This is the draft umbrella PR for wiring modeled state unemployment insurance benefits into
unemployment_compensationand downstream income flows.Keep this PR as a draft until the relevant state rules and
policyengine-us-datapipelines are ready. State UI rule implementations can still merge separately when they are calculator-safe; this PR is for the baseline microsimulation integration step.Why draft
The current PA wiring is conceptually right for household calculations, but it should not enter baseline aggregation until enhanced CPS can populate or impute the required wage-history and unemployment inputs. Otherwise, the integration would be partial: modeled UI would depend on inputs that are not yet available in the microsim data pipeline, and could mix calculator-only logic into baseline income flows prematurely.
Scope
unemployment_compensationonly after each state has usable data inputs.policyengine-us-datafor extraction/imputation of required variables.Current contents
Checklist
policyengine-us-data.policyengine-us-dataminimumpolicyengine-usversion after any new model variables are released.unemployment_compensationdoes not drop relative to the reported baseline.unemployment_compensation.addsonce data-backed.Tests so far
These passed for the current PA-only wiring, but they are not sufficient to merge this PR:
uv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/gov/states/pa/dli/unemployment_compensation -c policyengine_usuv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/contrib/taxsim/taxsim_v11.yaml -c policyengine_usuv run python -m policyengine_core.scripts.policyengine_command test policyengine_us/tests/policy/baseline/household/income/spm_unit/spm_unit_benefits.yaml -c policyengine_usuv run --extra dev ruff check policyengine_us/variables/gov/states/unemployment_compensation.pyuv run --extra dev ruff format --check policyengine_us/variables/gov/states/unemployment_compensation.py