Skip to content

Add household earnings sweep chart for bill review PRs#123

Merged
PavelMakarchuk merged 2 commits intomainfrom
household-chart
Feb 23, 2026
Merged

Add household earnings sweep chart for bill review PRs#123
PavelMakarchuk merged 2 commits intomainfrom
household-chart

Conversation

@PavelMakarchuk
Copy link
Contributor

Summary

  • New script scripts/generate_household_chart.py that generates a plotly chart showing net benefit by earnings for a representative household
  • Auto-selects household archetype based on reform type (EITC, CTC, rate cuts, etc.)
  • Uploads chart as an embedded image in PR comments via --upload-to-pr
  • Integrated into /encode-bill workflow as Phase 5b (after compute_impacts, before PR creation)

How it works

  1. Fetches reform_params + provisions from Supabase
  2. Pattern-matches reform type → picks household (single parent + 2 kids for EITC/CTC, single filer for rate cuts, married couple for joint reforms)
  3. Runs PE-US Simulation with axes to sweep employment income ($0 → max)
  4. Generates plotly PNG + interactive HTML
  5. Uploads PNG to charts branch via GitHub Contents API, embeds in PR comment

Example output

See PR #118 comment for a live example (CT SB69 — Eliminate State EITC).

CLI usage

python scripts/generate_household_chart.py --reform-id ct-hb5134
python scripts/generate_household_chart.py --reform-id ct-hb5134 --upload-to-pr 119
python scripts/generate_household_chart.py --reform-id va-hb979 --earnings-max 2000000

Test plan

  • Verified against ct-hb5134 (CTC): flat $1,200 benefit up to $100k
  • Verified against ok-hb2229 (EITC): triangle-shaped benefit curve
  • Verified against ct-sb69 (EITC elimination): inverted EITC loss curve
  • PR comment upload working on PR Bill review: Eliminate State EITC (CT) #118
  • Test with rate cut reform (ga-sb168 blocked by PE-US version issue)
  • Test with married couple archetype

🤖 Generated with Claude Code

PavelMakarchuk and others added 2 commits February 23, 2026 15:39
New script that generates a plotly chart showing net benefit by earnings
for a representative household, making reform impacts concrete for PR
reviewers. Auto-selects household archetype (EITC → single parent + kids,
rate cuts → single filer, etc.) and uploads chart as embedded PR comment.

Integrated into /encode-bill workflow as Phase 5b.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move `import copy` to module level
- Remove redundant deepcopy in run_simulations (caller already copies)
- Add empty-array guard in print_summary_stats
- Clean up orphaned GitHub branch on upload failure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@PavelMakarchuk PavelMakarchuk marked this pull request as ready for review February 23, 2026 20:48
@PavelMakarchuk PavelMakarchuk merged commit 99595f4 into main Feb 23, 2026
@PavelMakarchuk PavelMakarchuk deleted the household-chart branch February 23, 2026 20:48
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.

1 participant