Transit Drivecycle creates a visualization of bus velocity profiles, energy consumption and state of charge using the Drivecycle python library and OSM data.
The GTFS data used in this project must have the shape_dist_traveled field to get linearly reference stop distances.
Download OSM data from geofabrik and save in /valhalla/data. This will be used to generate the routing graph in Valhalla. If needed you can clip your pbf file using Osmium.
Since we are using DuckDb-Wasm for the joining GTFS tables in the browser, we'll need to convert the GTFS csv files to Parquet. See this notebook for more information on using Pandas to convert csv to Parquet. Parquet files must be stored in an S3 bucket and referenced in frontend/src/parquet_files.js
If you would like to setup a traditional PostGIS/PostGres database instead of using DuckDb then you can use gtfs-via-postgres to ingest GTFS. This will require changes to the API in drivecycleapi to connect to the db (not currently implemented).
docker compose -f docker-compose-dev.yml up frontend-devdocker compose up
In a production environment Valhalla tiles must be built before copying to the production Valhalla container. The following should be included in Valhalla:
valhalla/
elevation_data/
valhalla_tiles.tar
CDK is used to deploy to AWS Fargate. To install deploy python requirements, run:
pip install -r requirements.txt
After installing the CDK cli, deploy to AWS using the following:
cdk deploy
The project uses a micro services architecture deployed to ECS using Fargate with a separate task definitions for each service. Service Connect is used for for inter-container networking using hostnames similar to Docker networks. A single Application Load Balancer is used to route traffic.

