Last Week in VoteIt

In keeping with the idea that each Poplus Component should provide regular updates on what’s going on — an update on VoteIt.

Or, more precisely, an update on both VoteIt and Stancer, as they’re really two separate Components — the first an API for playing with Popolo format vote data, and the second, built on top of that, to let you generate Stances on Issues (like TheyWorkForYou’s “David Cameron voted a mixture of for and against a referendum on the UK’s membership of the EU”).

—-

VoteIt:

VoteIt has taken a couple of massive leaps forward in the last few weeks.

Firstly James published the initial version of the Popolo standard for
Voting data.

This allows us to collaborate on tools that target that format, rather
than every country doing its own thing based on their own data
structures.

Then at the ICFJ Code Camp in Bellagio we had a great team working on
some of these tools.

We now have an API server, which you can feed Popolo-format vote data
(for which we provide a bulk loader), and get back aggregate
information, grouped and filtered on lots of different aspects.

e.g. http://voteit-uk.herokuapp.com/api/1/aggregate?motion=pw-2002-09-24-319&motion=pw-2002-11-25-6&bloc=party.id&filter=party.id:pc
summarises how Plaid Cymru MPs voted on those two motions, or you can
change the bloc to be the MP to see the individual votes —
http://voteit-uk.herokuapp.com/api/1/aggregate?motion=pw-2002-09-24-319&motion=pw-2002-11-25-6&bloc=voter.id&filter=party.id:pc

There aren’t really many docs for it yet, and it’s a little brittle if
you ask stuff it doesn’t understand, but feel free to play around (github)

We’ve transformed lots of vote data from Finland, Germany, and the UK
into this format, and each have their own API server. There’s no
hosted version of this (yet?), but there are simple-to-follow
instructions for how to get it working on Heroku (where up to 512MB of
data is free.)

This doesn’t do very much, but that’s quite deliberate. The goal is
simply to provide a standardised layer that other Components or Apps
can build on top of.

So we also did some work on one such other Component …

Stancer

For most people, motion-level vote data is fairly meaningless. What
does it mean that someone voted against “To delete paragraph 3.b.ii
from the proposed amendment to the Road Traffic bill”?

Stancer is a Component for creating high-level Issues (“Making cycle
helmets compulsory”), and grouping together all the different motions
that relate to that issue, so that you can show how a policitican,
party, or other grouping of your choice (maybe by age, gender, or
region) voted on those.

In order to maximise the ability for groups to integrate something
like this into existing sites, there are three parts to this, all kept
very separate:

1) Generate Issues.

This is where you say which motions are part of the Issue, and how
strongly it contributes. This is the hard, time-consuming, part that
requires human input. Different groups will create and maintain these
in different ways, from simply building raw data-files by hand, though
having a admin interface for their own research staff to build them,
or allowing pre-approved NGOs to maintain each Issue (like Open Knesset
do), or maybe even opening it to the public via a Wiki, PublicWhip
style.

We did some work on a nice MEAN-based interface that lets you search
all the motions in a voteit-api server and add/remove them to Issues,
but this will require some more work before it’s ready for public use
(ideally by someone who understand the MEAN stack a lot better than I
do.)

I’ve also built a tool (github) to extract the data from a Public Whip policy
and convert it to JSON.

2) Generate Stances

The Stancer itself doesn’t care how you built the Issues — it just
takes the data for which motions they contain, fetches that data from
the voteit-api, and applies directional weighting information to it.

At the minute this is just a Ruby library (github), but I’m planning to turn it
into an API-based approach Real Soon Now (and quicker still if someone
else actually starts using this on real data).

3) Display Stances

Again, this is kept distinct from the other parts, because I expect
that this will mostly need to integrate into existing sites. So the
Stancer simply gives you JSON for a Stance, and it’s up to you how to
display it. Hopefully people will write simple drop-ins to Django /
Rails / whatever for making this even easier.

But just to prove how simple this part is, I build a Jekyll based demo version that can be displayed on GitHub Pages.

This uses all the PublicWhip data currently displayed on
TheyWorkForYou, but as well as letting you see stances for each MP,
you can now also browse by Party, or by Issue.

The code for it is on github but the basic principle is that you just drop JSON stances files into the _data directory, and everything just magically updates accordingly.

There’s still a lot of work to be done on all the different parts of
this — and there’s some more details on how they all hang together at
http://discomposer.com/stancer/ — but hopefully other people will join
in and help with that!

Thoughts, questions, suggestions etc., very welcome.

Leave a Reply

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