Skip to content

Conversation

@hua7450
Copy link
Collaborator

@hua7450 hua7450 commented Nov 24, 2025

Summary

Implements Wisconsin Works (W-2), Wisconsin's TANF program, with placement-based benefit calculation and automatic placement detection for eligible categories.

Closes #6856
Related: #6869 (prorated CSJ not modeled)

Status

  • Parameters created (6 files)
  • Variables implemented (7 files)
  • Tests written (40 test cases across 7 files)
  • CI passing
  • Formula verified against Wisconsin Statutes and W-2 Manual
  • Ready for review

Key Changes

Implementation Summary

  • 7 new variables for Wisconsin Works benefit calculation
  • 6 parameter files for placement amounts, income limits, and asset rules
  • 40 comprehensive test cases across 7 test files
  • Placement-based benefits with enum (CSJ, CMC, ARP, W2_TRANSITION)
  • All tests passing

Formula (Per Wisconsin Statutes §§ 49.141-49.161)

Income Eligibility: 115% of Federal Poverty Level

countable_income <= FPL × 1.15

Resource Eligibility: $2,500 limit with $10,000 vehicle exclusion

countable_resources = cash_assets + max(vehicle_value - $10,000, 0)

Benefit Calculation: Placement-based flat payments

benefit = placement_amount[placement_type]

Placement Types:

Placement Monthly Benefit Description
CSJ $653 Community Service Jobs (default)
CMC $673 Custodial Parent of Infant
ARP $673 At Risk Pregnancy
W2_TRANSITION $628 W-2 Transition

Automatic Placement Detection

  • CMC: Triggered when household has infant ≤ 2 months
  • ARP: Triggered when participant is in 3rd trimester (month 7+)
  • CSJ: Default placement for all other eligible households
  • W2_TRANSITION: Requires agency assessment (not auto-detected)

Files Added

Parameters (6 files)

policyengine_us/parameters/gov/states/wi/dcf/works/
├── asset/
│   ├── limit.yaml                          # $2,500
│   └── vehicle_exclusion.yaml              # $10,000
├── income_limit/
│   └── rate.yaml                           # 1.15 (115% FPL)
└── placement/
    ├── amount.yaml                         # Benefit by placement type
    ├── arp_pregnancy_month_threshold.yaml  # 7 (3rd trimester)
    └── cmc_infant_age_limit.yaml           # 2 months

Variables (7 files)

policyengine_us/variables/gov/states/wi/dcf/works/
├── eligibility/
│   ├── wi_works_eligible.py                # Overall eligibility
│   ├── wi_works_income_eligible.py         # 115% FPL test
│   └── wi_works_resources_eligible.py      # $2,500 asset test
├── income/
│   └── wi_works_countable_income.py        # Earned + unearned - child support
├── resources/
│   └── wi_works_countable_resources.py     # Cash + vehicle (with exclusion)
├── wi_works_placement.py                   # Placement type with auto-detection
└── wi_works.py                             # Main benefit calculation

Tests (7 files, 40 test cases)

policyengine_us/tests/policy/baseline/gov/states/wi/dcf/works/
├── wi_works.yaml                           # 6 tests
├── wi_works_countable_income.yaml          # 5 tests
├── wi_works_countable_resources.yaml       # 6 tests
├── wi_works_eligible.yaml                  # 6 tests
├── wi_works_income_eligible.yaml           # 5 tests
├── wi_works_placement.yaml                 # 7 tests
└── wi_works_resources_eligible.yaml        # 5 tests

Example Calculations

Example 1: Family Eligible for CSJ

Household: Single parent with 1 child, no special conditions
Income: $1,000/month earned

FPL for family of 2: ~$21,000/year = $1,750/month
Income limit: $1,750 × 1.15 = $2,013/month
$1,000 < $2,013 → Income eligible ✓

Placement: CSJ (default - no infant, not pregnant)
Benefit: $653/month

Example 2: CMC Placement with Infant

