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

feat: update transfers table to GTFS Schedule Reference Revised Dec 8 #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

dancesWithCycles
Copy link

Hi folks,
The GTFS Specification was revised. The transfers definition (not only) has changed due to this revision. Please feel free to improve, share, study or use this pull request to update the transfers definition to this revision. Cheers!

@fitnr
Copy link
Owner

fitnr commented May 10, 2023

According to the spec you linked to, the new PK is from_stop_id, to_stop_id, from_trip_id, to_trip_id, from_route_id, to_route_id. That's not reflected in this change. Additionally, you have deleted two foreign keys. Why?

…he NOT NULL is purposefully omitted on this column. Restore.
@dancesWithCycles
Copy link
Author

I restored the default value for documentation purposes.

@dancesWithCycles
Copy link
Author

dancesWithCycles commented May 11, 2023

According to the spec you linked to, the new PK is from_stop_id, to_stop_id, from_trip_id, to_trip_id, from_route_id, to_route_id.

Hi @fitnr ,
I agree. It has practical reasons, why I am not using a primary key for the transfers.txt tables anymore. According to the GTFS static specification, the primary key consists of 6 columns.

Primary key (from_stop_id, to_stop_id, from_trip_id, to_trip_id, from_route_id, to_route_id)

All those 6 columns are Conditionally Required or Optional. That is reflected in everyday life. Taking some example GTFS static files, you observe that

  • from_stop_id and to_stop_id is provided in general
  • all other 4 columns are provided on a provider basis

Look at this issue mfdz/GTFS-Issues#130 (comment) for instance.

"from_stop_id","to_stop_id","transfer_type","min_transfer_time","from_route_id","to_route_id","from_trip_id","to_trip_id"
"000000000010","000000000010",1,,"143954_0","143954_3",,
"000000000010","000000000010",1,,"143954_0","144058_0",,
"000000000010","000000000010",1,,"143954_3","143954_0",,
"000000000010","000000000010",1,,"143954_3","144058_0",,
"000000000010","000000000010",1,,"144058_0","143954_0",,
"000000000010","000000000010",1,,"144058_0","143954_3",,

You can not use just from_stop_id and to_stop_id as primary key. Those rows miss the NOT NULL UNIQUE constraint of a PRIMARY KEY. In this situation you could use 4 columns as primary key to comply with the constraint. Anyhow, there are other cases, where even 2 or 4 or 6 columns as primary key do not comply with the PRIMARY KEY constraint, as all those columns are Conditionally Required or Optional.

At the end of the day, it works for me only without a primary key at all.

What would be your guess?

Cheers!

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.

2 participants