metrics-mvp icon indicating copy to clipboard operation
metrics-mvp copied to clipboard

Update routes for specific dates

Open Brian-Lee opened this issue 5 years ago • 4 comments

Fixes #626

Proposed changes

Get the feed from transitfeeds (https://api.transitfeeds.com/v1/getFeedVersions?key={your-key}3&feed=sfmta%2F60&page=1&limit=10&err=1&warn=1) Use get the last 10 (changeable) previous versions of the GTFS files. Use those files in save_routes.py to save routes to subfolders in /backend/data. Subfolders and files have date suffixs.

These older versions of route JSON files can then be used for historical queries. ...

Screenshot

folder_screenshot

... Tests: Command: python3 save_routes.py --agency trimet (saves route_v3a_trimet_2020-MM-DD) where MM-DD is today's date) ... Command: python3 save_routes.py --agency trimet --date 2000-02-02 (gives error "an active GTFS for this date was not found " as we don't have a GTFS file qualifying for 2002-02-02) ... Command: python3 save_routes.py --agency muni --date 2020-02-22 (saves routes_v3a_muni-2020-02-18 as gtfs-muni-2020-02-18.zip is the recentmost qualifying GTFS) image

...

...

Brian-Lee avatar Apr 24 '20 18:04 Brian-Lee

I made a bunch of changes and I think I addressed everything mentioned. However, I am not sure that the Nextbus files are working correctly. Shouldn't they also be in date versioned folders?

Brian-Lee avatar Apr 27 '20 22:04 Brian-Lee

Hey @Brian-Lee I'm really sorry for the delay in reviewing this, I'll be faster in the follow-ups. Getting closer, I've added some comments. Request a review from me in the PR whenever you're ready. Thanks!

No worries! Thanks for helping me!

Brian-Lee avatar May 21 '20 20:05 Brian-Lee

Just wondering, could you, in the PR description, write out a list of what you did to test your PR? A section on Tests is part of the PR template (not completely sure), so that's missing.

It should look something like this:

Tests: Command: python3 save_routes.py --agency trimet ... Command: python3 save_routes.py --agency trimet --date 2000-02-02 (should give error as we don't have a GTFS from then) ... Command: python3 save_routes.py --agency trimet --date 2020-02-22 ... (saves route_v3a_trimet_2020-02-22...)

Great suggestion. I put in a few hypothetical test cases. The actual results depend on the date and the contents of your directory.

Brian-Lee avatar May 22 '20 18:05 Brian-Lee

Eddy, does this look good at this point?

hathix avatar May 28 '20 01:05 hathix