All Projects → planarnetwork → dtd2mysql

planarnetwork / dtd2mysql

Licence: other
MySQL / MariaDB import for DTD feeds (fares, timetable and routeing)

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to dtd2mysql

linked-connections-server
Express based server that exposes Linked Connections.
Stars: ✭ 12 (-52%)
Mutual labels:  gtfs
dbt-databricks
A dbt adapter for Databricks.
Stars: ✭ 115 (+360%)
Mutual labels:  etl
etl
[READ-ONLY] PHP - ETL (Extract Transform Load) data processing library
Stars: ✭ 279 (+1016%)
Mutual labels:  etl
iOSDC2018APP
iOSDC2018 unofficial timetable application
Stars: ✭ 39 (+56%)
Mutual labels:  timetable
osmosfeed
Turn GitHub into an RSS reader
Stars: ✭ 839 (+3256%)
Mutual labels:  feed
jekyll-rss-feeds
Templates for rendering RSS feeds for your Jekyll blog
Stars: ✭ 639 (+2456%)
Mutual labels:  feed
NBi
NBi is a testing framework (add-on to NUnit) for Business Intelligence and Data Access. The main goal of this framework is to let users create tests with a declarative approach based on an Xml syntax. By the means of NBi, you don't need to develop C# or Java code to specify your tests! Either, you don't need Visual Studio or Eclipse to compile y…
Stars: ✭ 102 (+308%)
Mutual labels:  etl
python-ical-timetable
Python 生成 ics 格式的大学生课表,支持自定义课程周数和其他信息,支持定义教室 GPS 等信息
Stars: ✭ 49 (+96%)
Mutual labels:  timetable
web-front-end-rss
📙 根据 RSS 抓取最新前端技术文章,来源:前端早读课、前端大全、前端之巅、淘宝前端、张鑫旭博客、凹凸实验室等
Stars: ✭ 24 (-4%)
Mutual labels:  feed
DataX-src
DataX 是异构数据广泛使用的离线数据同步工具/平台,实现包括 MySQL、Oracle、SqlServer、Postgre、HDFS、Hive、ADS、HBase、OTS、ODPS 等各种异构数据源之间高效的数据同步功能。
Stars: ✭ 21 (-16%)
Mutual labels:  etl
instagram-widget-by-wpzoom
The easiest way to add a nice Instagram widget on your WordPress site. It just works!
Stars: ✭ 22 (-12%)
Mutual labels:  feed
concentrate
Concentrate: combine realtime transit files
Stars: ✭ 23 (-8%)
Mutual labels:  gtfs
chronicle-etl
📜 A CLI toolkit for extracting and working with your digital history
Stars: ✭ 78 (+212%)
Mutual labels:  etl
krawler
A minimalist (geospatial) ETL
Stars: ✭ 51 (+104%)
Mutual labels:  etl
simsttab
Simple timetabling engine for schools
Stars: ✭ 21 (-16%)
Mutual labels:  timetable
hive-metastore-client
A client for connecting and running DDLs on hive metastore.
Stars: ✭ 37 (+48%)
Mutual labels:  etl
pentaho-gis-plugins
🗺 GIS plugins for Pentaho Data Integration
Stars: ✭ 42 (+68%)
Mutual labels:  etl
atom
Library for serializing the Atom web content syndication format https://crates.io/crates/atom_syndication
Stars: ✭ 68 (+172%)
Mutual labels:  feed
wikirepo
Python based Wikidata framework for easy dataframe extraction
Stars: ✭ 33 (+32%)
Mutual labels:  etl
IITP-Connect
The Android app for the IIT Patna student community by the student community. 📱
Stars: ✭ 22 (-12%)
Mutual labels:  timetable

Travis npm npm David

An import tool for the British rail fares, routeing and timetable feeds into a database.

Although both the timetable and fares feed are open data you will need to obtain the fares feed via the ATOC website. The formal specification for the data inside the feed also available on the ATOC website.

At the moment only MySQL compatible databases are supported but it could be extended to support other data stores. PRs are very welcome.

Download / Install

You don't have to install it globally but it makes it easier if you are not going to use it as part of another project. The -g option usually requires sudo. It is not necessary to git clone this repository unless you would like to contribute.

npm install -g dtd2mysql

Fares

Each of these commands relies on the database settings being set in the environment variables. For example DATABASE_USERNAME=root DATABASE_NAME=fares dtd2mysql --fares-clean.

Import

Import the fares into a database, creating the schema if necessary. This operation is destructive and will remove any existing data.

dtd2mysql --fares /path/to/RJFAFxxx.ZIP

Clean

Removes expired data and invalid fares, corrects railcard passenger quantities, adds full date entries to restriction date records. This command will occasionally fail due to a MySQL timeout (depending on hardware), re-running the command should correct the problem.

dtd2mysql --fares-clean

Timetables

Import

Import the timetable information into a database, creating the schema if necessary. This operation is destructive and will remove any existing data.

dtd2mysql --timetable /path/to/RJTTFxxx.ZIP

Convert to GTFS

Convert the DTD/TTIS version of the timetable (up to 3 months into the future) to GTFS.

dtd2mysql --timetable /path/to/RJTTFxxx.ZIP
dtd2mysql --gtfs-zip filename-of-gtfs.zip

Routeing Guide

Import

dtd2mysql --routeing /path/to/RJRGxxxx.ZIP
# optional
dtd2mysql --nfm64 /path/to/nfm64.zip 

Download from SFTP server

The download commands will take the latest full refresh from an SFTP server (by default the DTD server).

Requires the following environment variables:

SFTP_USERNAME=dtd_username
SFTP_PASSWORD=dtd_password
SFTP_HOSTNAME=dtd_hostname (this will default to dtd.atocrsp.org)

There is a command for each feed

dtd2mysql --download-fares /path/
dtd2mysql --download-timetable /path/
dtd2mysql --download-routeing /path/
dtd2mysql --download-nfm64 /path/

Or download and process in one command

dtd2mysql --get-fares
dtd2mysql --get-timetable
dtd2mysql --get-routeing
dtd2mysql --get-nfm64

Notes

null values

Values marked as all asterisks, empty spaces, or in the case of dates - zeros, are set to null. This is to preverse the integrity of the column type. For instance a route code is numerical although the data feed often uses ***** to signify any so this value is converted to null.

keys

Although every record format has a composite key defined in the specification an id field is added as the fields in the composite key are sometimes null. This is no longer supported in modern versions of MariaDB or MySQL.

missing data

At present journey segments, class legends, rounding rules, print formats and the fares data feed meta data are not imported. They are either deprecated or irrelevant. Raise an issue or PR if you would like them added.

timetable format

The timetable data does not map to a relational database in a very logical fashion so all LO, LI and LT records map to a single stop_time table.

GTFS feed cutoff date

Only schedule records that start up to 3 months into the future (using date of import as a reference point) are exported to GTFS for performance reasons. This will cause any data after that point to be either incomplete or incorrect, as override/cancellation records after that will be ignored as well.

Contributing

Issues and PRs are very welcome. To get the project set up run

git clone [email protected]:planarnetwork/dtd2mysql
npm install --dev
npm test

If you would like to send a pull request please write your contribution in TypeScript and if possible, add a test.

License

This software is licensed under GNU GPLv3.

Copyright 2017 Linus Norton.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].