Skip to content

Latest commit

 

History

148 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

thetrains

Website Code style: black

A project to gather, explore, analyse and present train related data collected primarily from the Network Rail feeds. Currently, a graphical representation of the UK rail network is generated from raw train movement data and presented using a Dash application. The live dashboard for this project is located at thetrains.co.uk.

The full deployment consists of four containers:

  1. mongo - A MongoDB database instance to persist all data.
  2. collector - A process to robustly gather a large volume of live train movement data from the Network Rail feeds for storage in the MongoDB instance.
  3. generator - A data transformation process that runs on a timer. Its purpose is to clean and process the raw train movement data to generate a novel graphical representation of the U.K rail network. A Fruchterman-Reingold force-directed algorithm is used for the estimation of node positions.
  4. dash - A Dash frontend application to display the generated graphical network alongside live network usage.

The wiki contains information on the projects inner workings.

Develop locally with docker-compose

First, a .env file containing all the required environment variables is needed. See .env.example for an example. It is recommended to modify this file and rename it to .env. To build and run all the containers locally run:

make build

You can then view the dash application at localhost:8000. To stop all the containers run:

make down

Deploy to Kubernetes cluster

First, the ./k8s/setup.yaml file needs to be modified for your cluster setup. Additionally, You will need both kubectl and skaffold for deployment.

To run the initial cluster setup run:

make k8s_setup

This step sets up the namespace, configuration, certificates, the application service and ingress. To build and push the containers to the GitHub container repository and then deploy to the cluster run:

make k8s_deploy

To continuously build and deploy to the cluster while you make changes run:

skaffold dev

Running the tests

The tests and other checking is run within a docker container, use by running:

make test

About

A personal project to produce a web based dash(flask) application to display the results of train related data analysis. The website for this code is at https://thetrains.co.uk/.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages