Open radumas opened 7 years ago
@bowenwen totally knows my bias here, but I'd recommend writing the API spec in YAML as you wish it existed, using the Swagger Editor: http://editor.swagger.io/#/
Then you can version control that yaml, and rig up an actual API proxy later :)
So I actually think this might also solve #13 as well, since there are a few tools for archiving , analysing, and visualizing GTFS-Real Time data.
Here's the GTFS-RT spec, the first post will be updated with a list of tasks
FeedMessage
+----FeedHeader
| +----gtfs_realtime_version: '2.0'
| +----incrementality: FULL_DATASET enum
| +----timestamp: POSIX
+----FeedEntity
| +----id (see EntitySelector)
| +----TripUpdate
| | +----TripDescriptor
| | | +---- trip_id (gtfs trip_id) if trip_id can be determined, the rest of the fields are
| | | +---- route_id
| | | +---- direction_id
| | | +---- start_time (ISO)
| | | +---- start_date (YYYYMMDD)
| | | +---- schedule_relationship:
| | | +-SCHEDULED if we can match to a trip_id
| | | +-ADDED if we can't. If ADDED then there should be no trip_id, and the other fields are necessary
| | +---- VehicleDescriptor
| | | +---- id
| | +---- StopTimeUpdate
| | | +---- stop_sequence
| | | +---- arrival StopTimeEvent
| | | | +---- time (POSIX)
| | | | +---- uncertainty (omit if prediction, 0 if arrived)
| | | +---- schedule_relationship: [SCHEDULED, SKIPPED, NO_DATA]
| | +---- timestamp (POSIX) vehicle timestamp
| +---- Alert (could be used to merge data from TTC website, I'll get back to this)
| | +----
I forked the this project, recommended on the GTFS slack, it generates a GTFS-RT API from a database. I think our steady state solution could be:
Got the package installed and built. Small problem is it's designed for surface vehicles, so default is taking in GPS positions of vehicles, not sure what is need to transform to trip updates (predicted arrival time for a headway service). Would need to modify at least two things:
Having the scraper generate GTFS-RT data would have two benefits:
This requires generating GTFS-RT in real... time, and then also reprocessing the archive of data.