Tunisia Election Data

Blank ballots are ballots cast by voters without a tick for a candidate, political party or coalition list.  In general, a blank ballot is cast by a voter who wishes to exercise his or her right to vote, but is dissatisfied with his or her candidate options or the electoral process.  In the 2011 National Constituent Assembly elections, nearly 100,000 voters cast blank ballots.  This visualization show the number of blank ballots cast per electoral district from the 2011 NCA elections.

Election Results

This CSV contains the number of Blank ballots . It was originally obtained from the National Constituent Assembly Report on the Elections (PDF), published by the Independent High Commission for Elections in February, 2012, and converted to CSV by OpenGovTN.

www

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

Two datasets power this map:

1. Import data to PostGIS

To set up the a table with appropriate columns, run the following SQL:

create table blank (
	cir_id int,
	circ_name text,
	total_votes numeric,
	votes_ennahdha numeric,
	votes_cpr numeric,
	votes_fdtl numeric,
	other_winning numeric,
	Wasted numeric,
	Blank_ballots numeric,
	cancelled_ballots numeric
);

Now run the following from your command line to populate the table:

blank-votes.csv | psql -d tunisia -c "COPY blank FROM STDIN WITH DELIMITER ',' CSV HEADER"

2. Dissolving Delegations into Districts

Note: If you have already performed this step for the Political parties map, you can skip to step 4.

Since this data has a district-level resolution, we need to create district polygons out of delegation polygons that we already imported.

To do this you’ll need to load the filter_rings() function explained in this post. This functions removes artifacts left by unioning each district’s member delegations. Once you’ve loaded the function into your database, run the following query.

create table districts as (
select
	circo_id,
	filter_rings(st_union(the_geom),2) as the_geom
from delegations
group by circo_id
);

4. Joining to geometry

You should now be able to open the Blank votes tilemill project

We’re joining the tabular data to geometry in TileMill’s PostGIS plugin. The query is here for your reference, but you should need to perform any further steps.

( select
    the_geom,
    cir_id,
    circ_name,
    blank_ballots,
    cancelled_ballots,
    wasted,
    map,
    total_votes,
    round((map / total_votes * 100)) as pct_n,
    cast(round((map / total_votes * 100)) as text)||'%' as pct_s,
    cast(round((map / total_votes * 100)) as text)||'%'||E' \n'||circ_name as display
  from districts a join blank b 
  on circo_id = cir_id 
) as data
Description About the data Methodology
A project by Democracy International, New Rights Group and DevelopmentSeed