-
Notifications
You must be signed in to change notification settings - Fork 100
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
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
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.
Thanks @lionel-nj! Some comments in-line.
...src/main/java/org/mobilitydata/gtfsvalidator/validator/StopTooFarFromTripShapeValidator.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidatorTest.java
Outdated
Show resolved
Hide resolved
main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidatorTest.java
Outdated
Show resolved
Hide resolved
main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidatorTest.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
# 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
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.
Thanks @lionel-nj, looks pretty good! A few more items in-line.
main/src/main/java/org/mobilitydata/gtfsvalidator/notice/FastTravelBetweenStopsNotice.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
main/src/main/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidator.java
Outdated
Show resolved
Hide resolved
main/src/test/java/org/mobilitydata/gtfsvalidator/validator/TripTravelSpeedValidatorTest.java
Outdated
Show resolved
Hide resolved
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.
LGTM
- 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 |
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.
LGTM, thanks @lionel-nj
@Test | ||
public void fastTravelFarStopsShouldGenerateNotice() { | ||
// sample table descriptions available at: | ||
// https://gist.github.com/lionel-nj/d21cc8b1519d4f44f9ebd53858cda78d |
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.
💯 On the Gist with the table
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 test
to make sure you didn't break anything[ ] Include screenshot(s) showing how this pull request works and fixes the issue(s)