Skip to content
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

Merged
merged 8 commits into from
Jan 16, 2024

Conversation

miles-grant-ibigroup
Copy link
Contributor

@miles-grant-ibigroup miles-grant-ibigroup commented Dec 25, 2023

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JavaDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing
  • The description lists all relevant PRs included in this release (remove this if not merging to master)
  • e2e tests are all passing (remove this if not merging to master)

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

Copy link
Contributor

@philip-cline philip-cline left a 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!

Copy link
Contributor

@br648 br648 left a 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.

int FEED_ID_INDEX = -1;

try {
configReader.setHeaders(new String[]{"stop_group_id", "feed_id", "stop_id", "is_primary"});
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@br648 br648 Jan 8, 2024

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.

Copy link
Contributor Author

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

Copy link
Contributor

@br648 br648 Jan 12, 2024

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.

@br648 br648 assigned miles-grant-ibigroup and unassigned br648 Jan 2, 2024
@miles-grant-ibigroup
Copy link
Contributor Author

Thanks for the feedback! All addressed

@br648 br648 assigned miles-grant-ibigroup and unassigned br648 Jan 10, 2024
@br648 br648 assigned miles-grant-ibigroup and unassigned br648 Jan 12, 2024
Updates to enum use and parameterized unit tests
Copy link
Contributor

@br648 br648 left a 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).
Copy link
Contributor

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.

@miles-grant-ibigroup miles-grant-ibigroup merged commit e14d5a2 into dev Jan 16, 2024
6 checks passed
@miles-grant-ibigroup miles-grant-ibigroup deleted the shared-stops-validator-repair branch January 16, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants