Skip to content

Format rate-type validation rows as percentages#96

Open
DTrim99 wants to merge 1 commit into
PolicyEngine:mainfrom
DTrim99:unit-aware-level-formatting
Open

Format rate-type validation rows as percentages#96
DTrim99 wants to merge 1 commit into
PolicyEngine:mainfrom
DTrim99:unit-aware-level-formatting

Conversation

@DTrim99

@DTrim99 DTrim99 commented Jul 7, 2026

Copy link
Copy Markdown

Companion to populace#348, which adds 104 Census state SPM poverty-rate backtests (out-of-sample) to the reform-validation payload. Those level rows carry unit: "percent" with decimal-fraction values (0.134), which the current views would render as $0.13.

  • Thread unit through the payload parser (lib/populace/reforms.ts) and both row interfaces.
  • New shared fmtUnitValue in components/shared/format.ts: "percent"13.4%, anything else → fmtMoney as before.
  • Applied to the Benchmark/populace value cells in the reforms view and the staging view.
  • Backward compatible: rows without unit (all existing payloads) render exactly as today. Error/trend columns are relative and unaffected.

Typecheck (npm run lint) and next build pass.

Motivation: the populace-vs-ECPS parity finding showed state poverty levels diverging up to 11.7pp with nothing on the dashboard to catch it — these rows put per-state poverty error on the board for every release.

🤖 Generated with Claude Code

Populace PR #348 adds Census state SPM poverty-rate backtests whose level
rows carry unit: "percent" with decimal-fraction values. Thread the unit
through the payload parser and row types, and format value cells with a
shared fmtUnitValue (0.134 -> "13.4%") in the reforms and staging views.
Rows without a unit keep the USD formatting, so pre-#348 payloads render
unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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