SCHEDULE: Difference between revisions

From Open Rail Data Wiki
Additional technical information on schedules, stripped out example records to be more concise
m Correct link to CIF User Spec
Line 7: Line 7:
Schedule files are available for all passenger TOCs and for each TOC.  Two types of file are available - a 'full' file which contains a snapshot of all schedules, and an 'update' file which can be applied to a a local database to bring it up-to-date with any changes.
Schedule files are available for all passenger TOCs and for each TOC.  Two types of file are available - a 'full' file which contains a snapshot of all schedules, and an 'update' file which can be applied to a a local database to bring it up-to-date with any changes.


The [[http://www.atoc.org/about-atoc/rail-settlement-plan/data-feeds/types-of-data][CIF User Specification]] is available from ATOC's website, which details the format of the CIF file.  This will be useful to developers wishing to gain deep understanding about the way train scheduling works, above and beyond the information contained here.
The [http://www.atoc.org/about-atoc/rail-settlement-plan/data-feeds/types-of-data CIF User Specification] is available from ATOC's website, which details the format of the CIF file.  This will be useful to developers wishing to gain deep understanding about the way train scheduling works, above and beyond the information contained here.


== Downloading ==
== Downloading ==

Revision as of 18:06, 27 October 2012

Schedule data

Overview

The Schedule feed is an extract of train schedules from Network Rail's ITPS (Integrated Train Planning System), converted in to JSON format for easier parsing. Network Rail are not planning to make raw CIF files available.

Schedule files are available for all passenger TOCs and for each TOC. Two types of file are available - a 'full' file which contains a snapshot of all schedules, and an 'update' file which can be applied to a a local database to bring it up-to-date with any changes.

The CIF User Specification is available from ATOC's website, which details the format of the CIF file. This will be useful to developers wishing to gain deep understanding about the way train scheduling works, above and beyond the information contained here.

Downloading

The schedule data, compressed using gzip, is downloaded from Amazon S3 via a private URL which is valid for a few minutes after generation.

To request schedule data, send an HTTP request with your username and password to:

 https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=bucket&day=file

For example:

 https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_FULL_DAILY&day=toc-full

Replace bucket with the name of the bucket, and file with the name of the file. On successful authentication, you will receive a 403 redirect to the location of the schedule files.

Data

The schedule data contains a header row, a set of zero or more association records, a set of zero or more schedule records, and an end-of-file (EOF) record.

Each association and schedule record has an action - either 'create' or 'delete'. In full files, there will be no 'delete' records.

Update files must be applied sequentially to a full file.

Interpretation

Validity

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:

  • 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.
  • N - STP schedule: similar to a permanent schedule, but planned through the Short Term Planning process
  • O - Overlay schedule: an alteration to a permanent schedule
  • P - Permanent schedule: a schedule planned through the Long Term Planning process

Schedules may be overridden on a particular day as follows:

  • A permanent schedule ('P') may be overridden by an overlay ('O') or planned cancellation ('C')
  • An STP schedule ('N') may be overridden by a planned cancellation ('C')

If two schedules appear to be valid for a particular day, the schedule with the lowest alphabetical STP indicator wins.

Schedules

A schedule comprises 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.

  • Originating locations will always have a WTT departure time and optionally a public departure time
  • 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
  • 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
  • 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).
  • A location may have engineering, pathing or performance allowances

Associations

Associations are relationships between two schedules - a main train and an associated train.

There are three types of association:

  • NP - Next Train. Not present for all schedules, but indicates the UID of the next service that the vehicle on this service will work
  • JJ - Join. Occurs at the end of the associated train's schedule.
  • VV - Split. Occurs at an intermediate location of the main train's schedule and indicates another train services that part of this train will form.

Associations may be for the same day (S), or cross midnight either backward (P) or forward (N) depending on the date indicator field.