OSCON 2008: Perl for Political Campaigns

There was nothing interesting for me scheduled for the second session today, so I ended up in Perl for Political Campaigns, presented by Chris “Pudge” Nandor. I’m not entirely sure why I’m here, but it likely has something to do with Perl in the title and Pudge as the presenter. I must be in the right place, though. Both Damian Conway and Adam Kennedy are present.

Pudge is, quite famously, a Republican, so he wants poor people to die, he asserts his right to shoot people who jaywalk, and he hates puppies. Now that we have that out of the way, this will not be a political talk. Instead, it will be a talk that just happens to use politics as the problem domain for which Perl was the solution (but isn’t it always?). Pudge happens to volunteer for the Republican party in Snohomish county, Washington. I actually know the area fairly well, as my grandmother happens to live there.

Winning elections is all about knowledge. And blackmail. But, mostly knowledge.

This session is essentially about data mining. There are a number of disparate data sources available with information about voters. From registration and voting history to contact information and preferences—can or can they not be contacted. This data is not always easy to access. For example, there is something called the Voter Vault, which is a super secret database of voter information controlled by the Republican party (there’s an NDA involved, so we won’t see any of it).

Essentially, Voter Vault is a really crummy Web application that only works for IE (hence the crummy part). That’s where WWW::Mechanize comes in. Using this brilliant module, data on any Web site can be retrieved, even if it requires a certain amount of user interaction to access. This, along with other sites, like the Washington State Public Disclosure Commission, provide all the raw data Pudge needs.

However, raw data is, by itself, not useful to anyone. This is the reason behind Pudge’s efforts. He uses Perl (and some JavaScript) to collect and aggregate all of this data. Then, once it’s all compiled, he can use a bit of Perl glue to use the data in Apple’s Address Book and Mail applications. But, more importantly, he can visualize it.

For the visualization, Pudge uses everyone’s favorite new tool, Google Maps. Using the Ajax API provided by Google, he can embed a map in his own Web application and, next to it, provide controls to enable and disable different views of the data on the map. For example, candidate donations by city and how much each candidate received.

It gets better. With the Google Earth APIs available to Google Maps, KML files can be generated (again, with Perl) to provide even better data visualizations. For example, precinct boundaries can be imported and colored based on voting history.

Initially, I wasn’t sure how I’d feel about this talk, but I ended up enjoying it. It was an excellent presentation on how to take data and display it to users in a useful manner.

[tags]oscon, oscon08, oscon2008, Perl, politics, visualization[/tags]

One thought on “OSCON 2008: Perl for Political Campaigns

  1. When I adapted WWW::Mechanize from Skud’s WWW::Automate, I was afraid that someone might use it for evil, such as spammers scraping websites for email addresses. I never thought that it would be used by a Republican!!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">