OpenCongress for Developers
At its core, OpenCongress is an open-source Ruby on Rails application for aggregating and managing open government data. Right now the opencongress.org website is focused on US Congress, but our vision is to bring tools for transparency and engagement to constituents of any governing body, from the UN to your local neighborhood association.
We rely on developers from the community to help us improve the code. Can you help?
Using OpenCongress data in your app
You can use OpenCongress data in your applications, provided you meet the licensing requirements (shown at right). Our API and RSS feeds provide all the data on OpenCongress, from official bill info to news and blog coverage to user-generated votes on bills and more.
OpenCongress - a Ruby on Rails application for displaying information about Congress
Lighthouse Project Page
OpenCongress for Developers
Getting started with our code
A. Dependencies
Start by installing all the packages required by OpenCongress.
For Ubuntu:
sudo apt-get install postgresql postgresql-client postgresql-contrib libpq-dev ruby1.8 ruby1.8-dev rubygems libopenssl-ruby imagemagick libmagick9-dev gcj-4.4-jre
or Mac OS X, start by installing MacPorts, then run:
sudo port install postgresql84 postgresql84-doc postgresql84-server ImageMagick md5sha1sum wget
Follow the instructions from the port install for initializing your database
Then grab the gems you need:
sudo gem install rails bluecloth mediacloth hpricot htree jammit json pg RedCloth ruby-openid simple-rss rmagick htmlentities oauth
Note for OS X: You may need to specify additional compile options for the pg gem. Make sure pg_config is in PATH and run sudo env ARCHFLAGS="-arch x86_64" gem install pg
B. Database setup
Switch to the postgres user and setup a db user following prompts for password and superuser.
sudo su postgres
createuser opencongress -P
Create your database
createdb opencongress_development -O opencongress
Import the tsearch2 backwards compatibility lib from wherever your postgres contribs got installed.
psql opencongress_development < /your/install/share/postgresql/contrib/8.4/tsearch2.sql
exit postgres user
C. App Setup
Copy over example yml files in /config
cd config; for file in `ls *example*`; do cp $file `expr "$file" : '\([^-\.]*\)'`.yml; done
Edit database.yml:
development:
adapter: postgresql
database: opencongress_development
username: opencongress
password: (password from step B)
host: localhost
Now you can start the solr server and run the database migrations
cd ..;rake solr:start
rake db:structure:load
rake db:seed
D. Data
create some dirs for data
Make sure all your data paths are set and exist in your environment file then run rake update:all to fetch and parse all available data sources. This process will take a very long time. Take a look at /lib/tasks/daily.rake for all the rake tasks if you want to run them individually.
Now just a script/server and you should be running
Copyright (c) 2005-2010 Participatory Politics Foundation
OpenCongress is licensed, as a whole, under AGPLv3. Components added prior to OpenCongress version 3 (July 27, 2011) were and are licensed under GPLv3. All components added for or after OpenCongress version 3 are licensed AGPLv3. When you contribute a patch to OpenCongress, it will be licensed under AGPLv3. See LICENSE-AGPLv3 file for details.
Quick links
OpenCongress is written with Ruby on Rails, backed by a PostgreSQL database and Solr full-text indexing. Our Wiki runs on Semantic MediaWiki.
- Data API docs & RSS feeds
- GitHub repository
- Lighthouse tracking
- Development roadmap
- Developer e-mail list
- IRC: chat.freenode.net channel #opencongress
Contact Us
Want to work on OpenCongress, show off your use of our API, or just say hello? Send us an e-mail () with a short note of introduction. We don't bite.
Licensing Terms
OpenCongress site code is available available on github and is licensed under the GNU Public License (GPL), so we encourage you to contribute to our code and reuse it in non-commercial contexts, as long as attribution to OpenCongress is given.
We encourage you to remix and excerpt our site and wiki content, as long as attribution to OpenCongress is given and you share your content as well. Our site content is licensed under the Creative Commons Attribution-Share Alike 3.0 US License, and our wiki content is licensed under the GNU Free Documentation License (GFDL).

OpenCongress for Developers

