Repository navigation
Show ACS margins of error in the charts and tables - #179
Merged
Merged
Conversation
The tidy endpoints add Value_MOE, Value_Reliability, Percent_MOE and Percent_Reliability; the timeseries endpoints add <Field>_MOE and <Field>_Reliability for the series that have margins. The frontend doesn't read them yet.
Trend lines get a shaded band for the 90% margin of error, with hollow dots on low-reliability estimates; the age and education distribution bars get whiskers (error bars in the PDF version). Tooltips and table cells read "value ± margin", with low reliability flagged, and the Excel exports carry the margins. Intervals are clamped to 0 and, for shares, to 100%.
The tidy query now selects every column and keeps the margin fields only where the warehouse has them, as the timeseries query already did, so the API can deploy before the ETL rerun. The PDF report's summary table shows margins, the low-reliability asterisk and the footnote, sharing the on-screen table's cell formatting. Table footnotes explain only the cells on screen, not hidden comparison values. Bar whisker headroom follows the visible series, the PDF bar chart draws comparison whiskers when only the comparison has margins, and a single-year trend keeps its dot.
The variable explorer's map tooltips and scatter, the DP explorer's trend chart and value cards, and the county comparison's ranked bars now carry margins and reliability labels. Each query adds the margin columns only where the warehouse has them, so an older warehouse serves these pages as before.
iansargent
reviewed
Nov 6, 2026
iansargent
left a comment
Collaborator
There was a problem hiding this comment.
The frontend implementation of these values were exactly what I imagined. Bar graphs get error bars and time series charts get the shaded error bands.
The only thing I might request is if you think a show/hide toggle for margins of error (when applicable) would help the user from overcrowding the plot. The default could be switched on, but the user could have the ability to toggle MOEs off the chart/table.
What do you think about the feature? Would it be too many bells and whistles? Or good UI?
Lmk
Collaborator
Author
|
I think it's a good idea! I noticed some charts the bands overlap and cover most of the chart. we can just default it enabled like you suggest. |
A "Margins of error" switch on each chart card with margins, saved as one setting for every chart and on by default. Hidden, charts drop their bands and whiskers and tables their "± margin", but low-reliability estimates keep their hollow dots and asterisks.
CI's fresh environment doesn't have it, so the test failed to load it.
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.
Third of three PRs for Census margins of error, after #177 (collection) and #178 (cleaning), both merged. The API now serves the margins and reliability labels, and the charts and tables show them: a shaded band around each line, a whisker on each bar, and "68,854 ± 4,182" in tooltips and tables. Low-reliability estimates get a hollow dot on charts and a "*" in tables, with a short note explaining both. Charts with no margins look as they did.
Value_MOE,Value_Reliability,Percent_MOEandPercent_Reliability, and the time-series endpoints add<Field>_MOEand<Field>_Reliability. Both leave them out on a warehouse built before margins were collected, so the API can deploy before the ETL rerun.just run-etl 2009 2024(from Carry ACS margins of error through cleaning, with reliability labels #178) has run; until then everything looks as it does today.