Describe the problem
The field trips. shape_id (a foreign ID referencing shapes.shape_id) is Conditionally Required, with the following condition:
Required if the trip has a continuous pickup or drop-off behavior defined either in routes.txt or in stop_times.txt
When that condition is true, shapes.txt becomes required as well, because trips.shape_id cannot be valid without a corresponding shapes.shape_id value.
Use cases
It is relevant for consumers when planning the database schemas, and for evaluating correctness of the feed.
Proposed solution
I see two possible paths:
- Preferred: make
shapes.txt conditionally required
Mark shapes.txt as Conditionally Required in the Presence column of the Dataset Files table (GTFS Schedule), with this condition:
Required if the trip has a continuous pickup or drop-off behavior defined either in routes.txt or in stop_times.txt.
This matches the existing condition on trips.shape_id and makes the transitive requirement explicit.
- Alternative: remove the reference from
trips.shape_id
If shapes.txt is not intended to become conditionally required under that condition, then trips.shape_id should not be a Foreign ID in trips.txt. In that case, its Type should be changed to Text (similar to direction_id), because there would be no guaranteed referenced table.
Additional information
This issue is related to #459, but it has a different purpose, as that one aims to include shapes.txt in the recommended tables.
As mentioned in the discussion of that issue, 85% of the feeds in the Mobility Database (as of May 2024) already have shapes.txt. Therefore, it shouldn’t be a significant change for producers to mark it as Conditionally Required.
Describe the problem
The field
trips. shape_id(a foreign ID referencingshapes.shape_id) is Conditionally Required, with the following condition:When that condition is true,
shapes.txtbecomes required as well, becausetrips.shape_idcannot be valid without a correspondingshapes.shape_idvalue.Use cases
It is relevant for consumers when planning the database schemas, and for evaluating correctness of the feed.
Proposed solution
I see two possible paths:
shapes.txtconditionally requiredMark
shapes.txtas Conditionally Required in the Presence column of the Dataset Files table (GTFS Schedule), with this condition:This matches the existing condition on
trips.shape_idand makes the transitive requirement explicit.trips.shape_idIf
shapes.txtis not intended to become conditionally required under that condition, thentrips.shape_idshould not be a Foreign ID intrips.txt. In that case, its Type should be changed to Text (similar todirection_id), because there would be no guaranteed referenced table.Additional information
This issue is related to #459, but it has a different purpose, as that one aims to include
shapes.txtin the recommended tables.As mentioned in the discussion of that issue, 85% of the feeds in the Mobility Database (as of May 2024) already have
shapes.txt. Therefore, it shouldn’t be a significant change for producers to mark it as Conditionally Required.