lunes, 11 de junio de 2007

Using Ubuntu and Python in elections systems

Since 1999, Magic Software Argentina (the compay I worked for until mid 2007) was responsible for providing information systems related to electoral processes in several provinces in Argentina. Some of these proyects included some form of electronic voting. Usually the main function is to provide the results of the election before midnight.

I've been involved in the design and development of every system used since the first one, that was implemented using only propietary software and tools. On May 20th, 2007, we carried out the first implementation of the system running absolutely on free software and tools: the elections in the province of Río Negro were made using Ubuntu, Python and PostgreSQL.

A quick introduction to the case

The process takes place at the end of the election day, that is 6:00 p.m., and it's based on the data provided by the marshalls at the voting places in official paper forms wich are sent to the datacenter by some means (fax, courier mail, etc). Data in these forms are fed to the system by a group of dataentries, while another component of the system adds up this data generating reports and charts served in the results site.

The software used in this process must be both reliable, secure and overcome any contingency in less than half an hour and fast enough to process at least 90% of the forms before midnight. The information provided by the system is what public media (newspapers, tv channels, radios) take as a basis for next morning headlines.

Getting to know the penguin

The first time we made an electoral process, it was based absolutely in preopietary software and tools. All machines were running Microsoft Windows, the programming language used was Magic and the html reports were made in a batch process and then uploaded to the official results web site.

At that time, I was taking my firsts steps in the world of GNU/Linux and open source. I had some experience in AIX and SCO, but wasn't so confident in OSS tools to put it forward for that critical application.

It was in mid 2000 when we first used Linux in a process realated to elections. We where using Compaq Tru64 for the main servers, the pie-charts generating program we used only run on Windows, and the performance wasn't acceptable. Since we needed the sources to be compiled in Tru64, the options where open source software or spend a lot of money. Whe choose open source, and found ploticus, a superb charting program that helped us since that election took our testing Linux server to the datacenter, and that was the first work we gave to Linux: it spent all the night drawing pie charts without problem. The conclusion was that Linux was stable enough to be used in critical applications. We -the technical staff- already knew that, but management not always trust tools that are not backed up by a company. In the following elections in which we were involved, we included more free/open tools: Linux became the main operating system for servers, apache was used as web server and PHP was used to generate reports.

Some times the options were limited by some propietary software we still used, like Oracle. Since Oracle only supported Red Hat (and maybe SuSE), we didn't have a choice for the distro to be installed on the database server. For the data entry application, we still used Magic on Windows.

The final evolution: Ubuntu, Python and PostgreSQL

In 2006 we made an electronic vote experience for the city of Rosario. It was a turning point since for the first time we didn't use Magic as the main programming language. The solution was based on Ubuntu LiveCDs, and the voting system was absolutely coded in Python + Gtk.

From that experience we learnt that Ubuntu was a stable Linux distro, and python is an awesome programming language that let us focus more on the functionality that in the problems related to the language. Programming in python is easy and fast, sometimes you have the feeling that you're just typing what you're thinking, it's amazing.

In these projects time is always short, but thanks to python (and Marcelo Fernandez's work) we managed to finish a module that helped people with sight disabilities to cast their vote in secret, using festival to read them the available options, and confirm the vote to be casted (using headphones).

For the elections in the province of Río Negro on May 20th, 2007, we chose to use the same tools that had been so satisfactory in Rosario, Ubuntu and python. The only problem here was that Oracle is not officialy supported in Ubuntu yet, and for the servers we should have to use Red Hat.

Since we are more experienced in managing Debian like systems, and didn't have much time to fully test our applications running on Red Hat, we took the last step left to make an election process only on open/free software: if we wanted to have our servers running Ubuntu, Oracle was not an option, so we moved to PostgreSQL.

After some quick tests, we were confident in PostgresSQL's performance. Instalation was just an 'apt-get install' away, and the online documentation was enough to set ready the database for the process.

For the data-entry application, made in python+gtk, we'd had to install Ubuntu and the application in a dozen rented machines the day before the elections day. To avoid such amount of work, time being was such a limited resource, we chose to set a Ubuntu + LTSP server, and used the machines as thin clients. This way all the configuration was made on only one server, and the deploy was reduced to net-boot the client machines.

Many technologies and products where used in the solution provided. The results where faxed from the voting centers to a datacenter in the city of Viedma. These faxes were sent to a posftix mail server by the Cisco appliances that received them. The fax images where extracted from the mails (using python and imagemagick) and sent to Buenos Aires (970 km away) through a VPN to be processed by the data entries. The results web site was running Apache + mod_python, as well as a workflow management system (only accesible in Viedma, through the VPN). Every machine involved in the process was running Ubuntu Edgy or Feisty.

Some pics of the datacenter in Buenos Aires:


Many people, including IT pros, use to think that community supported free software tools or distros are not 100% reliable in mission critical applications, and they end up usign comercial distros and/or propietary software. After this project are able to state not only that this vision is erroneous, but also that in some cases productivity was greatly improved.

Using Ubuntu as the main (and only) distribution allowed us to install and configure the bunch of servers that took part in the process. The Debian package system is unvaluable, and we found any piece of software we need in the Ubuntu repositories. It wasn't necessary to download or compile a single program.

In terms of programming, Python has anything we could need for this project. Python support on Ubuntu is great, anytime we needed a specific library, we found it on the repositories. Thanks to the power of python and the programming speed you can develop, only two skilled programmers were necessary to program the whole system, when using other tools we always needed more than four. Productivity in python is awesome.

Free software tools mantained by the community are absolutely reliable for mission critical applications like the one presented in this article. If they are so valuable in this kind of sensible proceses, why not use them in your next project? ;)

Gabriel Ernesto Patiño

Creative Commons License
work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.
Special thanks to Maria Laura Schibber for her review on this translation.

No hay comentarios.: