-
Notifications
You must be signed in to change notification settings - Fork 2
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
Set pickup/drop_off _type on in-seat transfers #21
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||||||||
from gtfs_loader.schema import TransferType, PickupType | ||||||||||||
|
||||||||||||
def set_pickup_drop_off(gtfs): | ||||||||||||
from_trip_ids_to_set = set() | ||||||||||||
to_trip_ids_to_set = set() | ||||||||||||
for from_trip_id, transfers in gtfs.transfers.items(): | ||||||||||||
for transfer in transfers: | ||||||||||||
transfer_type = transfer.transfer_type | ||||||||||||
to_trip_id = transfer.to_trip_id | ||||||||||||
|
||||||||||||
if not (from_trip_id and to_trip_id): | ||||||||||||
continue | ||||||||||||
Comment on lines
+9
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I'm not a stickler for it but I usually leave a blank line between different if blocks |
||||||||||||
if transfer_type in TransferType and transfer_type != TransferType.IN_SEAT: | ||||||||||||
continue | ||||||||||||
|
||||||||||||
from_trip_ids_to_set.add(from_trip_id) | ||||||||||||
to_trip_ids_to_set.add(to_trip_id) | ||||||||||||
|
||||||||||||
for trip_id in from_trip_ids_to_set: | ||||||||||||
gtfs.stop_times.get(trip_id)[-1].pickup_type = PickupType.REGULARLY_SCHEDULED | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's necessary to use a set to collect Regardless, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ |
||||||||||||
for trip_id in to_trip_ids_to_set: | ||||||||||||
gtfs.stop_times.get(trip_id)[0].drop_off_type = PickupType.REGULARLY_SCHEDULED |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
trip_id,stop_sequence,stop_id,arrival_time,departure_time,start_pickup_drop_off_window,end_pickup_drop_off_window,pickup_type,drop_off_type,mean_duration_factor,mean_duration_offset,safe_duration_factor,safe_duration_offset | ||
trip_1,0,junction,22:00:00,22:00:00,,,0,0,,,, | ||
trip_1,1,slocan-park,22:01:00,22:01:00,,,0,0,,,, | ||
trip_1,2,slocan-city,22:02:00,22:02:00,,,0,0,,,, | ||
trip_1,3,nelson-tc,22:03:00,22:03:00,,,0,0,,,, | ||
trip_1,4,junction,22:04:00,22:04:00,,,0,0,,,, | ||
trip_2,0,junction,22:04:00,22:04:00,,,0,0,,,, | ||
trip_2,1,slocan-park,22:05:00,22:05:00,,,0,0,,,, | ||
trip_2,2,slocan-city,22:06:00,22:06:00,,,0,0,,,, | ||
trip_2,3,nelson-tc,22:07:00,22:07:00,,,0,0,,,, | ||
trip_2,4,junction,22:08:00,22:08:00,,,0,0,,,, | ||
trip_3,0,junction,22:08:00,22:08:00,,,0,0,,,, | ||
trip_3,1,slocan-park,22:09:00,22:09:00,,,0,0,,,, | ||
trip_3,2,slocan-city,22:10:00,22:10:00,,,0,0,,,, | ||
trip_3,3,nelson-tc,22:11:00,22:11:00,,,0,0,,,, | ||
trip_3,4,junction,22:12:00,22:12:00,,,0,0,,,, | ||
trip_id,stop_sequence,stop_id,arrival_time,departure_time,pickup_type,drop_off_type,start_pickup_drop_off_window,end_pickup_drop_off_window,mean_duration_factor,mean_duration_offset,safe_duration_factor,safe_duration_offset | ||
trip_1,0,junction,22:00:00,22:00:00,0,1,,,,,, | ||
trip_1,1,slocan-park,22:01:00,22:01:00,0,0,,,,,, | ||
trip_1,2,slocan-city,22:02:00,22:02:00,0,0,,,,,, | ||
trip_1,3,nelson-tc,22:03:00,22:03:00,0,0,,,,,, | ||
trip_1,4,junction,22:04:00,22:04:00,0,0,,,,,, | ||
trip_2,0,junction,22:04:00,22:04:00,0,0,,,,,, | ||
trip_2,1,slocan-park,22:05:00,22:05:00,0,0,,,,,, | ||
trip_2,2,slocan-city,22:06:00,22:06:00,0,0,,,,,, | ||
trip_2,3,nelson-tc,22:07:00,22:07:00,0,0,,,,,, | ||
trip_2,4,junction,22:08:00,22:08:00,0,0,,,,,, | ||
trip_3,0,junction,22:08:00,22:08:00,0,0,,,,,, | ||
trip_3,1,slocan-park,22:09:00,22:09:00,0,0,,,,,, | ||
trip_3,2,slocan-city,22:10:00,22:10:00,0,0,,,,,, | ||
trip_3,3,nelson-tc,22:11:00,22:11:00,0,0,,,,,, | ||
trip_3,4,junction,22:12:00,22:12:00,1,0,,,,,, |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
trip_id,stop_sequence,stop_id,arrival_time,departure_time | ||
trip_1,0,junction,22:00:00,22:00:00 | ||
trip_1,1,slocan-park,22:01:00,22:01:00 | ||
trip_1,2,slocan-city,22:02:00,22:02:00 | ||
trip_1,3,nelson-tc,22:03:00,22:03:00 | ||
trip_1,4,junction,22:04:00,22:04:00 | ||
trip_2,0,junction,22:04:00,22:04:00 | ||
trip_2,1,slocan-park,22:05:00,22:05:00 | ||
trip_2,2,slocan-city,22:06:00,22:06:00 | ||
trip_2,3,nelson-tc,22:07:00,22:07:00 | ||
trip_2,4,junction,22:08:00,22:08:00 | ||
trip_3,0,junction,22:08:00,22:08:00 | ||
trip_3,1,slocan-park,22:09:00,22:09:00 | ||
trip_3,2,slocan-city,22:10:00,22:10:00 | ||
trip_3,3,nelson-tc,22:11:00,22:11:00 | ||
trip_3,4,junction,22:12:00,22:12:00 | ||
trip_id,stop_sequence,stop_id,arrival_time,departure_time,pickup_type,drop_off_type | ||
trip_1,0,junction,22:00:00,22:00:00,0,1 | ||
trip_1,1,slocan-park,22:01:00,22:01:00,0,0 | ||
trip_1,2,slocan-city,22:02:00,22:02:00,0,0 | ||
trip_1,3,nelson-tc,22:03:00,22:03:00,0,0 | ||
trip_1,4,junction,22:04:00,22:04:00,1,0 | ||
trip_2,0,junction,22:04:00,22:04:00,0,1 | ||
trip_2,1,slocan-park,22:05:00,22:05:00,0,0 | ||
trip_2,2,slocan-city,22:06:00,22:06:00,0,0 | ||
trip_2,3,nelson-tc,22:07:00,22:07:00,0,0 | ||
trip_2,4,junction,22:08:00,22:08:00,1,0 | ||
trip_3,0,junction,22:08:00,22:08:00,0,1 | ||
trip_3,1,slocan-park,22:09:00,22:09:00,0,0 | ||
trip_3,2,slocan-city,22:10:00,22:10:00,0,0 | ||
trip_3,3,nelson-tc,22:11:00,22:11:00,0,0 | ||
trip_3,4,junction,22:12:00,22:12:00,1,0 |
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.
These variables have now become unused,