@tmlmobilidade/types 20260320.1741.37 → 20260320.2238.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pcgi/index.d.ts +1 -0
- package/dist/pcgi/index.js +1 -0
- package/dist/pcgi/pcgi-vehicle-event.d.ts +49 -0
- package/dist/pcgi/pcgi-vehicle-event.js +2 -0
- package/dist/vehicle-events/clickhouse-vehicle-event.d.ts +29 -54
- package/dist/vehicle-events/clickhouse-vehicle-event.js +2 -2
- package/dist/vehicle-events/index.d.ts +1 -0
- package/dist/vehicle-events/index.js +1 -0
- package/dist/vehicle-events/raw-vehicle-event.d.ts +68 -0
- package/dist/vehicle-events/raw-vehicle-event.js +18 -0
- package/dist/vehicle-events/simplified-vehicle-event.d.ts +34 -70
- package/dist/vehicle-events/simplified-vehicle-event.js +15 -15
- package/package.json +1 -1
package/dist/pcgi/index.d.ts
CHANGED
package/dist/pcgi/index.js
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PCGI Vehicle Event
|
|
3
|
+
*/
|
|
4
|
+
export interface PcgiVehicleEvent {
|
|
5
|
+
_id: string;
|
|
6
|
+
content: {
|
|
7
|
+
entity: {
|
|
8
|
+
_id: string;
|
|
9
|
+
vehicle: {
|
|
10
|
+
agencyId: string;
|
|
11
|
+
currentStatus: string;
|
|
12
|
+
occupancyStatus: string;
|
|
13
|
+
operationPlanId: string;
|
|
14
|
+
position: {
|
|
15
|
+
bearing: number;
|
|
16
|
+
latitude: number;
|
|
17
|
+
longitude: number;
|
|
18
|
+
odometer: number;
|
|
19
|
+
speed: number;
|
|
20
|
+
};
|
|
21
|
+
stopId: string;
|
|
22
|
+
timestamp: number;
|
|
23
|
+
trigger: {
|
|
24
|
+
activity: string;
|
|
25
|
+
door: string;
|
|
26
|
+
};
|
|
27
|
+
trip: {
|
|
28
|
+
lineId: string;
|
|
29
|
+
patternId: string;
|
|
30
|
+
routeId: string;
|
|
31
|
+
scheduleRelationship: string;
|
|
32
|
+
tripId: string;
|
|
33
|
+
};
|
|
34
|
+
vehicle: {
|
|
35
|
+
_id: string;
|
|
36
|
+
blockId: string;
|
|
37
|
+
driverId: string;
|
|
38
|
+
shiftId: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}[];
|
|
42
|
+
header: {
|
|
43
|
+
gtfsRealtimeVersion: string;
|
|
44
|
+
incrementality: string;
|
|
45
|
+
timestamp: number;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
millis: number;
|
|
49
|
+
}
|
|
@@ -1,44 +1,23 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const ClickHouseVehicleEventSchema: z.ZodObject<
|
|
2
|
+
export declare const ClickHouseVehicleEventSchema: z.ZodObject<{
|
|
3
3
|
_id: z.ZodString;
|
|
4
|
-
created_at: z.ZodEffects<z.ZodNumber, import("../_common/index.js").UnixTimestamp, number>;
|
|
5
|
-
created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
6
|
-
is_locked: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/index.js").UnixTimestamp, number>;
|
|
8
|
-
updated_by: z.ZodOptional<z.ZodString>;
|
|
9
|
-
}, "created_by" | "is_locked" | "updated_by"> & {
|
|
10
4
|
agency_id: z.ZodString;
|
|
11
|
-
|
|
12
|
-
driver_id: z.ZodString;
|
|
13
|
-
event_id: z.ZodString;
|
|
14
|
-
extra_trip_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/index.js").UnixTimestamp, number>;
|
|
15
6
|
latitude: z.ZodNumber;
|
|
16
7
|
longitude: z.ZodNumber;
|
|
17
|
-
odometer: z.ZodNumber;
|
|
18
|
-
pattern_id: z.ZodString;
|
|
19
|
-
position: z.ZodObject<{
|
|
20
|
-
geohash: z.ZodString;
|
|
21
|
-
h3: z.ZodString;
|
|
22
|
-
latitude: z.ZodNumber;
|
|
23
|
-
longitude: z.ZodNumber;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
geohash: string;
|
|
26
|
-
h3: string;
|
|
27
|
-
latitude: number;
|
|
28
|
-
longitude: number;
|
|
29
|
-
}, {
|
|
30
|
-
geohash: string;
|
|
31
|
-
h3: string;
|
|
32
|
-
latitude: number;
|
|
33
|
-
longitude: number;
|
|
34
|
-
}>;
|
|
35
8
|
received_at: z.ZodEffects<z.ZodNumber, import("../_common/index.js").UnixTimestamp, number>;
|
|
36
|
-
stop_id: z.ZodString;
|
|
37
|
-
trigger_activity: z.ZodString;
|
|
38
|
-
trigger_door: z.ZodString;
|
|
39
9
|
trip_id: z.ZodString;
|
|
40
10
|
vehicle_id: z.ZodString;
|
|
41
|
-
|
|
11
|
+
bearing: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
12
|
+
current_status: z.ZodDefault<z.ZodNullable<z.ZodEnum<["INCOMING_AT", "STOPPED_AT", "IN_TRANSIT_TO"]>>>;
|
|
13
|
+
door: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
driver_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
extra_trip_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
odometer: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
17
|
+
pattern_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
18
|
+
speed: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
19
|
+
stop_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
} & {
|
|
42
21
|
h3_1: z.ZodString;
|
|
43
22
|
h3_2: z.ZodString;
|
|
44
23
|
h3_3: z.ZodString;
|
|
@@ -71,9 +50,6 @@ export declare const ClickHouseVehicleEventSchema: z.ZodObject<Omit<Omit<{
|
|
|
71
50
|
created_at: number & {
|
|
72
51
|
__brand: "UnixTimestamp";
|
|
73
52
|
};
|
|
74
|
-
updated_at: number & {
|
|
75
|
-
__brand: "UnixTimestamp";
|
|
76
|
-
};
|
|
77
53
|
latitude: number;
|
|
78
54
|
longitude: number;
|
|
79
55
|
geohash_2: string;
|
|
@@ -100,30 +76,29 @@ export declare const ClickHouseVehicleEventSchema: z.ZodObject<Omit<Omit<{
|
|
|
100
76
|
h3_11: string;
|
|
101
77
|
h3_12: string;
|
|
102
78
|
agency_id: string;
|
|
103
|
-
pattern_id: string;
|
|
79
|
+
pattern_id: string | null;
|
|
104
80
|
received_at: number & {
|
|
105
81
|
__brand: "UnixTimestamp";
|
|
106
82
|
};
|
|
107
|
-
stop_id: string;
|
|
83
|
+
stop_id: string | null;
|
|
108
84
|
trip_id: string;
|
|
109
85
|
vehicle_id: string;
|
|
110
|
-
event_id: string;
|
|
111
86
|
plan_id: string;
|
|
112
87
|
route_id: string;
|
|
113
88
|
operational_date: string & {
|
|
114
89
|
__brand: "OperationalDate";
|
|
115
90
|
};
|
|
116
|
-
|
|
117
|
-
|
|
91
|
+
bearing: number | null;
|
|
92
|
+
odometer: number | null;
|
|
93
|
+
speed: number | null;
|
|
94
|
+
current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null;
|
|
118
95
|
hour: number;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
extra_trip_id?: string | null | undefined;
|
|
96
|
+
door: string | null;
|
|
97
|
+
driver_id: string | null;
|
|
98
|
+
extra_trip_id: string | null;
|
|
123
99
|
}, {
|
|
124
100
|
_id: string;
|
|
125
101
|
created_at: number;
|
|
126
|
-
updated_at: number;
|
|
127
102
|
latitude: number;
|
|
128
103
|
longitude: number;
|
|
129
104
|
geohash_2: string;
|
|
@@ -150,21 +125,21 @@ export declare const ClickHouseVehicleEventSchema: z.ZodObject<Omit<Omit<{
|
|
|
150
125
|
h3_11: string;
|
|
151
126
|
h3_12: string;
|
|
152
127
|
agency_id: string;
|
|
153
|
-
pattern_id: string;
|
|
154
128
|
received_at: number;
|
|
155
|
-
stop_id: string;
|
|
156
129
|
trip_id: string;
|
|
157
130
|
vehicle_id: string;
|
|
158
|
-
event_id: string;
|
|
159
131
|
plan_id: string;
|
|
160
132
|
route_id: string;
|
|
161
133
|
operational_date: string;
|
|
162
|
-
odometer: number;
|
|
163
|
-
current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO";
|
|
164
134
|
hour: number;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
135
|
+
pattern_id?: string | null | undefined;
|
|
136
|
+
stop_id?: string | null | undefined;
|
|
137
|
+
bearing?: number | null | undefined;
|
|
138
|
+
odometer?: number | null | undefined;
|
|
139
|
+
speed?: number | null | undefined;
|
|
140
|
+
current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
|
|
141
|
+
door?: string | null | undefined;
|
|
142
|
+
driver_id?: string | null | undefined;
|
|
168
143
|
extra_trip_id?: string | null | undefined;
|
|
169
144
|
}>;
|
|
170
145
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* * */
|
|
2
2
|
import { ExtendedPositionSchema, OperationalDateSchema } from '../_common/index.js';
|
|
3
|
-
import { z } from 'zod';
|
|
4
3
|
import { SimplifiedVehicleEventSchema } from './simplified-vehicle-event.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
5
|
/* * */
|
|
6
|
-
export const ClickHouseVehicleEventSchema = SimplifiedVehicleEventSchema.
|
|
6
|
+
export const ClickHouseVehicleEventSchema = SimplifiedVehicleEventSchema.extend({
|
|
7
7
|
hour: z.number().min(0).max(23),
|
|
8
8
|
operational_date: OperationalDateSchema,
|
|
9
9
|
plan_id: z.string(),
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RawVehicleEventSchema: z.ZodObject<{
|
|
3
|
+
_id: z.ZodString;
|
|
4
|
+
agency_id: z.ZodString;
|
|
5
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
6
|
+
entity_id: z.ZodString;
|
|
7
|
+
raw: z.ZodAny;
|
|
8
|
+
received_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
9
|
+
version: z.ZodEnum<["default"]>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
_id: string;
|
|
12
|
+
created_at: number & {
|
|
13
|
+
__brand: "UnixTimestamp";
|
|
14
|
+
};
|
|
15
|
+
agency_id: string;
|
|
16
|
+
received_at: number & {
|
|
17
|
+
__brand: "UnixTimestamp";
|
|
18
|
+
};
|
|
19
|
+
entity_id: string;
|
|
20
|
+
version: "default";
|
|
21
|
+
raw?: any;
|
|
22
|
+
}, {
|
|
23
|
+
_id: string;
|
|
24
|
+
created_at: number;
|
|
25
|
+
agency_id: string;
|
|
26
|
+
received_at: number;
|
|
27
|
+
entity_id: string;
|
|
28
|
+
version: "default";
|
|
29
|
+
raw?: any;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Vehicle Events are produced by the vehicle's on-board computer on a regular schedule
|
|
33
|
+
* or whenever a significant event occurs. These events are used to track the vehicle's
|
|
34
|
+
* location, speed, and status, as well as the current service being provided by the vehicle.
|
|
35
|
+
* These events are based on the GTFS-RT specification but extended with additional fields
|
|
36
|
+
* specific to TML's needs.
|
|
37
|
+
*/
|
|
38
|
+
export type RawVehicleEvent = z.infer<typeof RawVehicleEventSchema>;
|
|
39
|
+
export declare const HashableRawVehicleEventSchema: z.ZodObject<Omit<{
|
|
40
|
+
_id: z.ZodString;
|
|
41
|
+
agency_id: z.ZodString;
|
|
42
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
43
|
+
entity_id: z.ZodString;
|
|
44
|
+
raw: z.ZodAny;
|
|
45
|
+
received_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
46
|
+
version: z.ZodEnum<["default"]>;
|
|
47
|
+
}, "_id" | "received_at">, "strip", z.ZodTypeAny, {
|
|
48
|
+
created_at: number & {
|
|
49
|
+
__brand: "UnixTimestamp";
|
|
50
|
+
};
|
|
51
|
+
agency_id: string;
|
|
52
|
+
entity_id: string;
|
|
53
|
+
version: "default";
|
|
54
|
+
raw?: any;
|
|
55
|
+
}, {
|
|
56
|
+
created_at: number;
|
|
57
|
+
agency_id: string;
|
|
58
|
+
entity_id: string;
|
|
59
|
+
version: "default";
|
|
60
|
+
raw?: any;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* A HashableRawVehicleEvent is a RawVehicleEvent without the _id and received_at fields,
|
|
64
|
+
* which are not relevant for hashing purposes. This type is used to create a unique hash
|
|
65
|
+
* for each vehicle event based on its content, allowing us to identify duplicate events
|
|
66
|
+
* and avoid storing them multiple times in the database.
|
|
67
|
+
*/
|
|
68
|
+
export type HashableRawVehicleEvent = z.infer<typeof HashableRawVehicleEventSchema>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* * */
|
|
2
|
+
import { UnixTimeStampSchema } from '../_common/unix-timestamp.js';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
/* * */
|
|
5
|
+
export const RawVehicleEventSchema = z.object({
|
|
6
|
+
_id: z.string(),
|
|
7
|
+
agency_id: z.string(),
|
|
8
|
+
created_at: UnixTimeStampSchema,
|
|
9
|
+
entity_id: z.string(),
|
|
10
|
+
raw: z.any(),
|
|
11
|
+
received_at: UnixTimeStampSchema,
|
|
12
|
+
version: z.enum(['default']),
|
|
13
|
+
});
|
|
14
|
+
/* * */
|
|
15
|
+
export const HashableRawVehicleEventSchema = RawVehicleEventSchema.omit({
|
|
16
|
+
_id: true,
|
|
17
|
+
received_at: true,
|
|
18
|
+
});
|
|
@@ -1,105 +1,69 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const SimplifiedVehicleEventSchema: z.ZodObject<
|
|
2
|
+
export declare const SimplifiedVehicleEventSchema: z.ZodObject<{
|
|
3
3
|
_id: z.ZodString;
|
|
4
|
-
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
5
|
-
created_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
6
|
-
is_locked: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
8
|
-
updated_by: z.ZodOptional<z.ZodString>;
|
|
9
|
-
}, "created_by" | "is_locked" | "updated_by"> & {
|
|
10
4
|
agency_id: z.ZodString;
|
|
11
|
-
|
|
12
|
-
driver_id: z.ZodString;
|
|
13
|
-
event_id: z.ZodString;
|
|
14
|
-
extra_trip_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5
|
+
created_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
15
6
|
latitude: z.ZodNumber;
|
|
16
7
|
longitude: z.ZodNumber;
|
|
17
|
-
odometer: z.ZodNumber;
|
|
18
|
-
pattern_id: z.ZodString;
|
|
19
|
-
position: z.ZodObject<{
|
|
20
|
-
geohash: z.ZodString;
|
|
21
|
-
h3: z.ZodString;
|
|
22
|
-
latitude: z.ZodNumber;
|
|
23
|
-
longitude: z.ZodNumber;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
geohash: string;
|
|
26
|
-
h3: string;
|
|
27
|
-
latitude: number;
|
|
28
|
-
longitude: number;
|
|
29
|
-
}, {
|
|
30
|
-
geohash: string;
|
|
31
|
-
h3: string;
|
|
32
|
-
latitude: number;
|
|
33
|
-
longitude: number;
|
|
34
|
-
}>;
|
|
35
8
|
received_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
|
|
36
|
-
stop_id: z.ZodString;
|
|
37
|
-
trigger_activity: z.ZodString;
|
|
38
|
-
trigger_door: z.ZodString;
|
|
39
9
|
trip_id: z.ZodString;
|
|
40
10
|
vehicle_id: z.ZodString;
|
|
11
|
+
bearing: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
12
|
+
current_status: z.ZodDefault<z.ZodNullable<z.ZodEnum<["INCOMING_AT", "STOPPED_AT", "IN_TRANSIT_TO"]>>>;
|
|
13
|
+
door: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
14
|
+
driver_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
15
|
+
extra_trip_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
odometer: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
17
|
+
pattern_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
18
|
+
speed: z.ZodDefault<z.ZodNullable<z.ZodNumber>>;
|
|
19
|
+
stop_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
41
20
|
}, "strip", z.ZodTypeAny, {
|
|
42
21
|
_id: string;
|
|
43
22
|
created_at: number & {
|
|
44
23
|
__brand: "UnixTimestamp";
|
|
45
24
|
};
|
|
46
|
-
updated_at: number & {
|
|
47
|
-
__brand: "UnixTimestamp";
|
|
48
|
-
};
|
|
49
25
|
latitude: number;
|
|
50
26
|
longitude: number;
|
|
51
27
|
agency_id: string;
|
|
52
|
-
pattern_id: string;
|
|
28
|
+
pattern_id: string | null;
|
|
53
29
|
received_at: number & {
|
|
54
30
|
__brand: "UnixTimestamp";
|
|
55
31
|
};
|
|
56
|
-
stop_id: string;
|
|
32
|
+
stop_id: string | null;
|
|
57
33
|
trip_id: string;
|
|
58
34
|
vehicle_id: string;
|
|
59
|
-
|
|
60
|
-
odometer: number;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
longitude: number;
|
|
67
|
-
};
|
|
68
|
-
driver_id: string;
|
|
69
|
-
trigger_activity: string;
|
|
70
|
-
trigger_door: string;
|
|
71
|
-
extra_trip_id?: string | null | undefined;
|
|
35
|
+
bearing: number | null;
|
|
36
|
+
odometer: number | null;
|
|
37
|
+
speed: number | null;
|
|
38
|
+
current_status: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null;
|
|
39
|
+
door: string | null;
|
|
40
|
+
driver_id: string | null;
|
|
41
|
+
extra_trip_id: string | null;
|
|
72
42
|
}, {
|
|
73
43
|
_id: string;
|
|
74
44
|
created_at: number;
|
|
75
|
-
updated_at: number;
|
|
76
45
|
latitude: number;
|
|
77
46
|
longitude: number;
|
|
78
47
|
agency_id: string;
|
|
79
|
-
pattern_id: string;
|
|
80
48
|
received_at: number;
|
|
81
|
-
stop_id: string;
|
|
82
49
|
trip_id: string;
|
|
83
50
|
vehicle_id: string;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
};
|
|
93
|
-
driver_id: string;
|
|
94
|
-
trigger_activity: string;
|
|
95
|
-
trigger_door: string;
|
|
51
|
+
pattern_id?: string | null | undefined;
|
|
52
|
+
stop_id?: string | null | undefined;
|
|
53
|
+
bearing?: number | null | undefined;
|
|
54
|
+
odometer?: number | null | undefined;
|
|
55
|
+
speed?: number | null | undefined;
|
|
56
|
+
current_status?: "INCOMING_AT" | "STOPPED_AT" | "IN_TRANSIT_TO" | null | undefined;
|
|
57
|
+
door?: string | null | undefined;
|
|
58
|
+
driver_id?: string | null | undefined;
|
|
96
59
|
extra_trip_id?: string | null | undefined;
|
|
97
60
|
}>;
|
|
98
61
|
/**
|
|
99
|
-
* Vehicle Events are
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
62
|
+
* Simplified Vehicle Events are data structures that represent the essential
|
|
63
|
+
* information about a vehicle's status and location at a given time. They are derived
|
|
64
|
+
* from the raw vehicle events produced by the vehicle's on-board computer, but they
|
|
65
|
+
* have been processed and simplified to include only the most relevant fields for analysis
|
|
66
|
+
* and reporting purposes. These events are used to track the vehicle's location, speed
|
|
67
|
+
* and status, as well as the current service being provided by the vehicle.
|
|
104
68
|
*/
|
|
105
69
|
export type SimplifiedVehicleEvent = z.infer<typeof SimplifiedVehicleEventSchema>;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/* * */
|
|
2
|
-
import { DocumentSchema } from '../_common/document.js';
|
|
3
|
-
import { PositionSchema } from '../_common/position.js';
|
|
4
2
|
import { UnixTimeStampSchema } from '../_common/unix-timestamp.js';
|
|
5
3
|
import { z } from 'zod';
|
|
6
4
|
/* * */
|
|
7
|
-
export const SimplifiedVehicleEventSchema =
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const SimplifiedVehicleEventSchema = z.object({
|
|
6
|
+
//
|
|
7
|
+
// Required Fields
|
|
8
|
+
_id: z.string(),
|
|
10
9
|
agency_id: z.string(),
|
|
11
|
-
|
|
12
|
-
driver_id: z.string(),
|
|
13
|
-
event_id: z.string(),
|
|
14
|
-
extra_trip_id: z.string().nullish(),
|
|
10
|
+
created_at: UnixTimeStampSchema,
|
|
15
11
|
latitude: z.number(),
|
|
16
12
|
longitude: z.number(),
|
|
17
|
-
odometer: z.number(),
|
|
18
|
-
pattern_id: z.string(),
|
|
19
|
-
position: PositionSchema,
|
|
20
13
|
received_at: UnixTimeStampSchema,
|
|
21
|
-
stop_id: z.string(),
|
|
22
|
-
trigger_activity: z.string(),
|
|
23
|
-
trigger_door: z.string(),
|
|
24
14
|
trip_id: z.string(),
|
|
25
15
|
vehicle_id: z.string(),
|
|
16
|
+
// Optional Fields
|
|
17
|
+
bearing: z.number().nullable().default(null),
|
|
18
|
+
current_status: z.enum(['INCOMING_AT', 'STOPPED_AT', 'IN_TRANSIT_TO']).nullable().default(null),
|
|
19
|
+
door: z.string().nullable().default(null),
|
|
20
|
+
driver_id: z.string().nullable().default(null),
|
|
21
|
+
extra_trip_id: z.string().nullable().default(null),
|
|
22
|
+
odometer: z.number().nullable().default(null),
|
|
23
|
+
pattern_id: z.string().nullable().default(null),
|
|
24
|
+
speed: z.number().nullable().default(null),
|
|
25
|
+
stop_id: z.string().nullable().default(null),
|
|
26
26
|
});
|