-
Notifications
You must be signed in to change notification settings - Fork 53
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
Repair Shared Stops Validator #584
Conversation
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.
Typo which I think has been there since the creation of shared stops, other than that I had a second to review this & it looks good!
src/main/java/com/conveyal/datatools/manager/jobs/validation/SharedStopsValidator.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.
Perhaps an issue around headers that might need addressing.
src/main/java/com/conveyal/datatools/manager/jobs/validation/SharedStopsValidator.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/manager/jobs/validation/SharedStopsValidator.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/manager/jobs/validation/SharedStopsValidator.java
Outdated
Show resolved
Hide resolved
int FEED_ID_INDEX = -1; | ||
|
||
try { | ||
configReader.setHeaders(new String[]{"stop_group_id", "feed_id", "stop_id", "is_primary"}); |
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.
My understanding is that you are setting the headers (and presumably the order) and then checking the index of each. I think the index will always be the same for each header as defined here.
Also, if the order in project.sharedStopsConfig
doesn't match this, the headers will be assigned to the wrong data column. To fix (assuming my understanding of this is correct) is to remove this line and therefore use the headers as they are defined (rightly or wrongly) in project.sharedStopsConfig
. A unit test or two around this would be really useful.
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.
Do we have examples of unit testing other validators? I've manually created some tests to fix the behavior issues you're talking about but I can't find a good way to split things to reasonably test them. Either way the issues you've mentioned have been fixed. Using split
.
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.
@miles-grant-ibigroup Look to move the contents of validate()
method into a static method or two so these can be called from a unit test to avoid having to go through the whole feed/validation process.
See https://github.com/ibi-group/gtfs-lib/blob/dev-flex/src/main/java/com/conveyal/gtfs/validator/FlexValidator.java and https://github.com/ibi-group/gtfs-lib/blob/dev-flex/src/test/java/com/conveyal/gtfs/validator/FlexValidatorTest.java.
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.
I've given this an attempt. Let me know what you think
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.
@miles-grant-ibigroup I hope you don't mind, but I have created a PR off of this PR: #585 and made a few changes. Let me know if you have any questions. If not, you can merge that back into this PR.
Thanks for the feedback! All addressed |
Updates to enum use and parameterized unit tests
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.
One minor nit, apart from that all good.
@@ -33,10 +33,10 @@ jobs: | |||
java-version: 19 | |||
distribution: 'temurin' | |||
# Install node 14 for running e2e tests (and for maven-semantic-release). |
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.
Nit update to 20 or remove 14.
Checklist
dev
before they can be merged tomaster
)Description
The shared stops validator was built on incomplete data. As a result, most of the validators didn't work correctly. This PR resolves these, adding support for the file in the way it was meant to be used.
Also adds support for the columns being in any order