TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

The US Census now has an API

173 pointsby ams1almost 13 years ago

12 comments

jack-r-abbitalmost 13 years ago
&#62; <i>The response for all queries is formatted as a two dimensional JSON array where the first row provides column names and subsequent rows provide data values.</i><p>Hmmm... looking at the example of this I can't help but think there has got to be a better way. This is more just a standard CSV (first row is header, all other rows are data). Using JSON for data formatted as such is kind of a waste of JSON. If you pass that example into a JSON decoder you get an extremely more difficult to use object. Am I missing something? or is this just typical "the government doesn't do tech properly" stuff?<p>EDIT: sorry, I try to be less negative but sometimes it is hard. I do applaud them for at least making the info available. I don't have a use for it but if some else does then dealing with a stupid format is better than not having data at all.<p>EDIT2: (to clarify) I was not saying the data <i>should</i> just be CSV... I'm saying it <i>is</i> and that defeats the purpose of using JSON. They should still use JSON but with their data formatted differently. Using their example, properly closed but truncated to just to first 2 records, the PHP function json_decode() turns it into this array:<p><pre><code> array ( 0 =&#62; array ( 0 =&#62; 'P0010001', 1 =&#62; 'NAME', 2 =&#62; 'state', ), 1 =&#62; array ( 0 =&#62; '710231', 1 =&#62; 'Alaska', 2 =&#62; '02', ), 2 =&#62; array ( 0 =&#62; '4779736', 1 =&#62; 'Alabama', 2 =&#62; '01', ), ) </code></pre> I don't find that format to be very pleasant.
评论 #4076545 未加载
评论 #4076777 未加载
评论 #4076502 未加载
评论 #4076518 未加载
评论 #4077659 未加载
评论 #4077442 未加载
评论 #4080016 未加载
jcampbell1almost 13 years ago
Wow, this is good government. I can nitpick the API details, but this is one giant leap in the right direction.<p>Under US law, the federal government can't claim copyright on works produced via tax dollars (makes sense). Since the feds can't require us to provide attribution for all this helpful data, how do we as a community advocate for more open data like this?
adeleviealmost 13 years ago
If anyone is interested, the FCC has a fairly comprehensive list of Developers pages for other federal agencies: <a href="http://www.fcc.gov/developers" rel="nofollow">http://www.fcc.gov/developers</a> (on the right column).<p>Also, for further reading on the topic of .gov APIs, <a href="http://ben.balter.com/2012/06/02/publishing-government-data-that-developers-will-actually-use/" rel="nofollow">http://ben.balter.com/2012/06/02/publishing-government-data-...</a> is a great start.
bryanjclarkalmost 13 years ago
Cool, especially since the census is one of the main reasons why we have computers at all.<p>I went to the Computer History Museum a few months back, and when we were looking through the origins of the modern computer, a lot of it traces back to census needs: we needed to automate the counting of large quantities of uniformly formatted data, so we used punchcards to tally up the data.<p>Fast forward to 2012, and the census is now getting an API. Weird how that works.
taylorbuleyalmost 13 years ago
When you sign up for an API key you get the message "Happy querying!" Quite the model of transparency.
DrJokepualmost 13 years ago
Wouldn't this be better served by a downloadable SQLite file rather than a web service?
评论 #4076695 未加载
评论 #4076524 未加载
评论 #4076423 未加载
评论 #4076703 未加载
评论 #4077749 未加载
评论 #4076422 未加载
bltalmost 13 years ago
It's pretty cool that they are putting up the machine time to run queries on the data. I wonder how long it will last if someone makes a popular web app using the census API.
andyjohnson0almost 13 years ago
Slightly OT, but UK census data can also be accessed by a web API. Some details are at <a href="http://www.programmableweb.com/api/office-for-national-statistics" rel="nofollow">http://www.programmableweb.com/api/office-for-national-stati...</a>.<p>The bad news is that it appears to be SOAP-based.
10dpdalmost 13 years ago
Has anyone considered possible use-cases for this dataset?<p>It's great to get excited about the data format, but actual use-cases currently seem a little limited to me. Of course this will hopefully change as more and more datasets become available.
评论 #4077551 未加载
alisteralmost 13 years ago
You need to request a "key" (essentially a user ID) before you can make queries.<p>I can imagine only 3 reasons for this: (1) they want to make you agree to the Terms &#38; Conditions, (2) it gives a way to choke off a DDOS attack that makes repeated complex queries, or (3) the census bureau wants to track how you are using its service.<p>The key is indeed easy to get, but I observe that Google would have exactly the same concerns as 1,2,&#38;3 above, yet they somehow manage to stay in business without making their users sign up to do a web search.<p>The federal government always makes things a little more complicated.
评论 #4077712 未加载
评论 #4077237 未加载
acoyfellowalmost 13 years ago
This opens my mind up to a whole new slew of ideas using their information so easily..
mkramlichalmost 13 years ago
better if was URL of a tarball of structured human-friendly data