How to Create an Automated Tube Delay Refund Service

Share Article

ClaimMyRefund.co.uk creator Devin Smith describes how the automated tube delay claiming service he created works and the technology used.

Busy Oyster Bariers St James's Park

Busy Oyster Bariers

Once the claim is submitted an email is sent to the member notifying them a claim has been submitted

ClaimMyRefund.co.uk is an automated tube delay claiming service for oyster card users. Commuters can utilise this service when they have linked their Oyster card to an Oyster online account. The refund system uses the Oyster card holders journey history to calculate when their journey was delayed and then submits the refund application on their behalf.

The refund application system uses a mixture of Transport for London (TfL) APIs and what is called screen scraping to provide its service. Screen scraping is a term used to describe when a program extracts data from a web site as if it were a person browsing. An API, short for Application Programmable Interface, a service that can be easily integrated into an application using open standards to communicate between systems.

TfL provide a whole series of APIs for developers to exploit, APIs on offer vary from route planning assistance to on platform arrivals board information to cycle hire docking station status and location.

ClaimMyRefund's journey history monitoring and refund submission system is built using a series of separately running modules, each module runs independently of each other increasing reliability, easing development and proving scalability as each module can be hosted on a separate machine.

Tube Line Status Collector Module

The first API used by ClaimMyRefund is the arrivals board service, this data feed provides the arrivals information for all stations on the Tube network. This is the same arrival information you see on the electronic boards on the platform. This data is processed to record the time a train arrives at a platform. The arrival times and train numbers are compared to calculate the actual running time of each train from station to station.

The creation of this data created the spinoff website TubeLineStatus.co.uk where the live running times compared to schedule can be seen. This running to schedule history is archived for use in the claim process. This system also archives data from the official Tube status API which provides the tube status you find on TfLs own website and in the array of mobile apps people use today.

Oyster Journey Collector Module

The claims service requires its members to provide access to their Oyster online journey history. This can be provided in two ways, the first and easiest way is by proving Oyster their online username and password. The service logs onto their account every 48 hours and extracts their journey history for analysis.

Email Journey Collector Module

A second journey collection module was been added at the request of those who do not want to share their username and password with ClaimMyRefund.co.uk, A member enables the emailing of a journey history csv file each week, they then set up their email account to automatically forward the csv to ClaimMyRefund.co.uk for analysis.

Journey History Analysis Module

The journey history is analysed by taking each journey in turn and comparing the actual journey time with the planned journey time provided by the journey planner API. If the journey took more than 15 minutes longer than it should have done then it is queued for the next step in the process.

To make sure that the passengers delay was due to a late running service the system checks each queued claim to make sure the trains were running behind on the same lines at the same time as those detailed in the Oyster journey history. If the trains were running late at that time then a quick check is made against the archived official Tube status data to make sure the delay was not outside London Undergrounds control. If the claim is still valid, then it is queued for submission.

Claims are invalid when Tube delays are due to circumstances outside London Undergrounds control, delays due to bad weather, personal illness and passenger injury or suicide do not qualify for a refund. Broken down trains, signal failure or staffing shortages do qualify.

Claim Submission Module

The final step, if the passenger provided their Oyster online username and password then the claim system logs onto their Oyster online account and extracts all the details required to complete the claim form. If the passenger chose the email method, their claim submission data is collected at registration time and used to complete the form. Once the claim is submitted an email is sent to the member notifying them a claim has been submitted.

The system runs as a series of services where activity is triggered for each paid up member every 48 hours. An Oyster online account is free to join, all that is required is an Oyster card number and a few personal details. While ClaimMyRefund charge £2 a year per Oyster online account. There is no limit to how many cards you have registered on your account.

ClaimMyRefund.co.uk is written in C# .NET 4.5 and runs on Windows 2008 server. The web site is a ASP.NET MVC 4.0 web application again written in C# and runs on Windows 2008 server, all data is managed using SQL Server 2008.

Devin Smith is a Microsoft .NET Software Developer working in London. Over the years he has worked for the Linklaters (Law Firm) Tesco.com, City Index, Javelin Group and is currently working at The Houses of Parliament.

Share article on social media or email:

View article via:

Pdf Print

Contact Author

Devin Smith
Follow us on
Visit website