Reaching Beyond The Web

Using RapidSMS to power democracy in Libya

Vinod Kurup

Take home points

  1. Why build SMS apps?
    • SMS = Short Message Service (i.e. 'text' message)
  2. RapidSMS is very simple.

Outline

  • Libyan SMS Voter Registration
  • RapidSMS

Government of Libya Mandates:

Build an SMS Voter Registration System

Why SMS?

Why electronic?

  • User's time
  • Protests
  • Expense
    • Staff
    • Materials
  • Access

Why not the web?

Why not the web?

Expensive!

Why not the web?

Developer time

  • No HTML
  • No JS
  • No CSS
  • No Fonts
  • No Colors
  • No Forms

Why not the web?

  • User's time

Why not the web?

The most important reason....

Access

  Internet SMS
Libya 16% 165%
Africa 21% 80%
South Africa 49% 147%
United States 87% 96%
World 39% 97%


Sources: Wikipedia and World Bank

SMS Summary

  • Widely accessible
  • User friendly
  • Inexpensive
  • Libya made a wise choice!

The Project

Timeline

  • 2012: Libya mandates HNEC to build SMS VR system
  • Sep 2013: Caktus and partners join team
  • Dec 2013: > 1 million registrations
  • Feb 2014: CDA elections (60 seats)
  • May 2014: additional 500K registrations
  • Jun 2014: CoR elections (200 seats)

How do I register?

  • 10010 is the HNEC short code
  • Send to 10010:
    111222333444 # 12345
  • We respond: You are registered or with an error message

Other Features

Voter query

  • Send to 10010:
    111222333444
  • We respond with your registration status
  • Also available via the web at https://libyavotes.ly

Translations

  • Standard Django setup
  • Transifex

Encodings

  • Easy with Python
  • Not easy when communicating with MNOs
  • Thank you Praekelt!

Reporting

  • Central staff needs to monitor polling centers in real-time
  • Parallell Voting Tabulation (PVT)
  • With 1600 centers, voice phone is not feasible
  • Staff reports number of voters with SMS to 10050:
    11007 # 3 # 932

Analytics

  • Fraud monitoring
  • Status reports

Help Desk

Bulk Outgoing SMS

  • Remind voters to vote
  • Inform voters of registration center changes

Deployment

Deployment

Testing

  • Automated tests
  • HNEC staff testing
  • ... (message 58)

Intro to RapidSMS

© 2010, courtesy RapidSMS on Flickr

RapidSMS: Overview

RapidSMS: Installation


                            pip install rapidsms
                        

RapidSMS: How To

  1. Setup a Backend
  2. Create an App
  3. There is no step 3

RapidSMS Backends

  • Twilio
  • Android phone
  • GSM Modem
  • Vumi
  • Others

RapidSMS Backend

  1. Configuration settings
    
    INSTALLED_BACKENDS = {
      "libyana": {
          "ENGINE": "rapidsms.backends.vumi.VumiBackend",
          "sendsms_url": 'http://127.0.0.1/libyana',
      },
    }
                                
  2. URL for incoming messages
    
    urlpatterns += patterns('',
      url(r"^backend/vumi-libyana/$",
          VumiBackendView.as_view(backend_name="libyana")))
                                

RapidSMS Apps

  • Just Python!
    
    from rapidsms.apps.base import AppBase
    
    class PingPong(AppBase):
    
        def handle(self, msg):
            if msg.text == 'ping':
                msg.respond('pong')
                return True
            return False
                                
  • Messages are just text

RapidSMS Apps

  • Multiple apps
  • Multiple phases
    
    from rapidsms.apps.base import AppBase
    
    class PingPong(AppBase):
    
        def filter(self, msg):
            pass
    
        def parse(self, msg):
            pass
    
        def handle(self, msg):
            pass
    
        def default(self, msg):
            pass
    
        def cleanup(self, msg):
            pass
    
                                

Libya Example


import re
from rapidsms.apps.base import AppBase

class PreprocessApp(AppBase):
    def parse(self, msg):
        NONDIGITS_RE = re.compile('[^\d]', flags=re.UNICODE)
        msg.number_list = [n for n in NONDIGITS_RE.split(msg_text) if n]
                    

Other RapidSMS concepts

  • Router
    
    RAPIDSMS_ROUTER = "rapidsms.router.celery.CeleryRouter"
                                
  • Handlers
  • Connection / Contacts
  • Message Tester
  • Message Log
  • Third party modules

Cool RapidSMS projects

  • 1000 Days - A project aimed at decreasing child mortality during the critical 1000 days after birth.
  • Project Mwana - A project to provide HIV test results and tracking to to infants, their mothers, and caregivers.

Conclusion

Take home points

  1. Is access important to your project?
    • Then SMS is important to your project.
    • Easy to add to a web app
  2. RapidSMS is easy to set up
    • RapidSMS is flexible and scalable
    • RapidSMS is NOT the only option

Thanks!

  • Caktus: Colin, Dan, Daryl, Elliott, Hao, Jeff, Michael, Nicole, Philip, Scott, Tobias, Victor
  • Reboot: Hunter, Josh, Justin
  • Praekelt: Ben, JP, Simon, Simon, Vincent
  • HNEC: Ahmed, Fadia, Munir
  • MIS: Ian, Joe
  • UN: Ajay, Panto



Questions?