While working on [OpenCongress](http://www.opencongress.org/), one of the questions we’ve been tackling is how close a given bill is to actually passing into law. Our interest in this question stems from our efforts to improve search results: People aren’t only interested in bills that are likely to pass. There is wide-spread, intense interest in a lot of bills that never pass, and we want to favor these bills in search results, too, while de-prioritizing the [many, many bills](http://www.washingtonpost.com/blogs/wonkblog/wp/2014/01/16/almost-none-of-the-bills-introduced-into-congress-ever-becomes-a-law/) that are introduced but attract no action or interest.
One of the qualities most popular bills share is having passed through the first few steps in the process. Our Congress API [provides an `active` flag](http://sunlightlabs.github.io/congress/bills.html) that signifies whether a bill has advanced through the steps that nearly all bills do. This is a good, rough cut of the data, but I wanted to see if I could improve on it by providing a more precise measure of how far away any eventual passage is.
The fundamental problem with this measurement is that not all bills take the same path through Congress. Some are fast-tracked, some ping-pong between the House and Senate, and a select few have an epic history of passing both chambers only to be vetoed and then re-pass on a veto-override vote. Needless to say, it can be hard to enumerate all of the possible paths. In order to sanity-check my own ideas about how Congress works, I generated a graph showing how many times bills have transitioned between statuses.
This effort builds on the great work in the [unitedstates/congress project](http://github.com/unitedstates/congress/), contributed by [Josh Tauberer](https://github.com/JoshData) (of [GovTrack](https://www.govtrack.us/) fame). The bill scraper codes each bill action based on whether it changes [the status of the bill](https://github.com/unitedstates/congress/wiki/bills#wiki-bill-status-codes) in question. To generate each graph, I iterated through each bill action chronologically and counted observations from status A to status B and then generated a [Graphviz](http://www.graphviz.org/) file ([code for those interested](https://gist.github.com/dvogel/8744642)).
As the saying goes, a picture is worth a thousand words; so here’s the graph for the last five congresses combined (click for a huge version):
60,001 bills were examined in the making of this image. None were harmed.
You can also view a separate graph for each Congress dating back to the 109th below: