SlideShare a Scribd company logo
Adventures incivic hacking 
FixMyStreet & Open311 
hakim@mysociety.org 
https://www.flickr.com/photos/theodevil/5457434597/
"easily launch a website that helps people to report street problems like potholes and broken street lights."
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
We make websites and tools that empower citizens 
For communities. 
For opening democracy. 
For getting things changed.
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
FixMyStreet <-> Local Government 
•User submits problem on web/app 
•We work out who to contact, based on location/type of problem 
•We send an email
FixMyStreet <-> Local Government 
•User submits problem on web/app 
•We work out who to contact, based on location/type of problem 
•We send an email 
•Council employee lovingly copies email into their actual system
https://www.flickr.com/photos/ltdemartinet/2811744365/
Integrations 
•User submits problem on web/app 
•We work out who to contact, based on location/type of problem 
•We run custom code which calls council API to recreate the FMS problem on a council’s system
Integrations 
•User submits problem on web/app 
•We work out who to contact, based on location/type of problem 
•We run custom code which calls council API to recreate the FMS problem on a council’s system 
•Exor 
•Mayrise 
•SAP 
•MS Dynamics CRM (via SOAP, eeek. Later versions REST) 
•etc….
Open311 
…is a form of technology that provides open channels of communication for issues that concern public space and public services. Primarily, Open311 refers to a standardized protocol for location- based collaborative issue-tracking. 
—http://www.open311.org/learn/
http://raulrene.wordpress.com/renes-pixie-pixelarium/
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
Adventures in civic hacking
Simples! 
•FixMyStreet has builtin Open311 client 
•Council backend is Open311 server
Simples! 
•FixMyStreet has builtin Open311 client 
•Council backend is not Open311 server
Adventures in civic hacking
Adventures in civic hacking
Here comes the architecture 
Shim 
Backend
CGI shim script 
Simple 
Few dependencies 
Easily run in hostile environment 
Subsetof Open311 
Non-standard URLS 
Won’t actually support other Open311 clients 
Hardcoded assumptions 
Hard to extend 
Hard to test
Open311::Endpoint 
•Plack 
•Web::Simple 
•DateTime::Parser:: 
•Data::Rx 
•Moo, Types::Standard, MooX::HandlesVia 
•DBD::Oracle 
•XML
Adventures in civic hacking
Plack::Test 
my $endpoint = Test::Endpoint->new; 
my $res = $endpoint->run_test_request( 
GET => '/services.xml‘ 
);
End to end tests? 
Shim 
Backend
Stub out backend 
Test::Shim 
(Stubbed)
Adventures in civic hacking
LWP::Protocol::PSGI 
Test::Shim 
(Stubbed) 
my $endpoint = Test::Endpoint->new; 
LWP::Protocol::PSGI->register( 
$endpoint, 
host => 'open311.example.com‘ 
);
Adventures in civic hacking
https://www.flickr.com/photos/cunaldo/468824934/
Web::Simple 
sub dispatch_request { 
my $self = shift; 
sub (GET + /services + ?*) { 
my ($self, $args) = @_; 
$self->call_api(GET_Service_List => $args); 
}, 
sub (POST + /requests + %*) { 
my ($self, $args) = @_; 
$self->call_api(POST_Service_Request => $args); 
},
https://www.flickr.com/photos/alanenglish/2780298470/
Types::Standard, MooX::HandlesVia 
has latlong => ( 
is => 'ro', 
isa => Tuple[ Num, Num ], 
default => sub { [0,0] }, 
handles_via => 'Array', 
handles => { 
lat => [ get => 0 ], 
long => [ get => 1 ], 
} 
);
Types::Standard, MooX::HandlesVia 
has latlong => ( 
is => 'ro', 
isa => Tuple[ Num, Num ], 
default => sub { [0,0] }, 
handles_via => 'Array', 
handles => { 
lat => [ get => 0 ], 
long => [ get => 1 ], 
} 
);
Types::Standard, MooX::HandlesVia 
has latlong => ( 
is => 'ro', 
isa => Tuple[ Num, Num ], 
default => sub { [0,0] }, 
handles_via => 'Array', 
handles => { 
lat => [ get => 0 ], 
long => [ get => 1 ], 
} 
);
Types::Standard, MooX::HandlesVia 
has latlong => ( 
is => 'ro', 
isa => Tuple[ Num, Num ], 
default => sub { [0,0] }, 
handles_via => 'Array', 
handles => { 
lat => [ get => 0 ], 
long => [ get => 1 ], 
} 
);
https://www.flickr.com/photos/dopey/9591636030/
Data::Rx 
$schema->learn_type('tag:GeoReport_v2:rx/service', { 
type => '//rec', 
required => { 
service_name => '//str', 
type => '/open311/post_type', 
metadata => '/open311/bool', 
description => '//str', 
}, 
optional => { 
keywords => '//str', 
group => '//str', 
}});
Data::Rx 
$schema->learn_type( 'tag:wiki.open311.org,GeoReport_v2:rx/datetime', 
{ 
type => '/open311/regex', 
pattern => qr{ 
^ 
d{4} -d{2} -d{2} # yyyy-mm-dd 
T 
d{2} : d{2} : d{2} # hh:mm:ss 
(?: 
Z # "Zulu" time, e.g. UTC 
| [+-] d{2} : d{2} # +/-hh:mm offset 
) 
$ 
}ax, # use ascii semantics so /d means [0-9] 
message => "found value isn't a datetime", 
});
Adventures in civic hacking
Inputs andOutputs 
sub GET_Service_Definition_input_schema { 
return { type => '//seq', 
contents => [ 
$self->get_identifier_type('service_code'), 
$self->get_jurisdiction_id_validation, ] } } 
sub GET_Service_Definition_output_schema { 
return { type => '//rec', 
required => { 
service_definition => { 
type => '/open311/service_definition', 
} } } }
XML::Simple 
•Yeah, I know… 
•Wrapped in Open311::Endpoint::Spark 
•interop with JSON schema
https://www.flickr.com/photos/rossap/7619777396/

More Related Content

PDF
Angular 2.0: Brighter future?
PDF
Phoenix demysitify, with fun
PPTX
Angular2 compiler
PPTX
Better Communication, Stronger Community : Socrata Customer Summit
PDF
Metropolia hri-luento-05092013-ok-share
PPTX
Melden met open311
PDF
Citizen Monitoring for Waste Management Services in Maputo
PPT
CitySDK Helsinki dev meetup 04.06.2012
Angular 2.0: Brighter future?
Phoenix demysitify, with fun
Angular2 compiler
Better Communication, Stronger Community : Socrata Customer Summit
Metropolia hri-luento-05092013-ok-share
Melden met open311
Citizen Monitoring for Waste Management Services in Maputo
CitySDK Helsinki dev meetup 04.06.2012

Similar to Adventures in civic hacking (20)

PPT
Crash course to Open Data and APIs
PPTX
RESTful design
ODP
One Person's Perspective on a Pragmatic REST Interface
KEY
Esperwhispering
PPT
Misa od low_hangingfruit_final
PDF
Lost In The Clouds
PDF
Bag Of Tricks From Iusethis
PDF
Making use of OpenStreetMap data with Python
PDF
Web::Machine - Simpl{e,y} HTTP
PDF
Creating Restful Web Services with restish
PPT
Stop Making The Web Harder Than It Is; Real-world REST, HATEOAS, and Hypermed...
PDF
Osm improvements
PPTX
Rest Essentials
PPTX
RESTful modules in zf2
PPT
OPen Source Web Test Engine for Geospatial Standards
PDF
IoT Interoperability: a Hub-based Approach
PDF
A micro service story
PDF
pecepcion remota y sistemas de informacion geografica
PPT
GeoLocal APIs: unencumbering the geolocal ecosystem
PDF
City Concierge V1.0
Crash course to Open Data and APIs
RESTful design
One Person's Perspective on a Pragmatic REST Interface
Esperwhispering
Misa od low_hangingfruit_final
Lost In The Clouds
Bag Of Tricks From Iusethis
Making use of OpenStreetMap data with Python
Web::Machine - Simpl{e,y} HTTP
Creating Restful Web Services with restish
Stop Making The Web Harder Than It Is; Real-world REST, HATEOAS, and Hypermed...
Osm improvements
Rest Essentials
RESTful modules in zf2
OPen Source Web Test Engine for Geospatial Standards
IoT Interoperability: a Hub-based Approach
A micro service story
pecepcion remota y sistemas de informacion geografica
GeoLocal APIs: unencumbering the geolocal ecosystem
City Concierge V1.0

More from osfameron (15)

PDF
Writing a Tile-Matching Game - FP Style
PPTX
Data Structures for Text Editors
PDF
Is Haskell an acceptable Perl?
PDF
Rewriting the Apocalypse
PDF
Global Civic Hacking 101 (lightning talk)
PDF
Functional pe(a)rls: Huey's zipper
PDF
Functional Pe(a)rls - the Purely Functional Datastructures edition
PDF
Haskell in the Real World
PDF
Oyster: an incubator for perls in the cloud
PDF
Semantic Pipes (London Perl Workshop 2009)
ODP
Functional Pearls 4 (YAPC::EU::2009 remix)
PPT
Functional Pe(a)rls version 2
PDF
Functional Pe(a)rls
PDF
Readable Perl
PDF
Bigbadwolf
Writing a Tile-Matching Game - FP Style
Data Structures for Text Editors
Is Haskell an acceptable Perl?
Rewriting the Apocalypse
Global Civic Hacking 101 (lightning talk)
Functional pe(a)rls: Huey's zipper
Functional Pe(a)rls - the Purely Functional Datastructures edition
Haskell in the Real World
Oyster: an incubator for perls in the cloud
Semantic Pipes (London Perl Workshop 2009)
Functional Pearls 4 (YAPC::EU::2009 remix)
Functional Pe(a)rls version 2
Functional Pe(a)rls
Readable Perl
Bigbadwolf

Recently uploaded (20)

PPTX
Digital Literacy And Online Safety on internet
PPTX
Introduction to Information and Communication Technology
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PDF
Testing WebRTC applications at scale.pdf
PPTX
Internet___Basics___Styled_ presentation
PPTX
Slides PPTX World Game (s) Eco Economic Epochs.pptx
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
PDF
The Internet -By the Numbers, Sri Lanka Edition
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Digital Literacy And Online Safety on internet
Introduction to Information and Communication Technology
Decoding a Decade: 10 Years of Applied CTI Discipline
introduction about ICD -10 & ICD-11 ppt.pptx
Design_with_Watersergyerge45hrbgre4top (1).ppt
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Testing WebRTC applications at scale.pdf
Internet___Basics___Styled_ presentation
Slides PPTX World Game (s) Eco Economic Epochs.pptx
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
Introuction about WHO-FIC in ICD-10.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Triggering QUIC, presented by Geoff Huston at IETF 123
The Internet -By the Numbers, Sri Lanka Edition
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Introuction about ICD -10 and ICD-11 PPT.pptx
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
Job_Card_System_Styled_lorem_ipsum_.pptx
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION

Adventures in civic hacking