Stancer

Today’s MPs are no longer scared of the whips. Instead, they are scared of their constituents. —— Peter Lilley

In a representative democracy you delegate your vote to a politician — but how do you know what they do with it? You might know how the main political parties vote on a few big issues that get press attention each year — but on the hundreds, or even thousands, of other issues they consider, can you tell if they are acting in the way you would have wanted, or if you should maybe have voted for someone else instead?

Many (though far from all) countries publish information on how legislators voted — but it’s largely meaningless to most people. Voting data is usually attached to motions that often say little more than “… motion to delete clause 1.f.3a from the Heinmann amendment”, and in many cases important votes look at first glance to be purely procedural.

In the UK, Public Whip and TheyWorkForYou have done a great job of turning that raw data into voting summaries that are accessible to regular people — not just political junkies, activists, and data nerds. But the code behind that is close to impossible to easily adapt for use in other countries (particularly ones that don’t use the Westminster system), and it doesn’t actually do many of the things that would be desired in other countries anyway (for example, it only lets you see how a single MP voted on a range of issues, when often it’s the overall record of a given party that’s more interesting and important than a specific politician).

Stancer is an attempt to solve this, by creating a set of tools to make it much easier — in any country — to see how MPs and political parties (or, indeed, any grouping1) voted on high level issues, in easily understandable language2.

It’s deliberately not one monolithic application — but lots of different parts with (hopefully) well defined interfaces, so that it can be used as easily as possible in as many countries as possible, in as many different ways as possible, whilst giving groups with the local knowledge maximal flexibility to turn raw data into something comprehensible and useful to regular citizens. The data is built on open standards, and all code is free software.

An example of this in action is at ukvotes.discomposer.com.

Building a similar site in another country is a five step process:

1. Transform your Vote data to the Popolo standard.

The Popolo Project is building open international standards around legislative data. Your first task is to gather your voting records, and generate Popolo Motions from them.

(Note: This will probably also require transforming your politician data too. Tools like PopIt can help with that part.)

2. Serve that data using voteit-api

Set up an API server, following the instructions at https://github.com/tmtmtmtm/voteit-api.

This is optimised for deployment to heroku, but you can run it anywhere you like3.

3. Create Issues

This is where you say that motions 2013-b93, 2013-f34, 2014-c6, and 2014-f11 are all on “introducing a tax on owning a bicycle” and how each vote on each motion contributes4.

This is the part that requires lots of human work, and can’t be automated. I want there to be tools that make this as easy as possible, but the hard work will always be examining motions and creating Issues — no matter how good we make the tech.

However, there are currently a couple of tools that can help you with this:

Public Whip

  • The Public Whip source code is available, so you could always try setting up your version of that.
  • OpenAustralia are also working on a rails version of that.
  • Data from those can then be transformed into the JSON format that Stancer requires. See voteit-data-pw for an example of this.

MEAN front-end

  • voteit-frontend is a MEAN-based front-end that lets you create Issues by searching a voteit-api instance for relevant motions. It’s unfinished, and may be quite tricky to integrate with an existing system, but if you want to use something like this, let’s talk! (It should also be easy to build a fairly light-weight jQuery version of this).

Jekyll-based

  • If you’re going to display your Issues using Jekyll/Github Pages, you could also describe them there in frontmatter (I have a tool in progress to help with that)

4. Configure a Stancer

A Stancer is the tool that will take all your Issue data (from step 3), and all your Motion data (from steps 1 and 2), and turn those into weighted stances for each person, party, or grouping you’re interested in.

Currently there’s only a UK-specific version of this available (see https://github.com/tmtmtmtm/stancer-pw), but making this more generic is a high priority (and will be higher still if someone wants to use this for real data in another country.)

This is currently a couple of command-line tools, but the idea is turn it into an API service.

5. Display everything with a Stance Viewer

The Stancer (from step 4) currently gives you static JSON files that can be used in your project. (Later versions will have a real-time dynamic option.)

You can simply take this information, and display it whatever way you like. I assume that most projects will want to display this within an existing framework, and thus don’t want to produce tools that assume a particular environment.

For demo purposes there are currently two simple versions:

  1. Jekyll (hosted on GitHub Pages) [code | site]
  2. Sinatra (hosted on Heroku) [code | site]

But it should be fairly simple <handwave/> to produce a Django app, or Rails engine, or all sorts of other simple ways of displaying the information.

6. Done

You now have a shiny site that lets people make informed decisions based on what legislators actually do, rather than vague awareness of propaganda.


  1. maybe you want to compare the record of male vs female politicians, or old vs young, or from different areas of the country []
  2. whilst also making it easier for analysts to collaborate on tools to explore the raw data — when we have all the voting records from every European country in the same format, for example, we could see whether parties who are in EU political groupings vote in similar ways to each other in their home countries; or we could more easily track how countries around the world stand on issues like gay marriage, or smoking bans etc []
  3. if you’re going to generate a static site at stage 5, you can even just run it on your laptop! []
  4. e.g. a yes vote on 2013-b93 may score +10, and a no vote -10, whereas on 2013-f34, which was more tangential to the issue, but phrased the opposite way around, yes might be -3, and no +3 []

Comments are closed.