SMS to Log and Clustered Web Map
Takes SMS messages containing a postcode and a message and logs them in a database. Also displays colour coded clusters on Open Street Map. I have no idea whether this works on Windows, developed on Linux Mint and works pretty well on an old desktop, that's the 'idea'.
For the moment, find me @hughbarnard on Twitter for help. This is alpha-quality, so if you can improve that's welcome, also.
1. Needs Perl and Mojolicious also DBIx::Class, IO::Socket::IP, Socket, DBD::SQLite (it uses websockets to display data). All those via CPAN or apt install
2. Testing script that will need to be adapted for non-UK in sms_map/t use prove -lv
3. For UK needs to load status.db translate table with UK postcodes and long/lat via https://www.getthedata.com/open-postcode-geo. Non UK, YMMV if I find out I'll add
French data, here: https://adresse.data.gouv.fr/donnees-nationales
USA Data: https://gist.github.com/erichurst/7882666
4. For example, loading the table from csv
$ sqlite3 status.db
sqlite> .mode csv
sqlite> .import postcode.csv translate
sqlite> .exit
5. The SMS in this version is adapted to smsworks in Bristol UK: https://thesmsworks.co.uk, if Twilio or (locally) Gammu + dongle is used, a few adjustments need to be made, working on gammu at present
6. Adjust sms_map.conf to point to the database and other settings, see below
{
secrets => ['8e9f3991acb4f6a852e264bd1fa451c1a0c37b1a'],
db => '/var/lib/smsmap/status.db', Location of database
title => 'Newham Experimental Map', Title of Display
input_format => 'json', For json input otherwise POST params assumed
sms_convert => 'yes', Yes to convert input
sms_convert_key => { Keys for conversion of input fields
'from' => 'From',
'content' => 'Text',
},
country_code => 'uk', Switches the postcode parsing
log_level => 'warn', Mojolicious log level
identity => 'newham', Not used: Used later for pub/sub
start_latitude => 51.505, Map start
start_longitude => -0.09, Map start
web_socket_ip => '10.0.0.51:3000', Web socket address and port for map data
rabbitmq => 'no', Not used: Used later for pub/sub
log_path => '/var/log/smsmap/smsmap.log',Log path
hypnotoad => { Hypnotoad parameters
listen => ['http://*:8080'],
workers => 10,
pid_file => '/var/run/smsmap/hypnotoad.pid'
},
message_to_type => { Translation of message to type
'help' => 1, Changes marker colour too
'ill' => 2, Change this to suit your own application
'food' => 3,
'recovered' => 4,
'isolating' => 5,
},
}
7. morbo /usr/share/smsmap/script/sms_mapshould start listening and displaying on port 3000. Hypnotoad is preferable for production. Use NAT settings on the router to serve it to the outside
This guide will also appear on <>/manual.html or <>/manual.fr.html