-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set pickup/drop_off _type on in-seat transfers (#21)
* Set pickup/drop_off _type on in-seat transfers If a transfer is in_seat, passengers should be able to embark at the last stop of the from_trip of the continuation, and disembark at the first stop of the to_trip of the continuation. Update the stop_times to reflect this. Update a simple test case to ensure that this transformation is applied. * Add test case to make sure that pickup_type and dropoff_type are correctly assigned in split-trip cases * PR comments * more PR comments
- Loading branch information
Showing
8 changed files
with
85 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from gtfs_loader.schema import TransferType, PickupType | ||
|
||
def set_pickup_drop_off(gtfs): | ||
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 | ||
|
||
if transfer_type in TransferType and transfer_type != TransferType.IN_SEAT: | ||
continue | ||
|
||
gtfs.stop_times[from_trip_id][-1].pickup_type = PickupType.REGULARLY_SCHEDULED | ||
gtfs.stop_times[to_trip_id][0].drop_off_type = PickupType.REGULARLY_SCHEDULED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/test_competing_continuations_on_same_day/expected_linear/stop_times.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
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 | ||
loop,0,nelson-tc,11:41:00,11:41:00,0,0,,,,,, | ||
loop,1,3-08,11:48:00,11:48:00,0,0,,,,,, | ||
loop,2,3-12,11:51:00,11:51:00,0,0,,,,,, | ||
loop,3,nelson-tc,11:56:00,11:56:00,0,0,,,,,, | ||
trip_1_b2t:if_fri-sat,0,castlegar-tc,11:00:00,11:00:00,0,1,,,,,, | ||
trip_1_b2t:if_fri-sat,1,nelson-tc,11:40:00,11:40:00,0,0,,,,,, | ||
trip_1_b2t:if_mon-tues-wed-thurs,0,castlegar-tc,11:00:00,11:00:00,0,1,,,,,, | ||
trip_1_b2t:if_mon-tues-wed-thurs,1,nelson-tc,11:40:00,11:40:00,1,0,,,,,, | ||
trip_3_b2t:if_fri-sat,0,nelson-tc,11:59:00,11:59:00,0,0,,,,,, | ||
trip_3_b2t:if_fri-sat,1,castlegar-tc,12:39:00,12:39:00,1,0,,,,,, | ||
trip_3_b2t:if_mon-tues-wed-thurs,0,nelson-tc,11:59:00,11:59:00,0,1,,,,,, | ||
trip_3_b2t:if_mon-tues-wed-thurs,1,castlegar-tc,12:39:00,12:39:00,1,0,,,,,, |
11 changes: 11 additions & 0 deletions
11
tests/test_competing_continuations_on_same_day/expected_standard/stop_times.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
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 | ||
loop,0,nelson-tc,11:41:00,11:41:00,0,0,,,,,, | ||
loop,1,3-08,11:48:00,11:48:00,0,0,,,,,, | ||
loop,2,3-12,11:51:00,11:51:00,0,0,,,,,, | ||
loop,3,nelson-tc,11:56:00,11:56:00,0,0,,,,,, | ||
trip_1,0,castlegar-tc,11:00:00,11:00:00,0,1,,,,,, | ||
trip_1,1,nelson-tc,11:40:00,11:40:00,0,0,,,,,, | ||
trip_3_b2t:if_fri-sat,0,nelson-tc,11:59:00,11:59:00,0,0,,,,,, | ||
trip_3_b2t:if_fri-sat,1,castlegar-tc,12:39:00,12:39:00,1,0,,,,,, | ||
trip_3_b2t:if_mon-tues-wed-thurs,0,nelson-tc,11:59:00,11:59:00,0,1,,,,,, | ||
trip_3_b2t:if_mon-tues-wed-thurs,1,castlegar-tc,12:39:00,12:39:00,1,0,,,,,, |
18 changes: 9 additions & 9 deletions
18
tests/test_competing_continuations_on_same_day/input/stop_times.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
trip_id,stop_sequence,stop_id,arrival_time,departure_time | ||
trip_1,0,castlegar-tc,11:00:00,11:00:00 | ||
trip_1,1,nelson-tc,11:40:00,11:40:00 | ||
loop,0,nelson-tc,11:41:00,11:41:00 | ||
loop,1,3-08,11:48:00,11:48:00 | ||
loop,2,3-12,11:51:00,11:51:00 | ||
loop,3,nelson-tc,11:56:00,11:56:00 | ||
trip_3,0,nelson-tc,11:59:00,11:59:00 | ||
trip_3,1,castlegar-tc,12:39:00,12:39:00 | ||
trip_id,stop_sequence,stop_id,arrival_time,departure_time,pickup_type,drop_off_type | ||
trip_1,0,castlegar-tc,11:00:00,11:00:00,0,1 | ||
trip_1,1,nelson-tc,11:40:00,11:40:00,1,0 | ||
loop,0,nelson-tc,11:41:00,11:41:00,0,1 | ||
loop,1,3-08,11:48:00,11:48:00,0,0 | ||
loop,2,3-12,11:51:00,11:51:00,0,0 | ||
loop,3,nelson-tc,11:56:00,11:56:00,1,0 | ||
trip_3,0,nelson-tc,11:59:00,11:59:00,0,1 | ||
trip_3,1,castlegar-tc,12:39:00,12:39:00,1,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,,,,,, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |