Creating a full-stack solution to track life-saving flights

The Royal Flying Doctor Service Flight Tracker at the Australian Stockman's Hall of Fame.

Main content

Profile picture for user cintia.fortespinto@artprocessors.net

The Australian Stockman's Hall of Fame wanted to evoke the spirit of innovation and community involvement that the Royal Flying Doctor Service has brought to outback Australia. As part of our exhibition design and technology overhaul of the Longreach icon, we built the RFDS Flight Tracker, an interactive that displays the service's active flights across Australia. Along the way, we learned a lot about tracking flights in real time, but also how the RFDS provides a lifeline for those who live, work and travel in rural and remote Australia.

Background

Established in 1928, the Royal Flying Doctor Service is one of the largest and most comprehensive aeromedical organisations in the world, providing extensive primary health care and 24-hour emergency service across the 7.69 million square kilometres of Australia.

The RFDS operates 77 aircraft that travel the length and breadth of Australia, delivering aeromedical services all over the country.

Our main goal for this interactive was to give visitors a glimpse into the amazing work of the RFDS by displaying planes and their routes on a map of Australia. The map would be displayed on a large screen mounted on a wall and as part of the RFDS exhibit in the Hall of Fame.

Australian Stockman’s Hall of Fame, February 2022

Design

Our UX & UI designer, Matt Kelsh, did an amazing job designing the interactive before any developer had looked at the API to see what we would be able to do with it.

Below is the initial proposed design, which went through a couple of iterations but stayed pretty consistent and close to the original:

Original UI design for the RFDS Flight Tracker

Matt is known for his incredible attention to detail. For this project, he created custom plane designs that matched actual planes in the RFDS fleet:

Royal Flying Doctor Service aircraft

Plane Finder API

We worked with Plane Finder to get a filtered list of RFDS flights through a poll-based API that we could query every 30 seconds. The API returned a list of RFDS aircraft flying at the time of query, with their current coordinates. However, we had no information regarding their origin or destination or regarding individual flights—we had individual plans but one plane could perform several flights.

In the table below you can see the API specification:

API specification

Note how we can track an aircraft with their unique ID (adshex in the table), but we had no information about individual flights and their origin and destination coordinates. 

Challenges

At this point, it was clear that we had two main problems:

  1. Seeing live planes move on the map would not be a very engaging experience for museum visitors and it wouldn't actually help us with our goal of showing the scale of the work being delivered by the RFDS.
  2. The data we had available through the Plane Finder API didn't support our design. We had no way of drawing the live flight routes on the map. Note: There is a "route" field in the API specification, but this was only available through Plane Finder for commercial airline flights, not RFDS flights.

The spike and solution

I thought the best place to start would be to do a spike and investigate potential solutions. My main goal going into the spike was to investigate a way to retrieve flight routes from the Plane Finder API and to have a graphical representation of them, so it would be easier to communicate with the rest of the team and as well as project stakeholders.

I needed a significant amount of data to work with and all I had was live information with no historic data. So my next step was polling the API data over a 10 hour time period and storing it.

From the data polled, I tracked the unique IDs of aircraft and then assumed the first coordinate to be the origin and the last one to be the destination. This was a very rough estimation of a flight but it gave us an idea of what it was possible to achieve.

Spike outcome

Quickly mapping the data using Mapbox led to this result:

Map of Australia displaying Royal Flying Doctor Service flight routes.

This was huge progress. We now had distinguishable flights and routes—a very good starting point. 

From the spike, we concluded that it was possible to get a coherent visual representation of the RFDS flights on the map.

Proposed solution

With all this information on hand, we decided to move forward with the solution of estimating the flights. It is worth pointing out that the goal for this interactive wasn't to provide an accurate representation of the RFDS's work, but an artistic interpretation of how they service rural and remote Australia.

It was also clear that we needed some historic data to be able to estimate the flights so we were not going to be able to show live data on the map. Instead, we agreed that we would show flights for the previous day as part of an animated time lapse covering a 24-hour period.

Technical Implementation

Flight Tracker Data-flow diagram

