False positives of DuplicateFareRuleZoneIdFieldsNotice when analyzing fare_rules.contains_id
Bug report
The GTFS Validator is generating false positives of the DuplicateFareRuleZoneIdFieldsNotice for certain conditions involving the fare_rules.txt#contains_id field.
Describe the bug
When a fare rule is described that involves combinations of the fare_rules.txt#contains_id, the GTFS Validator generates false positives of the DuplicateFareRuleZoneIdFieldsNotice when a fare_rules.txt#contains_id is used correctly twice - especially when the fare_rules.txt#contains_id is also associated with a fare_rules.txt#route_id.
How we reproduce the bug
Example feed: Archive.zip
In this feed in the fare_rules.txt file, the following use case is shown:
fare_id,route_id,origin_id,destination_id,contains_id
TL9,800,,,E
TL9,800,,,W
L1_E,800,,,E
L1_W,800,,,W
According to the GTFS Spec about the fare_rules.txt#contains_id field, it shows an example of a fare rule that applies only when all zones have been traversed. Therefore, in order to model a fare_rule that occurred in only one of the zones, one would expect there to be a "duplicate-looking" entry of another fare_rule that didn't have the same set of contains_id values as another fare rule.
Therefore, in the above use case, fare rule TL9 applies only when travel is involved in all of zones E and W, but not in just E or just W. If travel occurs in just zone E, then fare rule L1_E applies. If travel occurs in just zone W, then fare rule L1_W applies. Additionally, all of that only applies to only route_id 800.
Expected behaviour
The gtfs-validator should check the fare rules and compile a set of contains_id + route_id values when checking for duplicate fare rules.
Observed behaviour
The GTFS Validator flagged the above-mentioned use case as an error.
Screenshots: See relevant JSON output for the above-linked feed.
{
"code": "duplicate_fare_rule_zone_id_fields",
"severity": "ERROR",
"totalNotices": 2,
"sampleNotices": [{
"csvRowNumber": 4.0,
"fareId": "L1_E",
"previousCsvRowNumber": 2.0,
"previousFareId": "TL9"
}, {
"csvRowNumber": 5.0,
"fareId": "L1_W",
"previousCsvRowNumber": 3.0,
"previousFareId": "TL9"
}]
}
Environment versions
- validator version: v2, v3
- Java version:
- OS versions: