Skip to content

A UK rail timetable service. Has endpoints to: Provide details of individual services Provide departures/arrivals at a location Currently only supports schedules (loaded from CIF). Realtime (Darwin) is something for the future.

License

Notifications You must be signed in to change notification settings

Phils0/UkTimetableService

Repository files navigation

UkTimetableService

A simple timetable service for GB rail using aspnetcore.

It loads a GB timetable in the CIF file format and provides a simple API to query.

Build Status

API

  • /api/Timetable/service/C26193/2019-08-11 - request a service for a date using the TimetableUID
  • /api/Timetable/retailService/GW622100/2019-07-15 - request a service for a date using the Retail Service Id. Can be either 4 or 6 digit RSID. If 4 and has multiple services (generally associations) returns them all.
  • /api/Timetable/arrivals/SUR/2019-08-23T10:00:00 - arrivals at a location around a specific date time
  • /api/Timetable/departures/SUR/2019-08-23T10:00:00 - departures at a location around a specific date time
  • /api/Timetable/toc/GR/2019-07-30 - services for a train operating company (toc) on a specific date

Filtered responses

By default the arrivals, departures and toc endpoints filter out cancelled services.
There is a returnCancelledServices querystring parameter to allow callers to override this behavior.

All endpoints will by default filter out broken associations. If you want broken associations returned you can set the EnableDebugResponses setting in appSettings. This is a service wide setting.

Reference API

  • /api/Reference/location - locations grouped by CRS
  • /api/Reference/toc - tocs in timetable
  • /api/Reference/reasons/cancellation - Darwin cancellation reasons
  • /api/Reference/reasons/late - Darwin late reasons

The API has Swagger documentation which provides fuller details at /swagger

Timetable Data

It loads a timetable in the CIF file format. It can load an RDG timetable archive - zips named RJTTFnnn.ZIP and TTIS archives - zips named ttisnnn.zip where nnn is a 3 digit number. It has a dependency on loading the Master Station List (MSN) file from these archives to get the set of locations. Therefore it currently does not support the Network Rail version of the CIF which only has the timetable file.

This repo has powershell scripts to download the data

git clone https://github.com/phils0/RailOpenDataScripts

The data file needs to be placed in the Timetable.Web\Data directory

Edit Timetable.Web/appsettings.json, to set TimetableArchive to match the name of the downloaded timetable file.

Knowledgebase Data

Optionally can load some of the NRE knowledgebase files to provide additional names. Currently loads

  • stations
  • tocs

The data files need to be placed in the Timetable.Web\Data directory

Edit Timetable.Web/appsettings.json, to set StationKnowledgebase and TocKnowledgebase to match the name of the downloaded knowledgebase files.

More information about accessing these files can be found at https://wiki.openraildata.com/index.php?title=KnowledgeBase

Darwin Data - WIP

Optionally can load Darwin data. Currently only loads reference data.

Build and Test

Run dotnet build and dotnet test from the repos root directory (containing TimetableService.sln).

Alternatively open the solution TimetableService.sln in Visual Studio or Rider and it should just work.

Dependencies

It has dependencies on various other rail related open source projects to load the various data files:

About

A UK rail timetable service. Has endpoints to: Provide details of individual services Provide departures/arrivals at a location Currently only supports schedules (loaded from CIF). Realtime (Darwin) is something for the future.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages