Tunisia Election Data

Cette carte permet de visualiser la proportion de bulletins de vote qui ont été invalidés au cours du dépouillement. Cela peut être dû à une erreur de l'électeur à marquer le bulletin de vote, à la difficulté de déterminer l'intention de l'électeur, ou dû au fait que l'électeur abîme intentionnellement les bulletins de vote. Cela montre l’importance de l’impact positif d’une éducation plus robuste des électeurs. Au niveau national, près de 150.000 bulletins ont été invalidés lors du dépouillement dans les élections de l'Assemblée Nationale Constituante de 2011.

Nombre de bulletins annulés

Cet ensemble de données a annulé les bulletins de vote lors des élections de 2011 en Tunisie. Cet ensemble de données a été obtenu à partir du rapport (PDF) de l’Assemblée Nationale Constituante sur les élections publié par l’ISIE en Février 2012 et fourni sous forme de fichiers .Json par OpenGovTN.

www

The map of where cancelled votes came from relies polling center data available as individual .json files that were provided as a two CSV tables - one containing latitude + longitude coordinates and the other containing detailed election data.

NOTE: Seule une partie des 4836 centres de vote est actuellement visualisée sur la carte. Bien que les données électorales aient été recueillies pour pratiquement tous les centres de vote, les données de géolocalisation (latitude et longitude) n’avaient été recueillies que seulement sur une partie des bureaux de vote.

Make sure you have read the documentation regarding installing and setting up a PostGIS-enabled database before proceeding any further.

1. Import data to PostGIS

To set up the election data table run the following SQL:

create table results (
	circonscription_name text,
	circonscription_isieid int,
	delegation_name text,
	delegation_isieid int,
	centre_name text,
	centre_isieid int,
	bureau_name text,
	bureau_isieid numeric,
	registred_voters numeric,
	total_voters numeric,
	extracted_ballots numeric,
	delivered_ballots numeric,
	white_ballots numeric,
	not_used_ballots numeric,
	cancelled_ballots numeric,
	damaged_ballots numeric,
	valid_ballots numeric,
	list_name text,
	list_rank numeric,
	votes numeric,
	percentage numeric
);

If you’ve parsed the .json files into a CSV you can import that CSV data by running the command

cat eligible_voters 2011data/election-results.csv | psql -d tunisia -c "COPY results FROM STDIN WITH DELIMITER ',' CSV HEADER"

We set up a separate table for the geometry with the following schema:

create table pc (
	district_name_ar text,
	delegation_name_ar text,
	polling_center_name_ar text,
	latitude numeric,
	longitude numeric,
	contact text
	);
cat shapes/polling_centers_tunisia.csv | psql -d tunisia -c "COPY pc FROM STDIN WITH DELIMITER ',' CSV HEADER"

2. Aggregate Polling Center data + join to geometry

The data is structured so that each record (row) represents a party on the ballot at each polling center. To effectively show how many ballots were cancelled at each polling center, we need to

This can be accomplished with the following query.

create table pc_results as (
	select 
		a.district_name_ar,
 		a.delegation_name_ar,
 		a.polling_center_name_ar,
 		a.latitude,
 		a.longitude,
 		a.contact,
		b.circonscription_name,
		b.circonscription_isieid,
		b.delegation_name,
		b.delegation_isieid,
		b.centre_name,
		b.centre_isieid,
		b.id,
		b.registred_voters,
		b.total_voters,
		b.extracted_ballots,
		b.delivered_ballots,
		b.white_ballots,
		b.not_used_ballots,
		b.cancelled_ballots,
		b.damaged_ballots,
		b.valid_ballots,
		b.votes
	from pc a left join (
		select
			circonscription_name,
			circonscription_isieid,
			delegation_name,
			delegation_isieid,
			cast(cast(circonscription_isieid as text)||cast(delegation_isieid as text)||cast(centre_isieid as text) as int) as id,
			centre_name,
			centre_isieid,
			sum(registred_voters) as registred_voters,
			sum(total_voters) as total_voters,
			sum(extracted_ballots) as extracted_ballots,
			sum(delivered_ballots) as delivered_ballots,
			sum(white_ballots) as white_ballots,
			sum(not_used_ballots) as not_used_ballots,
			sum(cancelled_ballots) as cancelled_ballots,
			sum(damaged_ballots) as damaged_ballots,
			sum(valid_ballots) as valid_ballots,
			sum(votes) as votes
		from results 
		group by circonscription_name,circonscription_isieid,delegation_name,delegation_isieid,centre_name,centre_isieid
	) b
	on polling_center_name_ar = centre_name
);

You can now use the pc_results table in the canceled-votes tilemill project to style your data.

Description About the data Methodology
A project by Democracy International, New Rights Group and DevelopmentSeed