Skip to content

Commit 1ad7522

Browse files
authored
employee_run_dates.txt (#87)
2 parents 498e877 + e7bc306 commit 1ad7522

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

docs/spec/examples.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,53 @@ weekday,10000,20,BLOCK-A,deadhead ,,garage,08:50:00,stop-1,09:00:00
168168
weekday,10000,30,BLOCK-A,run-as-directed,,stop-1,09:00:00,stop-1,12:00:00
169169
weekday,10000,30,BLOCK-A,deadhead ,,stop-1,12:00:00,garage,12:10:00
170170
```
171+
172+
## Employee Assignments
173+
174+
This example uses [`employee_run_dates.txt`](/spec#employee_run_datestxt) to assign employees to runs (and trips).
175+
176+
In this example, `A` and `B` work Monday-Wednesday and Sunday. `C` and `D` work Thursday-Saturday.
177+
178+
On Wedneday, July 3, `A` has scheduled vacation, so a substitute is assigned instead.
179+
180+
**[`calendar.txt`](https://gtfs.org/documentation/schedule/reference/#calendartxt)**
181+
182+
```csv
183+
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
184+
weekday,1,1,1,1,1,0,0,20240701,20240707
185+
weekend,0,0,0,0,0,1,1,20240701,20240707
186+
```
187+
188+
July 1, 2024 was a Monday.
189+
190+
**[`run_events.txt`](/spec#run_eventstxt)**
191+
192+
For this example, the purpose of this file is just to show which runs exist. Real runs would have more interesting data.
193+
194+
```csv
195+
service_id,run_id,event_sequence,event_type,trip_id,start_location,start_time,end_location,end_time
196+
weekday,101,1,work,trip1,station,09:00:00,station,17:00:00
197+
weekday,102,1,work,trip2,station,09:00:00,station,17:00:00
198+
weekend,103,1,work,trip3,station,09:00:00,station,17:00:00
199+
weekend,104,1,work,trip4,station,09:00:00,station,17:00:00
200+
```
201+
202+
**[`employee_run_dates.txt`](/spec#employee_run_datestxt)**
203+
204+
```csv
205+
date,service_id,run_id,employee_id
206+
20240701,weekday,101,A
207+
20240701,weekday,102,B
208+
20240702,weekday,101,A
209+
20240702,weekday,102,B
210+
20240703,weekday,101,A
211+
20240703,weekday,102,B
212+
20240704,weekday,101,C
213+
20240704,weekday,102,D
214+
20240705,weekday,101,C
215+
20240705,weekday,102,D
216+
20240706,weekend,103,C
217+
20240706,weekend,104,D
218+
20240707,weekend,103,A
219+
20240707,weekend,104,B
220+
```

docs/spec/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ There are two types of files used in the TODS standard:
1212
- **Supplement files**, used to add, modify, and delete information from public GTFS files to model the operational service for internal purposes (with a `_supplement` filename suffix).
1313
- **TODS-Specific files**, used to model operational elements not currently defined in the GTFS standard.
1414

15+
All files are optional.
16+
1517
### Files
1618

1719
| **File Name** | **Type** | **Description** |
@@ -21,6 +23,7 @@ There are two types of files used in the TODS standard:
2123
| stop_times_supplement.txt | Supplement | Supplements and modifies GTFS [stop_times.txt](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#stop_timestxt) with non-public times at which trips stop at locations, `stop_times` entries for non-public trips, and related information. |
2224
| routes_supplement.txt | Supplement | Supplements and modifies GTFS [routes.txt](https://github.com/google/transit/blob/master/gtfs/spec/en/reference.md#routestxt) with internal route identifiers and other non-public route identification. |
2325
| run_events.txt | TODS-Specific | Lists all trips and other scheduled activities to be performed by a member of personnel during a run. |
26+
| employee_run_dates.txt | TODS-Specific | Assigns employees to runs. |
2427

2528
_The use of the Supplement standard to modify other GTFS files is not yet formally adopted into the specification and remains subject to change. Other files may be formally adopted in the future._
2629

@@ -133,9 +136,30 @@ Events that don't have `trip_id` set may overlap in time with any other events.
133136

134137
Because some events may overlap in time, it may not be possible to choose a single order for events within a run that's correct for all uses. Producers should use `event_sequence` to define a reasonable order. If a consumer cares about exactly how overlapping events are ordered, they should sort based on the time fields and `event_type` instead.
135138

139+
#### Run ID Uniqueness
140+
141+
Run IDs may be non-unique. E.g. E.g. there may be a "Run 100" on both Weekday and Weekend service. There may even be a Run 100 on both `garage1-weekday` and `garage2-weekday` services, happening on the same day. Runs are uniquely referred to by a `(service_id, run_id)` pair. This is why the service ID is required on this file and other files that refer to run IDs.
142+
136143
#### `run_events` Notes
137144

138145
- Multiple `run_event`s may refer to the same `trip_id`, if multiple employees work on that trip.
139146
- Events may have gaps between the end time of one event and the start time of the next. e.g. if an operator's layovers aren't represented by an event.
140147
- `start_time` may equal `end_time` for an event that's a single point in time (such as a report time) without any duration.
141148
- Recommended sort order: `service_id`, `run_id`, `event_sequence`.
149+
150+
### `employee_run_dates.txt`
151+
152+
Describes which employees are scheduled to which runs on which dates.
153+
154+
This file should represent the schedule after holidays, vacations, and other scheduled exceptions have been applied.
155+
156+
Each run and date combination may appear 0 times in this file (if there's no assigned employee), 1 time, or multiple times (if multiple employees are assigned to the same run on the same date).
157+
158+
Primary Key: `*`
159+
160+
| **Field Name** | **Type** | **Required** | **Description** |
161+
| --- | --- | --- | --- |
162+
| `date` | Date | Required | Service date. |
163+
| `service_id` | ID referencing [`run_events.txt`](#run_eventstxt) | Required | Part of the Run ID, which is refered to as `(service_id, run_id)`. See [Run ID Uniqueness](#run-id-uniqueness). |
164+
| `run_id` | ID referencing [`run_events.txt`](#run_eventstxt) | Required | The run that's added to this employee's schedule. |
165+
| `employee_id` | ID | Required | References an agency's external systems. Employee IDs are not used elsewhere in TODS. |

0 commit comments

Comments
 (0)