Congress needs SOAP

brian_d_foy on 2004-01-07T06:05:29

Maybe the US Congress or Library of Congress already have SOAP interfaces to their web sites, but I have not found them, and I spent a couple hours researching a couple of bills yesterday (HR 526: Telemarketing Relief Act and HR2239: Verifiable Vote Something or Other), and what I really wanted was one link that said "Download everything related to this bill" which would include the bill text, status report, co-sponsors (with contact info), related bills, and everything else.

use Congress; # just like big companies!

my $congress = Congress->new;

my $bill = $congress->fetch( 'HR2239' );

print $bill->text;

print "Bill has ", $bill->cosponsors->count, " cosponsors\n";

foreach my $related ( $bill->related ) { print "Related: ", $related->title, "\n"; }

$bill->approve() if int( rand 2 );


But let us go even further. We need to commoditize the legislative process.

Just imagine Congress as a web service like Amazon or Google. Imagine "A page that you made" but with pending legislation, including "People insterested in this bill were also interested in these" or "Senators who voted for this bill also voted for these". Hey, once we have that, we can have real-time popularity polls right on the congressional website. The congress members would then spend a good amount of their day checking their polls like some people watch the stock ticker. "Fitzgerald up 7/8th, Daschle down 500". Since I live in Chicago, I will need "Buy votes for this bill" and "Vote again (and again)" links.

So, Ziggy, where is it? It must be there somewhere and I just have not found it.


indeed

inkdroid on 2004-01-07T16:02:11

I was daydreaming along these lines myself after YAPC. Having a SOAP interface to Thomas would be pretty cool--and popular I imagine.

Re:indeed

brian_d_foy on 2004-01-07T16:33:43

I wrote to Senator Fitzgerald a while ago, and he invited me to visit him in Washington when I get back (I think he does this for everyone though). Maybe I can bring this up when I talk to him about S1980. :)

Re:indeed

inkdroid on 2004-01-07T17:28:38

Cool :-) In the meantime writing a Mech agent, or something that fits into the WWW::Search framework for accessing Thomas may not be too difficult. SOAP would be a whole lot cleaner, and versatile. But...
#!/usr/bin/perl

use strict;
use warnings;
use WWW::Mechanize;

my $bill = shift;
if ( !$bill ) { print "usage: bill S1980\n"; exit(1); }

my $th = WWW::Mechanize->new();
$th->get( 'http://thomas.loc.gov' );

$th->field( docidc108 => $bill );
$th->submit();

$th->follow_link( text => "GPO's PDF" )
    or ( print "No such bill $bill\n" and exit(1) );

$th->follow_link( text => 'Continue' );

open( PDF, ">$bill.pdf" );
print PDF $th->content();
close( PDF );
is a nice quick hack...Perl, ahhh!

I could definitely go for...

phillup on 2004-01-07T16:14:32

my $congress = Congress->new;