This repository is responsible for TransLink related tasks for UBC Live
- Data is retrieved from TransLink's GTFS Static and GTFS-Realtime APIs.
- Static data (routes, stops, stop times, trips) is provided in CSV format.
- Realtime data (vehicle positions, trip updates. service alerts) is provided in Protocol Buffer (.pb) format which is coverted into JSON.
route_number Public bus route number derived from GTFS static
"99vehicle_id Unique identifier for the bus reporting real-time data.
"8137"latitude, longitude Current GPS coordinates of the bus from the realtime feed.
49.2637,-123.16814timestamp The UNIX timestamp when the update was recorded. Converted to ISO-8601 for consistency.
"2025-11-15T23:45:02Z"stop_id ID of the upcoming stop the bus is traveling toward. Comes directly from stopId in the vehicle position entity.
"59"current_stop_sequence Index of the stop along the trip pattern according to GTFS-Realtime.
15arrival_estimate (derived) Estimated arrival time (in minutes) until the vehicle reaches stop_id. Computed by our pipeline (TransLink does not provide this directly).
3occupancy Crowding level of the bus. Only present when TransLink includes congestionLevel.
"FULL"
"MANY_SEATS"
"EMPTY"
route_number,vehicle_id,latitude,longitude,timestamp,stop_id,current_stop_sequence,arrival_estimate,occupancy
"99","8137",49.2637,-123.16814,"2025-11-15T23:45:02Z","59",15,3,"MANY_SEATS"- Raw data will be in
data/raw/and cleaned data indata/raw/clean/. - Note: The format of the data or CSV file may be changed as requirements evolve
-
Clone the repository
git clone https://github.com/UBC-Live/Translink.git cd Translink -
Create virtual environment
python3 -m venv venv source venv/bin/activateTo deactivate:
deactivate
-
Set up environment variables Create a copy .env.example contents into a new .env file, then put in API information. Copy .env.example contents into a new .env file, then put in API information. This file is local and should not be pushed, as specified in .gitignore
-
Install dependencies
pip install -r requirements.txt