From 8e4cdaf32e6ed1d1d622adbe50fd7d291e2c100d Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Mon, 30 Sep 2019 13:58:25 -0400 Subject: [PATCH] fix(validator): fix false pos. missing stop_time#shape_dist_traveled Do not check for missing shape_dist_traveled value on the first stop time record in a sequence. Many feeds omit this value instead of writing 0.0, which causes excessive noise in validation results. --- .../com/conveyal/gtfs/validator/SpeedTripValidator.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/conveyal/gtfs/validator/SpeedTripValidator.java b/src/main/java/com/conveyal/gtfs/validator/SpeedTripValidator.java index 31f13235f..0c8fc6528 100644 --- a/src/main/java/com/conveyal/gtfs/validator/SpeedTripValidator.java +++ b/src/main/java/com/conveyal/gtfs/validator/SpeedTripValidator.java @@ -55,8 +55,11 @@ public void validateTrip(Trip trip, Route route, List stopTimes, List< Stop currStop = stops.get(i); // Distance is accumulated in case times are not provided for some StopTimes. distanceMeters += fastDistance(currStop.stop_lat, currStop.stop_lon, prevStop.stop_lat, prevStop.stop_lon); - // Check that shape_dist_traveled is increasing. - checkShapeDistTraveled(prevStopTime, currStopTime); + // Check that shape_dist_traveled is increasing. Note: we skip checking the first index because it appears + // to be a common practice for agencies to omit a 0.0 value during export. Because most feed consumers + // likely will just default a missing value to 0.0, we skip this check because it causes excessive noise in + // validation results. + if (beginIndex > 0) checkShapeDistTraveled(prevStopTime, currStopTime); if (missingBothTimes(currStopTime)) { // FixMissingTimes has already been called, so both arrival and departure time are missing. // The spec allows this. Other than accumulating distance, skip this StopTime. If this stop_time serves @@ -93,7 +96,7 @@ public void validateTrip(Trip trip, Route route, List stopTimes, List< } /** - * Register shape dist traveled error if current stop time has a value AND either and the previous value is + * Register shape dist traveled error if current stop time has a value AND either the previous value is * missing (if at least one stop time has a value, all stop times for the trip should) OR if current value * is less than or equal to the previous value. Note: if the previous shape_dist_traveled value is present and the * current value is missing, the previous value will be greater than the current stop time's value because