Comments (6)
At Transit, we're in favour of the idea of rule priority in principle, as a way to make fare leg rules easier to write and understand. A big thank you to the folks from ITO World who've been working on advancing this.
There are so many unanswered questions we need to hammer down, hence why we asked for it to be in another PR.
So far the following questions have come up internally:
- What happens when multiple matching
fare_leg_rules
have equalrule_priority
? There should be a clear statement in this case. - The proposed changes appear to consist solely of adding a
rule_priority
field. As a result, the confusing special case for empty values for fields likefrom_area_id
,to_area_id
andnetwork_id
continues to apply (where they match all values not otherwise specified).- If left as is, we worry this would limit the value of
rule_priority
. - Perhaps when
rule_priority
is set, empty values truly meanempty
? - Or instead, the use of empty values could be banned when
rule_priority
is set?
- If left as is, we worry this would limit the value of
- This proposal doesn't appear to be backwards compatible, in that consumers that do not recognize the
rule_priority
column will derive a different meaning for the fare leg rules than that intended by the producer. Users could see incorrect fare calculators.- I think the proposed specification text will need a clear and extensive section describing the backwards compatibility situation when
rule_priority
is used. - I've only skimmed the proposal so far; if it is in fact backwards compatible, I'd love to see a worked example.
- I think the proposed specification text will need a clear and extensive section describing the backwards compatibility situation when
from transit.
We have been thinking about unintended consequences of rule_priority
and considering whether we need a way to restrict its effect.
As an example, take the example at the top, and imagine that those are contactless fares, and there is a different cash fare that is constant through the whole day.
leg_group_id | fare_product | from_timeframe_group_id | to_timeframe_group_id | rule_priority |
---|---|---|---|---|
1 | contactless_peak | peak | 1 | |
1 | contactless_offpeak | |||
1 | cash_allday |
In this case, when off-peak, the contactless and cash products will match. However in peak times, only the contactless_peak product will match, as it matching causes any rule_priority
=0 rules to be discarded. This is clearly undesirable, and could be a surprise if those rules are much further apart in the file.
One approach could be to have an optional scope that limits the override mechanism eg
leg_group_id | fare_product | from_timeframe_group_id | to_timeframe_group_id | rule_priority | rule_priority_scope_id |
---|---|---|---|---|---|
1 | contactless_peak | peak | 1 | contactless | |
1 | contactless_offpeak | contactless | |||
1 | cash_allday |
This would be one way, it could also be something like a fare_products.fare_product_group_id
that connects the two contactless products.
This example also raises the question of whether the rule_priority
mechanism operates on just the predicates in the fare leg rules, or whether it considers whether the fare products themselves actually match (at eg fare media level).
Our initial work around this feature was connected to zonal schemes, and so the language in the original proposal was around "cheaper fares being selected", such that we wouldn't present zones 1-4 as an option for a zones 2-3 journey. We probably need to resolve that case via a different mechanism, so I've changed the area-based proposal to override regardless of it being cheaper or more expensive.
from transit.
@npaun Glad it's looking useful.
Some initial answers:
- I've tweaked the proposal mentioned to say "those rules" rather than "the one rule". Ie all rules that have the equal highest priority are selected and the rest discarded.
- We have only used this in a world where those fields are never left empty (
from_area_id
= "anywhere" etc). I think working with them being empty would work, but maybe the the third option of requiring those fields be populated might be the best for now. At a later date, if we get a mechanism to opt-in change the rules of those empty values, we could relax that rule. - We may be missing something, but we see this as similar to any proposal that adds predicates to the fare leg rules, such as timeframes.
from transit.
Hey everyone - just a reminder that MobilityData is hosting a GTFS-Fares v2 monthly meeting, and we will discuss this issue tomorrow at 11 AM EDT. To participate in the meeting, please subscribe via this link.
For a summary and more details, please check out the meeting notes.
from transit.
Related Issues (20)
- Add rider_category_id to fare_products.txt
- Add maximum waiting time to transfers.txt HOT 2
- Documentation: inconsistencies between gtfs-realtime.proto
- GTFS-Fares v2: Improvement of filling with stops of a certain area HOT 3
- Move Dataset Publishing and General Practices from Best Practices to the spec HOT 10
- Add recommended presence: reconciling confusion between best practices and spec HOT 10
- Thoughts on forbidding "subfolder inside zip"? HOT 8
- TripDescriptor.start_date matching between GTFS-RT + GTFS-static HOT 2
- GTFS-Flex: Service Discovery HOT 11
- Add fare_media_type=1 to fare_media.txt HOT 8
- GTFS-Fares v2: Add networks.txt & route_networks.txt HOT 13
- GeoJSON in GTFS? (Or the future of GTFS serialisation) HOT 20
- Phone number international format in GTFS HOT 2
- stop_times.shapes_dist_traveled shouldn't be defined if the trip doesn't have shapes associated HOT 7
- GTFS changes - voting agents HOT 12
- Moving Schedule Best Practices into the Spec: Phasing Plan HOT 5
- [GTFS-Flex] Remove referencing location.geojson ids in stop_areas.txt (formerly location_groups.txt)?
- [GTFS-Flex] Replace areas.txt/stop_areas.txt with locations.geojson MultiPoint feature to describe collections of stops? HOT 11
- GTFS-fares v2: Fare Leg Rule "Scope" Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transit.