Flight Tracker Data-flow diagram

Plane Finder API

As mentioned before, this was the third party API we were using to get flight information. This Plane Finder API doesn’t provide historical data, only coordinates for where RFDS planes are at the time of the query.

CRON Job

There is a CRON job running every minute to poll the Plane Finder API and save the data to the database. To keep the database relatively small, the CRON job also deletes data that is older than five days after checking that there will be data left after the deletion. This ensures that we do not run out of data to display if the Plane Finder API stops working or if we lose our connection to it.

Flight Tracker API

Technologies used: 

  • Django - Python 

The Flight Tracker API is the API servicing the frontend interactive.

After having all the data from the Plane Finder API in the database, we used our learnings from the spike to start processing the data and making sense of it in a way that would allow us to build the frontend interactive in the way we wanted.

From the data gathered, we tracked an aircraft's unique ID and developed an algorithm to identify the flights that aircraft might have taken in the previous 24 hours. We tracked the plane's speed and altitude to find the flights and processed that information to discard flights that didn't look like they could be real, e.g. flights that were under 10 minutes long.

From the list of flights we could easily determine get their origin and destination GPS coordinates. The Plane Finder API returns a list of flights for the previous day, covering the 24-hour period.

Assumptions

Through trial and error, we also defined a maximum value for altitude and speed for an aircraft to be considered "on the ground", which was 30 knots and 30 feet respectively. This was necessary because we didn't have a continuous stream of data, just snapshots of where the planes were when we made our query. So it was common to see a plane not reach altitude and a speed of 0km and then disappear for some time, which indicated that it had most likely landed in between API queries.

After gathering our list of flights, we also noticed some flights also had a suspiciously short duration. For this reason, we defined a minimum of 10 minutes duration as necessary for it to be considered a flight.

Frontend Implementation

Technologies used:

  • Electron React App - TypeScript
  • MapBox GL JS and Turf.js
  • Styled Components

For the rendering of the map to match the designed style, the easiest way we found was to use Mapbox Studio. Matt uploaded the custom map design together with the icons for the planes and I was able to easily access them in the frontend.

Animations

Perhaps the most interesting part of the frontend implementation was the approach taken for the time-based animation of the flights looping through the previous day's 24-hour period in a much shorter time (around 2.5 minutes).

GIF showing the RFDS flight tracker animations in progress

GIF showing the aircraft animations in progress

Notice how the planes are not all moving at the same speed? This is because we used a custom React hook that exposes the "current time" in the time lapse timer. In other words, we loop through 24 hours worth of data in 2.5 minutes. We have the data for where a certain plane is at a certain time in the day. This time is then converted from the 24-hour value to the time lapse value, and we can place the plane drawing at the correct location for where it should be.

As the time lapse timer ticks on, we get the updated location for the plane and place the plane in the updated location. We do this quickly enough to look like the planes are moving.

Live stats sidebar

So far, we have focused on the Australian map component of the interactive but another part of the interactive is the sidebar displayed on the left. This component displays the current time and date as well as two figures:

  • the number of flights in the air “right now”
  • the number of flights on the previous day 
Royal Flying Doctor Service Flight Tracker at the Australian Stockman's Hall of Fame

RFDS Flight Tracker at Stockman’s Hall of Fame, February 2022  

Final thoughts

The Australian Stockman's Hall of Fame reopened last year and the Royal Flying Doctor Service exhibit has played an important role in its success.

From a personal and professional perspective, we started this RFDS Flight Tracker project with many ideas but also many challenges that I enjoyed investigating, while working with many talented people on our team to solve. I had a lot of fun throughout the process, from coming up with the algorithm to calculate the flights from the data we had to implementing the backend and seeing the data coming to life with the custom animations. 

Acknowledgement of Country

In the spirit of reconciliation, we acknowledge the many Traditional Custodians of Country throughout Australia and honour Elders past, present and emerging. We respect their deep, enduring connection to their lands, waterways and surrounding clan groups since time immemorial. We cherish the richness of First Nations Peoples’ artistic and cultural expressions.