Enhancement to the Line Status API: Via and explicit stops for entire DisruptedRoute

Hello all, we are about to introduce an enhancement to the /line/{lineid}/status endpoint. All changes are for the DisruptedRoute items under the ‘affectedRoutes’ part of each disruption.

  1. A new, optional via field will be added. For route sections Such as the Northern Line Edgware to Morden route section, this field will indicate whether the section is via ‘Bank’ or ‘Charing Cross’. Likewise for the Central line it will have values such as ‘Newbury Park’ vs. ‘Woodford’ and for the Circle line values such as ‘Kings Cross’, ‘Embankment’, ‘High Street Kensington’, ‘Tower Hill’ or ‘Aldgate’.

  2. At present, when a DisruptedRoute contains an empty routeSectionNaptanEntrySequence, this implies that the entire route section is affected. For example, if the entire Stanmore to Stratford route section is disrupted, the routeSectionNaptanEntrySequence will be an empty list. Following the change, the entire list of stops will be included.

  3. A new field isEntireRouteSection will be added to DisruptedRoute to indicate whether the list of routeSectionNaptanEntrySequence covers the entire route section.

Example snippet code:

“via”: {
“$type”: “Tfl.Api.Presentation.Entities.RouteSectionNaptanEntrySequence, Tfl.Api.Presentation.Entities”,
“ordinal”: 17,
“stopPoint”: {
“$type”: “Tfl.Api.Presentation.Entities.StopPoint, Tfl.Api.Presentation.Entities”,
“naptanId”: “940GZZLUCHX”,
“modes”: [],
“icsCode”: “1000045”,
“stationNaptan”: “940GZZLUCHX”,
“hubNaptanCode”: “HUBCHX”,

“commonName”: “Charing Cross Underground Station”,

}
},
“isEntireRouteSection”: false,

2 Likes

Welcome @lironschur

Great stuff.

Does this mean we can distinguish when the Overground is closed between Highbury & Islington and Canonbury we can now tell which line?

image

as the auto-diagram always got it wrong (showed the “NLL” being closed when it was the “ELL”)

Hi @briantist,
Issues in the map notwithstanding (we have just updated the live map to address at least some of the issues there), you can detect from the response which of these routes is impacted by looking at the ‘origin’ and ‘destination’ of the route section.

@lironschur

So, will the “NLL” report the example yellow outage as being as part of…

  • Overground - Stratford to Richmond via Willesden Junction; AND
  • Overground - Stratford to Clapham Junction via Willesden Junction; AND

and for this bit, where there are three overlaid services with different stopping patterns on the “tube map” proper

image

  • Overground - Liverpool Street to Cheshunt via Hackney Downs, Edmonton Green; and
  • Overground - Liverpool Street to Enfield Town via Hackney Downs, Edmonton Green; and
  • Overground - Liverpool Street to Chingford via Hackney Down

I’m trying to be helpful here… It’s just the data provided need to be specific enough to do something with…

Thanks @briantist, with regards to the map that is a general limitation of the map, a better example is e.g. Green Park where a disruption affecting the Victoria line would have no impact on the Jubilee line. Do we then mark that stop as disrupted? Or not? Same with the connections. Certainly something to consider when we get around to redesign the map. As far as the API response goes though, the appearance of a stop in the stop sequence in itself does not indicate a disruption, only its appearance together with neighbouring stops, which then indicates a disruption on a section of track. In this case several different route sections will be returned, but only the one with a sequence of stops disrupted is the one with an actual disruption, hence the specific Overground service disrupted. Hope that makes sense!

@lironschur

I must admit that I’m using a Directed Graph to store my network data, so each connection is linked from each node to node. This allows me to use Dijkstra to work out the fastest (cheapest, lowest-carbon etc) route with very little CPU.

I start with a DijkstraNode

class DijkstraNodeStates
{
public array $dist = [];
public array $prev = [];
public array $visited = [];

public function __construct($ArrayOfGraphPointers)
{
    foreach ($ArrayOfGraphPointers as $j => $arrTemp) {
        $this->dist[$j] = (float)INF;
        $this->prev[$j] = (float)-1;
        $this->visited[$j] = (float)INF;
    }
}
}

This allows me to build a Directed Graph which has both nodes (stations) and links (lines) and each has a value (distance or time or carbon-usage).

So, what I personally would love to have is list of effected CONNECTIONS. So your example would give me the data about the connections that were disrupted, say:

  • Victoria Line, Victoria to Green Park
  • Victoria Line, Green Park to Victoria
  • Victoria Line, Green Park to Oxford Circus
  • Victoria Line, Oxford Circus to Green Park

This would allow me to rebuild the data-graph for the network with these sections missing, allowing the Dijkstra to work it’s magic. In my world, the station data isn’t important, because if you remove the connections to it, it will disappear from the data-graph.

I would be able to derive a missing station (from a map display) because it wouldn’t be in the data-graph.

Basically, if you want to work this stuff out computationally, it is the connections that matter!

However, despite the success I had in doing an Overground diagram that has no crossing lines,

The node-based one “Tube Map” (with the Liz Line) I did isn’t that good. The idea here is that the interchange stations (including National Rail) are on a grid (TCR in the middle middle) and order priory is given to the station usage numbers (BIG TEXT!)

I kind-of-works but it really, really ugly.

1 Like