Going down to Trainhack, we had some trouble knowing if we should get off at an earlier stop, and in that case, which, because of the fire in Hässleholm. As we were already on the train, planning a new route was time sensitive. Inspired by our experiences, we built an application that for a given train trip shows alternative routes along each stop of the route.
We use Samtrafiken’s GTFS data to find the stops of a trip, and the Resrobot Reseplanerare to find alternative routes. The frontend is built with React and contains the logic regarding which stops should be considered and what alternative routes to display. The backend is built with Tornado which provides the endpoints the frontend uses to get stops and routes, and SQLAlchemy which is used to index the (very large) GTFS data into a queryable SQLite database.
The application is live at https://thundertrain.now.sh. The code is MPL-licensed and available at https://github.com/team-thunder-train/trainhack2019.