File shapes.txt should be Conditionally Required
- Dominant language
- No language data
- Stars
- 1.1k
- Forks
- 225
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 3
Description
### 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.
2. 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.
Contributor guide
Assessment
This issue has not been assessed yet.