Why the arrival predictions are incorrect when there are delays

Hi

I’m new to using tel unified api and I’ve noticed that the arrival prediction isn’t correct when there are delays or cancellations

I’m relaying on time_to_station value to decide whether the train is at the station or not. All I want to know if Elizabeth line has arrived at a specific station or not and if a train has arrived, then I need to find out if that train has left or not.

I’m putting a condition that if time_to_station < 50 then assume that the train has arrived at the station.

If you look at the screenshot you can see that time_to_station value is not reliable and also according to national rail that train shouldn’t be anywhere close to the station.

I’m using
https://api.tfl.gov.uk/Line/{line_id}/Arrivals/{stop_point_id}?direction={direction}

Where line_id the the line I’m interested in
stop_point_id is the station I’m interested in
and direction is inbound

Any help or advice on this will be greatly appreciated.

Thanks

hi @tfl_enthusiast

For Elizabeth line and Overground, we have an ArrivalDepartures operation under StopPoint that may serve your purpose better.

https://api.tfl.gov.uk/stoppoint/910GWCHAPEL/ArrivalDepartures?lineIds=elizabeth

Each prediction has enhanced data.

  {
    "$type": "Tfl.Api.Presentation.Entities.ArrivalDeparture, Tfl.Api.Presentation.Entities",
    "platformName": "Platform B",
    "destinationNaptanId": "910GHTRWTM4",
    "destinationName": "Heathrow Terminal 4 Rail Station",
    "naptanId": "910GWCHAPEL",
    "stationName": "Whitechapel Rail Station",
    "estimatedTimeOfArrival": "2024-08-08T12:24:00Z",
    "scheduledTimeOfArrival": "2024-08-08T12:24:00Z",
    "estimatedTimeOfDeparture": "2024-08-08T12:24:00Z",
    "scheduledTimeOfDeparture": "2024-08-08T12:24:00Z",
    "minutesAndSecondsToArrival": "91:0",
    "minutesAndSecondsToDeparture": "91:0",
    "departureStatus": "OnTime"
  },

Hopefully this will provide you what you need.

Many thanks,
James