Inspiration
The idea came from a common problem: transit apps often show an arrival time, but they do not clearly explain why a vehicle may be late or how outside conditions such as weather, traffic, construction, holidays, and nearby events affect the trip.
About the project
Milk Transit is a TTC-focused transportation assistant for Toronto commuters. The project combines a map-based TTC experience with an AI assistant called Milk bot. Users can explore nearby TTC stops, check predicted arrivals, search destinations, plan trips, and ask natural language questions such as: "When is the 501 coming?", "Why is my route slow?", "How is traffic right now?", or "Recommend food near CN Tower."
Milk supports questions about arrivals, delays, traffic, weather, construction, accidents, events, holidays, crowding, navigation, recommendations, Toronto guides, and route information. The app now also uses TTC GTFS-Realtime trip updates when available, so arrival estimates can be based on live TTC data instead of only static schedules.
What the app does
The project includes:
Milk bot
- A chatbot for TTC and local travel questions.
- Supports arrivals, delays, weather, traffic, events, holidays, crowding, navigation, recommendations, guide/itinerary planning, route terminals, and help.
- Uses location context from the map when the user asks "around me" or "near me."
- Keeps conversation context for follow-up questions.
- Supports English, Chinese, and French responses.
- Uses Gemini for intent classification and answer verification, while the actual transit answers come from structured APIs and local data.
Interactive TTC map
- Shows nearby TTC stops.
- Displays selected stops, available routes, and route directions.
- Supports map centering and a small "return to my location" button.
- Preserves the correct main-map state when users open and close report screens.
Destination search
- Searches TTC stops, addresses, landmarks, restaurants, parks, attractions, and shopping destinations.
- Uses online geocoding through Photon and Nominatim/OpenStreetMap.
- Keeps recent search history locally.
Trip planning and navigation
- Uses OpenTripPlanner 2.8 for walking, biking, driving, and TTC routing.
- Shows route steps, ETA, arrival time, transit legs, destination pins, and boarding/get-off markers.
- Supports multiple travel modes, including transit, walking, driving, and biking.
Arrival prediction
- Uses local TTC GTFS data stored in SQLite for stops, routes, trips, and scheduled arrivals.
- Uses TTC GTFS-Realtime trip updates when available.
- Falls back to scheduled GTFS estimates when live data is unavailable.
- Shows ETA, route direction, timing source, available routes, and confidence.
Delay explanation
- Breaks delay into schedule, weather, traffic, accident, construction, event, holiday, and other offsets.
- Conceptually, the prediction is: $$ ETA_{final} = ETA_{schedule} + \Delta_{weather} + \Delta_{traffic} + \Delta_{accident} + \Delta_{construction} + \Delta_{event} + \Delta_{holiday} + \Delta_{other} $$
Live traffic and incident awareness
- Uses TomTom Traffic API when configured.
- Checks live traffic flow, congestion, road closures, incidents, accidents, and roadwork.
Weather-aware predictions
- Uses WeatherAPI for current weather and forecast data.
- Estimates whether rain, snow, wind, humidity, or poor conditions may affect TTC travel.
- Supports both current-weather and near-future forecast questions.
Construction awareness
- Uses Toronto road reconstruction GeoJSON data.
- Detects nearby construction projects and estimates construction-related delay based on distance from the route area.
Events and holidays
- Uses Ticketmaster Discovery API for Toronto sports games, concerts, festivals, and entertainment events.
- Uses Nager.Date for Canadian and Ontario public holidays.
Toronto recommendations
- For restaurant, attraction, park, shopping, and "things to do" questions, Milk bot can return Yelp-style recommendation results through SerpApi Yelp Search.
- If live Yelp data is unavailable, the app falls back to built-in Toronto guide places.
Account and memory support
- Users can sign up, log in, and log out locally.
- The app keeps recent search history, so repeated searches are easier.
How it was built
The frontend is built with React, TypeScript, Vite, Tailwind-style utility classes, and Leaflet for maps. The backend is an Express API server written in TypeScript and run with tsx.
The backend connects several services:
- TTC GTFS SQLite database for stops, routes, stop times, and scheduled arrivals.
- TTC GTFS-Realtime Trip Updates API for live arrival updates.
- OpenTripPlanner for navigation.
- OpenStreetMap data for geographic and routing support.
- Photon and Nominatim/OpenStreetMap for geocoding and destination search.
- WeatherAPI for current weather and forecast data, with a mock fallback.
- TomTom Traffic API for live traffic, incidents, accidents, closures, and roadwork.
- Ticketmaster Discovery API for Toronto events, with a local venue-based fallback.
- Nager.Date for Canadian/Ontario holidays, with a local fallback.
- Road construction GeoJSON for construction impact.
- SerpApi Yelp Search for live recommendation results.
- Gemini for Milk bot intent classification and response verification.
What we learned
We learned how to combine structured transit data, map interaction, route planning, external APIs, and AI classification into one user-facing assistant. A major lesson was that the AI should not replace deterministic transit logic. Instead, the AI works best as an interface layer: it understands the user's request, detects intent and location scope, and then routes the request to structured APIs and templates.
We also learned that explainability matters. A transit app becomes more useful when it can show not only when a vehicle is coming, but also why the estimate may change.
Challenges we ran into
The biggest challenges were:
Combining live and local data
- GTFS, GTFS-Realtime, OpenTripPlanner, weather, traffic, events, holidays, construction, and recommendation data all have different formats and reliability levels.
Preventing AI hallucination
- Milk bot should not invent TTC arrivals, stops, routes, or event details. The system uses structured data first and uses Gemini mainly for classification and answer verification.
Routing dates with GTFS
- The GTFS feed may not match the real current date, so the app maps the current weekday/time into the GTFS service window for OpenTripPlanner.
Balancing real-time and scheduled predictions
- TTC GTFS-Realtime data is useful, but it may not always contain a matching route and stop. The app needed a reliable fallback to static GTFS schedules.
Accomplishments that we're proud of
We are proud that Milkbot evolved into a multi-function transit assistant that can answer many different commuting and trip-planning questions. We are also proud of the explainable prediction system, which combines scheduled TTC data, live TTC updates, weather, traffic, construction, events, holidays, and AI-assisted natural language interaction.
We are especially proud that the app does not simply generate answers with AI. Instead, it uses real APIs, local transit data, and rule-based calculations, and then uses AI to make the experience easier for users to interact with.
What's next for Milk Transit - Transportation Prediction App
We plan to bring Milk Transit to iPhone and Android so users can access it more easily during real commutes. We also want to improve prediction accuracy by advancing our algorithm, adding more TTC service alerts, vehicle crowding data, and personalized route preferences.
Built With
- digitalocean
- express.js
- figma
- figma-make
- gemini-api
- leaflet.js
- react
- render
- typescript
- vercel
- vite
Log in or sign up for Devpost to join the conversation.