A SQL Server database schema to load a UK timetable into plus a .Net Core app to load the data. The loader reads a full CIF timetable file into the database
The runLoader.ps1 script will create the schema (deleting any existing tables and data), load a timetable and then add some indices to the database.
It assumes its connecting to an existing local database using integrated security and the database is called Timetable.
CreateTimetable.sql will create the physical database in the default location. CreateTimetableRdg.sql creates a separate database called TimetableRdg should you want to have both.
runLoader.ps1 and Loader/Timetable/appSettings.json need to be updated with any different connection details
runLoadFullNrodFile.batshows how to callrunloader.ps1for a Network Rail cif file.runLoadFullRdgFile.batshows how to callrunloader.ps1for a RDG cif file.
Currently the loader has assumptions that it is reading in a full CIF in the format supplied by National Rail Open Data (NROD) or RDG. In the RDG case it loads the CIF file plus the Master Station file.
There are assumptions built into the loader that imply loading daily deltas files is problematic (it generates Ids during load, would need to select out of the database). I don't intend to implement this functionality given a full file is available everyday from NROD.
Due to the way database Ids are generated it created a quite nice unintended consequence that the Id is actually the line number of the record in the cif file. There is no guarantee this will always be the case.