Code Monkey home page Code Monkey logo

hulse's Introduction

Hulse

Hulse is a Ruby gem for accessing House and Senate roll call votes from the official sources on house.gov and senate.gov. It works using Ruby 1.9.3 and 2.0.0.

Hulse has two classes, HouseVote and SenateVote, which create Ruby objects using the XML attributes available from roll call vote data (voice votes are not covered by Hulse or available as data from official sources). Hulse makes a few changes, renaming some attributes for clarity and consistency, and collapsing each House vote's date and time into a single datetime attribute. Otherwise it does not alter the original data.

HouseVote and SenateVote have different attributes due to parliamentary conventions and the presence or absence of data in one chamber or the other. Senators are uniquely identified by a lis_member_id; House members are uniquely identified by a bioguide_id beginning in 2003. Prior to 2003, there is no unique ID for House members, but using a combination of name, state and political party one can be manfactured. House member attributes also include an unaccented_name and an name attribute that may contain accent characters.

Hulse is named for Carl Hulse, a longtime congressional correspondent for The New York Times.

Installation

Add this line to your application's Gemfile:

gem 'hulse'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hulse

Usage

For both House and Senate votes, pass the year and roll call number into the find class method:

2.0.0p353 :001 > require 'hulse'
2.0.0p353 :002 > include Hulse
2.0.0p353 :003 > hv = HouseVote.find(2013, 628)
2.0.0p353 :004 > hv.question
 => "On Agreeing to the Amendment"
2.0.0p353 :005 > hv.vote_count
  => {:yea_total=>157, :nay_total=>258, :present_total=>0, :not_voting_total=>16}

Be aware that in 2012, there were 5 House votes that occurred on Jan. 1, 2013. These are considered "2012" votes by the Clerk of the House, so use 2012 as the year for these.

For Senate votes, you can grab a year's SenateVote objects (with a limited set of attributes) by using the summary method:

2.0.0p353 :006 > senate_2013 = SenateVote.summary(2013)
2.0.0p353 :007 > senate_2013.first
=> <Hulse::SenateVote:0x000001017f0d58 @congress=113, @session=1, @year=2013, @vote_number="00291", @vote_date=<Date: 2013-12-20 ((2456647j,0s,0n),+0s,2299161j)>, @issue="PN921", @question="On the Cloture Motion", @vote_result="Agreed to", @vote_count={:yeas=>"59", :nays=>"34"}, @vote_title="Motion to Invoke Cloture on the Nomination of Janet L. Yellen to be Chairman of the Board of Governors of the Federal Reserve System">

Authors

Contributing

  1. Fork it ( http://github.com/dwillis/hulse/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

hulse's People

Contributors

dwillis avatar konklone avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.