The Journey of a Journey
Discover how our system works and what the engineering challenges are.
FAIRTIQ facilitates access to public transport by removing the ticket purchase barrier. How do we do it? Our app tracks the position of the traveller during the trip and then seamlessly charges the right price to their credit card. My friends’ reaction is: Wow! That sounds so simple. Is that all you do, or do you also make other apps? The truth is, to bring that level of simplicity to our users, a significant amount of challenges needs to be tackled, ranging from engineering to design right up to politics. This work definitely requires more than one developer, and it leaves us with no capacity to create other apps.
The journey of a journey starts inside the user's mobile phone, when they check in with FAIRTIQ. The app starts collecting GPS locations and transmits them to our servers together with other relevant data, such as remaining battery power. The server delivers a travel authorisation that can be presented during a ticket inspection. The tracking technology that we've been developing for that purpose is also available as a mobile SDK which third party providers can use to offer automatic ticketing in their own app.
When the user checks out at the end of their trip, the journey data is filtered, soaped, washed and rinsed. You can't imagine how much junk data we get from users’ mobile phones; it ranges from the inaccurate to the flat-out wrong. The data is then analysed using machine learning algorithms in order to reconstruct the list of stations covered during the journey. This is a particularly tricky task because we need to make sense out of noisy, incorrect and sparse data and also understand if the entire journey was on public transport or not (for example, if the user walked part of the way).
Once we have a list of stations, we have to figure out what tickets are needed to cover the journey. You might think that this problem had been solved ages ago. Actually, buying tickets after the journey has been made introduces a new layer of complexity, particularly if the traveller has taken multiple trips in the course of one day: if a day pass is cheaper, you're not going to sell four individual tickets, are you? The person would just buy their day pass somewhere else. That means we must compute the cheapest set of tickets for all of the journeys together. And the public transport industry doesn’t make it easy for us — you wouldn’t believe how creative providers are when it comes to tariffs: short-trip tickets, long-trip tickets, zone tickets that are valid for x amount of hours, zone travelcards, distance-based price, half-fare, 1st/2nd class.../etc., and all these combined.
The journey of the journey is almost over. It now has a price which can be invoiced to the user. The amount owing is charged to the user's credit card (or whatever means of payment they use) and the money goes directly into the public transport company’s account with no stopover in our account. We also interact with the public transport industry's accounting systems to register the ticket sales. This is where the journey ends.
These are only a few of the challenges we face, and each of them comes with their own subset of challenges. How do we compute a journey correctly after an app crash? How do we handle a diversion on a bus route? How do we charge 2nd class if the vehicle has no 1st class? How do we detect and prevent fraud? How do we use as little battery as possible? How do we protect users' privacy? How do we handle customer care and reimbursements?
Most of what I discussed so far are functional aspects. However, we also need to make sure that our users can rely on FAIRTIQ all the time. Imagine you're about to check-in and board the bus, then BAM! The service is not available. You're left with two options: travel without a ticket or miss the bus. This is why we aim for zero downtime. That has wide-ranging implications for our development processes. Continuous delivery, automated testing, scalability, fault tolerance and robustness are part of our daily business.
I feel I've written so much already, yet I could still write so much more. I think the only way to get the full picture is to actually work at FAIRTIQ. Mind you, the full picture may look a bit different by then! If you haven't done so, check out our engineering page and our careers page to find out more.