Skip to content

Every bus stop, route and timetable, using (Geo)Django and things

License

Notifications You must be signed in to change notification settings

kylecaswell/bustimes.org

 
 

Repository files navigation

Python application

Coverage

What's this?

Source code for the website bustimes.org.

It's a magnificent monolithic Django app that's evolved over time (since 2015). The structure doesn't make complete sense:

app concern
buses contains the site settings.py
busstops bus stops - but also operating companies, places, and routes 🤯 and all the site CSS and JavaScript
bustimes getting timetable data out of various formats (GTFS, TransXChange, ATCO-CIF) and into a database and doing stuff therewith
vehicles tracking buses' locations and showing them on a map, and pointless details about vehicles' colours and features
departures listing the "next departures" at a bus stop – from a timetable and/or predicted by an API
disruptions information about like roadworks, diversions and stuff
vosa the Great Britain Traffic Commissioners' bus service registration data. VOSA is the name of a defunct UK government agency.

This documentation is incomplete and out of date. And that's OK (?) because I don't expect anyone to need to follow it. I will try to document some things for my own reference.

Installing

Python 3.9 is required. Use Pipenv to install the Python dependencies (Django, etc):

pipenv --python 3.9
pipenv install --dev

There are also some JavaScript dependencies:

npm install

Importing data

Static data (stops, timetables, etc)

import.sh will download data from various sources and run the necessary Django management commands to import it. When run repeatedly, it will only download and import the stuff that's changed. It expects to be run from the data directory. It needs a username and password for the Traveline National Dataset step.

Live data

Some "live" data – departure times at stops, and vehicle locations – is/are fetched as and when a user accesses a page.

For the rest, there are some Django management commands that need to be run indefinitely in the background. These update the big map of bus locations, etc.

About

Every bus stop, route and timetable, using (Geo)Django and things

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 84.2%
  • HTML 8.5%
  • JavaScript 4.1%
  • SCSS 2.5%
  • Shell 0.5%
  • VCL 0.2%