umts / bojangles

Ruby script for monitoring the PVTA realtime bus departures feed
MIT License
0 stars 0 forks source link

Use & cache GTFS feed for comparison #3

Closed dfaulken closed 8 years ago

dfaulken commented 8 years ago

@werebus suggested using the GTFS feed for deciding when the PVTA realtime feed should be displaying one bus or another.

Since it's a large CSV file, some caching will need to be done there - probably a separate script which grabs the export, parses it, and generates some kind of quickly-traversable file containing the data the every-5-minute script can use to determine when a given bus should be running. May run every day or so.

akaplo commented 8 years ago

An addition to this could be a simple catch-all for obvious issues before the code begins the GTFS checks.

For example, we could say something like the following pseudocode (which I just turned into one line after writing out almost compilable code that would've warranted switching to slack :stuck_out_tongue: ):

  if (time is_between 7am, 7pm && all_routes_are_done) send_email 
dfaulken commented 8 years ago

Sure, but on 7/4. 12/25 etc. we'd get emails every 5 minutes for 12 hours (opened #4 for this).

dfaulken commented 8 years ago

From @werebus:

screen shot 2016-02-07 at 4 17 34 pm

dfaulken commented 8 years ago

Downloading, unzipping, caching, and finding planned departure times within the next n minutes is done. Just need to compare the two and decide how to handle any discrepancies.

dfaulken commented 8 years ago

We can now query the realtime feed and get a data structure in the same format as returned by the GTFS parser.

Question for @werebus or @sherson: what departures should we expect the realtime feed to return? Is it the next n departures for a given route? Departures within the next n hours?

dfaulken commented 8 years ago

My question was answered in #10. This issue is covered (in less broad terms) by #7.