https://wiki.openraildata.com//api.php?action=feedcontributions&user=Leon+Byford&feedformat=atomOpen Rail Data Wiki - User contributions [en-gb]2024-03-29T04:44:53ZUser contributionsMediaWiki 1.33.1https://wiki.openraildata.com//index.php?title=Lift_and_Escalator_API&diff=3341Lift and Escalator API2024-01-19T12:44:31Z<p>Leon Byford: Add deprecation notice</p>
<hr />
<div>Network Rail's '''[https://portal.nr-lift-and-escalator.net/ Lift and Escalator API]''' is an API developed for Network Rail in 2020 by rail technology consultancy Hack Partners Ltd (now a rail AI software company, trading as CrossTech), nominally offering the real-time status of lifts and escalators at many locations across the rail network in Great Britain. The official documentation is quite sparse, hence this article was created by Peter in order to document the API unofficially.<br />
<br />
'''This API is due to be decommissioned after 31<sup>st</sup> January 2024.'''<br />
<br />
== Signing up ==<br />
You can register for an account on the Lift and Escalator API [https://portal.nr-lift-and-escalator.net portal]. Once you've verified your email address, navigate to the "products" tab. Click on "Developer" in the list on this page, then create a new subscription with a name of your choosing. Now, navigate to "Profile", you should be able to see your keys.<br />
<br />
== Access ==<br />
Official documentation claims that V1 GraphQL functionality migrated to V2 doesn't require authentication, but this isn't entirely true. Some location information (e.g. postcode, toc) was broken out into a ''stations'' table, which is inaccessible while unauthenticated. The inclusion of station CRS codes in the assets table may render this table redundant.<br />
<br />
== Data elements (V1) ==<br />
<br />
The following data elements are held within the API:<br />
<br />
{| class="wikitable"<br />
|-<br />
!Field<br />
!v2 equivalent<br />
!Description<br />
|-<br />
|uprn<br />
|prn (asset)<br />
|Unique asset identifier (not a [https://www.ordnancesurvey.co.uk/business-government/tools-support/open-mastermap-programme/open-id-policy UPRN])<br />
|-<br />
|sensorId<br />
|sensorId (status or asset tables)<br />
|A four-digit sensor identifier for the Electronic Monitoring Unit (EMU), left-padded with zeroes if required. <br />
|-<br />
|blockId<br />
|blockId (assets)<br />
|An identifier for the location of the asset within a station<br />
|-<br />
|blockTitle<br />
|<br />
|The name of the location within the station<br />
|-<br />
|station<br />
|name (station)<br />
|Name of the station at which this asset is located<br />
|-<br />
|location<br />
|location (asset)<br />
|Name of the location within the station at which this asset is located<br />
|-<br />
|lat<br />
|lat (station)<br />
|Latitude in (WGS84)<br />
|-<br />
|long<br />
|long (station)<br />
|Longitude (WGS84)<br />
|-<br />
|postcode<br />
|postcode (station)<br />
|Postcode of the station in which this asset is located<br />
|-<br />
|route<br />
|route (station)<br />
|Network Rail [https://www.networkrail.co.uk/running-the-railway/our-regions/ Route] in which this asset is located<br />
|-<br />
|territory<br />
|region (station)<br />
|Network Rail [https://www.networkrail.co.uk/running-the-railway/our-regions/ Region] in which this asset is located<br />
|-<br />
|toc<br />
|toc (station)<br />
|Set to 'Managed Stations' for Network Rail Managed Stations, otherwise the name of the train operator<br />
|-<br />
|branch<br />
|<br />
|Unknown, but possibly the branch of the lift or escalator maintainer's organisation<br />
|-<br />
|type<br />
|type (asset)<br />
|Type of asset, e.g. Lift or Escalator<br />
|-<br />
|status<br />
|status (status)<br />
|Current status of the asset<br />
|-<br />
|isolated<br />
|isolated (status)<br />
|Indicates whether the asset is powered down or disconnected<br />
|-<br />
|engineerOnSite<br />
|engineerOnSite (status)<br />
|Indicates if an engineer has logged in to the sensor and is servicing the asset<br />
|-<br />
|independant<br />
|independent (status)<br />
|('''note the misspelling''' - independ'''ant''' in v1, independ'''ent''' in v2) Indicates if the lift is on [https://en.wikipedia.org/wiki/Elevator#Independent_service Independent Service] by use of a car preference key<br />
|-<br />
|updatedTime<br />
|<br />
|Date and time when the status was last updated<br />
|}<br />
<br />
== Tables (V2) ==<br />
=== Asset ===<br />
{| class="wikitable"<br />
|-<br />
!Field<br />
!Official description<br />
!Description<br />
|-<br />
|id<br />
|Unique asset identifier<br />
|Unique identifier (of asset?)<br />
|-<br />
|prn<br />
|Asset property reference number<br />
|Unique asset identifier, renamed from UPRN. '''This field cannot be used in the query builder.'''<br />
|-<br />
|stationNumber<br />
|Asset number<br />
| '''This field cannot be used in the query builder.'''<br />
|-<br />
|description<br />
|<br />
|e.g. "Colonnade Lift", "Lift 3,Platform 20"<br />
|-<br />
|displayName<br />
|Standardised asset name<br />
|e.g. "Lift to Colonnade ", "Lift, Platform 20"<br />
|-<br />
|sensorId<br />
|Associated sensor<br />
|A sensor identifier for the Electronic Monitoring Unit (EMU), '''no longer zero-padded'''<br />
|-<br />
|blockId<br />
|<br />
|An identifier for the location of the asset within a station<br />
|-<br />
|crs<br />
|Associated station<br />
|CRS code of the station at which this asset is located<br />
|-<br />
|location<br />
|<br />
|Name of the location within the station at which this asset is located (e.g. "Colonnade Lift", "Platform 20")<br />
|-<br />
|type<br />
|Asset type (i.e Lift or Escalator)<br />
|Type of asset, e.g. Lift or Escalator<br />
|-<br />
|inCommission<br />
|<br />
|'''This field cannot be used in the query builder. This field is not officially documented.''' Note that this bears a striking resemblence to the misspelled ''inCommision'' you can see in the query builder.<br />
|-<br />
|publicFacing<br />
|<br />
|'''This field is not officially documented.'''<br />
|-<br />
|status<br />
|''relations not covered''<br />
|(Relation) Current status of the asset<br />
|}<br />
<br />
=== Status ===<br />
{| class="wikitable"<br />
|-<br />
!Field<br />
!Official description<br />
!Description<br />
|-<br />
|sensorId<br />
|Unique sensor identifier<br />
|ID of sensor<br />
|-<br />
|isolated<br />
|<br />
|Indicates whether the asset is powered down or disconnected<br />
|-<br />
|engineerOnSite<br />
|<br />
|Indicates if an engineer has logged in to the sensor and is servicing the asset<br />
|-<br />
|independent<br />
|<br />
|('''note that this is now not misspelled'''), indicates if the lift is in independent service mode.<br />
|-<br />
|status<br />
|last status received<br />
|Current status of the asset (e.g. "Available", "Unknown", "Not Available")<br />
|-<br />
|<s>lastUpdated</s><br />
|Time of last update to status<br />
|'''Documented in v2 preview documentation, this field is completely absent'''.<br />
|-<br />
|asset<br />
|''relations not covered''<br />
|(Relation) Asset to which this status relates<br />
|}<br />
<br />
=== Stations ===<br />
{| class="wikitable"<br />
|-<br />
!Field<br />
!Official description<br />
!Description<br />
|-<br />
|id<br />
|Unique station identifier<br />
|API-specific ID for station<br />
|-<br />
|crs<br />
|Station CRS code<br />
|CRS code of station asset is located at<br />
|-<br />
|name<br />
|<br />
|Name of station<br />
|-<br />
|lat<br />
|<br />
|Latitude in (WGS84)<br />
|-<br />
|long<br />
|<br />
|Longitude (WGS84)<br />
|-<br />
|toc<br />
|Train operating company<br />
|Set to 'Managed Stations' for Network Rail Managed Stations, otherwise the name of the train operator<br />
|-<br />
|region<br />
|<br />
|Network Rail [https://www.networkrail.co.uk/running-the-railway/our-regions/ Region] in which this asset is located<br />
|-<br />
|route<br />
|<br />
|Network Rail [https://www.networkrail.co.uk/running-the-railway/our-regions/ Route] in which this asset is located<br />
|-<br />
|postcode<br />
|<br />
|Postcode of the station in which this asset is located<br />
|-<br />
|address<br />
|<br />
|'''This field cannot be used in the query builder.'''<br />
|-<br />
|contactEmail<br />
|<br />
|'''This field cannot be used in the query builder.'''<br />
|}<br />
<br />
Note that stations are only available if you've authenticated using your bearer token, this includes using the query builder on the portal. If you are not authenticated, you'll see an error which makes it look like the table simply doesn't exist.<br />
<br />
== Making a GraphQL request ==<br />
All requests are through the API endpoint (https://nr-lift-and-escalator.azure-api.net/graphql/v2). Requests must be made via an HTTP POST request, navigating to this URL in a web browser will make an HTTP GET request, which will result in the following error:<br />
<br />
<code>{"path":"$","error":"resource does not exist","code":"not-found"}</code><br />
<br />
The API uses [https://graphql.org/ GraphQL], which allows complex queries to be submitted in an HTTP POST request. A query is just a JSON data structure with some fields to filter on, and other fields to return.<br />
<br />
== REST API ==<br />
With V2 came the introduction of a handful of REST endpoints, these are<br />
* <code>https://nr-lift-and-escalator.azure-api.net/api/v2/sensors[?num][&offset]</code> - All statuses, essentially equivalent to a graphQL query for statuses with no joins.<br />
<br />
Num and offset aren't documented; they're used for paging, with num defining the limit, and offset defining the offset. Both are nominally optional, but num will default to 50 if unset. Instead of paging through these, there's no upper limit to ''num'', if you set it to 20000, you'll get all statuses at once.<br />
<br />
* <code>https://nr-lift-and-escalator.azure-api.net/api/v2/sensors/{id}</code> - Statuses by sensor ID, same columns as graphQL status table<br />
* <code>https://nr-lift-and-escalator.azure-api.net/api/v2/stations/{crs}/assets</code> - Assets marked as being at given station CRS<br />
<br />
Note that you need to provide bearer authentication for this, since it's passed through to GraphQL.<br />
<br />
* <s><code>https://nr-lift-and-escalator.azure-api.net/api/v2/assets/{id}</code></s> - Get asset information by asset ID (broken)<br />
<br />
<code>{"error":"field 'uprn' not found in type: 'assets'","path":"$.selectionSet.assets.selectionSet.uprn","code":"validation-failed"}</code><br />
<br />
== Simple requests ==<br />
<br />
=== All assets at a station (V1) ===<br />
<br />
To return the status of all lifts and escalators at a particular station, such as Edinburgh Waverley:<br />
<br />
<pre>query MyQuery {<br />
status(where: {station: {_eq: "Edinburgh Waverley"}}) {<br />
blockTitle<br />
branch<br />
engineerOnSite<br />
independant<br />
isolated<br />
lat<br />
location<br />
long<br />
postCode<br />
route<br />
sensorId<br />
station<br />
status<br />
territory<br />
toc<br />
type<br />
updatedTime<br />
uprn<br />
blockId<br />
}<br />
}</pre><br />
<br />
=== All assets at a station (V2) ===<br />
<pre><br />
query {<br />
assets(where: {crs: {_eq: "EDB"}}) {<br />
blockId<br />
crs<br />
description<br />
displayName<br />
id<br />
location<br />
sensorId<br />
status {<br />
engineerOnSite<br />
independent<br />
isolated<br />
sensorId<br />
status<br />
}<br />
type<br />
}<br />
}<br />
</pre><br />
<br />
=== All assets at all stations (V2) ===<br />
<br />
<pre>query {<br />
assets {<br />
blockId<br />
crs<br />
description<br />
displayName<br />
id<br />
location<br />
sensorId<br />
status {<br />
engineerOnSite<br />
independent<br />
isolated<br />
sensorId<br />
status<br />
}<br />
type<br />
}<br />
}</pre><br />
<br />
=== Stream of updates ===<br />
<br />
It is supposedly possible to make an API request and receive a stream of updates using the <code>@live</code> directive on the GraphQL query, but does not seem to work on this API.<br />
<br />
== Room for improvement (V1) ==<br />
<br />
There is some room for improvement on the API:<br />
<br />
* '''Null entries''' - some fields are set to "#N/A", and some are set to null<br />
* '''Unmapped sensors''' - there are instances (such as sensorId 3104) where no data has been filled in about the asset at all<br />
* '''No escalators''' - some escalators are included but fall fully within the problem above, all have null locational data<br />
* '''Incorrect references to territories''' - the term 'territory' was in use during Railtrack days, but is no longer used - Region and Routes are the current terminology<br />
* '''Out-of-date TOC information''' - sensor 4052 refers to London Midland, sensor 3082 refers to East Coast, and 6148 to Arriva Trains Wales - none of whom currently operate franchises<br />
* '''Lack of machine-interpretable data''' - sensor 5006 is described as 'Wolverhampton Stn Lift/Escalator 05', in location 'Passenger Lift Platform 4', whereas sensor 8127, 'Imperial Wharf Stn Lift/Escalator 01' is in location 'Platform 1' - these are not easy to parse and necessarily link to a particular platform<br />
* '''Non-passenger assets''' - 1032 and 4034 are lifts situated in the South Wales and Thames Valley signalling centres, respectively. 1041 is "Mepham Street Goods No. 2" at London Waterloo, and 5054 will take you to "[https://en.wikipedia.org/wiki/Red_Star_Parcels Red Star Parcels]" in Milton Keynes<br />
<br />
== Official documentation ==<br />
Links to official documentation<br />
<br />
=== Version 2 ===<br />
* [https://docs.google.com/document/d/18IWzcjuuj6usxEv6pIRjH39EOouDFyIzk9nTXUP7ymE/edit Lifts & Escalators (LNE) API V2 - Usage Instructions] - overview, registration, creating API subscription, obtaining bearer token<br />
* [https://docs.google.com/document/d/1Aikq_JzP2FvZkIJkKCBNahqIA0HdGwcSQUQUTP6oFY4/edit V2 API Authentication Docs] - creating API subscription, obtaining bearer token<br />
* [https://docs.google.com/document/d/e/2PACX-1vTBUhyCXJoCvKUdIjE5GSyV3CqPgXg5d4K7DAghGilat4j8DTlWwMaTIQwTee-zvifFuW4NVB_0Hd5S/pub Documentation - Lifts & Escalators API v2 (developer preview)] - Types, endpoints, responses, example queries<br />
* [[:File:Nr_lift_escalator_api_introspected_schema_2023-09-09.txt|Introspected GraphQL schema (2023-09-09)]] - Not provided officially (documentation claims that introspection has been disabled)<br />
=== Version 1 ===<br />
* [https://docs.google.com/document/d/e/2PACX-1vQEcL1yJLUVd8IAKGHi0s2cRsbKuedxuT2YT7b1TNnmjUi07_U15feiVWNlTGEzva7xoTiMrt4AcmE3/pub Documentation - Lifts & Escalators API (public preview)]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Identifying_Locations&diff=3305Identifying Locations2023-11-23T01:09:42Z<p>Leon Byford: Re-add description of ATCO Codes, with explanation</p>
<hr />
<div>Locations on the rail network can be identified by several different methods:<br />
<br />
* '''3-Alpha Codes''' - A 3-character code used for stations. Previously referred to as CRS (Computer Reservation System) or NRS (National Reservation System) codes.<br />
* '''NLC (National Location Code)''' - A 6-digit code generally used for retail purposes, [[NLC|described further here]]<br />
* '''TIPLOC (Timing Point Location)''' - Codes relating to points used in deriving train schedules<br />
* '''STANOX (Station Number)''' - These codes can refer to non-station locations such as sidings and junctions. STANOX codes are grouped by geographical area - the first two digits specify the area in which the location exists. See the [[STANOX_Areas | STANOX code areas]] page for details.<br />
* '''ATCO Code''' - Used by multi-modal journey planners and timetables<ref>ATCO Codes are maintained in the [https://beta-naptan.dft.gov.uk/ National Public Transport Access Nodes (NaPTAN) dataset]. "ATCO" stands for the [https://www.atco.website/ Association of Transport Co-ordinating Officers]. Not to be confused with the Association of Train Operating Companies (ATOC), now known as the [https://www.raildeliverygroup.com/ Rail Delivery Group].</ref><br />
<br />
A single location may have multiple codes representing it, and different sets of platforms in one location may have differing codes - see the [[#Multiple_Codes | multiple codes]] section below.<br />
<br />
See the [[Reference_Data | reference data]] page for sources of these codes.<br />
<br />
* TIPLOC's Mapped to Eastings & Northings - [[File:TIPLOC_Eastings_and_Northings.xlsx.gz]]<br />
<br />
== Examples ==<br />
<br />
{| class="wikitable"<br />
|-<br />
! scope="col" | Station<br />
! scope="col" | 3Alpha<br />
! scope="col" | NLC<br />
! scope="col" | TIPLOC<br />
! scope="col" | STANOX<br />
! scope="col" | ATCO<br />
|-<br />
|Leeds || LDS || 848700 || LEEDS || 17132 || 9100LEEDS<br />
|-<br />
|Kings Cross || KGX || 612100 || KNGX || 54311 || 9100KNGX<br />
|-<br />
|Lincoln Central || LCN || 634000 || LINCLNC || 44038 || 9100LINCLNC <br />
|-<br />
|Glasgow Central High Level || GLC || 981300 || GLGC || 07257 || 9100GLGC<br />
|-<br />
|Gatwick Airport || GTW || 541600 || GTWK || 87911 || 9100GTWK<br />
|}<br />
<br />
== Multiple Codes ==<br />
<br />
Emil Vaughan asked, "There appear to be two CRS codes used for Highbury and Islington in the ATOC timetables: HHY and HII. The first is used for the Overground, and the second for the deep-level FGW services. Only one of the codes, HII, is in the NaPTAN RailReferences.csv file. I was wondering how common it is for a station to have multiple CRS codes? Thanks!"<br />
<br />
It is reasonably common for a station to have multiple TIPLOC codes, where it consists of multiple groups of platforms on completely different lines. London Bridge, Victoria, Clapham Junction, Reading, Liverpool South Parkway are all examples of this I can think of off the top of my head. These different TIPLOC codes are used in schedules.<br />
<br />
A lot of the time these different TIPLOCs will additionally have a CRS code assigned to them (as in the case of HII for the Highbury & Islington low level platforms), but as far as I can see these secondary CRS codes are never used for anything, at least not in any of the public ATOC and Network Rail data. Yes, they appear in various indexes and master lists, but not elsewhere.<br />
<br />
HHY is definitely the main CRS code for Highbury & Islington; you can check this in the ATOC master station names file (TTISxxx.MSN) in the ATOC timetable feed, downloadable from data.atoc.org.<br />
<br />
== Notes ==<br />
<references /><br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:3-Alpha Codes]]<br />
[[Category:NLC Codes]]<br />
[[Category:TIPLOC Codes]]<br />
[[Category:STANOX Codes]]<br />
[[Category:ATOC Data]]<br />
[[Category:Identifying Locations]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=User:Leon_Byford/rid&diff=3236User:Leon Byford/rid2023-10-26T15:11:04Z<p>Leon Byford: Created page with "What's a '''rid'''? Darwin provides this property as an ID to identify a particular service. But I puzzled for a long time what it could stand for. It's a Darwin specific ID,..."</p>
<hr />
<div>What's a '''rid'''?<br />
<br />
Darwin provides this property as an ID to identify a particular service. But I puzzled for a long time what it could stand for. It's a Darwin specific ID, but it seemed a bit of a stretch to think it could stand for Da'''r'''win '''ID'''.<br />
<br />
Well, I found the answer in (surprise surprise) [[:File:LDB-SV User Guide.gz|Darwin's documentation]]. Fancy that!<br />
<br />
A few times in this document, it explains that a rid is "A unique RTTI ID for this service that can be used to obtain full details of the service."<br />
<br />
So rid = RTTI ID.<br />
<br />
But what's an RTTI?<br />
<br />
Thankfully there is a glossary on the last page of the document that reveals RTTI means "Real Time Train Information. Now known as Darwin."<br />
<br />
So now we know that rid (sort of) stands for '''Real Time Train Information Identifier'''.</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Darwin:Push_Port&diff=3164Darwin:Push Port2023-05-31T07:18:07Z<p>Leon Byford: /* Data */ Re-add link to specification</p>
<hr />
<div>The Darwin Push Port is an XML push feed that continuously streams information about the creation of,<br />
and changes to, train schedule records, together with train running predictions made by Darwin.<br />
<br />
The data is made available through http://opendata.nationalrail.co.uk.<br />
<br />
The Push Port requires the user to build a database capable of capturing extremely high volumes of <br />
information, as well as a query engine to draw the information from your database. There is a large <br />
amount of interpretation work involved in this; however this allows substantial flexibility to apply <br />
the information to any product within the limitations of your own infrastructure.<br />
<br />
= Data =<br />
The Push Port has two components:<br />
* Timetable and Timetable Reference Data.<br />
* Real-Time Update Data.<br />
<br />
All Darwin data is gzipped ''(except for the Darwin Status Topic)''. [[Darwin:Push_Port_XML_Schemas|XSDs]] for the interface are available, along with [[:File:Push Port Interface Specification.gz|the specification]].<br />
<br />
= Timetable and Timetable Reference Data =<br />
Darwin makes available Timetable and Timetable Reference Data exposed as static files that are <br />
generated ''usually'' on a daily basis. The creation of new Timetable and Timetable Reference files<br />
are alerted via ''TimeTableId'' messages in the real-time Update Data.<br />
<br />
== Timetables ==<br />
Timetable data contains a set of schedules covering at least a 48-hour<br />
period held in the Darwin database. This list of schedules provides the basis on<br />
which a Darwin snapshot can be applied. <br />
<br />
The schedules in the timetable do not include forecast or actual times although <br />
they reflect the latest state that Darwin has when the timetable file was generated, <br />
so any schedule changes, new schedules, false destinations, cancellations and <br />
associations will be included.<br />
<br />
== Reference Data ==<br />
The Timetable Reference Data contains the following data referenced in timetables:<br />
* [[Darwin:Reference_locations|TIPLOCs, CRS codes, TOC codes and location names]]<br />
* TOC codes, names and website URLs<br />
* [[Darwin:Late Running reason codes and text|Late Running reason codes and text]]<br />
* [[Darwin:Cancellation reason codes and text|Cancellation reason codes and text]]<br />
* [[Darwin:Via_Locations|Via locations]]<br />
* [[Darwin:CIS codes and names|CIS codes and names]]<br />
<br />
= Update Data =<br />
Darwin makes available real-time updates that alert the user to changes in the state of the<br />
Darwin database, or the creation of new Timetable and Timetable Reference Data. Darwin exposes two<br />
message topics:<br />
* Darwin Live Feed Topic<br />
* Darwin Status Topic<br />
<br />
== Darwin Live Feed Topic ==<br />
The live feed topic exposes all update messages. Update Messages contain one or more of the following elements: <br />
* [[Darwin:Schedule_Element|Schedule data]]<br />
* [[Darwin:Association_Element|Association data]]<br />
* [[Darwin:Train_Status_Element|Actual and Forecast data]]<br />
* [[Darwin:Train_Order_Element|Train order data]]<br />
* [[Darwin:Station_Message_Element|Station Messages]]<br />
* [[Darwin:Train_Alert_data|Train Alerts]]<br />
* [[Darwin:Tracking_ID_corrections|Tracking ID corrections]]<br />
* [[Darwin:Alarm_Element|Alarms]]<br />
* [[Darwin:Formations|Schedule formation]]<br />
* [[Darwin:Train_Loading|Loading]]<br />
<br />
The Live Feed Topic also exposes [[Darwin:TimeTableId_element|TimeTableId]] messages that alert the creation of a new Timetable<br />
or Timetable Reference file.<br />
<br />
== Status Messages ==<br />
The Status message topic contains status messages about the health and state of the Update Data.<br />
The possible messages are:<br />
; HBINIT : The upstream live feed is running but is initialising its timetable.<br />
<br />
; HBFAIL : The upstream live feed is shutting down.<br />
<br />
; HBPENDING : The upstream live feed is operating, but part of the system is currently in failover mode. Data may be queued for a short period. Clients may remain connected and data will be delivered when available.<br />
<br />
; SNAPSHOT : The Darwin Live Feed has encountered a discontinuity of messages from upstream and is starting a snapshot to re-sync it's state.<br />
<br />
; SHUTTING-DOWN : Darwin is shutting down and the message topics will soon become unavailable.<br />
<br />
= Usage =<br />
<br />
== Subscribing to Darwin ==<br />
The Darwin Push Port is made available through http://opendata.nationalrail.co.uk. By creating an account, you can register<br />
for a subscription to the Darwin feed.<br />
<br />
As a user with an active Darwin subscription, navigating to the My Feeds page will display the following details:<br />
<br />
; Darwin File Information : This section provides user details for accessing the Timetable and Timetable Reference Data via an Amazon S3 Bucket.<br />
<br />
; Darwin FTP Information : This section provides user details for accessing snapshots and 5-minute logs of the real-time Update Data via FTP.<br />
<br />
; Darwin Topic Information : This section provides user details for accessing real-time Update Data via OpenWire and STOMP message topics.<br />
<br />
'''Important''' - Please note NRDP accounts expire after extended periods of no use. The unused account expiry period is <br />
currently set to 30 days. If you create an account and do not consume any of the feeds during this time your account <br />
will be deleted. If your account has been deleted, you will receive a notification email, and you will be able to <br />
re-register for a new account.<br />
<br />
== How do I consume the data? ==<br />
<br />
=== Timetable and Reference Data ===<br />
Timetable and Reference data can be obtained via an Amazon S3 Bucket. You will be required to connect and authenticate to S3 via the details given in ''Darwin File Information'' on your ''My Feeds'' page.<br />
<br />
The reference data filenames are in the format "yyyymmddnnnnnn_ref_v3.xml.gz" (e.g. "PPTimetable/20230201021854_ref_v3.xml.gz"). There's usually several days of historical reference data, and different versions, so make sure you select the latest one for the right version (v3 is the correct reference data version for v16).<br />
<br />
The reference data was previously available via FTP, this is no longer the case. <br />
<br />
=== Keeping up to date ===<br />
Timetable and Reference Data is updated ''usually'' on a daily basis. To indicate that a new Timetable or Timetable Reference<br />
file is available, the real-time topic will send a ''TimeTableId'' message, to identify the new Timetable or Timetable Reference Data file name.<br />
<br />
A separate ''TimeTableId'' message will be sent for each individual Timetable or Reference<br />
Data file that becomes available. Thus, multiple ''TimeTableId'' messages will be generated<br />
in succession, one for each Timetable and Reference file schema version.<br />
<br />
''Note that due to existing schema limitations, the TimeTableId message has mandatory<br />
attributes for timetable file and timetable reference data file names. Since the<br />
TimeTableId notification message is only reporting the presence of a single file, only<br />
one of these attributes will be populated with a valid file name. The other attribute will<br />
consist only of white space.''<br />
<br />
=== Update Data via FTP ===<br />
The FTP server provides non real-time Update Data for users that missed the real-time updates. All files are gzipped.<br />
<br />
Darwin regularly creates ''Snapshot'' files, containing the entire state of Darwin at a given point in time. The latest snapshot file is available over FTP for end users.<br />
<br />
Every 5 minutes of Live Feed Data since the last snapshot will be available in log files, and available over FTP.<br />
<br />
=== Real-Time Update Data via OpenWire & Stomp Message Topics ===<br />
The Darwin Live Feed Topic and Darwin Status Messages Topic are exposed via ActiveMQ, and can be connected to<br />
via [http://activemq.apache.org/openwire.html OpenWire] or [http://en.wikipedia.org/wiki/Streaming_Text_Oriented_Messaging_Protocol STOMP]. The credentials for connecting can be obtained via your ''Darwin Topic Information'' section on your ''My Feeds'' page.<br />
<br />
STOMP and OpenWire allow durable and non-durable subscriptions. If you would like Darwin to retain messages for you on disconnection,<br />
you should use a durable subscription. Please note that message retention is limited, and is implemented to allow for short term<br />
subscriber failure, not long term message persistence.<br />
<br />
'''Important''': The following must be true when connecting to a Darwin Topic:<br />
* Watching Advisory Topics must be turned off.<br />
* If you are using a Durable Subscriber, your Client ID '''must''' begin with your username.<br />
<br />
=== Detecting Real-Time Discontinuity ===<br />
Each Update message contains a ''SequenceNumber'' header. The sequence number runs from 0 to 9,999,999.<br />
Upon reaching the end of this range the sequence number wraps around to 0.<br />
<br />
NRDP guarantees messages are produced with sequential sequence numbers, therefore a missing sequence number<br />
indicates a missed message.<br />
<br />
For example, if you received the following sequence numbers in order:<br />
<br />
0, 1, 2, 4, 5, 6<br />
<br />
Then you have missed the message with sequence number 3.<br />
<br />
=== Filtering ===<br />
If you wish to, you may filter the Darwin Live Feed by message type using JMS Selectors on the MessageType header. Available message types and their respective <br />
codes include: <br />
{| class="wikitable"<br />
!Description<br />
!Code<br />
|-<br />
|Schedule updates (consisting of Schedule, DeactivatedSchedule)<br />
|SC<br />
|-<br />
|Association updates<br />
|AS<br />
|-<br />
|Schedule formations<br />
|SF<br />
|-<br />
|Train order<br />
|TO<br />
|-<br />
|Actual and Forecast Information<br />
|TS<br />
|-<br />
|Loading<br />
|LO<br />
|-<br />
|Station messages<br />
|OW<br />
|-<br />
|Notifications (consisting of TrainAlert, TrackingID, RTTIAlarm)<br />
|NO<br />
|}<br />
Please note that if you choose to filter messages, you will not be able to detect discontinuities in the Darwin feed.<br />
<br />
= Good Practice =<br />
You should follow the [[Good_Practice|good practice guide]] when using this service.<br />
<br />
= Examples =<br />
Code examples for STOMP clients are available in [https://github.com/openraildata Github].<br />
<br />
The advanced usage page contains examples of some advanced applications for the data feeds, including bridging the ActiveMQ <br />
feeds to your own messaging server.<br />
<br />
Note that the use of gzip compression for messages makes it highly important to select a competent STOMP library, as gzip compressed data will often contain STOMP control characters, while the content-length header is optional in STOMP, so clients written without thought to binary data will often experience errors.<br />
<br />
= Version 12 Support =<br />
<br />
Push Port v12 is no longer available as of mid-May 2019.<br />
<br />
= Support =<br />
If you are having problems with the feeds:<br />
* First, read this wiki - there's a lot of material here that will help you<br />
* Check [https://twitter.com/open_rail_feeds twitter] to see if an issue has been reported<br />
* If you want to discuss your problem with other people working with the service, the [https://groups.google.com/d/forum/openraildata-talk openraildata-talk] group on Google Groups will be useful<br />
* Finally, if you're still having a problem, email [mailto:dsg_nrdp.support@caci.co.uk dsg_nrdp.support@caci.co.uk]<br />
<br />
{{Navtable-NreDataFeeds}}<br />
<br />
[[Category:National Rail Enquiries Data Feeds]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Lift_and_Escalator_API&diff=3076Lift and Escalator API2023-01-24T15:29:40Z<p>Leon Byford: add links to official docs</p>
<hr />
<div>Network Rail's '''[https://portal.nr-lift-and-escalator.net/ Lift and Escalator API]''' contains details of the status of lifts and escalators at many locations in Great Britain. The [[#Official documentation|supplied documentation]] is sparse and difficult to follow, and so [https://twitter.com/poggs/ Peter Hicks] of [https://twitter.com/opentraintimes OpenTrainTimes] has written this document for the community to help usage of the API.<br />
<br />
== Signing up ==<br />
<br />
The developer preview does not require you to [https://nr-lift-and-escalator.developer.azure-api.net/signup sign up], however it is probably worth your while to show how many people are using the API.<br />
<br />
== Access ==<br />
<br />
The developer preview does not require use of an authentication token, even though the [https://nr-lift-and-escalator.developer.azure-api.net/api-details#api=network-rail-lift-and-escalator-api HTTP requests on the API page] return a 401 Unauthorized.<br />
<br />
== Data elements ==<br />
<br />
The following data elements are held within the API:<br />
<br />
{| class="wikitable"<br />
|-<br />
!Field<br />
!Description<br />
|-<br />
|uprn<br />
|Unique asset identifier (not a [https://www.ordnancesurvey.co.uk/business-government/tools-support/open-mastermap-programme/open-id-policy UPRN])<br />
|-<br />
|sensorId<br />
|A four-digit sensor identifier for the Electronic Monitoring Unit (EMU), left-padded with zeroes if required. <br />
|-<br />
|blockId<br />
|An identifier for the location of the asset within a station<br />
|-<br />
|blockTitle<br />
|The name of the location within the station<br />
|-<br />
|station<br />
|Name of the station at which this asset is located<br />
|-<br />
|location<br />
|Name of the location within the station at which this asset is located<br />
|-<br />
|lat<br />
|Latitude in (WGS84)<br />
|-<br />
|long<br />
|Longitude (WGS84)<br />
|-<br />
|postcode<br />
|Postcode of the station in which this asset is located<br />
|-<br />
|route<br />
|Network Rail [https://www.networkrail.co.uk/running-the-railway/our-regions/ Route] in which this asset is located<br />
|-<br />
|territory<br />
|Network Rail [https://www.networkrail.co.uk/running-the-railway/our-regions/ Region] in which this asset is located<br />
|-<br />
|toc<br />
|Set to 'Managed Stations' for Network Rail Managed Stations, otherwise the name of the train operator<br />
|-<br />
|branch<br />
|Unknown, but possibly the branch of the lift or escalator maintainer's organisation where <br />
|-<br />
|type<br />
|Type of asset, e.g. Lift or Escalator<br />
|-<br />
|status<br />
|Current status of the asset<br />
|-<br />
|isolated<br />
|Indicates whether the asset is powered down or disconnected<br />
|-<br />
|engineerOnSite<br />
|Indicates if an engineer has logged in to the sensor and is servicing the asset<br />
|-<br />
|independant<br />
|(note the misspelling) Indicates if the lift is on [https://en.wikipedia.org/wiki/Elevator#Independent_service Independent Service] by use of a car preference key<br />
|-<br />
|updatedTime<br />
|Date and time when the status was last updated<br />
|}<br />
<br />
== Making a request ==<br />
<br />
All requests are through the [https://nr-lift-and-escalator.azure-api.net/gateway/v1/ API endpoint]. Requests must be made via an HTTP POST call - accessing the endpoint through a web browser will make an HTTP GET request, resulting in the following error:<br />
<br />
<code>{"path":"$","error":"resource does not exist","code":"not-found"}</code><br />
<br />
The API uses [https://graphql.org/ GraphQL], which allows complex queries to be submitted in an HTTP POST request. A query is just a JSON data structure with some fields to filter on, and other fields to return.<br />
<br />
== Simple requests ==<br />
<br />
=== All assets at a station ===<br />
<br />
To return the status of all lifts and escalators at a particular station, such as Edinburgh Waverley:<br />
<br />
<pre>query MyQuery {<br />
status(where: {station: {_eq: "Edinburgh Waverley"}}) {<br />
blockTitle<br />
branch<br />
engineerOnSite<br />
independant<br />
isolated<br />
lat<br />
location<br />
long<br />
postCode<br />
route<br />
sensorId<br />
station<br />
status<br />
territory<br />
toc<br />
type<br />
updatedTime<br />
uprn<br />
blockId<br />
}<br />
}</pre><br />
<br />
=== All assets at all stations ===<br />
<br />
To return data for all stations, remove the text in brackets after status, remove the statement within the brackets of the example above:<br />
<br />
<pre>query MyQuery {<br />
status {<br />
blockTitle<br />
branch<br />
engineerOnSite<br />
independant<br />
isolated<br />
lat<br />
location<br />
long<br />
postCode<br />
route<br />
sensorId<br />
station<br />
status<br />
territory<br />
toc<br />
type<br />
updatedTime<br />
uprn<br />
blockId<br />
}<br />
}</pre><br />
<br />
=== Stream of updates ===<br />
<br />
It is supposedly possible to make an API request and receive a stream of updates using the <code>@live</code> directive on the GraphQL query, but does not seem to work on this API.<br />
<br />
== Room for improvement ==<br />
<br />
There is some room for improvement on the API:<br />
<br />
* '''Null entries''' - some fields are set to "#N/A", and some are set to null<br />
* '''Unmapped sensors''' - there are instances (such as sensorId 3104) where no data has been filled in about the asset at all<br />
* '''No escalators''' - some escalators are included but fall fully within the problem above, all have null locational data<br />
* '''Incorrect references to territories''' - the term 'territory' was in use during Railtrack days, but is no longer used - Region and Routes are the current terminology<br />
* '''Out-of-date TOC information''' - sensor 4052 refers to London Midland, sensor 3082 refers to East Coast, and 6148 to Arriva Trains Wales - none of whom currently operate franchises<br />
* '''Lack of machine-interpretable data''' - sensor 5006 is described as 'Wolverhampton Stn Lift/Escalator 05', in location 'Passenger Lift Platform 4', whereas sensor 8127, 'Imperial Wharf Stn Lift/Escalator 01' is in location 'Platform 1' - these are not easy to parse and necessarily link to a particular platform<br />
* '''Non-passenger assets''' - 1032 and 4034 are lifts situated in the South Wales and Thames Valley signalling centres, respectively. 1041 is "Mepham Street Goods No. 2" at London Waterloo, and 5054 will take you to "[https://en.wikipedia.org/wiki/Red_Star_Parcels Red Star Parcels]" in Milton Keynes<br />
<br />
== Official documentation ==<br />
Links to official documentation:<br />
<br />
=== Version 2 ===<br />
* [https://docs.google.com/document/d/18IWzcjuuj6usxEv6pIRjH39EOouDFyIzk9nTXUP7ymE/edit Lifts & Escalators (LNE) API V2 - Usage Instructions]<br />
* [https://docs.google.com/document/d/1Aikq_JzP2FvZkIJkKCBNahqIA0HdGwcSQUQUTP6oFY4/edit V2 API Authentication Docs]<br />
* [https://docs.google.com/document/d/e/2PACX-1vTBUhyCXJoCvKUdIjE5GSyV3CqPgXg5d4K7DAghGilat4j8DTlWwMaTIQwTee-zvifFuW4NVB_0Hd5S/pub Documentation - Lifts & Escalators API v2 (developer preview)]<br />
=== Version 1 ===<br />
* [https://docs.google.com/document/d/e/2PACX-1vQEcL1yJLUVd8IAKGHi0s2cRsbKuedxuT2YT7b1TNnmjUi07_U15feiVWNlTGEzva7xoTiMrt4AcmE3/pub Documentation - Lifts & Escalators API (public preview)]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=AtocIndustryData&diff=3008AtocIndustryData2022-07-04T07:38:40Z<p>Leon Byford: Fix double redirect</p>
<hr />
<div>#REDIRECT [[About the National Rail Feeds]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Atoc_Industry_Data&diff=3007Atoc Industry Data2022-07-04T07:38:23Z<p>Leon Byford: Create redirect</p>
<hr />
<div>#REDIRECT [[About the National Rail Feeds]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Lift_and_Escalator_API&diff=2987Lift and Escalator API2022-06-26T11:01:30Z<p>Leon Byford: Link to API homepage</p>
<hr />
<div>Network Rail's '''[https://nr-lift-and-escalator.developer.azure-api.net/ Lift and Escalator API]''' contains details of the status of lifts and escalators at many locations in Great Britain. The [https://docs.google.com/document/d/e/2PACX-1vQEcL1yJLUVd8IAKGHi0s2cRsbKuedxuT2YT7b1TNnmjUi07_U15feiVWNlTGEzva7xoTiMrt4AcmE3/pub supplied documentation] is sparse and difficult to follow, and so [https://twitter.com/poggs/ Peter Hicks] of [https://twitter.com/opentraintimes OpenTrainTimes] has written this document for the community to help usage of the API.<br />
<br />
= Signing up =<br />
<br />
The developer preview does not require you to [https://nr-lift-and-escalator.developer.azure-api.net/signup sign up], however it is probably worth your while to show how many people are using the API.<br />
<br />
= Access =<br />
<br />
The developer preview does not require use of an authentication token, even though the [https://nr-lift-and-escalator.developer.azure-api.net/api-details#api=network-rail-lift-and-escalator-api HTTP requests on the API page] return a 401 Unauthorized.<br />
<br />
= Data elements =<br />
<br />
The following data elements are held within the API:<br />
<br />
{| class="wikitable"<br />
|-<br />
!Field<br />
!Description<br />
|-<br />
|uprn<br />
|Unique asset identifier (not a [https://www.ordnancesurvey.co.uk/business-government/tools-support/open-mastermap-programme/open-id-policy UPRN])<br />
|-<br />
|sensorId<br />
|A four-digit sensor identifier for the Electronic Monitoring Unit (EMU), left-padded with zeroes if required. <br />
|-<br />
|blockId<br />
|An identifier for the location of the asset within a station<br />
|-<br />
|blockTitle<br />
|The name of the location within the station<br />
|-<br />
|station<br />
|Name of the station at which this asset is located<br />
|-<br />
|location<br />
|Name of the location within the station at which this asset is located<br />
|-<br />
|lat<br />
|Latitude in (WGS84)<br />
|-<br />
|long<br />
|Longitude (WGS84)<br />
|-<br />
|postcode<br />
|Postcode of the station in which this asset is located<br />
|-<br />
|route<br />
|Network Rail [https://www.networkrail.co.uk/running-the-railway/our-regions/ Route] in which this asset is located<br />
|-<br />
|territory<br />
|Network Rail [https://www.networkrail.co.uk/running-the-railway/our-regions/ Region] in which this asset is located<br />
|-<br />
|toc<br />
|Set to 'Managed Stations' for Network Rail Managed Stations, otherwise the name of the train operator<br />
|-<br />
|branch<br />
|Unknown, but possibly the branch of the lift or escalator maintainer's organisation where <br />
|-<br />
|type<br />
|Type of asset, e.g. Lift or Escalator<br />
|-<br />
|status<br />
|Current status of the asset<br />
|-<br />
|isolated<br />
|Indicates whether the asset is powered down or disconnected<br />
|-<br />
|engineerOnSite<br />
|Indicates if an engineer has logged in to the sensor and is servicing the asset<br />
|-<br />
|independant<br />
|(note the misspelling) Indicates if the lift is on [https://en.wikipedia.org/wiki/Elevator#Independent_service Independent Service] by use of a car preference key<br />
|-<br />
|updatedTime<br />
|Date and time when the status was last updated<br />
|}<br />
<br />
= Making a request =<br />
<br />
All requests are through the [https://nr-lift-and-escalator.azure-api.net/gateway/v1/ API endpoint]. Requests must be made via an HTTP POST call - accessing the endpoint through a web browser will make an HTTP GET request, resulting in the following error:<br />
<br />
<code>{"path":"$","error":"resource does not exist","code":"not-found"}</code><br />
<br />
The API uses [https://graphql.org/ GraphQL], which allows complex queries to be submitted in an HTTP POST request. A query is just a JSON data structure with some fields to filter on, and other fields to return.<br />
<br />
== Simple requests ==<br />
<br />
=== All assets at a station ===<br />
<br />
To return the status of all lifts and escalators at a particular station, such as Edinburgh Waverley:<br />
<br />
<pre>query MyQuery {<br />
status(where: {station: {_eq: "Edinburgh Waverley"}}) {<br />
blockTitle<br />
branch<br />
engineerOnSite<br />
independant<br />
isolated<br />
lat<br />
location<br />
long<br />
postCode<br />
route<br />
sensorId<br />
station<br />
status<br />
territory<br />
toc<br />
type<br />
updatedTime<br />
uprn<br />
blockId<br />
}<br />
}</pre><br />
<br />
=== All assets at all stations ===<br />
<br />
To return data for all stations, remove the text in brackets after status, remove the statement within the brackets of the example above:<br />
<br />
<pre>query MyQuery {<br />
status {<br />
blockTitle<br />
branch<br />
engineerOnSite<br />
independant<br />
isolated<br />
lat<br />
location<br />
long<br />
postCode<br />
route<br />
sensorId<br />
station<br />
status<br />
territory<br />
toc<br />
type<br />
updatedTime<br />
uprn<br />
blockId<br />
}<br />
}</pre><br />
<br />
=== Stream of updates ===<br />
<br />
It is supposedly possible to make an API request and receive a stream of updates using the <code>@live</code> directive on the GraphQL query, but does not seem to work on this API.<br />
<br />
== Room for improvement ==<br />
<br />
There is some room for improvement on the API:<br />
<br />
* '''Null entries''' - some fields are set to "#N/A", and some are set to null<br />
* '''Unmapped sensors''' - there are instances (such as sensorId 3104) where no data has been filled in about the asset at all<br />
* '''No escalators''' - some escalators are included but fall fully within the problem above, all have null locational data<br />
* '''Incorrect references to territories''' - the term 'territory' was in use during Railtrack days, but is no longer used - Region and Routes are the current terminology<br />
* '''Out-of-date TOC information''' - sensor 4052 refers to London Midland, sensor 3082 refers to East Coast, and 6148 to Arriva Trains Wales - none of whom currently operate franchises<br />
* '''Lack of machine-interpretable data''' - sensor 5006 is described as 'Wolverhampton Stn Lift/Escalator 05', in location 'Passenger Lift Platform 4', whereas sensor 8127, 'Imperial Wharf Stn Lift/Escalator 01' is in location 'Platform 1' - these are not easy to parse and necessarily link to a particular platform<br />
* '''Non-passenger assets''' - 1032 and 4034 are lifts situated in the South Wales and Thames Valley signalling centres, respectively. 1041 is "Mepham Street Goods No. 2" at London Waterloo, and 5054 will take you to "[https://en.wikipedia.org/wiki/Red_Star_Parcels Red Star Parcels]" in Milton Keynes</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=OpenLDBWS_SOAP_Query_Raw&diff=2986OpenLDBWS SOAP Query Raw2022-06-25T14:17:51Z<p>Leon Byford: add wikilink</p>
<hr />
<div>Sending a [[About SOAP|SOAP]] query manually isn't useful in a production environment, but can be very useful in a development context. You're able to check that your token is valid, and see the raw response that the server returns.<br />
<br />
== Using Postman ==<br />
<br />
[http://www.getpostman.com Postman] is an extension for [http://www.google.com/chrome/ Google Chrome] which allows manual interaction with a variety of APIs.<br />
<br />
To use the OpenLDBWS API with Postman, send the following raw data in XML (text/xml) format as a POST (not a GET) query to the endpoint at https://lite.realtime.nationalrail.co.uk/OpenLDBWS/ldb6.asmx:<br />
<br />
<pre><br />
<?xml version="1.0"?><br />
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://thalesgroup.com/RTTI/2014-02-20/ldb/" xmlns:ns2="http://thalesgroup.com/RTTI/2010-11-01/ldb/commontypes"><br />
<SOAP-ENV:Header><br />
<ns2:AccessToken><br />
<ns2:TokenValue>*** YOUR TOKEN GOES HERE ***</ns2:TokenValue><br />
</ns2:AccessToken><br />
</SOAP-ENV:Header><br />
<SOAP-ENV:Body><br />
<ns1:GetDepartureBoardRequest><br />
<ns1:numRows>10</ns1:numRows><br />
<ns1:crs>MAN</ns1:crs><br />
</ns1:GetDepartureBoardRequest><br />
</SOAP-ENV:Body><br />
</SOAP-ENV:Envelope><br />
</pre><br />
<br />
Click 'Send' and the result of the GetDepartureBoardResponse query will be returned.<br />
<br />
[[Category:National Rail Enquiries Data Feeds]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Open_Data_Releases&diff=2985Open Data Releases2022-06-25T14:16:17Z<p>Leon Byford: Link to FOI Requests</p>
<hr />
<div>This page lists data that has been made available from the rail and transport industry.<br />
<br />
= Network Rail =<br />
<br />
* [https://datafeeds.networkrail.co.uk/ Network Rail Datafeeds], providing real-time train movement information from Network Rail's internal systems. You will need a reasonable level of technical skill to interpret the data.<br />
* The [https://www.networkrail.co.uk/industry-and-commercial/information-for-operators/national-electronic-sectional-appendix/ Sectional Appendix], containing detailed information of lines, routes, junctions and permitted speeds. This data is updated in June and December each year, an extract of the data in TSV and XLSX is [https://github.com/anisotropi4/nesa here] and [[HistoricalSectionalAppendicies|historical versions of the Sectional Appendix]] are available for reference. <br />
* [https://www.networkrail.co.uk/running-the-railway/the-timetable/working-timetable/ Working Timetables] - schedules for passenger, empty passenger, freight and infrastructure trains.<br />
* [https://www.networkrail.co.uk/industry-and-commercial/information-for-operators/ Engineering Access Statement/Train Planning Rules], Data relating to planned engineering blockades and constraints on timetable planning.<br />
* [https://cdn.networkrail.co.uk/wp-content/uploads/2019/05/Compendium-of-Signal-Box-Opening-Times.xls Signalbox Opening Times]<br />
* [https://www.networkrail.co.uk/communities/safety-in-the-community/level-crossing-safety/ List of Level Crossings]<br />
<br />
= Railway Safety and Standards Board =<br />
<br />
* [https://www.rssb.co.uk/railway-group-standards Railway Group Standards] has current and withdrawn Railway Group Standards (the 'Rule Book'), Rail Industry Approved Codes of Practice (RACOPs), guidance notes and and Rail Industry Standards.<br />
<br />
= Office of Rail and Road =<br />
<br />
* [https://dataportal.orr.gov.uk/ ORR Data Portal], including Signals Passed at Danger (SPADs), volume of freight movement, historical Public Performance Measure data, passenger train revenue and temporary speed restrictions.<br />
<br />
= ATOC =<br />
<br />
* [http://data.atoc.org/ Passenger timetable data] from [http://www.atoc.org/ ATOC] in [[Common Interchange File format]]<br />
* [http://data.atoc.org/ London Terminals data] from [http://www.atoc.org/ ATOC], detailing the valid London station used when travelling from a particular station<br />
* [http://data.atoc.org/ Fares data] from [http://www.atoc.org/ ATOC] - see [[Fares Data]]<br />
<br />
= Transport for London =<br />
<br />
* [https://tfl.gov.uk/info-for/open-data-users/ TfL Open Data], where you can sign up for access to numerous feeds, including live traffic camera images, real-time bus arrivals, Tube departure boards, station locations, a journey planner and tube disruption data.<br />
<br />
= Transport for Greater Manchester (TfGM) =<br />
<br />
* [https://developer.tfgm.com/ TfGM Real-Time Open Data Portal]<br />
<br />
= High Speed Two Ltd =<br />
<br />
* [http://data.gov.uk/dataset/hs2-gis-route Data.gov.uk] details the route of the planned HS2 line. It is ESRI shapefile format. Licenced under Open Government Licence (OGL)<br />
<br />
= British Transport Police =<br />
<br />
* [http://data.gov.uk/dataset/btp-crimes-recorded-january-2012 Data.gov.uk] has crime stats for stations and trains in Jan to August 2012<br />
<br />
= OpenStreetMap.org =<br />
<br />
* [https://www.openstreetmap.org/ OpenStreetMap] contains most of the UK rail network at varying levels of detail. Some stations are tagged with naptan:AtcoCode and/or a CRS reference, and some have routes associated with them. The Osmosis application could be used to pull nodes and ways from an OSM planet dump/extract.<br />
<br />
= Non-UK data =<br />
<br />
Some of this data is fully open, other data is available for casual use but without clear licensing conditions.<br />
<br />
* [https://data.sncf.com SNCF Open Data] is the open data project from French national operator, SNCF.<br />
* [https://www.ns.nl/en/travel-information/ns-api NS API for all Dutch trains] is a great, simple API including stations, schedules, and realtime feeds.<br />
* [https://hello.irail.be/ Irail] is a Belgian non-profit initiative with the aim of opening up transportation data.<br />
* [http://api.erail.in/ eRail.in] Indian Railways API.<br />
* [http://data.deutschebahn.com/ DB Open-Data-Portal] for open rail data in Germany.<br />
* [https://data.sbb.ch/pages/home/ SBB Open Data] for open rail data in Switzerland.<br />
<br />
== Sweden ==<br />
<br />
* [https://api.trafikinfo.trafikverket.se/ Trafikinfo API] for trains operating in Sweden provided by Trafikverket, the Swedish Transport Administration.<br />
* [https://lastkajen.trafikverket.se/107_OA_FileStorage/Default.aspx Järnvägsdata] contains geographical data of railway infastructure in Shapefile format.<br />
<br />
== Finland ==<br />
<br />
Finland has an extensive open rail data platform thanks to the government's open-data initiative.<br />
<br />
* [https://rata.digitraffic.fi/swagger/index.html rata.digitraffic.fi] API for trains operating in Finland.<br />
* [https://rata.digitraffic.fi/infra-api/ Infra-API] for railway infrastructure.<br />
* [https://rata.digitraffic.fi/jeti-api/ Jeti-API] for planned (maintenance) restrictions.<br />
<br />
= See also =<br />
<br />
* [[FOI Requests]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=AtocTimetableFeed&diff=2984AtocTimetableFeed2022-06-25T14:09:00Z<p>Leon Byford: Link to ATOC site</p>
<hr />
<div>The [https://data.atoc.org/how-to ATOC Timetable Feed] contains a number of files:<br />
<br />
* The full timetable file in CIF format, containing passenger train services, shipping and bus services<br />
* The manual trains file contains data not held in the train planning system<br />
* The master station names file stores location-specific data for stations in the full timetable file<br />
* The fixed link file contains walking times, bus, tube and metro links between stations where this data isn't otherwise provided in the full timetable file<br />
<br />
[http://data.atoc.org/sites/all/themes/atoc/files/rsps5041%20-%20Timetable%20Data.pdf Full details of the timetable feed] is available.<br />
<br />
[[Category:ATOC Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=AtocLondonTerminalsFeed&diff=2983AtocLondonTerminalsFeed2022-06-25T13:59:37Z<p>Leon Byford: Add link to ATOC site</p>
<hr />
<div>The [https://data.atoc.org/london-terminals ATOC London Terminals feed] identifies the London railway stations to which which an 'any permitted' fare is valid.<br />
<br />
It is produced in XML format.<br />
<br />
[[Category:ATOC Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Common_Interchange_File_format&diff=2982Common Interchange File format2022-06-25T13:53:40Z<p>Leon Byford: Redirect to page with more detailed information</p>
<hr />
<div>#REDIRECT [[CIF File Format]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Reference_Data&diff=2981Reference Data2022-06-25T13:48:29Z<p>Leon Byford: /* Programmatic Download */ formatting, spelling</p>
<hr />
<div>{{DISPLAYTITLE:Reference Data}}<br />
Three sets of reference data are available from Network Rail. The ''All Reference Data'' topic must be selected and subscribed to in the ''My Feeds'' tab of the data feeds site to be able to access the CORPUS and SMART data. The Train Planning data is available from this site. See the [[About_the_feeds|about the feeds]] page for more details.<br />
<br />
Other useful reference sources are also listed.<br />
<br />
= CORPUS: Location Reference Data =<br />
<br />
This is provided from the CORPUS system (''Codes for Operations, Retail & Planning – a Unified Solution''). The data is a periodically-updated snapshot of the CORPUS database. This can be used to translate STANOX, TIPLOC, NLC, UIC and 3-alpha (CRS) codes to location descriptions.<br />
<br />
== Downloading CORPUS Data ==<br />
<br />
To download the data, visit https://datafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=CORPUS<br />
<br />
== CORPUS Data Format ==<br />
<br />
CORPUS data is supplied as a plain text file containing a JSON representation of the data. Entries comprise the following fields (not all fields may contain data):<br />
<br />
{| class="wikitable"<br />
! Field<br />
! Description<br />
|-<br />
|STANOX<br />
|[[STANOX]] code<br />
|-<br />
|UIC<br />
|UIC code<br />
|-<br />
|3ALPHA<br />
|[[CRS|3-letter location code]]<br />
|-<br />
|TIPLOC<br />
|[[TIPLOC]] code<br />
|-<br />
|NLC<br />
|[[NLC]] code<br />
|-<br />
|NLCDESC<br />
|Description of the [[NLC]]<br />
|-<br />
|NLCDESC16<br />
|[[NLC]] description (16-character version)<br />
|-<br />
|}<br />
<br />
= SMART: Berth Stepping Data =<br />
<br />
The SMART database contains details of [[TD|train describer berths]] and allows movements into berths to be translated into arrivals and departures from locations. The data feed contains a periodically-updated snapshot of the SMART database.<br />
<br />
== Downloading SMART Data ==<br />
<br />
To download the data, visit https://datafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=SMART<br />
<br />
== SMART Data Format ==<br />
<br />
SMART data is supplied as a plain text file containing a JSON representation of the data. Entries comprise the following fields (not all fields may contain data):<br />
<br />
{| class="wikitable"<br />
! Field<br />
! Description<br />
|-<br />
|TD<br />
|Train describer area<br />
|-<br />
|FROMBERTH<br />
|TD berth that movement is from<br />
|-<br />
|TOBERTH<br />
|TD berth that movement is to<br />
|-<br />
|FROMLINE<br />
|Line which the movement is from<br />
|-<br />
|TOLINE<br />
|Line which the movement is to<br />
|-<br />
|BERTHOFFSET<br />
|Difference between the time the berth event occurs and the time to be recorded in TRUST, in seconds<br />
|-<br />
|PLATFORM<br />
|Platform<br />
|-<br />
|EVENT<br />
|One of A, B, C, D<br />
|-<br />
|ROUTE<br />
|<br />
|-<br />
|STANOX<br />
|[[STANOX]] code for location<br />
|-<br />
|STANME<br />
|Abbreviated description of location<br />
|-<br />
|STEPTYPE<br />
|One of B, F, C, D, I, T, E<br />
|-<br />
|COMMENT<br />
|<br />
|-<br />
|}<br />
<br />
{| class="wikitable"<br />
! EVENT<br />
! Description<br />
|-<br />
| A<br />
| Arrive Up<br />
|-<br />
| B<br />
| Depart Up<br />
|-<br />
| C<br />
| Arrive Down<br />
|-<br />
| D<br />
| Depart Down<br />
|}<br />
<br />
{| class="wikitable"<br />
! STEPTYPE<br />
! Description<br />
|-<br />
| B<br />
| Between<br />
|-<br />
| F<br />
| From<br />
|-<br />
| T<br />
| To<br />
|-<br />
| D<br />
| Intermediate First<br />
|-<br />
| C<br />
| Clearout<br />
|-<br />
| I<br />
| Interpose<br />
|-<br />
| E<br />
| Intermediate<br />
|}<br />
<br />
An in-depth [[SmartBerthDetail|overview of how to use SMART data]] is available.<br />
<br />
= BPLAN Geography =<br />
<br />
Twice a year, [[BPLAN_Geography|a set of geographical data]] is released from Network Rail which contains data to be used when planning trains. It also includes other data, such as platform numbers at stations, and details of activity codes used in CIF.<br />
<br />
The data is available [[BPLAN_Geography_Data|on a separate page]].<br />
<br />
= Train Planning Network Model =<br />
<br />
The Train Planning Network Model contains very detailed information on the network model used by ITPS, the Integrated Train Planning System.<br />
<br />
== Downloading the data ==<br />
<br />
To download the data, visit https://datafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=TPS<br />
<br />
The raw data is XML in tarred bzip2 (tar.bz2) format<br />
<br />
The current schema for the Network Model is available [[Media:TPS_Schema_20200818.xsd.gz|here]].<br />
<br />
The previous schema, valid until an unknown date in 2020, is available [[Media:TPS_Schema.xsd.gz|here]].<br />
<br />
= Other Sources =<br />
<br />
* [http://www.railwaycodes.org.uk/index.shtml Phil Deaves] has compiled a reference site listing location codes (CRS, STANOX and TIPLOC) as well as a comprehensive listing of other railway codes<br />
* [http://data.gov.uk/dataset/naptan NaPTAN] (National Public Transport Access Nodes) is provided by the Department for Transport and is the single government source for all public transport stops/stations in the UK, also including bus stops, ferry terminals, airports, metro stations, and heritage railways, as well as associated metadata, including the location of entrances to stations, and platform locations in some circumstances. Contains ATCO, CRS and TIPLOC codes and latitude/longitudes.<br />
<br />
= Programmatic Download =<br />
<br />
The CORPUS, SMART and TPS reference data can be downloaded programmatically using the command<br />
<nowiki>curl -L -u '<USERNAME>:<PASSWORD>' -o '<FILENAME>' 'https://datafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=<DATASET>'</nowiki><br />
where<br />
* <code><USERNAME></code> and <code><PASSWORD></code> are from your NR Open Data login<br />
* <code><FILENAME></code> is what you want the locally downloaded file to be called<br />
* <code><DATASET></code> is one of <code>CORPUS</code>, <code>SMART</code> or <code>TPS</code><br />
<br />
This allows you to automate download of the data when it is updated<br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:Reference Data]]<br />
[[Category:3-Alpha Codes]]<br />
[[Category:NLC Codes]]<br />
[[Category:TIPLOC Codes]]<br />
[[Category:STANOX Codes]]<br />
[[Category:Identifying Locations]]<br />
[[Category:Train Describer Data]]<br />
[[Category:CORPUS Data]]<br />
[[Category:SMART Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=CIF_Schedule_Records&diff=2971CIF Schedule Records2022-05-30T18:32:06Z<p>Leon Byford: /* Record Types */ Add LO and LI records</p>
<hr />
<div>== Overview ==<br />
Schedule records are contained within the [[SCHEDULE]] data feed, and provide information about the possible schedules available for trains. For a given train service, there may be multiple schedules listed - the date of the train service and any short / very-short term plans will affect which schedule is current.<br />
<br />
A schedule record comprises of a header containing a schedule UID, data about the schedule (including whether it is a train, bus or ship) and validity dates, and an ordered list of locations and times at which a particular service should arrive, depart or pass.<br />
<br />
* Originating locations will always have a WTT departure time and optionally a public departure time<br />
* Intermediate locations in a schedule will have a passing time if they are a mandatory timing point, or an arrival and departure time if the train carries out an activity at that location<br />
* Terminating locations will always have a WTT arrival time and optionally a public arrival time, which may be some minutes later than the WTT time<br />
* A location may have one or more activities associated with it - for example, U for locations where the train calls to pick up passengers (i.e. not available for alighting), D for locations where the train calls to set down passengers (i.e. not available for boarding).<br />
* A location may have engineering, pathing or performance allowances<br />
<br />
== Record Format ==<br />
<pre><br />
BSRG828851510191510231100100 POO2N75 113575825 DMUE 090 S O<br />
BX SRY <br />
LOGLGQHL 1703 17033 UEG TB <br />
LICWLRSSJ 1706 00000000 <br />
LICWLRSWJ 1706H00000000 UEG <br />
LIBSHB 1709 1710 17091710 T <br />
CRLENZIE OO2N75 123578903 DMUE 090 S <br />
LILENZIE 1714 1714H 17141714 T <br />
LICROY 1720 000000001 1H <br />
LIGNHLUJN 1726 00000000 H <br />
LIGNHLLJN 1727 00000000 <br />
LICRMRSWJ 1729 00000000 <br />
LICRMRSEJ 1730 00000000 <br />
LICAMELON 1731 1732 17311732 T <br />
LTFALKRKG 1734 17341 TF <br />
</pre><br />
<br />
== Record Types ==<br />
<br />
=== BS - Basic Schedule ===<br />
{|class ="wikitable"<br />
! Field !! Format !! Size !! Mandatory !! Comment<br />
|-<br />
| Record Identity || String || 2 || Y || Value ''BS''.<br />
|-<br />
| Transaction Type || Char || 1 || Y || The type of transaction<br />
* '''N''' - New<br />
* '''D''' - Delete<br />
* '''R''' - Revise.<br />
|-<br />
| Train UID || String || 6 || Y || The identifier for the schedule. This is made up of a letter plus five numbers. There may be multiple schedules for one schedule UID. See also the ''train_uid'' field of the [[Train_Activation | TRUST Train Activation]] message type.<br />
|-<br />
| Date Runs From || Date (YYMMDD)|| 6 || Y || The start date of the schedule.<br />
|-<br />
| Date Runs To || Date (YYMMDD)|| 6 || Y* || The end date of the schedule.<br />
|-<br />
| Days Run || Bit String || 7 || Y* || A seven-bit field; first bit starting from the left represents Monday, and last bit represents Sunday. A ''1'' means that the service runs on that day, while a ''0'' means that it does not.<br />
|-<br />
| Bank Holiday Running || Char || 1 || || Bank holiday running code:<br />
* ''X'' - Does not run on specified Bank Holiday Mondays<br />
* ''G'' - Does not run on Glasgow Bank Holidays.<br />
|-<br />
| Train Status || Char || 1 || Y* || See [[CIF_Codes#Train_Status | train status codes]].<br />
|-<br />
| Train Category || String || 2 || Y* || See [[CIF_Codes#Train_Category | train category codes]].<br />
|-<br />
| Train Identity || String || 4 || Y* || Signalling ID, also referred to as headcode, not to be confused with below. For passenger services, this is the headcode of the service. For anonymous freight services this will be blank.<br />
|-<br />
| Headcode || Numeric || 4 || || National Reservation System headcode, designated by train operator, not to be confused with above.<br />
|-<br />
| Course Indicator || Numeric || 1 || Y || Not used. Value ''1''.<br />
|-<br />
| Train Service Code || Numeric || 8 || Y* || Divides trains into ''[[TrainServiceCode | service groups ]]''. Is used for attribution of revenue.<br />
|-<br />
| Portion ID || Char || 1 || || Used to denote a Portion ID for services involved in joining / splitting activities (Associations).<br />
|-<br />
| Power Type || String || 3 || Y* || See [[CIF_Codes#Power_Type | power type codes]].<br />
|-<br />
| Timing Load || String || 4 || || See [[CIF_Codes#Timing_Load | timing load codes]].<br />
|-<br />
| Speed || Numeric || 3 || Y* || Planned speed of the train service in miles per hour.<br />
|-<br />
| Operating Characteristics || String || 6 || || See [[CIF_Codes#Operating_Characteristics | operating characteristics codes]].<br />
|-<br />
| Seating Class || Char || 1 || || Seating classes available:<br />
* ''Blank'' or ''B'' - First and standard<br />
* ''S'' - Standard class only.<br />
|-<br />
| Sleepers || Char || 1 || || Sleeping accommodation available:<br />
* ''B'' - First and standard class <br />
* ''F'' - First Class only<br />
* ''S'' - Standard class only.<br />
|-<br />
| Reservations || Char || 1 || || Reservation recommendations:<br />
* ''A'' - Reservations compulsory<br />
* ''E'' - Reservations for bicycles essential<br />
* ''R'' - Reservations recommended<br />
* ''S'' - Reservations possible from any station.<br />
|-<br />
| Connection Indicator || Char || 1 || || Not used.<br />
|-<br />
| Catering Code || String || 4 || || Up to two characters from the following:<br />
* ''C'' - Buffet Service<br />
* ''F'' - Restaurant Car available for First Class passengers<br />
* ''H'' - Hot food available<br />
* ''M'' - Meal included for First Class passengers<br />
* ''P'' - Wheelchair only reservations<br />
* ''R'' - Restaurant<br />
* ''T'' - Trolley service.<br />
|-<br />
| Service Branding || String || 4 || || Service brand:<br />
* ''E'' - Eurostar.<br />
|-<br />
| Spare || || 1 || || <br />
|-<br />
| STP Indicator || Char || 1 || Y || STP (short-term planning) schedule indicator:<br />
* '''C''' - STP cancellation of permanent association<br />
* '''N''' - New STP association (not an overlay)<br />
* '''O''' - STP overlay of permanent association<br />
* '''P''' - Permanent association<br />
|}<br />
<br />
<nowiki>*</nowiki> may be truncated in ''Delete'' records.<br />
<br />
=== BX - Basic Schedule Extra Details ===<br />
<br />
Note that for Deletion and Cancellation of schedules, a BX record will not be issued.<br />
<br />
{|class ="wikitable"<br />
! Field !! Format !! Size !! Mandatory !! Comment<br />
|-<br />
| Record Identity || String || 2 || Y || Value ''BX''.<br />
|-<br />
| Traction Class || String || 4 || || Not used.<br />
|-<br />
| UIC Code || Numeric || 5 || || A 5-character numeric code for train services running to/from continental Europe.<br />
|-<br />
| ATOC Code || String || 2 || Y || See [[TOC_Codes | TOC codes]].<br />
|-<br />
| Applicable Timetable Code || Char || 1 || Y ||<br />
* ''Y'' - Train is subject to performance monitoring (Applicable Timetable Service)<br />
* ''N'' - Train is not subject to performance monitoring (Not Applicable Timetable Service)<br />
|-<br />
| Reserved field || String || 8 || || RSID. Not populated from ITPS.<br />
|-<br />
| Reserved field || Char || 1 || || Data source. Not populated from ITPS.<br />
|-<br />
| Spare || || 57 || || <br />
|}<br />
<br />
=== LO - Origin Location ===<br />
<br />
{|class ="wikitable"<br />
! Field !! Size !! Comment<br />
|-<br />
| Record Identity || 2 || Value ''LO''.<br />
|-<br />
| Location || 8 || TIPLOC + Suffix<br />
|-<br />
| Scheduled Departure Time || 5<br />
|-<br />
| Public Departure Time || 4<br />
|-<br />
| Platform || 3<br />
|-<br />
| Line || 3<br />
|-<br />
| Engineering Allowance || 2<br />
|-<br />
| Pathing Allowance || 2<br />
|-<br />
| Activity || 12<br />
|-<br />
| Performance Allowance || 2<br />
|-<br />
| Spare || 37<br />
|}<br />
<br />
=== LI - Intermediate Location ===<br />
<br />
{|class ="wikitable"<br />
! Field !! Size !! Comment<br />
|-<br />
| Record Identity || 2 || Value ''LI''.<br />
|-<br />
| Location || 8 || TIPLOC + Suffix<br />
|-<br />
| Scheduled Arrival Time || 5<br />
|-<br />
| Scheduled Departure Time || 5<br />
|-<br />
| Scheduled Pass || 5<br />
|-<br />
| Public Arrival || 4<br />
|-<br />
| Public Departure || 4<br />
|-<br />
| Platform || 3<br />
|-<br />
| Line || 3<br />
|-<br />
| Path || 3<br />
|-<br />
| Activity || 12<br />
|-<br />
| Engineering Allowance || 2<br />
|-<br />
| Pathing Allowance || 2<br />
|-<br />
| Performance Allowance || 2<br />
|-<br />
| Spare || 20<br />
|}<br />
<br />
{{Navtable-CifSchedule}}<br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:Schedule Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=CIF_File_Format&diff=2970CIF File Format2022-05-30T18:15:21Z<p>Leon Byford: Add link to specification</p>
<hr />
<div>The Common Interface File (CIF) format is the industry standard for transfer of schedules electronically from Network Rail's Integrated Train Planning System (ITPS) to downstream operational and information systems.<br />
<br />
The CIF file is a text file containing one record per row. Each record has a fixed length of 80 characters. The first two characters of a row identify the ''Record Type''.<br />
<br />
== Record Types ==<br />
<br />
* '''HD''' - [[CIF_Header | Header record]]<br />
* TIPLOC Records<br />
** '''TI''' - [[CIF_Tiploc_Insert | TIPLOC Insert record]]<br />
** '''TA''' - [[CIF_Tiploc_Amend | TIPLOC Amend record]]<br />
** '''TD''' - [[CIF_Tiploc_Delete | TIPLOC Delete record]]<br />
* '''AA''' - [[CIF_Association_Records | Association Records]]<br />
* [[CIF_Schedule_Records | Train Schedule Records]]:<br />
** '''BS''' - Basic Schedule<br />
** '''BX''' - Basic Schedule Extra Details<br />
** '''TN''' - Train Specific Note (unused)<br />
** '''LO''' - Origin Location<br />
** '''LI''' - Intermediate Location<br />
** '''CR''' - Change en Route<br />
** '''LT''' - Terminating Location<br />
** '''LN''' - Location Specific Note (unused)<br />
* '''ZZ''' - Trailer record (End of File)<br />
<br />
== External links ==<br />
<br />
* [https://www.raildeliverygroup.com/files/Publications/services/rsp/RSPS5046_timetable_information_data_feed_interface_specification.pdf RSPS5046 Timetable information data feed interface specification (PDF)]<br />
<br />
{{Navtable-CifSchedule}}<br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:Schedule Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=CIF_Schedule_Records&diff=2969CIF Schedule Records2022-05-30T18:10:57Z<p>Leon Byford: Add CIF navtable</p>
<hr />
<div>== Overview ==<br />
Schedule records are contained within the [[SCHEDULE]] data feed, and provide information about the possible schedules available for trains. For a given train service, there may be multiple schedules listed - the date of the train service and any short / very-short term plans will affect which schedule is current.<br />
<br />
A schedule record comprises of a header containing a schedule UID, data about the schedule (including whether it is a train, bus or ship) and validity dates, and an ordered list of locations and times at which a particular service should arrive, depart or pass.<br />
<br />
* Originating locations will always have a WTT departure time and optionally a public departure time<br />
* Intermediate locations in a schedule will have a passing time if they are a mandatory timing point, or an arrival and departure time if the train carries out an activity at that location<br />
* Terminating locations will always have a WTT arrival time and optionally a public arrival time, which may be some minutes later than the WTT time<br />
* A location may have one or more activities associated with it - for example, U for locations where the train calls to pick up passengers (i.e. not available for alighting), D for locations where the train calls to set down passengers (i.e. not available for boarding).<br />
* A location may have engineering, pathing or performance allowances<br />
<br />
== Record Format ==<br />
<pre><br />
BSRG828851510191510231100100 POO2N75 113575825 DMUE 090 S O<br />
BX SRY <br />
LOGLGQHL 1703 17033 UEG TB <br />
LICWLRSSJ 1706 00000000 <br />
LICWLRSWJ 1706H00000000 UEG <br />
LIBSHB 1709 1710 17091710 T <br />
CRLENZIE OO2N75 123578903 DMUE 090 S <br />
LILENZIE 1714 1714H 17141714 T <br />
LICROY 1720 000000001 1H <br />
LIGNHLUJN 1726 00000000 H <br />
LIGNHLLJN 1727 00000000 <br />
LICRMRSWJ 1729 00000000 <br />
LICRMRSEJ 1730 00000000 <br />
LICAMELON 1731 1732 17311732 T <br />
LTFALKRKG 1734 17341 TF <br />
</pre><br />
<br />
== Record Types ==<br />
<br />
=== BS - Basic Schedule ===<br />
{|class ="wikitable"<br />
! Field !! Format !! Size !! Mandatory !! Comment<br />
|-<br />
| Record Identity || String || 2 || Y || Value ''BS''.<br />
|-<br />
| Transaction Type || Char || 1 || Y || The type of transaction<br />
* '''N''' - New<br />
* '''D''' - Delete<br />
* '''R''' - Revise.<br />
|-<br />
| Train UID || String || 6 || Y || The identifier for the schedule. This is made up of a letter plus five numbers. There may be multiple schedules for one schedule UID. See also the ''train_uid'' field of the [[Train_Activation | TRUST Train Activation]] message type.<br />
|-<br />
| Date Runs From || Date (YYMMDD)|| 6 || Y || The start date of the schedule.<br />
|-<br />
| Date Runs To || Date (YYMMDD)|| 6 || Y* || The end date of the schedule.<br />
|-<br />
| Days Run || Bit String || 7 || Y* || A seven-bit field; first bit starting from the left represents Monday, and last bit represents Sunday. A ''1'' means that the service runs on that day, while a ''0'' means that it does not.<br />
|-<br />
| Bank Holiday Running || Char || 1 || || Bank holiday running code:<br />
* ''X'' - Does not run on specified Bank Holiday Mondays<br />
* ''G'' - Does not run on Glasgow Bank Holidays.<br />
|-<br />
| Train Status || Char || 1 || Y* || See [[CIF_Codes#Train_Status | train status codes]].<br />
|-<br />
| Train Category || String || 2 || Y* || See [[CIF_Codes#Train_Category | train category codes]].<br />
|-<br />
| Train Identity || String || 4 || Y* || Signalling ID, also referred to as headcode, not to be confused with below. For passenger services, this is the headcode of the service. For anonymous freight services this will be blank.<br />
|-<br />
| Headcode || Numeric || 4 || || National Reservation System headcode, designated by train operator, not to be confused with above.<br />
|-<br />
| Course Indicator || Numeric || 1 || Y || Not used. Value ''1''.<br />
|-<br />
| Train Service Code || Numeric || 8 || Y* || Divides trains into ''[[TrainServiceCode | service groups ]]''. Is used for attribution of revenue.<br />
|-<br />
| Portion ID || Char || 1 || || Used to denote a Portion ID for services involved in joining / splitting activities (Associations).<br />
|-<br />
| Power Type || String || 3 || Y* || See [[CIF_Codes#Power_Type | power type codes]].<br />
|-<br />
| Timing Load || String || 4 || || See [[CIF_Codes#Timing_Load | timing load codes]].<br />
|-<br />
| Speed || Numeric || 3 || Y* || Planned speed of the train service in miles per hour.<br />
|-<br />
| Operating Characteristics || String || 6 || || See [[CIF_Codes#Operating_Characteristics | operating characteristics codes]].<br />
|-<br />
| Seating Class || Char || 1 || || Seating classes available:<br />
* ''Blank'' or ''B'' - First and standard<br />
* ''S'' - Standard class only.<br />
|-<br />
| Sleepers || Char || 1 || || Sleeping accommodation available:<br />
* ''B'' - First and standard class <br />
* ''F'' - First Class only<br />
* ''S'' - Standard class only.<br />
|-<br />
| Reservations || Char || 1 || || Reservation recommendations:<br />
* ''A'' - Reservations compulsory<br />
* ''E'' - Reservations for bicycles essential<br />
* ''R'' - Reservations recommended<br />
* ''S'' - Reservations possible from any station.<br />
|-<br />
| Connection Indicator || Char || 1 || || Not used.<br />
|-<br />
| Catering Code || String || 4 || || Up to two characters from the following:<br />
* ''C'' - Buffet Service<br />
* ''F'' - Restaurant Car available for First Class passengers<br />
* ''H'' - Hot food available<br />
* ''M'' - Meal included for First Class passengers<br />
* ''P'' - Wheelchair only reservations<br />
* ''R'' - Restaurant<br />
* ''T'' - Trolley service.<br />
|-<br />
| Service Branding || String || 4 || || Service brand:<br />
* ''E'' - Eurostar.<br />
|-<br />
| Spare || || 1 || || <br />
|-<br />
| STP Indicator || Char || 1 || Y || STP (short-term planning) schedule indicator:<br />
* '''C''' - STP cancellation of permanent association<br />
* '''N''' - New STP association (not an overlay)<br />
* '''O''' - STP overlay of permanent association<br />
* '''P''' - Permanent association<br />
|}<br />
<br />
<nowiki>*</nowiki> may be truncated in ''Delete'' records.<br />
<br />
=== BX - Basic Schedule Extra Details ===<br />
<br />
Note that for Deletion and Cancellation of schedules, a BX record will not be issued.<br />
<br />
{|class ="wikitable"<br />
! Field !! Format !! Size !! Mandatory !! Comment<br />
|-<br />
| Record Identity || String || 2 || Y || Value ''BX''.<br />
|-<br />
| Traction Class || String || 4 || || Not used.<br />
|-<br />
| UIC Code || Numeric || 5 || || A 5-character numeric code for train services running to/from continental Europe.<br />
|-<br />
| ATOC Code || String || 2 || Y || See [[TOC_Codes | TOC codes]].<br />
|-<br />
| Applicable Timetable Code || Char || 1 || Y ||<br />
* ''Y'' - Train is subject to performance monitoring (Applicable Timetable Service)<br />
* ''N'' - Train is not subject to performance monitoring (Not Applicable Timetable Service)<br />
|-<br />
| Reserved field || String || 8 || || RSID. Not populated from ITPS.<br />
|-<br />
| Reserved field || Char || 1 || || Data source. Not populated from ITPS.<br />
|-<br />
| Spare || || 57 || || <br />
|}<br />
<br />
<nowiki>*</nowiki> may be truncated in ''Delete'' records.<br />
<br />
{{Navtable-CifSchedule}}<br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:Schedule Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=CIF_File_Format&diff=2968CIF File Format2022-05-30T18:10:07Z<p>Leon Byford: Add CIF navtable</p>
<hr />
<div>The Common Interface File (CIF) format is the industry standard for transfer of schedules electronically from Network Rail's Integrated Train Planning System (ITPS) to downstream operational and information systems.<br />
<br />
The CIF file is a text file containing one record per row. Each record has a fixed length of 80 characters. The first two characters of a row identify the ''Record Type''.<br />
<br />
== Record Types ==<br />
<br />
* '''HD''' - [[CIF_Header | Header record]]<br />
* TIPLOC Records<br />
** '''TI''' - [[CIF_Tiploc_Insert | TIPLOC Insert record]]<br />
** '''TA''' - [[CIF_Tiploc_Amend | TIPLOC Amend record]]<br />
** '''TD''' - [[CIF_Tiploc_Delete | TIPLOC Delete record]]<br />
* '''AA''' - [[CIF_Association_Records | Association Records]]<br />
* [[CIF_Schedule_Records | Train Schedule Records]]:<br />
** '''BS''' - Basic Schedule<br />
** '''BX''' - Basic Schedule Extra Details<br />
** '''TN''' - Train Specific Note (unused)<br />
** '''LO''' - Origin Location<br />
** '''LI''' - Intermediate Location<br />
** '''CR''' - Change en Route<br />
** '''LT''' - Terminating Location<br />
** '''LN''' - Location Specific Note (unused)<br />
* '''ZZ''' - Trailer record (End of File)<br />
<br />
{{Navtable-CifSchedule}}<br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:Schedule Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Template:Navtable-CifSchedule&diff=2967Template:Navtable-CifSchedule2022-05-30T18:06:52Z<p>Leon Byford: Link template header</p>
<hr />
<div>{{Navtable-Header|text = [[CIF File Format|<span style="color: white;">CIF</span>]]}}<br />
<br />
{{Navtable-Row<br />
|title = CIF<br />
|content = [[CIF_Header | HD (Header)]] &bull; ZZ (End of File)}}<br />
<br />
{{Navtable-Row<br />
|title = TIPLOC<br />
|content = [[CIF_Tiploc_Insert | TI (TIPLOC Insert)]] &bull; [[CIF_Tiploc_Amend | TA (TIPLOC Amend)]] &bull; [[CIF_Tiploc_Delete | TD (TIPLOC Delete)]]}}<br />
<br />
{{Navtable-Row<br />
|title = Association<br />
|content = [[CIF_Association_Records | AA (Association)]]}}<br />
<br />
{{Navtable-Row<br />
|title = Location<br />
|content = BS (Basic Schedule) &bull; BX (Basic Schedule Extra) &bull; LO (Location Origin) &bull; LI (Location Intermediate) &bull; CR (Change-en-Route) &bull; LT (Location Terminate)}}<br />
<br />
{{Navtable-Footer}}</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=CIF_Tiploc_Delete&diff=2966CIF Tiploc Delete2022-05-30T18:02:08Z<p>Leon Byford: Created page with "== Record Format == <pre> TDMLCHSTR </pre> == Record Fields == {|class ="wikitable" ! Field !! Format !..."</p>
<hr />
<div>== Record Format ==<br />
<pre><br />
TDMLCHSTR <br />
</pre><br />
<br />
== Record Fields ==<br />
{|class ="wikitable"<br />
! Field !! Format !! Length !! Example Value !! Comments<br />
|-<br />
| Record Identity || String || 2 || TD || Constant value 'TD'<br />
|-<br />
| TIPLOC code || String || 7 || MLCHSTR || [[Identifying Locations|Timing Point Location code]]<br />
|-<br />
| Spare || String || 71 || (empty space)<br />
|}<br />
<br />
{{Navtable-CifSchedule}}<br />
<br />
{{Navtable-NetworkRailDataFeeds}}<br />
<br />
[[Category:Schedule Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Open_Data_Releases&diff=2965Open Data Releases2022-05-30T13:16:05Z<p>Leon Byford: /* Office of Rail Regulation */ Update link to ORR Data Portal</p>
<hr />
<div>This page lists data that has been made available from the rail and transport industry.<br />
<br />
= Network Rail =<br />
<br />
* [https://datafeeds.networkrail.co.uk/ Network Rail Datafeeds], providing real-time train movement information from Network Rail's internal systems. You will need a reasonable level of technical skill to interpret the data.<br />
* The [https://www.networkrail.co.uk/industry-and-commercial/information-for-operators/national-electronic-sectional-appendix/ Sectional Appendix], containing detailed information of lines, routes, junctions and permitted speeds. This data is updated in June and December each year, an extract of the data in TSV and XLSX is [https://github.com/anisotropi4/nesa here] and [[HistoricalSectionalAppendicies|historical versions of the Sectional Appendix]] are available for reference. <br />
* [https://www.networkrail.co.uk/running-the-railway/the-timetable/working-timetable/ Working Timetables] - schedules for passenger, empty passenger, freight and infrastructure trains.<br />
* [https://www.networkrail.co.uk/industry-and-commercial/information-for-operators/ Engineering Access Statement/Train Planning Rules], Data relating to planned engineering blockades and constraints on timetable planning.<br />
* [https://cdn.networkrail.co.uk/wp-content/uploads/2019/05/Compendium-of-Signal-Box-Opening-Times.xls Signalbox Opening Times]<br />
* [https://www.networkrail.co.uk/communities/safety-in-the-community/level-crossing-safety/ List of Level Crossings]<br />
<br />
= Railway Safety and Standards Board =<br />
<br />
* [https://www.rssb.co.uk/railway-group-standards Railway Group Standards] has current and withdrawn Railway Group Standards (the 'Rule Book'), Rail Industry Approved Codes of Practice (RACOPs), guidance notes and and Rail Industry Standards.<br />
<br />
= Office of Rail and Road =<br />
<br />
* [https://dataportal.orr.gov.uk/ ORR Data Portal], including Signals Passed at Danger (SPADs), volume of freight movement, historical Public Performance Measure data, passenger train revenue and temporary speed restrictions.<br />
<br />
= ATOC =<br />
<br />
* [http://data.atoc.org/ Passenger timetable data] from [http://www.atoc.org/ ATOC] in [[Common Interchange File format]]<br />
* [http://data.atoc.org/ London Terminals data] from [http://www.atoc.org/ ATOC], detailing the valid London station used when travelling from a particular station<br />
* [http://data.atoc.org/ Fares data] from [http://www.atoc.org/ ATOC] - see [[Fares Data]]<br />
<br />
= Transport for London =<br />
<br />
* [https://tfl.gov.uk/info-for/open-data-users/ TfL Open Data], where you can sign up for access to numerous feeds, including live traffic camera images, real-time bus arrivals, Tube departure boards, station locations, a journey planner and tube disruption data.<br />
<br />
= Transport for Greater Manchester (TfGM) =<br />
<br />
* [https://developer.tfgm.com/ TfGM Real-Time Open Data Portal]<br />
<br />
= High Speed Two Ltd =<br />
<br />
* [http://data.gov.uk/dataset/hs2-gis-route Data.gov.uk] details the route of the planned HS2 line. It is ESRI shapefile format. Licenced under Open Government Licence (OGL)<br />
<br />
= British Transport Police =<br />
<br />
* [http://data.gov.uk/dataset/btp-crimes-recorded-january-2012 Data.gov.uk] has crime stats for stations and trains in Jan to August 2012<br />
<br />
= OpenStreetMap.org =<br />
<br />
* [https://www.openstreetmap.org/ OpenStreetMap] contains most of the UK rail network at varying levels of detail. Some stations are tagged with naptan:AtcoCode and/or a CRS reference, and some have routes associated with them. The Osmosis application could be used to pull nodes and ways from an OSM planet dump/extract.<br />
<br />
= Non-UK data =<br />
<br />
Some of this data is fully open, other data is available for casual use but without clear licensing conditions.<br />
<br />
* [https://data.sncf.com SNCF Open Data] is the open data project from French national operator, SNCF.<br />
* [https://www.ns.nl/en/travel-information/ns-api NS API for all Dutch trains] is a great, simple API including stations, schedules, and realtime feeds.<br />
* [https://hello.irail.be/ Irail] is a Belgian non-profit initiative with the aim of opening up transportation data.<br />
* [http://api.erail.in/ eRail.in] Indian Railways API.<br />
* [http://data.deutschebahn.com/ DB Open-Data-Portal] for open rail data in Germany.<br />
* [https://data.sbb.ch/pages/home/ SBB Open Data] for open rail data in Switzerland.<br />
<br />
== Sweden ==<br />
<br />
* [https://api.trafikinfo.trafikverket.se/ Trafikinfo API] for trains operating in Sweden provided by Trafikverket, the Swedish Transport Administration.<br />
* [https://lastkajen.trafikverket.se/107_OA_FileStorage/Default.aspx Järnvägsdata] contains geographical data of railway infastructure in Shapefile format.<br />
<br />
== Finland ==<br />
<br />
Finland has an extensive open rail data platform thanks to the government's open-data initiative.<br />
<br />
* [https://rata.digitraffic.fi/swagger/index.html rata.digitraffic.fi] API for trains operating in Finland.<br />
* [https://rata.digitraffic.fi/infra-api/ Infra-API] for railway infrastructure.<br />
* [https://rata.digitraffic.fi/jeti-api/ Jeti-API] for planned (maintenance) restrictions.</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Open_Data_Releases&diff=2964Open Data Releases2022-05-30T13:06:23Z<p>Leon Byford: /* OpenStreetMap.org */ Link to OSM website</p>
<hr />
<div>This page lists data that has been made available from the rail and transport industry.<br />
<br />
= Network Rail =<br />
<br />
* [https://datafeeds.networkrail.co.uk/ Network Rail Datafeeds], providing real-time train movement information from Network Rail's internal systems. You will need a reasonable level of technical skill to interpret the data.<br />
* The [https://www.networkrail.co.uk/industry-and-commercial/information-for-operators/national-electronic-sectional-appendix/ Sectional Appendix], containing detailed information of lines, routes, junctions and permitted speeds. This data is updated in June and December each year, an extract of the data in TSV and XLSX is [https://github.com/anisotropi4/nesa here] and [[HistoricalSectionalAppendicies|historical versions of the Sectional Appendix]] are available for reference. <br />
* [https://www.networkrail.co.uk/running-the-railway/the-timetable/working-timetable/ Working Timetables] - schedules for passenger, empty passenger, freight and infrastructure trains.<br />
* [https://www.networkrail.co.uk/industry-and-commercial/information-for-operators/ Engineering Access Statement/Train Planning Rules], Data relating to planned engineering blockades and constraints on timetable planning.<br />
* [https://cdn.networkrail.co.uk/wp-content/uploads/2019/05/Compendium-of-Signal-Box-Opening-Times.xls Signalbox Opening Times]<br />
* [https://www.networkrail.co.uk/communities/safety-in-the-community/level-crossing-safety/ List of Level Crossings]<br />
<br />
= Railway Safety and Standards Board =<br />
<br />
* [https://www.rssb.co.uk/railway-group-standards Railway Group Standards] has current and withdrawn Railway Group Standards (the 'Rule Book'), Rail Industry Approved Codes of Practice (RACOPs), guidance notes and and Rail Industry Standards.<br />
<br />
= Office of Rail Regulation =<br />
<br />
* [http://www.rail-reg.gov.uk/server/show/nav.1863 National Rail Trends], including Signals Passed at Danger (SPADs), volume of freight movement, historical Public Performance Measure data, passenger train revenue and temporary speed restrictions.<br />
<br />
= ATOC =<br />
<br />
* [http://data.atoc.org/ Passenger timetable data] from [http://www.atoc.org/ ATOC] in [[Common Interchange File format]]<br />
* [http://data.atoc.org/ London Terminals data] from [http://www.atoc.org/ ATOC], detailing the valid London station used when travelling from a particular station<br />
* [http://data.atoc.org/ Fares data] from [http://www.atoc.org/ ATOC] - see [[Fares Data]]<br />
<br />
= Transport for London =<br />
<br />
* [https://tfl.gov.uk/info-for/open-data-users/ TfL Open Data], where you can sign up for access to numerous feeds, including live traffic camera images, real-time bus arrivals, Tube departure boards, station locations, a journey planner and tube disruption data.<br />
<br />
= Transport for Greater Manchester (TfGM) =<br />
<br />
* [https://developer.tfgm.com/ TfGM Real-Time Open Data Portal]<br />
<br />
= High Speed Two Ltd =<br />
<br />
* [http://data.gov.uk/dataset/hs2-gis-route Data.gov.uk] details the route of the planned HS2 line. It is ESRI shapefile format. Licenced under Open Government Licence (OGL)<br />
<br />
= British Transport Police =<br />
<br />
* [http://data.gov.uk/dataset/btp-crimes-recorded-january-2012 Data.gov.uk] has crime stats for stations and trains in Jan to August 2012<br />
<br />
= OpenStreetMap.org =<br />
<br />
* [https://www.openstreetmap.org/ OpenStreetMap] contains most of the UK rail network at varying levels of detail. Some stations are tagged with naptan:AtcoCode and/or a CRS reference, and some have routes associated with them. The Osmosis application could be used to pull nodes and ways from an OSM planet dump/extract.<br />
<br />
= Non-UK data =<br />
<br />
Some of this data is fully open, other data is available for casual use but without clear licensing conditions.<br />
<br />
* [https://data.sncf.com SNCF Open Data] is the open data project from French national operator, SNCF.<br />
* [https://www.ns.nl/en/travel-information/ns-api NS API for all Dutch trains] is a great, simple API including stations, schedules, and realtime feeds.<br />
* [https://hello.irail.be/ Irail] is a Belgian non-profit initiative with the aim of opening up transportation data.<br />
* [http://api.erail.in/ eRail.in] Indian Railways API.<br />
* [http://data.deutschebahn.com/ DB Open-Data-Portal] for open rail data in Germany.<br />
* [https://data.sbb.ch/pages/home/ SBB Open Data] for open rail data in Switzerland.<br />
<br />
== Sweden ==<br />
<br />
* [https://api.trafikinfo.trafikverket.se/ Trafikinfo API] for trains operating in Sweden provided by Trafikverket, the Swedish Transport Administration.<br />
* [https://lastkajen.trafikverket.se/107_OA_FileStorage/Default.aspx Järnvägsdata] contains geographical data of railway infastructure in Shapefile format.<br />
<br />
== Finland ==<br />
<br />
Finland has an extensive open rail data platform thanks to the government's open-data initiative.<br />
<br />
* [https://rata.digitraffic.fi/swagger/index.html rata.digitraffic.fi] API for trains operating in Finland.<br />
* [https://rata.digitraffic.fi/infra-api/ Infra-API] for railway infrastructure.<br />
* [https://rata.digitraffic.fi/jeti-api/ Jeti-API] for planned (maintenance) restrictions.</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=Connecting_with_Stomp&diff=2963Connecting with Stomp2022-05-30T12:51:50Z<p>Leon Byford: fix a couple of links</p>
<hr />
<div>[https://stomp.github.io/ Stomp] is a Simple Text-Oriented Messaging Protocol, used by the [[About the Network Rail feeds|Network Rail]] and [[About the NRE Feeds|National Rail Enquiries]] Data Feeds platforms.<br />
<br />
= Clients =<br />
<br />
A number of [[Example_STOMP_Code|code examples are available]], which are tailored to the Network Rail data feeds.<br />
<br />
Clients which will work on either the Network Rail or National Rail Enquiries feeds are currently being written and will be available on the [https://github.com/openraildata openraildata] organisation on GitHub.<br />
<br />
= Connection details =<br />
<br />
== Network Rail ==<br />
<br />
{|class='wikitable'<br />
!Hostname<br />
|datafeeds.networkrail.co.uk<br />
|-<br />
!Port<br />
|61618<br />
|-<br />
!Username<br />
|The username you use to sign in to [https://datafeeds.networkrail.co.uk https://datafeeds.networkrail.co.uk]<br />
|-<br />
!Password<br />
|The password you use to sign in to [https://datafeeds.networkrail.co.uk https://datafeeds.networkrail.co.uk]<br />
|}<br />
<br />
Messages are delivered on topics. You should subscribe to each topic as <code>/topic/&lt;topic-name&gt;</code>.<br />
<br />
It's recommended that you use a [[Durable_Subscription|durable subscription]], which will keep any pending messages for you for a total of five minutes after you disconnect.<br />
<br />
== National Rail Enquiries (Darwin v16) ==<br />
<br />
{|class='wikitable'<br />
!Hostname<br />
|The hostname displayed on the 'My Feeds' screen on [https://opendata.nationalrail.co.uk https://opendata.nationalrail.co.uk]<br />
|-<br />
!Port<br />
|61613<br />
|-<br />
!Username<br />
|The username displayed on the 'My Feeds' screen on [https://opendata.nationalrail.co.uk https://opendata.nationalrail.co.uk]<br />
|-<br />
!Password<br />
|The password displayed on the 'My Feeds' screen on [https://opendata.nationalrail.co.uk https://opendata.nationalrail.co.uk]<br />
|}<br />
<br />
== National Rail Enquiries (Legacy) ==<br />
<br />
{|class='wikitable'<br />
!Hostname<br />
|datafeeds.nationalrail.co.uk<br />
|-<br />
!Port<br />
|61613<br />
|-<br />
!Username<br />
|The username displayed on the 'My Feeds' screen on [https://datafeeds.nationalrail.co.uk https://datafeeds.nationalrail.co.uk]<br />
|-<br />
!Password<br />
|The password displayed on the 'My Feeds' screen on [https://datafeeds.nationalrail.co.uk https://datafeeds.nationalrail.co.uk]<br />
|}<br />
<br />
All message bodies are compressed with gzip, and you will need to un-compress them when you receive them.<br />
<br />
Messages are delivered on per-user queues. Your queue name is on the 'My Feeds' screen, and you should subscribe to the queue as <code>/queue/&lt;queue-name&gt;</code>.<br />
<br />
There is no need to use a durable subscription, as you will receive each message on your own queue exactly once, and messages will be queued for a total of five minutes after you disconnect.<br />
<br />
[[Category:Network Rail Data Feeds]]<br />
[[Category:National Rail Enquiries Data Feeds]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=FAQ&diff=2962FAQ2022-05-30T12:45:31Z<p>Leon Byford: Add redirect to new page</p>
<hr />
<div>#REDIRECT [[Rail Data FAQ]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=NreDarwinPushPort&diff=2961NreDarwinPushPort2022-05-30T12:42:47Z<p>Leon Byford: Fix redirect</p>
<hr />
<div>#REDIRECT [[Darwin:Push Port]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=SCHEDULE&diff=2958SCHEDULE2022-05-25T07:10:12Z<p>Leon Byford: /* Downloading via curl */ update example curl command to use single quotes (which helps if your username or password includes certain special characters)</p>
<hr />
<div>The SCHEDULE feed is an extract of train schedules from Network Rail's ITPS (Integrated Train Planning System), available in [[JSON File Format|JSON]] and [[CIF File Format|CIF]] format.<br />
<br />
'''Note:''' If you are just starting out with the service use the JSON files. The CIF data is more suited to advanced users of the service and requires additional parsing compared to the JSON data.<br />
<br />
= Overview =<br />
<br />
The schedule data consists of Train Schedules, Train Associations and details of Timing Point Location codes.<br />
<br />
A description of the scheduling process is available on the [[HowSchedulingWorks | how scheduling works]] page. This describes how multiple schedules can be used to describe a specific train service.<br />
<br />
= Usage =<br />
<br />
Trains are sets of schedules identified by a common ''UID''. A schedule for a specific train service can be uniquely identified by ''UID'', ''Start Date'' and ''STP Indicator''.<br />
<br />
== Types of file ==<br />
<br />
There are two types of files:<br />
* A full extract, a snapshot of schedule database valid on that day, which can be used to initialise your schedule database<br />
* An update extract is produced each night, which can be applied to the previous update extract to bring your database up-to-date<br />
<br />
Update extracts will specify how the schedule database has changed. It is important that the update files are processed in sequential order. Amendments may be received for schedules that are currently valid, i.e. the schedule has started running but has not finished yet. Changes will replace any previous version of a train schedule. Deletions will not be raised for schedules that have become historic.<br />
<br />
The following formats are available from SCHEDULE Feed:<br />
<br />
{| class="wikitable"<br />
! Format<br />
! Type<br />
! Rate<br />
! Details<br />
|-<br />
|rowspan="2"|[[JSON File Format]]<br />
|Full Extract<br />
|Daily<br />
|rowspan="2"|The schedules in JSON format are available for all operators, or for individual operators.<br />
|-<br />
|Update Extract<br />
|Daily<br />
|-<br />
|rowspan="2"|[[CIF File Format]]<br />
|Full Extract<br />
|Weekly<br />
|rowspan="2"|The schedules in CIF format are only available for all operators. A 'full' extract is available each Friday, and an 'update' extract is available daily.<br />
|-<br />
|Update Extract<br />
|Daily<br />
|-<br />
|}<br />
<br />
The JSON data files are generated overnight and will be available from around 0600. The CIF files are go through a different process and will be available from around 0100.<br />
<br />
'''Note:''' Late-notice train schedules, which are not available through the SCHEDULE feed, are published via the real-time [[VSTP]] feed.<br />
<br />
== Downloading ==<br />
<br />
The schedule data is compressed using gzip and is downloaded from Amazon S3 via a private URL which is valid for a few minutes after generation. Authentication will be required either by logging in through the Data Feeds website, or by sending your username and password as part of the HTTP request. On successful authentication, you will receive a HTTP 302 (Moved Temporarily) redirect to the location of the schedule file. Requests are of the format:<br />
<br />
https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=type&day=day<br />
<br />
where ''type'' determines the TOCs contained in the schedule extract and whether the file is a full schedule or an update file, and ''day'' determines which day's update file is downloaded. For example:<br />
<br />
https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_FULL_DAILY&day=toc-full<br />
<br />
would download a full schedule file in JSON format for all TOCs. And if the CIF format is what you are after, add a trailing .CIF.gz to get the CIF format.<br />
<br />
Values for ''type'' and ''day'' can be one of the following:<br />
<br />
{| class='wikitable'<br />
!''type''<br />
!''day''<br />
!Description<br />
!Example URL (JSON format)<br />
!Example URL (CIF format)<br />
|-<br />
|CIF_ALL_FULL_DAILY<br />
|toc-full<br />
|Daily all-TOC snapshot<br />
|[https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_FULL_DAILY&day=toc-full Daily]<br />
|[https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_FULL_DAILY&day=toc-full.CIF.gz Weekly]<br />
|-<br />
|CIF_ALL_UPDATE_DAILY<br />
|toc-update-''DAY''<br />
|Daily all-TOC update<br />
|[https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-mon Mon], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-tue Tue], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-wed Wed], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-thu Thu], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-fri Fri], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-sat Sat], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-sun Sun]<br />
|[https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-mon.CIF.gz Mon], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-tue.CIF.gz Tue], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-wed.CIF.gz Wed], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-thu.CIF.gz Thu], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-fri.CIF.gz Fri], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-sat.CIF.gz Sat], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_UPDATE_DAILY&day=toc-update-sun.CIF.gz Sun]<br />
|-<br />
|CIF_''XX''_TOC_FULL_DAILY<br />
|toc-full<br />
|Daily snapshot for TOC ''XX''<br />
|[https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_XX_TOC_FULL_DAILY&day=toc-full Daily]<br />
|Not available<br />
|-<br />
|CIF_''XX''_TOC_UPDATE_DAILY<br />
|toc-update-''DAY''<br />
|Daily update for TOC ''XX''<br />
|[https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_XX_TOC_UPDATE_DAILY&day=toc-update-mon Mon], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_XX_TOC_UPDATE_DAILY&day=toc-update-Tue Tue], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_XX_TOC_UPDATE_DAILY&day=toc-update-wed Wed], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_XX_TOC_UPDATE_DAILY&day=toc-update-thu Thu], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_XX_TOC_UPDATE_DAILY&day=toc-update-fri Fri], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_XX_TOC_UPDATE_DAILY&day=toc-update-sat Sat], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_XX_TOC_UPDATE_DAILY&day=toc-update-sun Sun]<br />
|Not available<br />
|-<br />
|CIF_FREIGHT_FULL_DAILY<br />
|toc-full<br />
|Daily FREIGHT snapshot<br />
|[https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_FREIGHT_FULL_DAILY&day=toc-full Daily]<br />
|Not available<br />
|-<br />
|CIF_FREIGHT_UPDATE_DAILY<br />
|toc-update-''DAY''<br />
|Daily update for FREIGHT<br />
|[https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_FREIGHT_UPDATE_DAILY&day=toc-update-mon Mon], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_FREIGHT_UPDATE_DAILY&day=toc-update-tue Tue], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_FREIGHT_UPDATE_DAILY&day=toc-update-wed Wed], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_FREIGHT_UPDATE_DAILY&day=toc-update-thu Thu], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_FREIGHT_UPDATE_DAILY&day=toc-update-fri Fri], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_FREIGHT_UPDATE_DAILY&day=toc-update-sat Sat], [https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_FREIGHT_UPDATE_DAILY&day=toc-update-sun Sun]<br />
|Not available<br />
|-<br />
|}<br />
<br />
''DAY'' should be replaced with the shortened version of the name of the previous day. For example, on Monday, Sunday's ('sun') update should be requested.<br />
<br />
A list of [[TOC Codes]] is available. Note that the TOC code used in the URL is not the ATOC code as seen in schedule files, but the business code as used in Network Rail systems.<br />
<br />
=== Downloading via curl ===<br />
<br />
The schedule file can be downloaded from the command line using the ''curl'' utility (included with linux, versions available for other operating systems) with the following syntax:<br />
<br />
curl -L -u 'username:password' -o file.gz 'https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_FULL_DAILY&day=toc-full'<br />
<br />
(Thanks to [[User:Jules Self|Jules Self]] for figuring this syntax out.)<br />
<br />
=== Downloading via C# ===<br />
<br />
Below is sample code written in C# that will download files. <br />
<br />
There is also a last modified check method that can be used to see if a new file has been uploaded using the file header - without downloading the full file. This is useful if you quickly want to check every hour if a file is new compared to any you may have.<br />
<br />
[https://github.com/Legolash2o/OpenRailDataScheduleDownload C# Sample]<br />
<br />
== Validity ==<br />
<br />
Associations and schedule validities are between a start date and an end date, and on particular days of the week. They each have a Short Term Planning (STP) indicator field as follows:<br />
<br />
* '''C''' - Planned cancellation: the schedule does not apply on this date, and the train will not run. Typically seen on public holidays when an alternate schedule applies, or on Christmas Day.<br />
* '''N''' - STP schedule: similar to a permanent schedule, but planned through the Short Term Planning process and not capable of being overlaid<br />
* '''O''' - Overlay schedule: an alteration to a permanent schedule<br />
* '''P''' - Permanent schedule: a schedule planned through the Long Term Planning process<br />
<br />
Permanent ('P') schedules can be overlaid by another schedule with the same UID - either a Variation ('O') or Cancellation Variation ('C'). For any particular day, of all the schedules for that UID valid on that day, the 'C' or 'O' schedule is the one which applies. Conveniently, it also means that the lowest alphabetical STP indicator wins - 'C' and 'O' are both lower in the alphabet than 'P'.<br />
<br />
This process allows a different schedule to be valid on particular days, or the service to not be valid on that day. For example, a schedule may be valid Monday - Friday each day of the year, but have a Cancellation Variation on Christmas Day and Boxing Day only.<br />
<br />
Cancellation variations are usually within the validity period of the base (permanent) schedule, however it is possible to have a cancellation variation which has a 'valid from' date which is within one version of a schedule and a 'valid to' date within another version of a schedule. In this case, the variation applies to both. An example of this is schedule C33552 at the start of 2015, where a cancellation variation applied to two separate permanent schedules.<br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:Schedule Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=TOC_Codes&diff=2957TOC Codes2022-05-24T07:24:35Z<p>Leon Byford: TfL Rail -> Elizabeth line</p>
<hr />
<div>This page lists the codes used to identify Train Operating Companies (TOCs) in the various data feeds available from Network Rail. Different feeds use different sets of codes to refer to the same company. Network Rail also have a set of business codes for each of their geographical areas of responsibility, listed at the bottom.<br />
<br />
== History ==<br />
<br />
Business codes are used for a variety of purposes, and are comprised of two alphabetic characters. Historically, the first letter was assigned as follows:<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
! Code<br />
! Description<br />
|-<br />
| C<br />
| Central Services<br />
|-<br />
| D<br />
| Railfreight Distribution<br />
|-<br />
| E<br />
| Train Operating Companies<br />
|-<br />
| G<br />
| British Rail International<br />
|-<br />
| H<br />
| Train Operating Companies<br />
|-<br />
| J<br />
| Other Businesses<br />
|-<br />
| K<br />
| [https://www.gracesguide.co.uk/BREL BREL] and Level 5 Depots<br />
|-<br />
| L<br />
| Train Operating Companies<br />
|-<br />
| P<br />
| Train Operating Companies<br />
|-<br />
| Q<br />
| British Rail Headquarters<br />
|-<br />
| R<br />
| British Rail Infrastructure Services<br />
|-<br />
| T<br />
| [https://www.nationalrail.co.uk/contact/feedback/46617.aspx NRCC]<br />
|-<br />
| U<br />
| Ex-British Rail (now privatised)<br />
|-<br />
| V<br />
| Ex-British Rail (now privatised)<br />
|-<br />
| W<br />
| DB Cargo UK<br />
|-<br />
| X<br />
| Private owners<br />
|-<br />
| Y<br />
| Private owners<br />
|-<br />
| Z<br />
| Other businesses<br />
|}<br />
<br />
== Non-Network Rail ==<br />
<br />
* ''Company Name'' is the name of the company<br />
* ''Business Code'' is a two-character code used within the TRUST system. It is used in the names of the individual [[Train_Movements | train movement feeds]].<ref>Strictly speaking, the first letter is the business code and the second letter is the profit centre</ref>.<br />
* ''Sector Code'' is the sector code used to represent the TOC in [[Train_Movements | TRUST messages]]. <br />
* ''ATOC Code'' is a two-character code used to representing the TOC in the [[SCHEDULE]] feed. Non-passenger operators are represented by an ATOC code of ''ZZ'' and are subject to obfuscation in the SCHEDULE feed (with the exception of GB Railfreight services).<br />
* ''Whitelisted'' means that the sector code is 'whitelisted' and TRUST messages are published for these operators without obfuscation. Sector codes which are not whitelisted will be obfuscated and TRUST messages are published for these operators with sector code ''00''.<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
!Company Name<br />
!Business Code<br />
!Sector Code<br />
!ATOC Code<br />
!Whitelisted<br />
|-<br />
|Virtual European Paths<br />
|EU<br />
|?<br />
|EU<br />
|?<br />
|-<br />
|[https://en.wikipedia.org/wiki/Alliance_Rail_Holdings Alliance Rail]<br />
|ZB<br />
|14<br />
|AR<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Northern_Trains Northern Trains]<br />
|ED<br />
|23<br />
|NT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Transport_for_Wales Transport for Wales]<br />
|HL<br />
|71<br />
|AW<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/C2c c2c]<br />
|HT<br />
|79<br />
|CC<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Caledonian_Sleeper Caledonian Sleeper]<br />
|ES<br />
|35<br />
|CS<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Chiltern_Railways Chiltern Railways]<br />
|HO<br />
|74<br />
|CH<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/CrossCountry CrossCountry]<br />
|EH<br />
|27<br />
|XC<br />
|Y<br />
|-<br />
|[https://www.dcrail.com/ DC Rail]<br />
|PO<br />
|34<br />
|ZZ<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/East_Midlands_Railway East Midlands Railway]<br />
|EM<br />
|28<br />
|EM<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Eurostar Eurostar]<br />
|GA<br />
|06<br />
|ES<br />
|Y<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/First_Capital_Connect First Capital Connect])<br />
|EG<br />
|26<br />
|FC<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Hull_Trains Hull Trains]<br />
|PF<br />
|55<br />
|HT<br />
|Y<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Gatwick_Express Gatwick Express])<br />
|HV<br />
|81<br />
|GX<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/GB_Railfreight GB Railfreight]<br />
|PE<br />
|54<br />
|ZZ<br />
|Y<br />
|-<br />
|Govia Thameslink Railway (Great Northern)<br />
|ET<br />
|88<br />
|GN<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Govia_Thameslink_Railway Govia Thameslink Railway (Thameslink)]<br />
|ET<br />
|88<br />
|TL<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Grand_Central_(train_operating_company) Grand Central]<br />
|EC<br />
|22<br />
|GC<br />
|Y<br />
|-<br />
|Grand Central (North West)<br />
|LN<br />
|14<br />
|GC<ref>Also listed as LF</ref><br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Great_Western_Railway_(train_operating_company) Great Western Railway]<br />
|EF<br />
|25<br />
|GW<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Greater_Anglia_(train_operating_company) Greater Anglia]<br />
|EB<br />
|21<br />
|LE<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Heathrow_Connect Heathrow Connect]<br />
|EE<br />
|24<br />
|HC<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Heathrow_Express Heathrow Express]<br />
|HM<br />
|86<br />
|HX<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Island_Line_(brand) Island Lines]<br />
|HZ<br />
|85<br />
|IL<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Locomotive_Services_Limited Locomotive Services]<br />
|LS<br />
|89<br />
|LS<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/West_Midlands_Trains West Midlands Trains]<br />
|EJ<br />
|29<br />
|LM<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/London_Overground London Overground]<br />
|EK<br />
|30<br />
|LO<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Bakerloo_line LUL Bakerloo Line]<br />
|XC<br />
|91<br />
|LT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/District_line LUL District Line - Richmond]<br />
|XE<br />
|93<br />
|LT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/District_line LUL District Line - Wimbledon]<br />
|XB<br />
|90<br />
|LT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Merseyrail Merseyrail]<br />
|HE<br />
|64<br />
|ME<br />
|Y<br />
|-<br />
|Network Rail (On-Track Machines)<br />
|LR<br />
|15<br />
|LR<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Tyne_and_Wear_Metro Nexus (Tyne & Wear Metro)]<br />
|PG<br />
|56<br />
|TW<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/North_Yorkshire_Moors_Railway North Yorkshire Moors Railway]<br />
|PR<br />
|51<br />
|NY<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Abellio_ScotRail ScotRail]<br />
|HA<br />
|60<br />
|SR<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/South_Western_Railway_(train_operating_company) South Western Railway]<br />
|HY<br />
|84<br />
|SW<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Sheffield_Supertram South Yorkshire Supertram]<br />
|SJ<br />
|19<br />
|SJ<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Southeastern_(train_operating_company) Southeastern]<br />
|HU<br />
|80<br />
|SE<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Southern_(Govia_Thameslink_Railway) Southern]<br />
|HW<br />
|88<br />
|SN<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Swanage_Railway Swanage Railway]<br />
|SP<br />
|18<br />
|SP<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Elizabeth_line Elizabeth line]<br />
|EX<br />
|33<br />
|XR<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/TransPennine_Express TransPennine Express]<br />
|EA<br />
|20<br />
|TP<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Avanti_West_Coast Avanti West Coast]<br />
|HF<br />
|65<br />
|VT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/London_North_Eastern_Railway London North Eastern Railway]<br />
|HB<br />
|61<br />
|GR<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/West_Coast_Railways West Coast Railways]<br />
|PA<br />
|50<br />
|WR<br />
|Y<br />
|-<br />
|[http://www.jsdrail.com/ JSD Rail Research & Development]<br />
|RR<br />
|02<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Victa_Westlink_Rail Victa Westlink Rail (defunct)]<br />
|PV<br />
|03<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/DB_Cargo_UK DB Cargo Charters]<br />
|FM<br />
|04<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/DB_Cargo_UK DB Cargo Freight]<br />
|WA<br />
|05<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Rail_Operations_Group Rail Operations Group]<br />
|PH<br />
|07<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/DB_Cargo DB Cargo International]<br />
|DA<br />
|08<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Freightliner_Group Freightliner Intermodal]<br />
|DB<br />
|09<br />
|ZZ<br />
|N<br />
|-<br />
|[https://www.serco.com/media-and-news/2014/serco-uk-rail-operations Serco Rail Operations]<br />
|SD<br />
|10<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Freightliner_Group#United_Kingdom Freightliner Heavy Haul]<br />
|DH<br />
|11<br />
|ZZ<br />
|N<br />
|-<br />
|Freight Europe (defunct)<br />
|PN<br />
|12<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Europorte_Channel Europorte Channel]<br />
|PT<br />
|13<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Loram_Maintenance_of_Way LORAM]<br />
|LC<br />
|16<br />
|ZZ<br />
|N<br />
|-<br />
|Hanson & Hall Rail Services<br />
|YG<br />
|17<br />
|ZZ<br />
|N<br />
|-<br />
|Network Rail Virtual Freight Company<br />
|QJ<br />
|31<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Wrexham_%26_Shropshire Wrexham and Shropshire] (defunct)<br />
|EI<br />
|32<br />
|WS<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Vintage_Trains Vintage Trains]<br />
|TY<br />
|36<br />
|TY<br />
|N<br />
|-<br />
|Seco Rail (defunct)<br />
|RU<br />
|37<br />
|ZZ<br />
|N<br />
|-<br />
|Carillion Rail CTRL (Phase 1) (defunct)<br />
|RQ<br />
|38<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Harsco Harsco]<br />
|RT<br />
|39<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Balfour_Beatty Balfour Beatty Rail]<br />
|RZ<br />
|40<br />
|ZZ<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|41<br />
|<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Colas_Rail Colas Rail]<br />
|RG<br />
|42<br />
|ZZ<br />
|N<br />
|-<br />
|Amey Fleet Services<br />
|RE<br />
|43<br />
|ZZ<br />
|N<br />
|-<br />
|Carillion Rail<br />
|RB<br />
|44<br />
|ZZ<br />
|N<br />
|-<br />
|[https://www.lumo.co.uk/ Lumo]<br />
|LD<br />
|45<br />
|LD<br />
|N<br />
|-<br />
|[https://www.sbrail.com/ SB (Swietelsky Babcock) Rail]<br />
|RD<br />
|46<br />
|ZZ<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|47<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|48<br />
|<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/VolkerRail VolkerRail]<br />
|RH<br />
|49<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Pre_Metro_Operations Pre Metro Operations]<br />
|PK<br />
|52<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/SNCF SNCF Freight Services]<br />
|PS<br />
|53<br />
|ZZ<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|57<br />
|<br />
|N<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Advenza_Freight Advenza Freight])<br />
|PI<br />
|58<br />
|ZZ<br />
|N<br />
|-<br />
|On Route Logistics<br />
|PM<br />
|59<br />
|ZZ<br />
|N<br />
|-<br />
|[https://www.slcoperations.com/ SLC Operations]<br />
|SO<br />
|11<ref>Shared with Freightliner Heavy Haul</ref><br />
|SO<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|62<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|63<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|66<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|67<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|68<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|69<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|70<br />
|<br />
|N<br />
|-<br />
|[http://www.granduniontrains.co.uk/ Grand Union Trains]<br />
|LF<br />
|12<br />
|LF<br />
|?<br />
|-<br />
|[https://www.liservices.co.uk/ Legge Infrastructure Services]<br />
|LG<br />
|72<br />
|ZZ<br />
|N<br />
|-<br />
|Grand Central (North West)<br />
|LN<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped<br />
|<br />
|73<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|75<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|76<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|77<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|78<br />
|<br />
|N<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Southern_(Govia_Thameslink_Railway) Southern])<br />
|HW<br />
|82<br />
|SN<br />
|Y<br />
|-<br />
|Unmapped<br />
|<br />
|83<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|87<br />
|<br />
|N<br />
|-<br />
|Network Rail Reserved Pathings (non-QJ)<br />
|NR<br />
|92<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Ffestiniog_Railway Ffestiniog Railway]<br />
|XJ<br />
|94<br />
|<br />
|Y<br />
|-<br />
|[https://varamis.co.uk/ Varamis Rail]<br />
|MV<br />
|95<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|96<br />
|<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Direct_Rail_Services Direct Rail Services]<br />
|XH<br />
|97<br />
|ZZ<br />
|N<br />
|-<br />
|Internal Testing<br />
|RM<br />
|98<br />
|ZZ<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|99<br />
|<br />
|N<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Anglia_Railways Anglia Railways])<br />
|HS<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Silverlink Silverlink Train Services])<br />
|HP<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Central_Trains Central Trains])<br />
|HG<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/West_Anglia_Great_Northern WAGN])<br />
|HQ<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/First_Great_Eastern First Great Eastern])<br />
|HR<br />
|<br />
|<br />
|<br />
|-}<br />
<br />
== Network Rail ==<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
!Network Rail Route<br />
!Business Code<br />
|-<br />
|HQ Functions<br />
|QA<br />
|-<br />
|Sussex<br />
|QB<br />
|-<br />
|Wessex<br />
|QC<br />
|-<br />
|Western<br />
|QD<br />
|-<br />
|Central<br />
|QE<br />
|-<br />
|North West<br />
|QF<br />
|-<br />
|North East<br />
|QG<br />
|-<br />
|Anglia<br />
|QH<br />
|-<br />
|East Coast<br />
|QI<br />
|-<br />
|Eastern<br />
|QJ<br />
|-<br />
|Southern<br />
|QK<br />
|-<br />
|Scotland<br />
|QL<br />
|-<br />
|Kent<br />
|QM<br />
|-<br />
|WCML South<br />
|QN<br />
|-<br />
|High Speed 1<br />
|QQ<br />
|-<br />
|North West & Central<br />
|QR<br />
|-<br />
|Scotland<br />
|QS<br />
|-<br />
|Wales & Western<br />
|QU<br />
|-<br />
|East Midlands<br />
|QV<br />
|-<br />
|Wales<br />
|QW<br />
|}<br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:Reference Data]]<br />
[[Category:Train Movement Data]]<br />
[[Category:Schedule Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=TOC_Codes&diff=2954TOC Codes2022-05-17T13:47:02Z<p>Leon Byford: Include note about the Elizabeth line</p>
<hr />
<div>This page lists the codes used to identify Train Operating Companies (TOCs) in the various data feeds available from Network Rail. Different feeds use different sets of codes to refer to the same company. Network Rail also have a set of business codes for each of their geographical areas of responsibility, listed at the bottom.<br />
<br />
== History ==<br />
<br />
Business codes are used for a variety of purposes, and are comprised of two alphabetic characters. Historically, the first letter was assigned as follows:<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
! Code<br />
! Description<br />
|-<br />
| C<br />
| Central Services<br />
|-<br />
| D<br />
| Railfreight Distribution<br />
|-<br />
| E<br />
| Train Operating Companies<br />
|-<br />
| G<br />
| British Rail International<br />
|-<br />
| H<br />
| Train Operating Companies<br />
|-<br />
| J<br />
| Other Businesses<br />
|-<br />
| K<br />
| [https://www.gracesguide.co.uk/BREL BREL] and Level 5 Depots<br />
|-<br />
| L<br />
| Train Operating Companies<br />
|-<br />
| P<br />
| Train Operating Companies<br />
|-<br />
| Q<br />
| British Rail Headquarters<br />
|-<br />
| R<br />
| British Rail Infrastructure Services<br />
|-<br />
| T<br />
| [https://www.nationalrail.co.uk/contact/feedback/46617.aspx NRCC]<br />
|-<br />
| U<br />
| Ex-British Rail (now privatised)<br />
|-<br />
| V<br />
| Ex-British Rail (now privatised)<br />
|-<br />
| W<br />
| DB Cargo UK<br />
|-<br />
| X<br />
| Private owners<br />
|-<br />
| Y<br />
| Private owners<br />
|-<br />
| Z<br />
| Other businesses<br />
|}<br />
<br />
== Non-Network Rail ==<br />
<br />
* ''Company Name'' is the name of the company<br />
* ''Business Code'' is a two-character code used within the TRUST system. It is used in the names of the individual [[Train_Movements | train movement feeds]].<ref>Strictly speaking, the first letter is the business code and the second letter is the profit centre</ref>.<br />
* ''Sector Code'' is the sector code used to represent the TOC in [[Train_Movements | TRUST messages]]. <br />
* ''ATOC Code'' is a two-character code used to representing the TOC in the [[SCHEDULE]] feed. Non-passenger operators are represented by an ATOC code of ''ZZ'' and are subject to obfuscation in the SCHEDULE feed (with the exception of GB Railfreight services).<br />
* ''Whitelisted'' means that the sector code is 'whitelisted' and TRUST messages are published for these operators without obfuscation. Sector codes which are not whitelisted will be obfuscated and TRUST messages are published for these operators with sector code ''00''.<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
!Company Name<br />
!Business Code<br />
!Sector Code<br />
!ATOC Code<br />
!Whitelisted<br />
|-<br />
|Virtual European Paths<br />
|EU<br />
|?<br />
|EU<br />
|?<br />
|-<br />
|[https://en.wikipedia.org/wiki/Alliance_Rail_Holdings Alliance Rail]<br />
|ZB<br />
|14<br />
|AR<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Northern_Trains Northern Trains]<br />
|ED<br />
|23<br />
|NT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Transport_for_Wales Transport for Wales]<br />
|HL<br />
|71<br />
|AW<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/C2c c2c]<br />
|HT<br />
|79<br />
|CC<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Caledonian_Sleeper Caledonian Sleeper]<br />
|ES<br />
|35<br />
|CS<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Chiltern_Railways Chiltern Railways]<br />
|HO<br />
|74<br />
|CH<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/CrossCountry CrossCountry]<br />
|EH<br />
|27<br />
|XC<br />
|Y<br />
|-<br />
|[https://www.dcrail.com/ DC Rail]<br />
|PO<br />
|34<br />
|ZZ<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/East_Midlands_Railway East Midlands Railway]<br />
|EM<br />
|28<br />
|EM<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Eurostar Eurostar]<br />
|GA<br />
|06<br />
|ES<br />
|Y<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/First_Capital_Connect First Capital Connect])<br />
|EG<br />
|26<br />
|FC<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Hull_Trains Hull Trains]<br />
|PF<br />
|55<br />
|HT<br />
|Y<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Gatwick_Express Gatwick Express])<br />
|HV<br />
|81<br />
|GX<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/GB_Railfreight GB Railfreight]<br />
|PE<br />
|54<br />
|ZZ<br />
|Y<br />
|-<br />
|Govia Thameslink Railway (Great Northern)<br />
|ET<br />
|88<br />
|GN<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Govia_Thameslink_Railway Govia Thameslink Railway (Thameslink)]<br />
|ET<br />
|88<br />
|TL<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Grand_Central_(train_operating_company) Grand Central]<br />
|EC<br />
|22<br />
|GC<br />
|Y<br />
|-<br />
|Grand Central (North West)<br />
|LN<br />
|14<br />
|GC<ref>Also listed as LF</ref><br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Great_Western_Railway_(train_operating_company) Great Western Railway]<br />
|EF<br />
|25<br />
|GW<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Greater_Anglia_(train_operating_company) Greater Anglia]<br />
|EB<br />
|21<br />
|LE<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Heathrow_Connect Heathrow Connect]<br />
|EE<br />
|24<br />
|HC<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Heathrow_Express Heathrow Express]<br />
|HM<br />
|86<br />
|HX<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Island_Line_(brand) Island Lines]<br />
|HZ<br />
|85<br />
|IL<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Locomotive_Services_Limited Locomotive Services]<br />
|LS<br />
|89<br />
|LS<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/West_Midlands_Trains West Midlands Trains]<br />
|EJ<br />
|29<br />
|LM<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/London_Overground London Overground]<br />
|EK<br />
|30<br />
|LO<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Bakerloo_line LUL Bakerloo Line]<br />
|XC<br />
|91<br />
|LT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/District_line LUL District Line - Richmond]<br />
|XE<br />
|93<br />
|LT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/District_line LUL District Line - Wimbledon]<br />
|XB<br />
|90<br />
|LT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Merseyrail Merseyrail]<br />
|HE<br />
|64<br />
|ME<br />
|Y<br />
|-<br />
|Network Rail (On-Track Machines)<br />
|LR<br />
|15<br />
|LR<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Tyne_and_Wear_Metro Nexus (Tyne & Wear Metro)]<br />
|PG<br />
|56<br />
|TW<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/North_Yorkshire_Moors_Railway North Yorkshire Moors Railway]<br />
|PR<br />
|51<br />
|NY<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Abellio_ScotRail ScotRail]<br />
|HA<br />
|60<br />
|SR<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/South_Western_Railway_(train_operating_company) South Western Railway]<br />
|HY<br />
|84<br />
|SW<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Sheffield_Supertram South Yorkshire Supertram]<br />
|SJ<br />
|19<br />
|SJ<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Southeastern_(train_operating_company) Southeastern]<br />
|HU<br />
|80<br />
|SE<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Southern_(Govia_Thameslink_Railway) Southern]<br />
|HW<br />
|88<br />
|SN<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Swanage_Railway Swanage Railway]<br />
|SP<br />
|18<br />
|SP<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/TfL_Rail TfL Rail]<ref>From Tuesday 24th May 2022, TfL Rail will be rebranded as the [https://en.wikipedia.org/wiki/Elizabeth_line Elizabeth line]</ref><br />
|EX<br />
|33<br />
|XR<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/TransPennine_Express TransPennine Express]<br />
|EA<br />
|20<br />
|TP<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Avanti_West_Coast Avanti West Coast]<br />
|HF<br />
|65<br />
|VT<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/London_North_Eastern_Railway London North Eastern Railway]<br />
|HB<br />
|61<br />
|GR<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/West_Coast_Railways West Coast Railways]<br />
|PA<br />
|50<br />
|WR<br />
|Y<br />
|-<br />
|[http://www.jsdrail.com/ JSD Rail Research & Development]<br />
|RR<br />
|02<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Victa_Westlink_Rail Victa Westlink Rail (defunct)]<br />
|PV<br />
|03<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/DB_Cargo_UK DB Cargo Charters]<br />
|FM<br />
|04<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/DB_Cargo_UK DB Cargo Freight]<br />
|WA<br />
|05<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Rail_Operations_Group Rail Operations Group]<br />
|PH<br />
|07<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/DB_Cargo DB Cargo International]<br />
|DA<br />
|08<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Freightliner_Group Freightliner Intermodal]<br />
|DB<br />
|09<br />
|ZZ<br />
|N<br />
|-<br />
|[https://www.serco.com/media-and-news/2014/serco-uk-rail-operations Serco Rail Operations]<br />
|SD<br />
|10<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Freightliner_Group#United_Kingdom Freightliner Heavy Haul]<br />
|DH<br />
|11<br />
|ZZ<br />
|N<br />
|-<br />
|Freight Europe (defunct)<br />
|PN<br />
|12<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Europorte_Channel Europorte Channel]<br />
|PT<br />
|13<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Loram_Maintenance_of_Way LORAM]<br />
|LC<br />
|16<br />
|ZZ<br />
|N<br />
|-<br />
|Hanson & Hall Rail Services<br />
|YG<br />
|17<br />
|ZZ<br />
|N<br />
|-<br />
|Network Rail Virtual Freight Company<br />
|QJ<br />
|31<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Wrexham_%26_Shropshire Wrexham and Shropshire] (defunct)<br />
|EI<br />
|32<br />
|WS<br />
|Y<br />
|-<br />
|[https://en.wikipedia.org/wiki/Vintage_Trains Vintage Trains]<br />
|TY<br />
|36<br />
|TY<br />
|N<br />
|-<br />
|Seco Rail (defunct)<br />
|RU<br />
|37<br />
|ZZ<br />
|N<br />
|-<br />
|Carillion Rail CTRL (Phase 1) (defunct)<br />
|RQ<br />
|38<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Harsco Harsco]<br />
|RT<br />
|39<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Balfour_Beatty Balfour Beatty Rail]<br />
|RZ<br />
|40<br />
|ZZ<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|41<br />
|<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Colas_Rail Colas Rail]<br />
|RG<br />
|42<br />
|ZZ<br />
|N<br />
|-<br />
|Amey Fleet Services<br />
|RE<br />
|43<br />
|ZZ<br />
|N<br />
|-<br />
|Carillion Rail<br />
|RB<br />
|44<br />
|ZZ<br />
|N<br />
|-<br />
|[https://www.lumo.co.uk/ Lumo]<br />
|LD<br />
|45<br />
|LD<br />
|N<br />
|-<br />
|[https://www.sbrail.com/ SB (Swietelsky Babcock) Rail]<br />
|RD<br />
|46<br />
|ZZ<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|47<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|48<br />
|<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/VolkerRail VolkerRail]<br />
|RH<br />
|49<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Pre_Metro_Operations Pre Metro Operations]<br />
|PK<br />
|52<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/SNCF SNCF Freight Services]<br />
|PS<br />
|53<br />
|ZZ<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|57<br />
|<br />
|N<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Advenza_Freight Advenza Freight])<br />
|PI<br />
|58<br />
|ZZ<br />
|N<br />
|-<br />
|On Route Logistics<br />
|PM<br />
|59<br />
|ZZ<br />
|N<br />
|-<br />
|[https://www.slcoperations.com/ SLC Operations]<br />
|SO<br />
|11<ref>Shared with Freightliner Heavy Haul</ref><br />
|SO<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|62<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|63<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|66<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|67<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|68<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|69<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|70<br />
|<br />
|N<br />
|-<br />
|[http://www.granduniontrains.co.uk/ Grand Union Trains]<br />
|LF<br />
|12<br />
|LF<br />
|?<br />
|-<br />
|[https://www.liservices.co.uk/ Legge Infrastructure Services]<br />
|LG<br />
|72<br />
|ZZ<br />
|N<br />
|-<br />
|Grand Central (North West)<br />
|LN<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped<br />
|<br />
|73<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|75<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|76<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|77<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|78<br />
|<br />
|N<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Southern_(Govia_Thameslink_Railway) Southern])<br />
|HW<br />
|82<br />
|SN<br />
|Y<br />
|-<br />
|Unmapped<br />
|<br />
|83<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|87<br />
|<br />
|N<br />
|-<br />
|Network Rail Reserved Pathings (non-QJ)<br />
|NR<br />
|92<br />
|ZZ<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Ffestiniog_Railway Ffestiniog Railway]<br />
|XJ<br />
|94<br />
|<br />
|Y<br />
|-<br />
|[https://varamis.co.uk/ Varamis Rail]<br />
|MV<br />
|95<br />
|<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|96<br />
|<br />
|N<br />
|-<br />
|[https://en.wikipedia.org/wiki/Direct_Rail_Services Direct Rail Services]<br />
|XH<br />
|97<br />
|ZZ<br />
|N<br />
|-<br />
|Internal Testing<br />
|RM<br />
|98<br />
|ZZ<br />
|N<br />
|-<br />
|Unmapped<br />
|<br />
|99<br />
|<br />
|N<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Anglia_Railways Anglia Railways])<br />
|HS<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Silverlink Silverlink Train Services])<br />
|HP<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/Central_Trains Central Trains])<br />
|HG<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/West_Anglia_Great_Northern WAGN])<br />
|HQ<br />
|<br />
|<br />
|<br />
|-<br />
|Unmapped (was [https://en.wikipedia.org/wiki/First_Great_Eastern First Great Eastern])<br />
|HR<br />
|<br />
|<br />
|<br />
|-}<br />
<br />
== Network Rail ==<br />
<br />
{| class="wikitable sortable"<br />
|-<br />
!Network Rail Route<br />
!Business Code<br />
|-<br />
|HQ Functions<br />
|QA<br />
|-<br />
|Sussex<br />
|QB<br />
|-<br />
|Wessex<br />
|QC<br />
|-<br />
|Western<br />
|QD<br />
|-<br />
|Central<br />
|QE<br />
|-<br />
|North West<br />
|QF<br />
|-<br />
|North East<br />
|QG<br />
|-<br />
|Anglia<br />
|QH<br />
|-<br />
|East Coast<br />
|QI<br />
|-<br />
|Eastern<br />
|QJ<br />
|-<br />
|Southern<br />
|QK<br />
|-<br />
|Scotland<br />
|QL<br />
|-<br />
|Kent<br />
|QM<br />
|-<br />
|WCML South<br />
|QN<br />
|-<br />
|High Speed 1<br />
|QQ<br />
|-<br />
|North West & Central<br />
|QR<br />
|-<br />
|Scotland<br />
|QS<br />
|-<br />
|Wales & Western<br />
|QU<br />
|-<br />
|East Midlands<br />
|QV<br />
|-<br />
|Wales<br />
|QW<br />
|}<br />
<br />
{{Navtable-DataFeeds}}<br />
<br />
[[Category:Reference Data]]<br />
[[Category:Train Movement Data]]<br />
[[Category:Schedule Data]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=DTD&diff=2953DTD2022-05-09T07:56:30Z<p>Leon Byford: The `Host` HTTP request header is required (although included implicitly by curl) -- this caused me confusion when I kept getting 400 Bad Request errors</p>
<hr />
<div>Train companies create various types of data associated with the provision of their rail services, including fares, timetable and routeing data. They use this data to provide rail travel information to their customers in a variety of ways, including through approved websites, via mobile phone apps and at their stations through accredited retail systems.<br />
<br />
RDG is authorised to make this data available under licence to third parties on behalf of the train companies. Fares, Routeing guide and Timetable data is of a technical nature, and you will require a good level of computer skills in order to be able to process the data.<br />
<br />
Fares data consists of product information relating to permanent fares offered by the train operating companies. The data will typically include general fares information such as price, validity, class of travel and restriction information. <br />
<br />
Routeing data is created from the information used to specify route validity for certain fares and prescribed customer journey route options. <br />
<br />
Timetable data consists of the train service timetable information provided by the train operating companies. The data includes general timetable information such as departure and arrival times for all stations at which a train calls on its journey (e.g. origin, intermediate and terminating).<br />
<br />
= Accessing Fares, Routeing Guide and Timetable data =<br />
<br />
To access Fares, Routeing Guide and Timetable data you must have an account on the National Rail Data Portal (NRDP) at http://opendata.nationalrail.co.uk. By creating an account, you can register for a subscription to the Fares, Routeing and Timetable feed.<br />
<br />
'''Important''' - Please note NRDP accounts expire after extended periods of no use. The unused account expiry period is currently set to 30 days. If you create an account and do not consume any of the feeds during this time your account will be deleted. If your account has been deleted, you will receive a notification email, and you will be able to re-register for a new account.<br />
<br />
== Advice on downloading data ==<br />
<br />
Best practice is to check no more than daily for new data.<br />
<br />
To determine which file is the latest version, each files header contains the last updated timestamp (response HTTP header, Last-Modified). <br />
<br />
NRDP will publish data as received from RDG, on a weekly basis. The data is updated at varying rates. <br />
<br />
* Fares, Routeing Guide and Timetable data - At selected times of the year, RDG will temporarily suspend Fares data publishing. NRDP will continue to make last retrieved file available to NRDP users.<br />
* Routeing data – weekly<br />
* Timetable data – Files are rarely updated and Users are advised to poll for updates infrequently<br />
<br />
== Examples ==<br />
<br />
After selecting the Fares, Routeing Guide and Timetable data subscription type on NRDP, you can receive the files in 2 steps via a rest client by performing the following steps.<br />
<br />
# Authenticate: Perform HTTP POST call to NRDP via https://opendata.nationalrail.co.uk/authenticate to generate a token.<br />
# Download file: Perform HTTP GET call to individual NRDP Feed using the token produced in step 1<br />
<br />
=== Step 1: Generate Token ===<br />
<br />
In this step, using a REST client you perform an HTTP POST call to https://opendata.nationalrail.co.uk/authenticate. This step requires using your email address and password registered on NRDP and will produce a token key. The following example shows the HTTP POST request and response with NRDP:<br />
<br />
Example HTTP POST Request to NRDP:<br />
<br />
<pre>POST https://opendata.nationalrail.co.uk/authenticate HTTP/1.1<br />
Content-Type: application/x-www-form-urlencoded<br />
Accept: application/json, text/plain, */*<br />
Host: opendata.nationalrail.co.uk<br />
Raw payload: username=user1@gmail.com&password=P@55w0rd1</pre><br />
<br />
If you're using [https://curl.se/ cURL], the following will correctly encode the request:<br />
<br />
<pre><br />
curl --location \<br />
--request POST \<br />
'https://opendata.nationalrail.co.uk/authenticate' \<br />
--header 'Content-Type: application/x-www-form-urlencoded' \<br />
--data-urlencode 'username=user1@gmail.com' \<br />
--data-urlencode 'password=P@55w0rd1'</pre><br />
<br />
Corresponding example HTTP Response from NRDP:<br />
<br />
<pre>{<br />
"username": "user1@gmail.com",<br />
"roles": {<br />
"ROLE_USER": true,<br />
"ROLE_DTD": true<br />
},<br />
"token": "user1@gmail.com:1491312310772:56c56baa3e56d35ff0ede4a6aad1bcfb"<br />
}</pre><br />
<br />
Each token is valid for 1 hour and you will receive a 401 Unauthorized response when the token has expired. <br />
<br />
The following HTTP response example is generated after sending an HTTP request to a NRDP feed with an expired token.<br />
<br />
Example HTTP 401 Response Header: Token Expired:<br />
<br />
<pre>Date: Thu, 22 Nov 2018 13:39:58 GMT<br />
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips<br />
X-Content-Type-Options: nosniff<br />
X-XSS-Protection: 1; mode=block<br />
Cache-Control: no-cache, no-store, max-age=0, must-revalidate<br />
Pragma: no-cache<br />
Expires: 0<br />
X-Frame-Options: DENY<br />
Content-Type: application/json;charset=UTF-8<br />
Transfer-Encoding: chunked</pre><br />
<br />
Corresponding example JSON Response: Token Expired:<br />
<br />
<pre>{<br />
"timestamp": "2018-11-21T12:34:33.377+0000",<br />
"status": 401,<br />
"error": "Unauthorized",<br />
"message": "Unauthorized",<br />
"path": "/api/staticfeeds/2.0/routeing"<br />
}</pre><br />
<br />
=== Step 2: Perform a HTTP GET call for each file ===<br />
<br />
In this step using a REST client, you would perform a HTTP GET call to each Fares, Routeing Guide and Timetable data files using the token key produced in step 1. This will produce the zip file containing fixed format flat text file(s) for the corresponding Fares, Routeing Guide and Timetable data feeds.<br />
<br />
The following are the required links to make the respective HTTP GET call:<br />
<br />
* Fares: https://opendata.nationalrail.co.uk/api/staticfeeds/2.0/fares <br />
* Routeing guide: https://opendata.nationalrail.co.uk/api/staticfeeds/2.0/routeing<br />
* Timetable: https://opendata.nationalrail.co.uk/api/staticfeeds/3.0/timetable<br />
<br />
The following is an example of request/response for Routeing data via NRDP:<br />
<br />
Example HTTP GET Request to NRDP feed:<br />
<br />
<pre>GET https://opendata.nationalrail.co.uk/api/staticfeeds/2.0/routeing HTTP/1.1<br />
Content-Type: application/json<br />
Accept: */*<br />
Host: opendata.nationalrail.co.uk<br />
X-Auth-Token: user1@gmail.com:1491312310772:56c56baa3e56d35ff0ede4a6aad1bcfb</pre><br />
<br />
Note: X-Auth-Token header value should contain the token from the authenticate response<br />
<br />
Corresponding example HTTP 200 Response Header:<br />
<br />
<pre>Date: Thu, 22 Nov 2018 13:53:00 GMT<br />
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips<br />
Last-Modified: Wed, 21 Nov 2018 05:13:43 GMT<br />
Content-Disposition: attachment; filename="RJRG0541.ZIP"<br />
Accept-Ranges: bytes<br />
X-Content-Type-Options: nosniff<br />
X-XSS-Protection: 1; mode=block<br />
Cache-Control: no-cache, no-store, max-age=0, must-revalidate<br />
Pragma: no-cache<br />
Expires: 0<br />
X-Frame-Options: DENY<br />
Content-Type: application/zip<br />
Content-Length: 66021837</pre><br />
<br />
Example corresponding fixed format response files:<br />
<br />
Each feed returns a zip file with numerous fixed format flat text files. An index file is also provided. For Timetable <br />
and Fares data this is the DAT file, for Routeing this is the RGI file.<br />
<br />
Example Routeing RGI file (Unzipped):<br />
<br />
/!! Start of file<br />
/!! Content type: index<br />
/!! Sequence: 0541<br />
/!! Generated: 07/11/2018<br />
/!! Exporter: RJIS RjEhrNRG v0.1<br />
RJRG0541.RGK<br />
RJRG0541.RGV<br />
RJRG0541.RGA<br />
RJRG0541.RGL<br />
RJRG0541.RGB<br />
RJRG0541.RGM<br />
RJRG0541.RGX<br />
RJRG0541.RGC<br />
RJRG0541.RGN<br />
RJRG0541.RGY <br />
RJRG0541.RGD<br />
RJRG0541.RGE<br />
RJRG0541.RGP<br />
RJRG0541.RGF<br />
RJRG0541.RGG<br />
RJRG0541.RGR<br />
RJRG0541.RGH<br />
RJRG0541.RGS<br />
/!! End of file (18 records) (07/11/2018)<br />
<br />
Example portion of Routeing fixed format file RGRJ0541.RGX (Unzipped)<br />
<br />
/!! Start of file<br />
/!! Content type: new stations<br />
/!! Sequence: 0541<br />
/!! Generated: 07/11/2018<br />
/!! Exporter: RJIS RjEhrNRG v0.1<br />
AUR,DAG,01011999,31122999<br />
AYS,AVP,27112008,31122999<br />
BCV,SVS,27032014,31122999<br />
BDI,LMR,07042017,31122999<br />
BGN,LWM,11052005,31122999<br />
BGN,RIA,11052005,31122999<br />
BHG,ARM,09092010,31013000<br />
BKP,CNP,01011999,31122999<br />
BON,HWI,21012000,21012999<br />
BTR,BTP,13112000,13112999<br />
<br />
Details on how to interpret the fixed format files can be found in specifications listed below.<br />
<br />
* [https://www.raildeliverygroup.com/files/Publications/services/rsp/RSPS504502-00FaresandAssociatedDataFeedInterfaceSpecification.pdf Fares and associated data feed interface specification (RSPS5045 v.02-00)]<br />
* [https://www.raildeliverygroup.com/files/Publications/services/rsp/RSPS504702-00NationalRoutingGuideDataFeedSpecification.pdf National Routeing Guide data feed specification (RSPS5047 v.02-00)]<br />
* [https://www.raildeliverygroup.com/about-us/publications/services/rsp/12111-rsps5046-timetable-information-data-feed-interface-specification/file.html Timetable information data feed interface specification (RSPS5046 v.03-00)]<br />
<br />
= Support =<br />
<br />
You may also find the below documentation useful in understanding and using the national routeing guide data set:<br />
<br />
* [http://datafeeds.rdg.s3.amazonaws.com/RSPS5047/nrg_instructions.pdf Instructions]: Information on how, when and why you should use the National Routeing Guide.<br />
* [http://datafeeds.rdg.s3.amazonaws.com/RSPS5047/nrg_detail.pdf Detail]: More information on how to use the National Routeing Guide, including some step by step examples.<br />
* [http://datafeeds.rdg.s3.amazonaws.com/RSPS5047/nrg_glossary.pdf Glossary]: A list of National Routeing Guide terms and their conditions.<br />
* [http://datafeeds.rdg.s3.amazonaws.com/RSPS5047/nfm64.zip NFM64 Fares]: NFM64 fares, required for Fares Checking<br />
<br />
{{Navtable-NreDataFeeds}}<br />
<br />
[[Category:National Rail Enquiries Data Feeds]]</div>Leon Byfordhttps://wiki.openraildata.com//index.php?title=User:Leon_Byford&diff=2952User:Leon Byford2022-05-09T07:47:09Z<p>Leon Byford: Created page with "Digital Product Manager at [https://tfl.gov.uk/ Transport for London]"</p>
<hr />
<div>Digital Product Manager at [https://tfl.gov.uk/ Transport for London]</div>Leon Byford