Saving Lives with Node.js

(and the Air Ambulance Service)

by Nigel Hanlon


Who am I?

Nigel Hanlon

Senior Software Developer at OpenApp

Work primarily on GIS.

(I develop maps to solve problems)

Talk Outline

Air Ambulance service, from 999 to hospital door

Health Atlas AeroMedical System

Web mapping and GIS technology

ESB Power lines

Real time Aircraft tracking

Finding Patients with LocateMe112

Future developments

Questions and Answers

The Air Ambulance service

From 999 to hospital door

What service do you require?

All 999/112 calls are answered by ECAS

Emergency Call Answering Service

Ambulance requests are handled by the National Emergency Operations Centre

Based in Tallaght and Ballyshannon

Ambulance Dispatch

Paramedics arrive and assess the situation

An Air Ambulance can be called if:

  • Time critical injury or condition
  • Journey to appropriate hospital by road is greater than 45 minutes
  • No Advanced Paramedic or Doctor available

The Air Desk

Responsible for managing air ambulance missions

Passes on mission details to responders

Coordinates with other agencies that may be required

Custume Barracks Athlone

Pilots receive mission location and select landing zone

Advanced Paramedic briefed on patient condition

Take off in 5 minutes or less

On route

From Athlone to the West Coast in 30 minutes

The pilots use a printed datasheet of the landing zone

Datasheet shows ESB wires, buildings and other obstacles

On Scene

Leaving for hospital

Arriving at hospital

Health Atlas Ireland AeroMedical

What is it?

A Web based system for managing Air Ambulance Missions

Operating 24/7 for the last 6 years

Developed in cooperation with multiple agencies

Demo Time

(because what could possibly go wrong?)

Back End
  • Express
  • pg
  • ldapjs
  • mocha
  • winston
  • handlebars
  • phantomjs
  • pm2

Stack overview

Web Mapping and GIS

Lines, Points and Polygons

1,000+ Service Features (Hospitals, Garda etc)

4,000+ Helisite Points

30,000 Motorway Markers & ERT Features

68,051 Gazetteer Points

75,825 High Voltage Lines

910,033 Medium & Low Voltage Lines

2,313,218 Address Points

PostgreSQL and PostGIS

We use PostgreSQL as our database of choice.

PostGIS Extension - provides spatial objects and location queries.

node-postgres module by Brian Carlson

Node JS Feature Server

Inspired by the Python Project of the same name.

Provides a RESTful Geographic Feature Service

Serves GeoJSON layers from PostgreSQL tables

Provides search interfaces for known layers


A powerful, feature packed library for mapping data.

Supports vector layers using GeoJSON

Proj4.js Library for projection support

Bounding Box queries for larger datasets like ESB powerlines.

ESB Power lines

The Data

Data provided for entire ESB power grid

Available under special licence

Updates available every 6 weeks

Delivered via DVD in CAD format


Converted to a GIS format using GDAL Library

Rules applied in SQL to remove all unwanted features.

Remaining overhead power lines checked against paper maps.

High voltage

Low & Medium Voltage

Real time Aircraft Tracking

Irish Aircorps

Data provided by Track24 based Canada

Onboard Device broadcasts GPS location via Iridium Satellite link

Low update resolution but Satellite time is expensive

Location updates POST'd directly to tracking server

Irish Coast Guard

Tracking data provided by Dept. of Transport

Locations captured by AIS (Automated Identification System)

AIS is an automatic tracking system used for collision avoidance on ships

Data streamed via TCP in AIS message format

Bespoke decoder translates messages to GIS coordinates

AIS, 6-bit wonder


6 bit ASCII encoding representing a binary message.

Character '9' is ASCII value 57. We subtract 48 from this and get 9 which is '001001'

001001 000011 101110 011010 111101 110100 110000 010001 010000 000000 011111 100011 010101 010111 101110 011110 100100 101100 110101 010000 000000 001101 110000 000010 000000 110000 100001 000011

Playing with Bits

Buffers deal with Bytes, not bit level operations

parseInt(value, radix) is your friend!

In AIS, offsets and bit lengths represent different attributes.

Altitude begins at bit 38 and is 12 bits in length

Altitude is parseInt('000001000101', 2) which gives us 69 metres.

From Database to Screen

All tracking messages are stored in PostgreSQL

Tracking data is streamed to front-end sessions via WebSockets

An INSERT on the database triggers a 'push' event, updating all open sessions.

Only the last 24 hours of tracking data is held.



Air Ambulance missions require location for dispatch.

ECAS can pin point the location of land line calls.

In the last 5 years, over two thirds of 999 calls are now from mobile devices.

Ireland does not implement the Radio Resource Location Services Protocol

Closest cell tower gives county or urban area match at best.


Majority of people now have a Smartphone with GPS

Browser based GeoLocation allows us to request and report device location

Unique SMS link sent each person

Small web application activates GPS, POST's location to server

Developed in collaboration with the Irish Aircorps


4,300 Text Messages sent

3,600 delivered successfully.

Over 1,525 people found using LocateMe112

Device breakdown: 45% Android, 52% iOS, 3% Others

Average location accuracy is 220 metres

Future Developments

Thank you.

Follow me on Twitter for updates: @nigelhanlon

Questions and Answers