Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PyConZA 2014: "Reaching Beyond the Web" by Vino...

Pycon ZA
October 03, 2014

PyConZA 2014: "Reaching Beyond the Web" by Vinod Kurup

a.k.a. Using RapidSMS to power democracy in Libya.

As web developers, we often think of the web as being a ubiquitous resource, available to everyone. The truth is that there are still large groups of people who have either limited or no web access. In addition, there are people who have excellent web access, yet still prefer to use simpler tools to connect to others. How can we reach these groups of people? While not perfectly ubiquitous, SMS technology is much more widespread, especially in areas that don't have great internet connectivity. It's also ubiquitous in the sense that people who have excellent internet access still use SMS frequently.

The government of Libya recently implemented a voter registration system and chose to use SMS as the implementation technology, largely because of these reasons. In this talk, I will explain how we used RapidSMS, a Django-based SMS framework, to build this groundbreaking voter registration system. We will discuss the basics of the RapidSMS framework, and show concrete examples from our Libyan project. I will mostly describe concepts at a high level, though familiarity with Python code may help you understand the details.

If you truly want your tools to reach everyone, adding SMS connectivity will spread the power of your web apps.

Pycon ZA

October 03, 2014
Tweet

More Decks by Pycon ZA

Other Decks in Programming

Transcript

  1. Take home points 1. Why build SMS apps? SMS =

    Short Message Service (i.e. 'text' message) 2. RapidSMS is very simple.
  2. Why not the web? Developer time No HTML No JS

    No CSS No Fonts No Colors No Forms
  3. Access Internet SMS Libya 16% 165% Africa 21% 80% South

    Africa 49% 147% United States 87% 96% World 39% 97% Sources: and Wikipedia World Bank
  4. 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)
  5. How do I register? 10010 is the HNEC short code

    Send to 10010: We respond: You are registered or with an error message 1 1 1 2 2 2 3 3 3 4 4 4 # 1 2 3 4 5
  6. Voter query Send to 10010: We respond with your registration

    status Also available via the web at 1 1 1 2 2 2 3 3 3 4 4 4 https://libyavotes.ly
  7. 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: 1 1 0 0 7 # 3 # 9 3 2
  8. RapidSMS: Overview UNICEF developed in 2007 Free and Open Source

    (BSD) https://rapidsms.org https://github.com/rapidsms/rapidsms
  9. 1. Configuration settings 2. URL for incoming messages I N

    S T A L L E D _ B A C K E N D S = { " l i b y a n a " : { " E N G I N E " : " r a p i d s m s . b a c k e n d s . v u m i . V u m i B a c k e n d " , " s e n d s m s _ u r l " : ' h t t p : / / 1 2 7 . 0 . 0 . 1 / l i b y a n a ' , } , } u r l p a t t e r n s + = p a t t e r n s ( ' ' , u r l ( r " ^ b a c k e n d / v u m i - l i b y a n a / $ " , V u m i B a c k e n d V i e w . a s _ v i e w ( b a c k e n d _ n a m e = " l i b y a n a " ) ) ) RapidSMS Backend
  10. Just Python! Messages are just text f r o m

    r a p i d s m s . a p p s . b a s e i m p o r t A p p B a s e c l a s s P i n g P o n g ( A p p B a s e ) : d e f h a n d l e ( s e l f , m s g ) : i f m s g . t e x t = = ' p i n g ' : m s g . r e s p o n d ( ' p o n g ' ) r e t u r n T r u e r e t u r n F a l s e RapidSMS Apps
  11. Multiple apps Multiple phases f r o m r a

    p i d s m s . a p p s . b a s e i m p o r t A p p B a s e c l a s s P i n g P o n g ( A p p B a s e ) : d e f f i l t e r ( s e l f , m s g ) : p a s s d e f p a r s e ( s e l f , m s g ) : p a s s d e f h a n d l e ( s e l f , m s g ) : p a s s d e f d e f a u l t ( s e l f , m s g ) : p a s s d e f c l e a n u p ( s e l f , m s g ) : p a s s RapidSMS Apps
  12. Libya Example i m p o r t r e

    f r o m r a p i d s m s . a p p s . b a s e i m p o r t A p p B a s e c l a s s P r e p r o c e s s A p p ( A p p B a s e ) : d e f p a r s e ( s e l f , m s g ) : N O N D I G I T S _ R E = r e . c o m p i l e ( ' [ ^ \ d ] ' , f l a g s = r e . U N I C O D E ) m s g . n u m b e r _ l i s t = [ n f o r n i n N O N D I G I T S _ R E . s p l i t ( m s g _ t e x t ) i f n ]
  13. Router Handlers Connection / Contacts Message Tester Message Log Third

    party modules R A P I D S M S _ R O U T E R = " r a p i d s m s . r o u t e r . c e l e r y . C e l e r y R o u t e r " Other RapidSMS concepts
  14. Cool RapidSMS projects - A project aimed at decreasing child

    mortality during the critical 1000 days after birth. - A project to provide HIV test results and tracking to to infants, their mothers, and caregivers. 1000 Days Project Mwana
  15. 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
  16. 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