By Derek Willis
The Federal Election Commission isn’t the first place that reporters might expect to find election results. The agency is known for providing data about the financing of campaigns – who is giving and getting money – and for deciding how to enforce campaign finance laws.
But election results? There’s no direct link to the FEC’s section on congressional and presidential results from the site’s home page, but every two years the commission compiles certified results for primary and general elections from official sources, and then publishes spreadsheets and PDFs containing the data.
Today we’re announcing the release of FecResults, a Ruby gem for retrieving and parsing the data contained in those files, as well as a JSON API for that data.
OpenElections, like the FEC, collects official results data from state election officials, and we’re looking for as much detail as we can get. The FEC data, by contrast, is just concerned with the race-wide totals for House, Senate and presidential contests. So why would we make the FEC results data available?
One reason is that for many users, race-wide data for federal elections is useful enough, and some of the breakdowns that the FEC provides for presidential races are particularly useful (state-by-state electoral and popular vote totals, for example). Another reason is that we see this data as helping us fulfill the mission of OpenElections, which is not only to publish election results data but to make it easier to link to other kinds of information.
The FEC results data (2004 example) includes unique identifiers for most candidates within each election, which are assigned by the FEC for fundraising purposes. Most state election results sites don’t include this identifier, since it has little use for state authorities. Publishing the FEC data will enable us to use it as a reconciliation service so that we can connect state-produced data with the federal ID system, and thus with federal campaign finance data where possible. Having the certified totals is also a way to check our state data gathering processes, too.
Some technical details: the FecResults gem makes use of the RemoteTable library, which handles all kinds of tabular data in files on the Internet. Since the spreadsheet files aren’t always consistent from year to year, we needed to customize the process of grabbing and parsing the data into Ruby objects. A separate gem, FecResultsGenerator, publishes the data as static JSON files, which are then published via GitHub Pages.