diff --git a/CHANGELOG.md b/CHANGELOG.md index 610b96b5..f19e2d43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- `vehicle_crew` table for multiple crew members per trip, including mid-trip reliefs ([#220](https://github.com/TIDES-transit/TIDES/issues/220)) + +### Changed + +- `trips_performed.operator_id` description clarified to reference vehicle_crew table for multi-operator trips ([#220](https://github.com/TIDES-transit/TIDES/issues/220)) + ## [1.0] - 2025-12-23 ### Changed diff --git a/samples/template/TIDES/datapackage.json b/samples/template/TIDES/datapackage.json index 399cb82a..5bf53f32 100644 --- a/samples/template/TIDES/datapackage.json +++ b/samples/template/TIDES/datapackage.json @@ -150,6 +150,20 @@ } ] }, + { + "name": "vehicle_crew", + "profile": "tabular-data-resource", + "path": "vehicle_crew.csv", + "schema": "https://raw.githubusercontent.com/TIDES-transit/TIDES/main/spec/vehicle_crew.schema.json", + "sources": [ + { + "title": "Where did data come from?", + "component": "Type of technology component, i.e. `CAD/AVL`", + "product": "Product used.", + "vendor": "Vendor selling product." + } + ] + }, { "name": "station_activities", "profile": "tabular-data-resource", diff --git a/samples/template/TIDES/vehicle_crew.csv b/samples/template/TIDES/vehicle_crew.csv new file mode 100644 index 00000000..59d2084b --- /dev/null +++ b/samples/template/TIDES/vehicle_crew.csv @@ -0,0 +1 @@ +service_date,trip_id_performed,vehicle_id,crew_id,crew_role,start_time,end_time diff --git a/spec/tides-datapackage-profile.json b/spec/tides-datapackage-profile.json index aa25313b..9a284fd6 100644 --- a/spec/tides-datapackage-profile.json +++ b/spec/tides-datapackage-profile.json @@ -301,6 +301,7 @@ "stop_visits", "train_cars", "trips_performed", + "vehicle_crew", "vehicle_locations", "vehicle_train_cars", "vehicles" diff --git a/spec/trips_performed.schema.json b/spec/trips_performed.schema.json index 8c4c4b35..7850fd5c 100644 --- a/spec/trips_performed.schema.json +++ b/spec/trips_performed.schema.json @@ -206,7 +206,7 @@ "name": "operator_id", "type": "string", "title": "ID referencing operators.operator_id", - "description": "Identifies the vehicle’s operator." + "description": "Identifies the vehicle's operator. Optional; for trips with multiple operators, use the first operator or reference the vehicle_crew table for complete crew assignments." }, { "name": "block_id", diff --git a/spec/vehicle_crew.schema.json b/spec/vehicle_crew.schema.json new file mode 100644 index 00000000..abb9087c --- /dev/null +++ b/spec/vehicle_crew.schema.json @@ -0,0 +1,102 @@ +{ + "primaryKey": [ + "service_date", + "trip_id_performed", + "crew_id", + "start_time" + ], + "missingValues": [ + "NA", + "NaN", + "" + ], + "fields": [ + { + "name": "service_date", + "type": "date", + "description": "Service date. References GTFS", + "constraints": { + "required": true + } + }, + { + "name": "trip_id_performed", + "type": "string", + "title": "ID referencing trips_performed.trip_id_performed", + "description": "Identifies the trip performed. Required as part of the primary key.", + "constraints": { + "required": true + } + }, + { + "name": "vehicle_id", + "type": "string", + "title": "ID referencing vehicles.vehicle_id", + "description": "Identifies the vehicle.", + "constraints": { + "required": true + } + }, + { + "name": "crew_id", + "type": "string", + "title": "ID referencing operators.operator_id", + "description": "Identifies the crew member. References operators table.", + "constraints": { + "required": true + } + }, + { + "name": "crew_role", + "type": "string", + "description": "Role of the crew member on the vehicle.", + "constraints": { + "enum": [ + "operator", + "conductor", + "fare_inspector", + "other" + ] + } + }, + { + "name": "start_time", + "type": "datetime", + "description": "Timestamp when the crew member's assignment began.", + "constraints": { + "required": true + } + }, + { + "name": "end_time", + "type": "datetime", + "description": "Timestamp when the crew member's assignment ended. Null if assignment is ongoing." + } + ], + "foreignReferences": [ + { + "fields": ["service_date", "trip_id_performed"], + "reference": { + "resource": "trips_performed", + "fields": ["service_date", "trip_id_performed"] + } + }, + { + "fields": "vehicle_id", + "reference": { + "resource": "vehicles", + "fields": "vehicle_id" + } + }, + { + "fields": "crew_id", + "reference": { + "resource": "operators", + "fields": "operator_id" + } + } + ], + "name": "vehicle_crew.schema.json", + "description": "Crew member assignments to vehicles and trips, supporting multiple crew members and mid-trip reliefs.", + "_table_type": "Supporting" +}