Releasing MEPcheck

Go to repository

Quickly check what your MEPs (Member of European Parliament) are doing and how they vote.

The idea

There are currently 750 MEPs, at most 96 and at least 6 per European country. EU is a complex and sometimes obscure machine, but it usually works and most of current rules and laws in Europe come directly or indirectly from mom EU.

Many people complain that the decision process is not transparent and often national representatives present results of votes as decisions of the EU. This is mainly a lie: every EU member has its say both in the Parliament and the Council. The Parliament is even very transparent and you can check how every MEP voted for every proposal.

The issue is that the process isn’t exactly user friendly, Votewatch partially solves the problem, but since I like raw data and the possibility to easily retrieve them I thought: “What if there was an API to retrieve voting data without much hassle?”.

MEPcheck is essentially this, a package to retrieve MEPs voting data and easily manage them.

Installation

While we wait for a REST service directly from the European Parliament, we can make good use of Votewatch. In fact getting MEPs names and last votes is as easy as making an HTTP call.

To try it you will need Python 3 (if you don’t have it or you don’t know how to install it follow the guide for your OS here) and you can install it from pip:

Or directly from the GitHub repo:

Now you’re ready to go!

How it works

The first thing you should try is to use MEPcheck from an interactive Python session, you can start one from your IDE (if you use one) or from the command line by simply invoking python.

In the video above you can see  what is achievable with a few commands. While the interactive use is good for messing around and trying stuff, for occasional use it is better to rely on the command line. This is why I set up a Dockerfile in the repo, so you can call MEPcheck from every directory without messing with your path.

To install it with Docker clone the repo as above and use these commands, remember that if you see an error when launching docker commands you might have to use sudo in both of them:

After the build process is finished you can put this snippet in your .bashrc or .bash_profile depending on which one you use:

Now you just have to fire up your terminal and run it from wherever you want. To try if everything works fine – remember to restart your terminal or to source the bash file – you can run mepcheck from a random directory:

By running mepcheck you get the same result as for get_meps(), a table of available EU member States. This makes searching MEPs easier: you start from the country you’re interested in and then look for your MEP.

As we all know I’ve chosen Cyprus beacuse it has just a few MEPs – because the number of MEPs is tied to a member state population – and it looks better on screen.  Let’s see what Costas Mavrides is doing lately. His ID is 439, so I just call:

If you’ve run this you saw many more results. The default number of votes to retrieve is 50, but we can change it by using the --limit option.

Otherwise we can ask for a nice summary table of votes, let’s say we want to analyze the last 250 votes, but before we want to take a look at the data.

I increased the --limit to 250 and added the -s option that produces a much more contained table of counts. On top we can see that Costas was absent 6% of the times during this period, not that great.

If we want we can pipe or redirect the output to nearly anything, and using three different formats: a list, JSON and a Pandas DataFrame.

The -d option takes either list, json or df as parameters and outputs different data structures. This option is the same as calling the data_() method in Python, and that is probably where you want to use it to analyze or move data efficiently.

Contributing

I accept and encourage every kind of contribution: bug signaling, improvement proposals, pull requests, etc. I would really love to know if you’re using MEPcheck and how you’re using it. To contact me you can write a comment here, on Github, on Twitter or by sending an email at alan@rdisorder.eu.

Go to repository

Leave a Reply

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