The Scoop

  • Home
  • Projects
  • About The Scoop
  • Fixing Journalism
  • Medill Links
  • Departments
    • API
    • Apple
    • Asides
    • Broadcast
    • Campaign Finance
    • Car Tools
    • Data
    • DIY
    • django
    • Fed Data
    • FOIA
    • General
    • IRE
    • Journalism
    • Local Data
    • Mapping
    • Miscellany
    • NonGov Data
    • Online
    • Paper Trail
    • Presentations
    • Public Records
    • Python
    • Rails
    • SLA
    • Social Network Analysis
    • Sports
    • State Data
    • Teaching
    • Work
    • XML
  • Subscribe via RSS

FEC Electronic Filings

Electronic Filings RSS Feed

This Python script uses a MySQL database to parse the list of electronic filings and create an RSS 2.0 feed of the current day’s filings. It requires MySQL, obviously, and the FEC’s table of committees available via FTP (don’t forget the record layout). The feed’s committee names are derived from the table. The feed’s link points to the viewable version of the filing on the FEC site. The feed hosted here is rebuilt every hour between 8 a.m. and 11 p.m. via a cron job.

Get the script.


The following scripts download lists of electronic filings from the Federal Election Commission based on several criteria and output pipe-delimited text files suitable for importing into a database.


Electronic Expenditures

The FEC does not type into its databases expenditure records, but those records are available in individual electronic filings made by most committees (Senate candidates and the two main senatorial fundraising committees are the exceptions). Downloading and copying lines file-by-file isn’t much fun, so I wrote a Python script that will go line-by-line and create output files for the two types of expenditures (they have slightly different layouts, so you need two files). The only thing the user needs to do is supply a text file with the names of the filings to be parsed, one file to a line (you can find the names of filings by searching the FEC’s database of filings and copying the names of the “Download” links. Running the script is simply a matter of typing python fecexpend.py filename.txt at the command prompt, where filename.txt is the name of your text file. The resulting files can be imported into a spreadsheet or database manager. The script is released under a Creative Commons license ; please refer to the license for information on republishing or modifying it.

Get the script.


Electioneering Filings

The Federal Election Commission recently began posting a list of electioneering communication filings (a new type of filing created by the new campaign finance law). This Python script, based on the earlier one, scrapes the list and returns a pipe-delimited text file with a list of filings by committee ID, along with the period of activity and the total raised and spent. It appears that the figures apply to the entire period listed and thus some of the filings will overlap.


FEC Filings Script

Finally, I can announce that I’ve finished converting a Perl script that parsed the list of FEC electronic filings to Python. This was done for several reasons, not the least of which is that I’ve decided to concentrate on Python as my primary scripting language, but also because the FEC stopped updating its single-page list of filings and now only makes such lists available through a Web form”. The initial release of the new script downloads a list of party committee filings into a pipe-delimited text file, although this can be changed in the script’s parameters to match any of the FEC’s codes. Future development will concentrate on compiling a single file with all electronic filings through multiple form submissions. The script is released under a GPL license – use, improve and enjoy!

Update: this script works under Python 2.3, but it may yield a “maximum recursion limit” error under 2.2


Fetch FEC Electronic Filings by Date

This AppleScript prompts the user for a date in MM/DD/YY format, then queries the FEC’s electronic filings site to find a list of filings made on that day. Using curl, it saves the file to the user’s hard drive (you’ll need to change the path to match your system) and then opens it with Safari. My plan is to revisit this and make several changes, including making the resulting file reflect the date entered and adding some error messages for the input.

Download the script file (.sit format), and feel free to send along any comments or questions.

Recent Comments

  • Jessica Baumgart on How APIs Help the Newsroom
  • Bookmarks van juli 7th tot juli 14th | .: zerocontent - Blog :. on How APIs Help the Newsroom
  • Reporting with Data: How the New York Times Uses APIs on How APIs Help the Newsroom
  • Brad B on Six Reasons To Look Past Caspio
  • Annelies on Big Numbers, Low Impact

Recent Posts

  • How APIs Help the Newsroom
  • Big Numbers, Low Impact
  • Using the NYT Congress API with … Excel?
  • An Even Better CAR Conference?
  • 2010 CAR Conference


©2010 The Scoop
Powered by WordPress using the Gridline Lite theme by Graph Paper Press.