Skip to content

File shapes.txt should be Conditionally Required #643

Description

@fabianabarca

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:

  1. 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.

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions