node-red-web-nodes
node-red-web-nodes copied to clipboard
Transport for London Tube node
Introduction
This node will use the Transport for London (TfL) provided "Network Status & Train Prediction Services Development Beta SDK v0.2" (Tube departure boards, line status and station status). The API is documented at http://www.tfl.gov.uk/cdn/static/cms/documents/trackernet-data-services-guide-beta.pdf .
These node are Line & Tube station focused. (Get data about a particular line or get data about a particular station as part of a line).
Generally we have the following scenarios we'd like to support:
- Send me a notification when a train is about to arrive/depart from a particular station and line and towards a given direction. Advance warning is possible. => most useful as an input node
- Send me a notification when any event occurs at a station/when a failure/warning is issued for a station or a line. => input node
- Send me the train departure/arrival information at a particular station and line and direction. I'm already at the platform and I'm interested in all data. => query node
The API is in XML so an XML parser is to be picked for use. The API doesn't support location based on latitude/longitude so the user will have to select the underground line from a drop-down. Then they'll need to select the relevant station. Then the desired terminal direction of the trains. It's only then possible to send relevant information. Partial data input is possible (say only selecting a line gives line status, only selecting a line & station but not direction gives station info).
Input Node
- TfL Credentials: stored in credentials
- line: Select tube line from pre-programmed values. Triggers tube line status query which fetches station names and populates next drop down.
- Station: Select a station on this particular line. Fetch all approaching trains final directions.
- Direction: Determine the direction of the train service.
- Arrival/departure: Are we to be notified about the departure or arrival of a train
- Advance notice: How much advance notice is to be given before actual arrival/departure.
Query Node
- TfL Credentials: stored in credentials
- line: Select tube line from pre-programmed values. Triggers tube line status query which fetches station names and populates next drop down.
- Station: Select a station on this particular line. Fetch all approaching trains final directions.
- Direction: Determine the direction of the train service.
Issues to be considered
- Query simple train prediction service for a line => Gets all stations. => Query detailed train predictions service for a line and station => gets detailed departure info of all trains => filter by terminal station
- data is in XML format, so needs different processing to buses node. XML parser/technology to be agreed on.
- We should add a disclaimer that the data/nodes should not be used in train safety applications. This disclaimer is also sent out in the detailed prediction service XML by TfL.
- Add attribution to TfL: "Data provided by Transport for London"
This is not a comment :-).... No GPS... But there is now some WiFi... So won't be long before goog etc add them to the location awareness api.

This is a series of comments ;-) based on my experience of trying to work with the data
The document you cite about the API is the Trackernet data which although the TFP page says you need to sign up for a key this key currently appears not to be used.
Nowhere in the documentation can I find the live server for these data feeds documented ( its http://cloud.tfl.gov.uk )
So you can link directly to e.g http://cloud.tfl.gov.uk/trackernet/predictionsummary/d
There are feeds available from http://api.tfl.gov.uk which do use the keys but these feeds are not linked to from the Opendata part of the TFL website and use a different data structure. These do include a "place" to allow you to return nearest tube station etc.
Then there are complexities in the data feeds returned!
- Using the trackernet data using TubeLines as a drop down list might be confusing to endusers as there is no Circle Line data feed.
- The prediction summary also returns all at a for that station so for example if you select the Metropolitan Line and Barbican station, the data returned will include Circle and Hammersmith & City trains.
- Using "final destination" also runs into difficulties due to trains which list "Check Front of Train” in that field (see District line which appears to be the worst offender!)
Generally direction of travel can be determined from the Platform,with most stations having platforms labelled Eastbound/Westbound or Northbound/Southbound. But some such as the Central Line’s Hainault Loop have “Inner Rail” and “Outer Rail” and some stations such as White City and Edgware Road have platforms that take trains in both directions or more than one platform from which trains head in the same direction.