Skip to content

Add vehicle_crew supporting table#246

Open
chrisyamas wants to merge 7 commits intodevelopfrom
feature/issue-220-vehicle-crew
Open

Add vehicle_crew supporting table#246
chrisyamas wants to merge 7 commits intodevelopfrom
feature/issue-220-vehicle-crew

Conversation

@chrisyamas
Copy link
Copy Markdown
Contributor

@chrisyamas chrisyamas commented Dec 29, 2025

Summary

Adds new vehicle_crew table to support multiple crew members per vehicle/trip, including mid-trip reliefs. This addresses the limitation where trips_performed.operator_id could only reference a single operator.

Resolves #220

Changes

  • spec/vehicle_crew.schema.json (new) defines the vehicle_crew table with:
    • Primary key: [service_date, trip_id_performed, crew_id, start_time]
    • Required fields: service_date, vehicle_id, crew_id, start_time
    • Optional fields: trip_id_performed (for vehicle-level assignments), crew_role, end_time
    • crew_role enum: operator, conductor, fare_inspector, other (uses snake_case consistent with 🐛📄 – Improve event_type naming convention in passenger_events #235)
    • Foreign references to trips_performed, vehicles, and operators
  • samples/template/TIDES/vehicle_crew.csv (new) provides header-only template
  • spec/trips_performed.schema.json updated operator_id description to clarify optional usage and reference to vehicle_crew table for multi-operator scenarios
  • spec/tides-datapackage-profile.json added vehicle_crew to tides-table enum
  • samples/template/TIDES/datapackage.json added vehicle_crew resource entry
  • CHANGELOG.md added entries under [Unreleased] for new table and description change

Reason for this change

Rail systems commonly have multiple crew members (operators, conductors) on a single trip, and operator reliefs mid-trip are standard practice. The current trips_performed.operator_id field can only reference one operator, forcing agencies to either lose crew data or pick an arbitrary operator to record.

The new vehicle_crew table allows agencies to capture complete crew assignment history while keeping the existing operator_id field for simple single-operator cases.

- See related discussion in Issue #220 and Fall 2025 TIDES Issues Working Group notes from December 1 and December 10.

Review checklist

Per change management policy, the following must be met before feature branch changes can merge to develop branch:

  • All JSON files validate
  • Reviewed and approved by 2+ contributors or board members

@chrisyamas chrisyamas added this to the v2.0 milestone Dec 29, 2025
@chrisyamas chrisyamas self-assigned this Dec 29, 2025
@chrisyamas chrisyamas added the 🚀 feature Adds a new feature - to spec or code label Dec 29, 2025
@chrisyamas chrisyamas requested a review from a team as a code owner December 29, 2025 16:14
@chrisyamas chrisyamas added the 📄 spec Pertains to the specification itself label Dec 29, 2025
@chrisyamas chrisyamas requested a review from a team as a code owner December 29, 2025 16:14
@chrisyamas chrisyamas added restructuring For issues such as adding or removing tables, making significant chages to a table, etc. 🔄 normative change A normative change requires approval of TIDES Board labels Dec 29, 2025
@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

Data Validation Report

Sample Status
./samples/template/TIDES ⚠️

@github-actions
Copy link
Copy Markdown
Contributor

Data Validation Report

Sample Status
./samples/template/TIDES ⚠️

@chrisyamas
Copy link
Copy Markdown
Contributor Author

Data Validation Report

Sample Status
./samples/template/TIDES ⚠️

This warning is because the frictionless validation check can't find the vehicle_crew.schema.json since it checks against main branch and the schema for the new table doesn't exist on main branch yet. But this should resolve automatically once the PR is merged.

@chrisyamas chrisyamas changed the base branch from main to develop January 2, 2026 16:04
Copy link
Copy Markdown
Contributor

@botanize botanize left a comment

Choose a reason for hiding this comment

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

I believe this meets the needs discussed in the issue. However, it looks like this PR accidentally removes trip_id_performed from the trips_performed table. I also suspect that trip_id_performed should be required if it's part of the primary key. Though to be fair, it doesn't strictly need to be, service_date, crew_id and start_time should be sufficient for the primary key. Including trip_id_performed just makes it easier to use.

  • undo removal of trips_performed.trip_id_performed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like you've accidentally removed trip_id_performed from trips_performed!

"name": "trip_id_performed",
"type": "string",
"title": "ID referencing trips_performed.trip_id_performed",
"description": "Identifies the trip performed. Optional if crew assignment is at vehicle level only."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't trip_id_performed be required if it's part of the primary key?

Comment on lines -29 to +39
- `stop_visits` - Summarized boarding, alighting, arrival, departure, and other events (kneel engaged, ramp deployed, etc.) by trip and stop for each service date.
- `stop_visits` - Summarized boarding, alighting, arrival, departure, and other events (kneel engaged, ramp deployed, etc.) by trip and stop for each service date.
- `trips_performed` - Trips performed for each service date.
- `station_activities` - Summarized transactions, entries, and exits by stop or station and time period for each service date (for events not associated with a trip).
- `station_activities` - Summarized transactions, entries, and exits by stop or station and time period for each service date (for events not associated with a trip).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like there's some extra whitespace in these lines.

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

Labels

🚀 feature Adds a new feature - to spec or code 🔄 normative change A normative change requires approval of TIDES Board restructuring For issues such as adding or removing tables, making significant chages to a table, etc. 📄 spec Pertains to the specification itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛📄 – TODS and TIDES Alignment: Mid-Trip Reliefs

3 participants