April 24, 2018 Hatem

Opening up 2018 Tunisian Municipal Elections Data

Level : Intermediate
Requirements : Some knowledge of Linux Shell, Tabula, and any spreadsheets software.

Publishing elections data in closed format become very common, in case any data have been published. Few days from the municipal elections we are still worried if it is going really to happen or not. Efforts come as usual from civil society and private sector to open up data and reuse it, and we saw few applications such as TunisieElection.org or Targa’s analysis … Big thanks to Abderrahman Gharsallah who did the first dataviz and released data in open format on github, a project supported by Democracy International and Mourakiboun.

One reason of doing this work is a comment from a friend telling me that there are some independent lists that are present in more than one region, and they could be not really independent as they claim ! I started googling the list name and found that it’s present in at least 6 regions. So I needed official list of candidates to check how many independent list is present in more than one region.

Unfortunately I have sometimes some bad habits to start from scratch, and that’s how I discovered that a file related to Tunis2 candidates have been removed from official ISIE website and replaced with a new one, nothing changed in data, it still in PDF but columns are in reverse order ! Now tables are in PDF ? First step to deal with this is Tabula.

I converted all PDF to CSV format manually one by one :

Then combined them in one file using “miller” :

mlr --rs lf --csv sort -f date,code *.csv > combined.csv

Of course I make sure that I reversed columns order in Tunis2 file before combining files to be able to directly work with data. I was looking for independent lists, but that’s how I discovered that the whole list of names is messing !

Cluster analysis of data in Arabic is really hard, but it can help :

So I started combining names to make sure that a same list have the same name in the whole dataset. The final result is quiet interesting : about 9% of independent lists have more than one list, six of them have more than ten lists ! Especially if you know that 21 parties are participating in this elections with one list only ! Independent lists seems to be more powerful than many well known political parties.


I will stop here, below the list of  independent parties participating in this municipal elections and having more than  10 lists :

It’s great to have independent lists participating in these elections, however lots of questions come to my mind when I saw these numbers. Are they really independent ? Who is behind these lists ? I think it’s for the ISIE to answer these questions in case municipal elections are going to happen this 6th May 2018.


Leave a Reply

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

(HBY) Consultancy