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

False positives for duplicate_fare_rule_zone_id_fields in fare_rules.txt #1296

Closed
isabelle-dr opened this issue Nov 21, 2022 · 1 comment · Fixed by #1297
Closed

False positives for duplicate_fare_rule_zone_id_fields in fare_rules.txt #1296

isabelle-dr opened this issue Nov 21, 2022 · 1 comment · Fixed by #1297
Assignees
Labels
bug Something isn't working (crash, a rule has a problem) GTFS Reference Used for Adding or changing rules that belong in the GTFS reference status: Ready An issue that is ready to be worked on.

Comments

@isabelle-dr
Copy link
Contributor

Describe the bug

This was flagged by SDMTS.

False positives for the duplicate_fare_rule_zone_id_fields rule.
They only have (fare_id, route_id) fields defined, every row has a unique combination of both.
The spec mentions that the primary key for fare_rules.txt is (*) which means: all fields (reference)

They had duplicate_fare_rule_zone_id_fields triggered (which is an ERROR) and it looks like a problem with the way this rule is designed.

Steps/Code to Reproduce

  • download dataset provided
  • run validator
  • open report

Expected Results

No issue with fare rules

Actual Results

The notice duplicate_fare_rule_zone_id_fields is triggered 296 times.

Screenshots

No response

Files used

https://www.sdmts.com/google_transit_files/google_transit.zip

Validator version

4.0.0

Operating system

MacOS

Java version

No response

Additional notes

Now that we support multiple @PrimaryKey annotations, we don't need to have the duplicate_fare_rule_zone_id_fields rule in this validator at all.
We can use the @PrimaryKey annotation in fare_rules.txt directly, and the notice duplicate_key will be triggered if we have duplicate records.

@isabelle-dr isabelle-dr added bug Something isn't working (crash, a rule has a problem) status: Needs triage Applied to all new issues status: Ready An issue that is ready to be worked on. GTFS Reference Used for Adding or changing rules that belong in the GTFS reference and removed status: Needs triage Applied to all new issues labels Nov 21, 2022
@bdferris-v2
Copy link
Collaborator

Generally agreed that this validation rule doesn't seem to match the spec. Interestingly enough, I believe Google disables this check in our instance of the validator, probably for the same reason.

Per the acceptance tests, there are a number of feeds (~60) that trigger the existing duplicate_fare_rule_zone_id_fields notice. Spot checking a few feeds, many of them are indeed specifying the same combination of fare rules with different fare ids. The corresponding fare attributes often have a different price, probably indicating that the producer is attempting to model some other aspect of their fare system (different fare products? different rider categories?) despite the fact that this is not really supported in Fares v1. While it's maybe not obvious how feed consumers should productively use this data, other than showing the cheapest fare, the spec technically allows it, so the validator should as well.

The acceptance test shows that a number of feeds (~10) newly trigger a duplicate_key notice. These are all feeds that really due have a duplicate combination of all fields in fare_rules.txt. However, each of these feeds was already triggering a duplicate_fare_rule_zone_id_fields notice, so there are no newly-invalidated feeds from this change.

All in all, +1 to making a change to validation here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working (crash, a rule has a problem) GTFS Reference Used for Adding or changing rules that belong in the GTFS reference status: Ready An issue that is ready to be worked on.
Projects
None yet
2 participants