feat: Too fast trip travel speed - #710
Conversation
- implement new validation rule - implement GeoUtil class - draft unit tests - create new notice - update RULES.md
- write new logic rule - additional unit tests - update RULES.md
# Conflicts: # RULES.md
# Conflicts: # RULES.md
|
This PR relies on a dependency that is not supported by Google, as a result, the implementation of this new rule is postponed until @aababilov evaluates possibilities #708 (comment) |
* Only process each trip once * Refactor forEach to simple loop to clarify behavior * Refactor distance variables and method to use double instead of float and int * Refactor utility method signature to remove need for trip object * Cleanup docs - remove references to "error" * Add docs for method of distance calculation * Fix existing tests
# Conflicts: # RULES.md # main/src/main/java/org/mobilitydata/gtfsvalidator/util/GeospatialUtil.java # main/src/main/java/org/mobilitydata/gtfsvalidator/validator/StopTooFarFromTripShapeValidator.java # main/src/test/java/org/mobilitydata/gtfsvalidator/util/GeospatialUtilTest.java # main/src/test/java/org/mobilitydata/gtfsvalidator/validator/StopTooFarFromTripShapeValidatorTest.java
…/gtfs-validator into fix-stop-too-far-from-shape
- draft one more unit test to verify the number of method invocations - make checkStopsWithinTripShape package private
- draft one more unit test to verify the number of method invocations - make checkStopsWithinTripShape package private
Mockito captures parameters by reference and not value, so we get the final state of the cache, not the state after each method invocation
stop_times.txt should only have stops location_types 0 and 4, so validation for that can be done elsewhere.
stop_times.txt should only have stops location_types 0 and 4, so validation for that can be done elsewhere.
This also has the effect of using Euclidean instead of Geodetic buffers, which saves execution time and likely memory, and doesn't seem to result in a level of error that causes problems. So the tradeoff of performance vs. accuracy seems acceptable. See #750 (comment) for details.
…o too-fast-travel
- split validator method - add javadocs
barbeau
left a comment
There was a problem hiding this comment.
Thanks @lionel-nj! Some comments in-line.
# Conflicts: # main/src/main/java/org/mobilitydata/gtfsvalidator/validator/StopTooFarFromTripShapeValidator.java # main/src/test/java/org/mobilitydata/gtfsvalidator/validator/StopTooFarFromTripShapeValidatorTest.java
- check algorithm on non-timepoints stop times - check algorithm on StopTimeWithArrivalBeforePreviousDepartureTimeNotice case
- handle non-timepoints stop times - handle StopTimeWithArrivalBeforePreviousDepartureTimeNotice situation - rework checkSpeedAlongTrip to take tripId and tripStopTimes as a list - as two parameters - update javadocs
barbeau
left a comment
There was a problem hiding this comment.
Thanks @lionel-nj, looks pretty good! A few more items in-line.
- refactor for consistency - beginStopSequence: rework rule logic to no longer maintain a list on integer - rework tests for clarity - additional unit test - improve documentation TODO: finish test refactor + additional unit test for non time points fast and non fast travel
|
@barbeau reading #765 (comment): it seems like I implemented the solution 2 you suggested.
|
Done. I also reworked the tests to ease clarity and reading. @barbeau |
| @Test | ||
| public void fastTravelFarStopsShouldGenerateNotice() { | ||
| // sample table descriptions available at: | ||
| // https://gist.github.com/lionel-nj/d21cc8b1519d4f44f9ebd53858cda78d |
closes #517
Please review after #708
Summary:
This PR implements a new validation rule: check trip travel is reasonable.
Expected behavior:
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle testto make sure you didn't break anything[ ] Include screenshot(s) showing how this pull request works and fixes the issue(s)