Guest Post: Node.js and the Air Ambulance Service

By: Guest Author

Node.js and the Air Ambulance Service (3)

Thanks to Nigel Hanlon from OpenApp for taking the time to write this blog post. Nigel has worked with Node.js to provide some amazing developments with the Air Ambulance Service. 

It was Christmas six years ago when the spec for a new project came across my desk. Inside, it detailed a new emergency service that was to go live in the coming months and their requirements for a new mapping system. Little did I realise the gravity of what I was embarking on and how today, I would rank it as one of my most important and interesting projects.

“It is their responsibility to manage and direct all AeroMedical missions and, as I learned six months prior to launch, they would be using my maps to do it”

On the 4th of June 2012, Ireland’s first Emergency AeroMedical Service (EAS) took to the skies and began its one-year trial. A joint venture between the HSE and the Defence Forces, the military helicopter, with an advanced paramedic on board, can reach anywhere in Ireland within 45 minutes. Its goal is to deliver care to those suffering from stroke, cardiac events and traumatic injuries who need immediate care and transport to hospital. The AeroMedical service is coordinated by the aptly-named “Air Desk” run by the National Ambulance Service in both Tallaght and Ballyshannon. It is their responsibility to manage and direct all AeroMedical missions and, as I learned six months prior to launch, they would be using my maps to do it.

The first version of the software was released just before the service began and was given the name Health Atlas AeroMedical or AeroMed for short. The name was derived from the many other health related projects that we had completed for the HSE under the programme name Health Atlas. While far from a technical marvel at the time (at least in my opinion), the system did provide a number of useful tools and services that were unavailable in the existing Ambulance despatch software. It combined best in class web maps with address search for finding patients who required the service. It also featured various bespoke tools for finding the exact latitude and longitude of features which the Air Ambulance pilots needed for navigation.

“The first day of service was a resounding success with the life of a young woman in Roscommon saved.”

The first day of service was a resounding success with the life of a young woman in Roscommon saved. She had been badly injured in a farm accident and needed immediate access to hospital. With the trip by road ambulance taking an hour and a half at best, the decision was made to bring her by helicopter and the call was placed with the Air Desk. A short while later she was on her way to Galway University Hospital, a total flight time of 11 minutes. From that day onward demand grew rapidly and by Christmas that year, over 100 missions had been flown.

Health Atlas AeroMedical matured rapidly as each mission helped to refine the workflow. By the time development for version 2 was announced, the original specification had doubled in size with feature requests. The first two versions took the form of a single page app with search and map features being delivered via API from Zope (a large Python based framework). As the needs of the project grew, version 3 migrated to Django to provide support for LDAP and the ever-growing list of helicopter landing zones the Air Corps were compiling. Fields, GAA pitches, golf courses and even stretches of road were being added daily as a reference for future missions.

“the challenge of updating more than fifty open sessions in near real time seemed an impossibility”

In 2013, I received the specification for the fourth iteration of the software. While most of the requests were refinements of previous tools, the one new addition that caught my eye was flight tracking. With positional data now available from the Irish Coast Guard and coming online soon for the Air Corps helicopters, the challenge of updating more than fifty open sessions in near real time seemed an impossibility. I searched for weeks for solutions but each seemed more complicated than the last. All that was available in the Python world were Twisted and Tornado, both of which were too complicated and verbose for my liking. I could take the easy way out and poll the server over and over but I believed there had to be a better solution.

My search continued unabated until I stumbled across the web site of Socket.io, a Websocket implementation for Node. There on that home page, what had seemed impossible was now 5-10 lines of magic in a language I had grown to know intimately over the previous years. I had known nothing of Node before that day, but seeing that example compelled me to learn. The thought of running JavaScript on the front and back end excited me and, as my knowledge grew, I took my first steps with Express. The further down the rabbit hole I went, the more my confidence grew and I took the bold step of rewriting the Health Atlas AeroMedical application, abandoning its Python roots and nearly two years of commits. Being traditionally a “Python shop”, using Node was a big step forward for both OpenApp and myself, but going against tradition paid off big time when the first helicopters moved across my screen.

“Today, AeroMed stands at version 5.10.0 with Node still working hard day and night to support the Emergency Services”

Version 4 was released mid-2013 powered fully by Express, Websockets and Node.js. Since that release, I haven’t once looked back on the decision to move to Node. For each problem faced, NPM had the module needed and for every question, a community of answers awaited. Today, AeroMed stands at version 5.10.0 with Node still working hard day and night to support the Emergency Services. I’ve added a few more features since the 2013 release and it doesn’t look like development will be stopping anytime soon. The system now has over one million ESB power lines detailed on maps to help aircraft avoid them when landing in remote areas. The LocateMe112 system allows the Air Desk to send an SMS to patients and find their location via Smartphone GeoLocation. These features and a multitude of other datasets recently added would certainly be useless without the means to deliver them in a performant, reliable and real-time way. For me, I certainly don’t believe the system could have evolved into the indispensable tool it has become today without the power of Node, its ecosystem and the thousands of dedicated people behind its success.

Slides from Nigel’s talk at our Node.js Dublin Meetup can be found here.