Skip to content
Congressional data aggregator website and meta-API.
Ruby JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
config
migrations
public
sources
vendor/cache
views
.gitignore
Capfile
Gemfile
Gemfile.lock
LICENSE
README.textile
Rakefile
config.ru.example
congrelate.rb
unicorn.rb.example

README.textile

Relating Data about Congress

Congrelate, a project of the Sunlight Labs, is a web app and data aggregation framework written in Sinatra. At its core, Congrelate is a dynamic, sortable spreadsheet of data about Members of Congress.

By pulling in other sets of data about campaign contributions and voting records, a user can quickly answer questions like: “Which women voted against the Lily Ledbetter Fair Pay Act?” or “Which industries are the largest contributions to members of the Senate Finance Committee?”.

Congrelate accomplishes this by pulling together data from various sources. Currently, the standard data sources used are:

Getting Set Up

Congrelate uses Sinatra for the basic web framework, and jQuery to power the dynamic data table. See congrelate.rb and public/javascripts/congrelate.js for the implementation details.

Basic

  • Required gems: sinatra, htmlentities, activerecord, activesupport, open-uri, json, fastercsv, hpricot, httparty, technicalpickles-daywalker (from GitHub).
  • Set up a database, copy config/database.yml.example to config/database.yml and modify as needed.
  • Run rake db:migrate.

Source Data

  • Register for a Sunlight Labs API key.
  • Copy sources/api_keys.yml.example to sources/api_keys.yml and add your Sunlight API key for “legislator”.
  • OpenSecrets.org releases their data under their OpenData initiative (as a zipped up CSV file). To get this, sign up for an account at OpenSecrets.org and download the 2008 Campaign Finance data set here. Unzip that into data/opensecrets/, so that the .csv files are in data/opensecrets/CampaignFin08.

Finishing Up

  • A simple rake sources:update will update all data sources according to their time-to-life values in sources/sources.yml.
  • Running ruby congrelate.rb will fire up the app on port 4567.

Developing Your Own Data Sources

We strongly encourage you to fork this code and contribute your own data sources to the project! In five easy steps:

  1. Create a new directory in sources/
  2. Write the database migration and pop it in migrations/
  3. Write an ActiveRecord model that defines class methods for sorting, updating, and generating columns for the data, and any other helper classes you need
  4. Write the form HTML for the pop-up that lets the user choose from your data (view helpers provided)
  5. Update sources/sources.yml with the details of your new source

See the sources/example/ directory for details.

Something went wrong with that request. Please try again.