TransitFlow is a backend API built with FastAPI that reads GO Transit GTFS files (CSV format) and provides clean, developer-friendly endpoints for:
- Listing and searching routes
- Listing and searching stops
- Predicting crowd levels (prototype model for now)
For now, all data is read directly from CSV files so itโs quick and easy to test without setting up a database.
- Python 3.11+
- FastAPI โ high-performance API framework
- Uvicorn โ ASGI server
- Pydantic โ data validation & serialization
- GTFS CSV โ public transit data format (
routes.txt,stops.txt, etc.)
| Method | Endpoint | Description |
|---|---|---|
| GET | /routes |
List/search routes |
| GET | /routes/{route_id} |
Get route details |
| GET | /stops |
List/search stops |
| GET | /stops/{stop_id} |
Get stop details |
| GET | /predict |
Predict crowd level for a route & stop |
Right now, the predict endpoint uses a placeholder. The goal is to replace it with a trained model that considers:
- Historical ridership patterns from CSV/GTFS + public reports
- Time-based trends โ weekday rush hours, weekend lows
- Stop-specific patterns โ since some stops are always busier (based on real rider experience)
- Special events & anomalies โ game days, holidays, weather
Example model approach:
- Start with rule-based logic (e.g., โIf weekday 7โ9 AM and stop in downtown core โ high crowdโ)
- Transition to a machine learning model once enough data is collected
- Use personal ride knowledge as seed training data to bootstrap predictions before large-scale datasets are integrated