Building the Tally software used in the Libyan Constitutional Election

Peter Lubell-Doughtie
March 12, 2014

We recently built the tallying software used to aggregate votes in the Libyan constitutional assembly elections. Our software recorded, verified, and reported on over 720,000 votes cast by Libyan citizens. These votes were cast throughout the country, on off-shore oil rigs, and at international voting centers throughout the world.

intake section

The Libyan High National Election Commission has generously made the tally system software open source. All application source code is on Github, there is an overview of the tallying process, and additional code documentation.

The tally-system software is written in Python using the Django web framework, some JavaScript for the UI, and shell scripts to help deployment and setup. The software processes forms through a collection pipeline: 1. intake, 2. data entry, 3. corrections, 4. quality control, 5. archiving.

The system overview provides a detailed description of each phase in the tally process and the additional stages used for review of suspicious or otherwise problematic forms.

The tally system has a suite of administrator functionality for viewing form state, approving administator only actions, and viewing the results.

We use PostgreSQL as the datastore. We chose PostgreSQL because it is a CP and ACID database, which has been shown to not lose data. We include scripts to setup database replication and create automated backups of the database.

In a production environment we recommend replicating the database to at least one additional machine and dumping the database from that machine. This ensures you have a live duplicate in the case of a failure and that the process of backingup data does not interfere with live system operations. (In the case that the master node fails and the replicated node becomes the master you should disable backups until the master node has recovered.)