-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import route_directions.txt, if present #73
base: master
Are you sure you want to change the base?
Conversation
Begin addition of non-standard route_direction.txt
Finished specification of model for RouteDirection. Added basic tests and configurations.
Add RouteDirection to feed.py to get route_directions.txt to import. Modified associated tests to account for new optional file.
This adresses #63 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, and mirrors the standards of existing code nicely. I'd like to do some manual testing before merging. If you know of a feed smaller than TriMet that uses this, I'd appreciate it 😄 .
route = models.ForeignKey( | ||
'Route', null=True, blank=True, | ||
help_text="Route for which this direction description applies.", | ||
on_delete=models.CASCADE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 adding the on_delete
method
class RouteDirection(Base): | ||
"""Associate a name with a Route and Direction | ||
|
||
Maps to non-standard route_directions.txt in GTFS feed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any online docs for the format of this file that we could link here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the best approach would be for me to create a section for it under Optional Files
in docs/gtfs.rst
? I could do that this afternoon and add to this PR.
The closest thing to documentation seems to be this discussion, which mainly discusses adding this info to trips.txt, but the final paragraph of the final post in that thread explains why a route_directions.txt
would be a better approach and seems to be where it was first suggested. Guessing people ran off with it after that.
Sure thing! Albany: http://transitfeeds.com/p/albany-transit-system/435/latest Those each seem to import in under five seconds. 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good. There are some follow-on actions that come to mind:
- Add documentation (gtfs.html is the right place, maybe in a new section)
- Register an admin class (admin.py)
- Add a list and detail view to the example app, and link from the route detail (exploreapp/templates/multigtfs)
I think the change is useful without this, so I'd be happy to merge this PR as-is and create issues for the follow-on tasks.
Sorry, some stuff came up and I got sidetracked from this. I'll block out time to get those follow-on actions added tomorrow and Thursday and commit them to this pull request, unless it works better for you to have them in a separate PR. |
Not a problem, and thanks for the work so far! I think the example app is the most work and the lowest priority, so focus on the other bits when you have time. |
We have reviewed this PR as well as extensible model in #83 and the later solution would be better for including non-standard models into multigtfs. |
Some providers, notably TriMet, provide a route_directions.txt file that associates a
route_id
anddirection_id
with a human-readable name. This data is valuable and can be much more convenient to use than trying to divine this information usingStopTime.stop_headsign
— especially with the larger feeds.This PR implements the RouteDirection model and was based largely on existing models.
In addition to passing automated tests, I tested this with a few recent TriMet and C-TRAN feeds (which do not have
route_directions.txt
) and imports occurred as expected.