The NY Senate made an exciting announcement today – a host of new open source software and services are being deployed to enhance transparency in what the Senate does.
This is big news, and a major tip of the hat goes to the NY Senate CIO, Andrew Hoppin, and his staff. They are doing amazing work in advancing transparency in the Senate – an organization that has traditionally been as closed as closed can get.
The announcement by the NY Senate has many different components, but the one I find most exciting right out of the gate is the release of an API to query the Senate bill tracking system. I’ve had an idea for a while now to do an Instant Messaging (IM) application that would let someone query the status of a bill, and get a bill summary, using an IM client.
Because the bill tracking system is now exposed via an API, building this kind of application is easy — so I went ahead and did it. Alltogether it took about 2 hours to build, test and deploy.
The code for my sample application can be downloaded here.
You can test this application out by adding firstname.lastname@example.org to your Jabber IM client (Google chat will work just fine). If you send an IM with a Senate Bill number (e.g., S2111) you will get a response with the bill sponsor, summary and the last action taken on the bill.
Here is what I used to build this application:
- The NY Senate Open Leg Service API (note – at the time of this writing, the API documentation appears to be offline. Hope this is restored soon.)
- PHP (however, since we’re justing hitting a REST API using HTTP, there are a host of different languages that will do).
- The IMified platform – more on IMified here.
- A simple PHP class for building IM applications – more on this class, and a primer on building IM apps here.
That’s it! Its admittedly simple, and there is no real error handling in the app just yet, but if you give it a live bill number it works just fine. I’ll probably do some more work to build this example app out as the Open Leg Service API matures.
Now you can get the status of a bill and summary information quickly and easily using an IM client. This is just a quick example of what can be done when an organization like the NY Senate has forward thinking IT leadership, that embraces open standards, open source and open information.
UPDATE: Twitter support added to NY Senate Bill Status Bot.
Because of some awesome new functionality added to the IMified platform, I’ve added Twitter support for the NY Senate bot. Now you can get the bill sponsor and bill status by sending the bill ID (e.g., S2111) to @opensenate.
I’ve also updated the code sample provided above to reflect the changes to the IMified API. This significantly enhances the usefulness of the application, and allows you to turn inquiry into advocacy (can you say Retweet!). I’ll be writing more about this shortly but for now I am working on some minor tweaks to the sample bot.
UPDATE II: New GitHub Repo
The latest code is now up on GitHub.