Household: Parent with newborn (1 month old)

Infant age: 1 month ≤ 2 months → CMC eligible
Placement: CMC (Custodial Parent of Infant)
Benefit: $673/month

Example 3: ARP Placement for Third Trimester

Household: Pregnant person in 8th month

Pregnancy month: 8 ≥ 7 → In third trimester
Placement: ARP (At Risk Pregnancy)
Benefit: $673/month

Implementation Highlights

Key Features

  • ✅ Placement-based benefit calculation with enum
  • ✅ Automatic CMC detection (infant ≤ 2 months)
  • ✅ Automatic ARP detection (3rd trimester)
  • ✅ 115% FPL income test (uses rate, not hardcoded values)
  • ✅ $2,500 resource limit with $10,000 vehicle exclusion
  • ✅ Child support disregard
  • ✅ Citizenship check using federal variable

Design Decisions

  1. Placement Enum: Uses WIWorksPlacement enum for type-safe placement handling

    • Enables parameter lookup by placement type
    • Allows future expansion for prorated CSJ
  2. FPL Rate Pattern: Uses 1.15 multiplier instead of hardcoded dollar amounts

    • Automatically updates with FPL changes
    • Cleaner and more maintainable
  3. Federal Rule Reuse: Uses federal TANF variables

    • is_demographic_tanf_eligible
    • is_citizen_or_legal_immigrant
    • tanf_gross_earned_income
    • tanf_gross_unearned_income
  4. Child Support Disregard: Uses adds/subtracts attributes

    • Child support is included in unearned income but fully disregarded
    • Clean and self-documenting

Known Limitations & Future Enhancements

