Skip to content

Vehicle assignments #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4fadf35
Add vehicle_assignments.txt, vehicles files
antrim Dec 6, 2024
94e3146
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2024
405e1b3
vehicle_category -> vehicle_type
antrim Dec 13, 2024
7102599
Merge branch 'vehicle_assignments' of https://github.com/antrim/opera…
antrim Dec 13, 2024
85f67e5
primary key for vehicle assignments
antrim Dec 15, 2024
aee1524
"run" -> "trip"
antrim Dec 15, 2024
f3281fe
remove vehicle_assignments.trip_id
antrim Dec 15, 2024
b4c4be1
vehicle_id and vehicle_type_id must agree
antrim Dec 15, 2024
82bc797
remove crew/rostering
antrim Dec 15, 2024
9c6b91e
Remove vehicle_types.txt, pair down vehicles.txt
antrim Feb 5, 2025
b3d2bec
clarify: service day GTFS term definition
antrim Feb 5, 2025
593c646
Future compatibility, vehicle_assignments.vehicle_id requirement
antrim Feb 5, 2025
9cb1e09
examples.md: vehicle assignments
antrim Feb 5, 2025
94ef3db
examples.md: oops, remove notes
antrim Feb 5, 2025
1acaf76
Update docs/spec/index.md - vehicle_label
antrim Feb 9, 2025
24a9cfc
vehicle_assignments - "block and date combo"
antrim Feb 9, 2025
b311056
Merge branch 'main' into vehicle_assignments
antrim May 6, 2025
c2d4c04
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 6, 2025
137e6bc
Update examples.md
antrim May 6, 2025
966ffb9
Update examples.md
antrim May 6, 2025
0d5aa48
Update index.md
antrim May 6, 2025
8c7718f
Update index.md - employee_run_dates.txt
antrim May 6, 2025
feee1a0
Update index.md - Fix accidental deletion
antrim May 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/spec/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,45 @@ Primary Key: `*`
If a feed doesn't represent rosters, it can still assign employees to runs by putting every run for every date in this file. In that case, the `exception_type` column can be omitted because every row would be adding a date, which is the default when the column is blank.

Each run can only be assigned to one employee on each date. Employees may be scheduled to more than one run on the same date.

### `vehicle_assignments.txt`

Primary Key: `*`

| Field Name | Type | Required | Description |
|---|---|---|---|
| `date` | Date | Required | |
| `service_id` | ID referencing `calendar.service_id` or `calendar_dates.service_id` | Optional | Identifies a set of dates when the run is scheduled to take place. Required if `block_id`s are repeated between different `service_id`s. |
| `block_id` | ID referencing `trips.block_id` | Conditionally required | Identifies the block. Either `trip_id` or `block_id` must be specified. |
| `trip_id` | ID referencing `trips.trip_id` | Conditionally required | Either `trip_id` or `block_id` must be specified. In the case where both are supplied, `trip_id` overrides `block_id`. Note: multiple vehicles are allowed on the same block+date, but this is not recommended. |
| `vehicle_id` | ID referencing `vehicles.vehicle_id` | Conditionally required | Refers to a specific vehicle in the transit fleet. Either `vehicle_id` or `vehicle_category_id` MUST be supplied. |
| `vehicle_category_id` | ID referencing `vehicle_categories.vehicle_category_id` | Conditionally required | Refers to a category of vehicle in the transit fleet if there is no specific vehicle assignment. Either `vehicle_id` or `vehicle_category_id` MUST be supplied. |

Not every trip or block and date combo needs to have a vehicle specified.

### `vehicle_categories.txt`

Primary Key: `vehicle_category_id`

| Field Name | Type | Required | Description |
|---|---|---|---|
| `vehicle_category_id` | ID, primary key | Required | Defines an ID for a vehicle category. |
| `vehicle_category_name` | Text | Optional | The vehicle_category_name field defines the name of the vehicle category. E.g. “MR73” in Montréal, “TGV Duplex” in France or “8-car Waratah Train” in Sydney. |
| `fuel_type` | Enum | Optional | 0 or empty - unknown propulsion <br />1 - Gasoline <br /> 2 - Diesel <br /> 3 - LPG auto <br /> 4 - Mixture <br /> 5 - Biodiesel <br /> 6 - Electricity <br /> 7 - Hybrid <br /> 8 - Natural Gas <br /> 9 - Other |
| `wheelchair_accessible` | Enum | Optional | Wheelchair accessible. <br />0 or empty - no <br />1 - yes |
| `seating_capacity` | Non-negative Integer | Optional | This number denotes the number of seats dedicated to riders, excluding folding seats. A seat is considered accommodating only one rider in a seated position. |
| `max_capacity` | Non-negative Integer | Optional | This number denotes the maximum number of riders that the vehicle can carry. |
| `wheelchair_capacity` | Non-negative Integer | Optional | This number denotes the maximum number of riders in a wheelchair that the vehicle can carry. |

### `vehicles.txt`

Primary Key: `vehicle_id`

| Field Name | Type | Required | Description |
|---|---|---|---|
| `vehicle_id` | ID, primary key | Required | Defines an ID for a vehicle. |
| `vehicle_ category_id` | ID referencing `vehicle_categories.vehicle_category_id` | Optional | |
| `vehicle_description` | Text | Optional | |
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the description should be on the type, instead of the individual. Individuals within each type shouldn't be unique enough to require their own description, but a description field could be useful on the type.

Edit: I see the type is optional, so this could be useful to give details on a vehicle that doesn't have a type. But I feel like a better approach would be to add a type for the vehicle and describe it there. Denormalizing the data into the individual vehicles is only useful if agencies have many bespoke vehicles, which seems rare.

Copy link
Author

Choose a reason for hiding this comment

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

Was assuming that descriptive text strings can end up being useful for edge cases we can't anticipate.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see this field being useful for vehicle-specific things, even more esoteric items like "Veterans-Wrapped Coach" or "Heritage Paint Scheme."

| `registration_date` | Date | Optional | |
Copy link
Contributor

Choose a reason for hiding this comment

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

What should be the reasoning for which fields belong in TODS?

registration_date doesn't seem that useful for assigning vehicles to trips.

Copy link
Author

@antrim antrim Feb 5, 2025

Choose a reason for hiding this comment

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

@skyqrose Agree. I will remove.

| `license_plate` | Text | Optional | License number of the vehicle for identification, e.g. “E898656” |
Copy link
Contributor

Choose a reason for hiding this comment

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

There may need to be a label field in addition to license_plate, similar to GTFS-RT VehicleDescriptor.

| `owner` | Text | Optional | Registered owner, e.g “City of Arcata” |
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps owner should be part of the vehicle type instead. If two owners own similar vehicles in the same feed, it's okay if they're represented as two types, cuz they're probably not interchangeable anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

@skyqrose Yes and no. In interstate rail, it's not uncommon for various identical pieces of equipment to be owned by different operators (e.g. 4/120 SEPTA SLV cars are owned by the State of Delaware, but are otherwise identical and interchangeable with the rest of the fleet; MNR's M8s are owned in a mix between MNR and ConnDOT, but the cars are likewise identical). From a planning perspective, we wouldn't necessarily care whose car was operated, just that one of those cars was operated along the trip.

Loading