Skip to content

Commit

Permalink
Merge pull request #384 from conveyal/missed-stop-area-update
Browse files Browse the repository at this point in the history
Update to include missed stop area updates
  • Loading branch information
Robin Beer authored Jul 10, 2023
2 parents 7826c92 + bbc4ce3 commit 5c383ab
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static GraphQLFieldDefinition field (String tableName) {
// queries which first get the fields to join to routes.
new JDBCFetcher("pattern_stops", "stop_id", null, false),
new JDBCFetcher("pattern_locations", "location_id", null, false),
new JDBCFetcher("pattern_location_groups", "location_group_id", null, false),
new JDBCFetcher("pattern_stop_areas", "area_id", null, false),
new JDBCFetcher("patterns", "pattern_id", null, false),
new JDBCFetcher("routes", "route_id")))
.build();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/conveyal/gtfs/model/StopTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ protected Iterator<StopTime> iterator() {
}

/**
* Check that the flex column 'start_pickup_drop_off_window' existing in the stop time table. If this column exists
* it is assumed that the other flex columns do too. This is to guard against cases where booking rules, location
* groups or locations are defined in a feed but flex specific stop time columns are not.
* Check that the flex column 'start_pickup_drop_off_window' exists in the stop time table. If this column exists
* it is assumed that the other flex columns do too. This is to guard against cases where booking rules, stop
* areas or locations are defined in a feed but flex specific stop time columns are not.
*/
private static boolean flexColumnExist(Connection connection, String tablePrefix) throws SQLException {
boolean exists = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ReferencesTripValidator extends TripValidator {
Set<String> referencedTrips = new HashSet<>();
Set<String> referencedRoutes = new HashSet<>();
Set<String> referencedLocations = new HashSet<>();
Set<String> referencedLocationGroups = new HashSet<>();
Set<String> referencedStopAreas = new HashSet<>();

public ReferencesTripValidator(Feed feed, SQLErrorStorage errorStorage) {
super(feed, errorStorage);
Expand Down Expand Up @@ -65,7 +65,7 @@ public void validateTrip(
});
stopAreas.forEach(stopArea -> {
if (stopArea != null) {
referencedLocations.add(stopArea.area_id);
referencedStopAreas.add(stopArea.area_id);
}
});
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public void complete (ValidationResult validationResult) {
List<StopArea> stopAreas = Lists.newArrayList(feed.stopAreas);
feed.stopTimes.forEach(stopTime -> {
if (FlexValidator.stopIdIsStopArea(stopTime.stop_id, stopAreas) &&
!referencedLocationGroups.contains(stopTime.stop_id)
!referencedStopAreas.contains(stopTime.stop_id)
) {
registerError(
getStopAreaById(stopAreas, stopTime.stop_id),
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/fake-agency/areas.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
area_id,area_name
1,"This is the area name"
area1,"This is the area name"
2 changes: 1 addition & 1 deletion src/test/resources/fake-agency/stop_areas.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
area_id,stop_id
1,123
area1,123
3 changes: 2 additions & 1 deletion src/test/resources/fake-agency/stop_times.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ trip_id,arrival_time,departure_time,stop_id,stop_sequence,stop_headsign,pickup_t
a30277f8-e50a-4a85-9141-b1e0da9d429d,07:00:00,07:00:00,4u6g,1,Test stop headsign,0,0,0.0000000,
a30277f8-e50a-4a85-9141-b1e0da9d429d,07:01:00,07:01:00,johv,2,Test stop headsign 2,0,0,341.4491961,
frequency-trip,08:00:00,08:00:00,4u6g,1,Test stop headsign frequency trip,0,0,0.0000000,
frequency-trip,08:29:00,08:29:00,1234,2,Test stop headsign frequency trip 2,0,0,341.4491961,
frequency-trip,08:29:00,08:29:00,1234,2,Test stop headsign frequency trip 1,0,0,0.0000000,
frequency-trip,08:30:00,08:30:00,area1,3,Test stop headsign frequency trip 2,0,0,0.0000000,
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@
"message" : "The long name of a route should complement the short name, not include it.",
"priority" : "LOW",
"type" : "ROUTE_LONG_NAME_CONTAINS_SHORT_NAME"
}, {
"count" : 1,
"message" : "This stop area is not referenced by any trips.",
"priority" : "MEDIUM",
"type" : "STOP_AREA_UNUSED"
}, {
"count" : 1,
"message" : "This stop is not referenced by any trips.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"agency" : 1,
"calendar" : 1,
"calendar_dates" : 1,
"errors" : 57,
"errors" : 56,
"routes" : 1,
"stop_times" : 6,
"stops" : 5,
Expand Down

0 comments on commit 5c383ab

Please sign in to comment.