Not Yet Implemented

  1. Prorated CSJ (Wisconsin Works: Add prorated CSJ payment tiers #6869) - Requires modeling hours worked which varies
  2. W2_TRANSITION auto-detection - Requires agency assessment
  3. Time limits - 24-month/60-month limits require time-series tracking
  4. Sanctions - Benefit reductions for non-compliance
  5. Lump sum diversion - One-time payments

Simplified Assumptions

  • All eligible households receive full placement amount (no proration)
  • W2_TRANSITION requires manual assignment
  • Uses federal demographic eligibility rules

Testing & Verification

Test Results

✅ All 40 tests passing across 7 test files
   - 7 placement tests (CMC, ARP, CSJ scenarios)
   - 33 unit tests (income, resources, eligibility)
   - 0 failures

How to Run

# All tests
policyengine-core test policyengine_us/tests/policy/baseline/gov/states/wi/dcf/works/ -c policyengine_us

References

Official Sources


Branch Information

Branch: integration/wi-tanf-20251123
Base: master
Status: ✅ All tests passing, ready for review


Implementation by: @hua7450
Issue: #6856
Ready for: Code review and testing feedback

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (0ecb2c6) to head (f17bd87).
⚠️ Report is 10 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #6857   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         7    +5     
  Lines           39       108   +69     
=========================================
+ Hits            39       108   +69     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hua7450 hua7450 marked this pull request as ready for review November 24, 2025 06:00
@hua7450 hua7450 marked this pull request as draft November 24, 2025 16:03
hua7450 and others added 9 commits November 26, 2025 00:17
Starting implementation of Wisconsin TANF (Wisconsin Works - W-2).
Documentation and parallel development will follow.

Related to PolicyEngine#6856
- Comprehensive documentation in docs/agents/sources/wi_tanf/
- Overview of program structure and legal authorities
- Detailed eligibility requirements (income, assets, demographic)
- Benefit calculation methodology (fixed payments by placement type)
- Consolidated working_references.md for implementation sprint
- Identified 2024 WIOA Combined Plan TANF Section PDF for extraction
- Flagged non-simulatable rules (time limits, work requirements)
- Implementation guidance for simplified approach
Tests created based on Wisconsin TANF documentation covering:
- Income limits and countable income calculation
- Resource eligibility requirements
- Overall TANF eligibility determination
- Integration test with real-world scenarios

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Income limits: 115% FPL by household size (monthly)
- Payment standard: CSJ placement at $653/month
- Asset limit: $2,500 combined equity value
- Vehicle exclusion: $10,000 equity disregard

All parameters sourced from:
- Wisconsin Statutes § 49.145, § 49.148
- Wisconsin Administrative Code DCF 101.09, DCF 101.18
- W-2 Manual Chapter 3 (Eligibility), Chapter 7 (Benefits)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Implements simplified Wisconsin TANF eligibility and benefit calculation:

Variables created:
- wi_tanf_income_limit: Returns 115% FPL income limit by household size
- wi_tanf_countable_income: Calculates income with WI-specific disregards
  (child support, EITC, state EITC fully excluded)
- wi_tanf_income_eligible: Tests countable income <= limit
- wi_tanf_countable_resources: Calculates assets with vehicle exclusion
- wi_tanf_resources_eligible: Tests assets <= $2,500
- wi_tanf_eligible: Combines all eligibility checks
- wi_tanf: Fixed $653/month CSJ benefit if eligible

Key implementation notes:
- Uses federal demographic eligibility baseline (age 18+, custodial parent)
- Uses federal gross income baseline (tanf_gross_earned_income,
  tanf_gross_unearned_income)
- Implements Wisconsin-specific income disregards and limits
- Fixed payment amount ($653 CSJ) - NO benefit reduction formula
- Cannot model placement assignment, time limits, or work requirements
  due to PolicyEngine's single-period architecture

Parameters fixed:
- Added 'values:' key to payment_standard.yaml, asset_limit/*.yaml
- Kept scale parameter structure for income_limit/amount.yaml

All formulas use parameters - zero hard-coded values.

References: Wisconsin Statutes §§ 49.145, 49.148; Wisconsin
Administrative Code DCF 101.09, 101.18; W-2 Manual Chapters 3, 7

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Fix variable name: household_assets -> net_worth (accessed via spm_unit.household())
- Fix test variable names: household_net_worth -> net_worth
- Fix test variable names: household_vehicle_value -> household_vehicles_value
- Align variable references between tests and implementation

These fixes resolve import errors and variable mismatches between the
parallel branches from test-creator and rules-engineer agents.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add Wisconsin TANF (Wisconsin Works - W-2) implementation
- Include income eligibility rules and calculations
- Include cash assistance benefit calculation
- Include countable income determination
- Include maximum benefit amounts and group categorization

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Update all test periods from 2024 to 2025 to match parameter effective dates
- Fix wi_tanf_countable_resources to properly separate vehicle and non-vehicle assets
- Fix wi_tanf_countable_income entity aggregation for EITC
- Delete working_references.md (all citations now embedded in code metadata)

All 44 tests now pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Renamed from wi_tanf to wi_works throughout
- Added placement-based benefit calculation with enum (CSJ, CMC, ARP, W2_T)
- Replaced hardcoded income limits with 115% FPL rate
- Added citizenship check using is_citizen_or_legal_immigrant
- Added placement auto-detection for CMC (infant <= 2 months) and ARP (3rd trimester)
- Restructured parameters: asset_limit -> asset, payment_standard -> placement/amount
- Used adds/subtracts pattern for countable income instead of formula
- Added comprehensive test suite for all variables with formulas

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@hua7450 hua7450 force-pushed the integration/wi-tanf-20251123 branch from 6e1c266 to 8e32c70 Compare November 26, 2025 05:17
@hua7450 hua7450 changed the title Implement Wisconsin TANF (Wisconsin Works - W-2) Implement Wisconsin Works (W-2) Nov 26, 2025
@hua7450 hua7450 marked this pull request as ready for review November 26, 2025 05:19
@hua7450 hua7450 marked this pull request as draft November 26, 2025 05:20
hua7450 and others added 3 commits November 26, 2025 00:23
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Wisconsin TANF (Wisconsin Works - W-2)

1 participant