WIP Supabase Bus Stalking Project
Go to file Use this template
projectmoon f2f5236e2e One row per bus position entry. TimescaleDB! 2024-04-10 10:38:35 +02:00
supabase One row per bus position entry. TimescaleDB! 2024-04-10 10:38:35 +02:00
.gitignore initial commit - bus funcs 2024-04-09 23:05:05 +02:00
README.md One row per bus position entry. TimescaleDB! 2024-04-10 10:38:35 +02:00

README.md

Jokullbase

How to track how late buses are:

  • Download bus route data
  • Insert raw bus positions into timescaledb/postGIS table?
    • "Fan-out" JSON responses into one DB row per datapoint.
  • Download routes.
    • There is an endpoint called Timetable, which takes a route number (along with day of week etc).
    • The timetable response includes a list of stops in the route, along with the route ID.
    • There is an endpoint called BusLocationByStop, which takes a stop ID as a parameter.
      • This information has upcoming arrivals, included estimated arrival time, along with the current position of the bus.
    • Record stop info every few minutes, notably the arrivals.
  • Analyze actual arrival vs what the stop endpoint said about the arrival.
    • Use PostGIS to compute "bus arrived" event: When bus is within X meters of a stop on its route, mark that as an arrival event.
    • Once we have bus arrival events, we can compare them to arrivals throughout the day.
    • We can then discard the raw bus position data, as it's not needed to store it: delete every raw data point between the last arrival and the newly computed one.