Getting data from the Census Developer API
The Census provides a ton of data through their straightforward to use API. It speaks JSON and it's CORS enabled so it's a breeze to use.
Below is a gist with code to make a call to the API to get population and poverty counts in urban areas, do some minor manipulation of the data, and make a table showing:
- the name of each urban area
- population in each urban area
- the number of people under the poverty line
- the percentage of people under the poverty line
And a live version of the page.
The hardest part of using the API is figuring out which variable names (things like B17001_002E
and B01001_001E
) to put in requests to the API. There are some files to sort of help figure things out, like variables.json for the American Community Survey as well as variables.json for summary file 1
(warning: both of those are several MB of JSON). Both are huge and if do a find in file, you'll likely get thousands of results. I have better luck poking around other sites, like Census Reporter, to zero in on various variables.
Maybe that's what needs to be built: a sensible Census data variable browser.