How can I pull political data into my website?
December 31, 2010 1:24 PM   Subscribe

How can I find out United States political information, such as Senators, current elections, and so on, for visitors of my website, in as automatic a way as possible?

I'm working on a politically-themed website, and I'd like my users to be able to enter their zipcode, or county, or... something. Then, based on that information, pull up who their politicians are (at a minimum), and pull up anything else I can, politically speaking (like, if there's an election going on or whatever).

Is there any kind of government-sponsored, or nonprofit-sponsored database or API or something I can query, or at least pull a copy of daily? I don't really care what format it's in... frankly, I'm willing to screenscrape if I have to.
posted by fvox13 to Computers & Internet (8 answers total) 4 users marked this as a favorite
Check out, they offer this on the individual, might have a way to automate it in the manner you desire.
posted by nomadicink at 1:38 PM on December 31, 2010
posted by MsKim at 1:46 PM on December 31, 2010
posted by MsKim at 1:48 PM on December 31, 2010

Best answer: Elections are set by states. You can count on biennial elections in all states (for US Congress), most states elect state legislature representatives in those elections, some in "off-year" elections. Special elections, however, are set state-by-state, sometimes by law, sometimes by law but the governor sets the precise date, etc.

Zipcode isn't going to map to districts/elective offices except for state-wide elections (governor, US senator), and each state will have numerous different intermediate jurisdictions between precinct (where you vote) and state of residence: all of these, wards, managerial districts, towns, townships, freehold, counties, independent cities, state lower house districts, state upper house districts, US congressional districts, will not necessarily "nest" (that is, lie in only one) next-larger-kind of jurisdiction. Often, you'll have to consult county boards of election for precinct, ward, managerial district, and state BOEs for the rest.

US CDs will all redistrict next year, and that may or may not trigger state districts and county precincts to do the same. Depends on the state.

To tell someone where he or she votes basically means getting from each county BOE its assignment not for an area, but for that particular voter, if you want to be accurate. Which means convincing a visitor to your site to give at a minimum his full name, and either address specified his county's BOE's way, or his date of birth. Address alone just doesn't do it for many edge cases, and if it does, it needs to be a full address, not just zipcode, and again, specified close enough to how the BOE splits out address parts.

In some states, voter lists are free to anyone; in others it's necessary to pay thousands of dollars per list (that is, per county). And each county likely has a its own database format for specifying voter, precinct, ward, etc, which you'll need to munge into a common format, and its own particular medium for supplying data -- some may supply only compact disks, for example.

It's a major pain, and costly.

People for the American Way put together a voter list in 2004, I don't know which states it covered. I put together one that year for some counties in a particular state, and it was painful. The major parties pay millions to rent these lists, from contractors who may or may not keep them up-to-date (which is why I had to put together the list I did).
posted by orthogonality at 1:51 PM on December 31, 2010

Oh, and of course, as soon as someone registers, they're on the county list but not yours, so you have to be able to re-import the variously differently formatted county BOE lists on a regular basis. And to account for people removed, that means wiping out all that county's data and re-importing it en masse. And often the county doesn't even know when someone has died.
posted by orthogonality at 1:56 PM on December 31, 2010

Best answer: lets you find representatives and senators by state, by ZIP Code, or by street address.

Open Government Data and .NET describes setting up a web app to find Congressional representatives by ZIP Code using a GovTrack API and the Sunlight Labs Congress API:
I wanted to test the waters by writing a small app that allowed someone to enter a zip code, find all of their Congressional representatives , then find out the committees they're on, bills they've sponsored, how they vote based on some issues… and then provide me the tools to contact them, as well as enter a daily rating on how I think they're doing.
posted by kirkaracha at 2:52 PM on December 31, 2010

Best answer: 2 APIs:
MsKim: &
Where is the API here that fulfills the OP's requirements, again?

posted by coolguymichael at 3:53 PM on December 31, 2010

Best answer: David with PPF here. The above-mentioned APIs all work. One of the services OpenCongress provides is accompanying contextual info from around the Web regarding official government info. We offer a free OpenCongress API of much of that and user actions on our site (more about our code) and the open scraping code that aggregates the data on our web pages. Our new project is OpenGovernment, a more modular & remix-friendly-as-always version of OpenCongress for state & local government, including the GovKit API wrapper and the OG web app itself.
posted by Participatory Politics at 8:32 AM on January 6, 2011

« Older Aliens hunting you down with nowhere to run?   |   Can GGG stand for Great, Gregarious, Genial? Newer »
This thread is closed to new comments.