The delay accuracy does get pretty noticeable for longer delays (like say 20-min), namely since the avg speed of buses is usually closer to 20km/h. Use the scheduled times to get calculatedDelay.
- Adding a timeAlongRoute field to StopTimesWithLocation
- Generate it from departure_time (converted to be the number of seconds of the day)
- Then - get calculatedDelay from the difference in the timeAlongRoute - which will be based off the schedule; interpolate it between the two stops linearly based on the distance travelled