Format rate-type validation rows as percentages - #96
Closed
DTrim99 wants to merge 1 commit into
Closed
Conversation
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>
MaxGhenis
added a commit
that referenced
this pull request
Jul 23, 2026
…111) * Format rate-type validation rows as percentages 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> * Consolidate percent-unit cell formatting into shared fmtUnitValue The reforms view (via #108) and staging view (via this branch) had two identical local implementations of the same unit dispatch; keep the one shared helper in components/shared/format.ts and add unit tests for it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: David Trimmer <david@policyengine.org> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Thanks @DTrim99 — this landed in two pieces while you were out: #108 independently shipped the parser/type changes and reforms-view rendering earlier today, and #111 (merged) cherry-picked your commit for the remaining half — the shared |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.unitthrough the payload parser (lib/populace/reforms.ts) and both row interfaces.fmtUnitValueincomponents/shared/format.ts:"percent"→13.4%, anything else →fmtMoneyas before.unit(all existing payloads) render exactly as today. Error/trend columns are relative and unaffected.Typecheck (
npm run lint) andnext buildpass.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