Code Monkey home page Code Monkey logo

Matching timetabled bus journeys to archived real-time bus trips

The scripts in this repository attempt to match real-time bus position information against timetabled journeys and to present the results as a table from which trips and journeys can be viewed on a map.

This document provides instructions for installing them on the TFC platform. See DESCRIPTION.md for a more general description and instructions for a stand-alone installation.

Installation

  1. Clone this repository in the home directory of the tfc_prod user

  2. cd timetable_matching

  3. mkdir -p /mnt/sdb1/tfc/cam_tt_matching/json

  4. mkdir -p /mnt/sdb1/tfc/tnds/sections

  5. ln -s /mnt/sdb1/tfc/cam_tt_matching/ /media/tfc/cam_tt_matching

  6. ln -s /mnt/sdb1/tfc/tnds/ /media/tfc/tnds

  7. (as root) cp nginx/tt_matching.conf /etc/nginx/includes2/

  8. (as root) service nginx restart

  9. python3 -m venv venv

  10. pip install -r requirements.txt

  11. cp setup_environment.skel setup_environment. Edit setup_environment to set at least API_TOKEN, TNDS_USERNAME and TNDS_PASSWORD (or copy from one of the other servers). The default values of the other variables should be fine.

The script refresh_timetable.sh will fetch a copy of the requred timetable files into /media/tfc/tnds. It runs no more than once every 2 hours and only fetched timetable data when it changes.

The script process_day.sh (which itself runs refresh_timetable.sh) takes zero or more 'YYYY-MM-DD' command-line parameters and generates merged data files for the corresponding days. If run with no command-line parameters it generates merged data files for "yesterday". It shouldn't be run for a day that doesn't have complete trip data (like 'today').

On tfc-app4, tfc_prod's crontab file has run process_day.sh daily at 02:45 since late September 2018:

# Extract yesterday's timetable and journeys
45 2 * * * cd /home/tfc_prod/timetable_matching/ && ./process_day.sh >/var/log/tfc_prod/process_day.err 2>&1 && echo $(date --iso-8601=seconds) > /var/log/tfc_prod/process_day.timestamp

The web interface for interrogating the analysed data is at http://<hostname>/backdoor/tt_matching/index.html. It needs to be run with a query parameter identifying the day to analyse, e.g.

http://<hostname>/backdoor/tt_matching/index.html?2018-10-01

Jon Warbrick's Projects

Jon Warbrick doesnโ€™t have any public repositories yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.