Skip to content

Conversation

@tzujenchanmbd
Copy link
Collaborator

Context

Currently network (grouping of routes) can be defined by routes.network_id. However, during the fares v2 working group discussions, we identified the need to separate the production of fares data. The networks.txt and route_networks.txt stem from Ito World's proposal, using a mechanism similar to areas.txt and stop.areas.txt, allowing fares data to be produced separately from schedule data.

Changes in this PR

  • Add networks.txt and route_networks.txt files
  • Modify presence of routes.network_id
  • Modify description of fare_leg_rules.network_id

This PR tries to capture consensus reached during the working group meetings:

  • Adding these two files
  • Not allowing both routes.network_id and routes_networks.txt + networks.txt in the same dataset. (presence: Conditionally Forbidden)
  • Not allowing many-to-many relationship (A route can be defined in 1 network). We can release this restriction if needed in the future.

In addition, networks.txt indicates networks are used for fares use case, we can release this restriction if needed in the future as well.

For previous discussions, please see issue#389 and working group meeting minutes.

Please go through the changes and feel free to share your thoughts/questions here.

@tzujenchanmbd tzujenchanmbd added GTFS Schedule Issues and Pull Requests that focus on GTFS Schedule GTFS-Fares Issues and Pull Requests that focus on GTFS-Fares Extension labels Oct 9, 2023
@tzujenchanmbd tzujenchanmbd linked an issue Oct 9, 2023 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Nov 2, 2023

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 2, 2023
@tzujenchanmbd
Copy link
Collaborator Author

not stale

@tzujenchanmbd
Copy link
Collaborator Author

Hello,

We have at least one producer: Ito World. They have shared their dataset in this file, which is part of a private feed.
We have at least one consumer: Apple Maps. Please see the screenshot below for the same dataset.

As per the GTFS amendment process, the requirements to open a vote are met.
We are opening a vote for adding networks.txt and route_networks.txt.

Please vote with a +1 (for) or -1 (against) in the comments. Voting ends on 2023-11-27 at 23:59:59 UTC.

Network_screenshot

@e-lo
Copy link

e-lo commented Nov 13, 2023

🙇‍♀️ Thank you to everyone who worked on getting this working!

+1 from me, UrbanLabs LLC

@tzujenchanmbd tzujenchanmbd added the Vote to Test Community votes to determine whether the proposal is ready for testing. label Nov 13, 2023
@evansiroky
Copy link
Contributor

+1 from Caltrans. This does raise the question of how some best practices can be defined so that both producers can properly inform consumers of potentially separate parts of the GTFS existing in separate places.

@gcamp
Copy link
Contributor

gcamp commented Nov 14, 2023

+0 from Transit, as we said previously we don’t think independent publication is a worthy goal by itself and generally will encourage bad design practice in GTFS. We think a simple merge of data makes more sense.

That said, we recognize that we are in the overwhelming minority, so we’ll just abstain.

@westontrillium
Copy link
Contributor

+1 from Trillium


File: **Conditionally Forbidden**

Primary key (`*`)
Copy link
Contributor

Choose a reason for hiding this comment

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

If a route_id can only be defined in one network_id, should the primary key be route_id?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, thanks for catching this! - 8664074


Primary key (`route_id`)

Assigns routes from [routes.txt](#stopstxt) to networks. Forbidden if `routes.network_id` field exists.
Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies, I missed this one as well. #stopstxt => #routestxt

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks Brian! - f191923

@bdferris-v2
Copy link
Contributor

+1 from Google

@tzujenchanmbd
Copy link
Collaborator Author

The vote passed on 2023-11-27 at 23:59:59 UTC.

4 votes in favour and no votes against.

The votes came from:
UrbanLabs LLC (@e-lo)
Caltrans (@evansiroky)
Trillium (@westontrillium)
Google (@bdferris-v2)

Thanks to everyone who contributed and voted!

| [fare_transfer_rules.txt](#fare_transfer_rulestxt) | Optional | Fare rules for transfers between legs of travel.<br><br>Along with [fare_leg_rules.txt](#fare_leg_rulestxt), file [fare_transfer_rules.txt](#fare_transfer_rulestxt) provides a more detailed method for modeling fare structures. As such, the use of [fare_transfer_rules.txt](#fare_transfer_rulestxt) is entirely separate from files [fare_attributes.txt](#fare_attributestxt) and [fare_rules.txt](#fare_rulestxt). |
| [areas.txt](#areastxt) | Optional | Area grouping of locations. |
| [stop_areas.txt](#stop_areastxt) | Optional | Rules to assign stops to areas. |
| [networks.txt](#networkstxt) | **Conditionally Forbidden** | Network grouping of routes.<br><br>Conditionally Forbidden:<br>- **Forbidden** if `routes.network_id` field exists.<br>- Optional otherwise. |

Choose a reason for hiding this comment

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

Why would networks.txt be forbidden when the relation between networks an routes is specified in routes.txt? The conditionally forbidden relation this pull request intends is only between routes.network_id and route_networks.txt

Choose a reason for hiding this comment

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

@ferranmanya I agree and was recently confused by this as well. As currently written here and validated by MobilityData's validator (https://github.com/MobilityData/gtfs-validator/pull/1671/files), networks can't both be named (requires use of networks.txt) and be linked to routes (requires use of routes.network_id or route_networks.txt).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ferranmanya @sberkley
Agree this could be a bit confusing... Here’s some background information:

routes.network_id, networks.txt, and route_networks.txt were not all introduced into GTFS at the same time. routes.network_id was added to GTFS in May 2022 through PR#286. At that time, there was no dedicated networks.txt table for networks (“non-normalized”), and most producers simply defined networks using routes.network_id.

In 2023, the community raised the need to handle fares data separately—which is what this PR addresses—and that led to the addition of both route_networks.txt and networks.txt. With networks.txt, networks became normalized and have a network_id primary key.

After introducing networks.txt, what if it also became the primary table referenced by routes.network_id? This would mean the validator must check the references between the two tables, which would be a breaking change for producers who had previously only provided routes.network_id. And GTFS currently maintains strict backward compatibility for producers. We also want to avoid the confusion that could result from mixing old and new approaches. In a mixed scenario, it can become unclear which definition of a network should be treated as authoritative...

This is why the current validator rule exists. Its meaning is essentially: either use the previous routes.network_id alone, or use the new [route_networks.txt + networks.txt] combination to define networks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GTFS Schedule Issues and Pull Requests that focus on GTFS Schedule GTFS-Fares Issues and Pull Requests that focus on GTFS-Fares Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GTFS-Fares v2: Add networks.txt & route_networks.txt

8 participants