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

fix: make stop_without_zone_id conditional on fare rule type (#1663) #1693

Merged
merged 6 commits into from
Mar 12, 2024

Conversation

michaelandrewkearney
Copy link
Contributor

Summary:

Resolves #1663 by updating StopZoneIdValidator to issue notice about a stop without zone_id defined only when the stop is contained in a trip contained in a route defined in a fare rule with zone fields defined. Change from previous logic which warned about stops without zone_id defined if any fare rules had zone fields defined.

  • The warning is still only triggered for stops where location_type is 0.
  • Zone fields in fare_rules.txt are origin_id, destination_id, and contains_id.
  • Adds tests to StopZoneIdValidatorTest to confirm expected behavior as described below.

Note that a previous, nearly-identical version of this pull request was closed and abandoned because of issues with the commit email address and the CLA.

Expected behavior:

If a stop of location_type 0 does not have a zone_id defined, and that stop is defined as part of a trip in stop_times.txt, and that trip is defined as part of a route in trips.txt, and that route is defined in a fare rule in fare_rules.txt, and that fare rule has any of origin_id, destination_id, or contains_id defined, then a stop_without_zone_id notice is issued.

Exactly one notice is issued per stop that meets the criteria to issue a notice even if that stop meets the notice criteria through multiple combinations of trips, routes, and fare rules.

The notice is never issued if a stop has a zone_id defined, even if that zone_id is never defined in a zone field of a fare rule associated with the stop by the (stop_time > trip > route) chain described above.

This pull request fixes the issue on the test feed provided by westontrillium in google/transit #429.

Validator results on test feed without fix:
Validator results without fix

Validator results on test feed with fix:
Validator results with fix

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Run the unit tests with gradle test to make sure you didn't break anything
  • Add or update any needed documentation to the repo
  • Format the title like "feat: [new feature short description]". Title must follow the Conventional Commit Specification(https://www.conventionalcommits.org/en/v1.0.0/).
  • Linked all relevant issues
  • Include screenshot(s) showing how this pull request works and fixes the issue(s)

…yData#1663)

- Update `StopZoneIdValidator` to issue notice about a stop without `zone_id` defined only when the stop is contained in a trip contained in a route defined in a fare rule with zone fields defined.
- Change from previous logic which warned about stops without `zone_id` defined if any fare rules had zone fields defined.
- The warning is still only triggered for stops of location type `0`.
- Zone fields in `fare_rules.txt` are `origin_id`, `destination_id`, and `contains_id`.
Copy link

welcome bot commented Mar 7, 2024

Thanks for opening this pull request! You're awesome. We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of titles with semantic prefixes:

  • fix: Bug with ssl network connections + Java module permissions.
  • feat: Initial support for multiple @PrimaryKey annotations.
  • docs: update RELEASE.md with new process
    To get this PR to the finish line, please do the following:
  • Read our Contribution Guidelines
  • Follow Google Java style coding standards
  • Include tests when adding/changing behavior
  • Include screenshots

Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great contribution! I added a minor suggestion before approving it.

*/
@GtfsValidationNotice(
severity = ERROR,
severity = INFO,
files = @FileRefs({GtfsStopSchema.class, GtfsFareRuleSchema.class}))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the additional file schema here to enhance the generated documentation: GtfsStopTimeSchema.class, GtfsTripSchema.class and GtfsRouteSchema.class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Is it required or recommended or neither that a notice referencing a file includes a row number for that file?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's recommended as it helps the report's consumer fix the issues.

Copy link
Member

@davidgamez davidgamez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@davidgamez davidgamez merged commit f91e524 into MobilityData:master Mar 12, 2024
332 of 333 checks passed
Copy link

welcome bot commented Mar 12, 2024

🥳 Congrats on getting your first pull request merged!

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.

Rule change: make stop_without_zone_id conditional on fare rule type
2 participants