corequery-gtfs 0.16.4 → 1.0.1
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/README.md +382 -1
- package/dist/config/routes.d.ts +1 -1
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -1
- package/dist/data/raw/realtime-data-json.d.ts +1 -2
- package/dist/data/route/route-stop.d.ts +2 -2
- package/dist/data/route/route-stop.js +3 -3
- package/dist/data/route/route-stop.js.map +1 -1
- package/dist/parser/gtfs-route-matcher.js +6 -6
- package/dist/parser/gtfs-route-matcher.js.map +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -1,5 +1,386 @@
|
|
|
1
|
-
# CoreQuery GTFS
|
|
1
|
+
# CoreQuery GTFS <!-- omit in toc -->
|
|
2
2
|
|
|
3
3
|
[](https://codecov.io/gh/dan-schel/corequery-gtfs)
|
|
4
4
|
|
|
5
5
|
Library for parsing services from GTFS feeds for [CoreQuery](https://github.com/dan-schel/corequery).
|
|
6
|
+
|
|
7
|
+
## Table of contents <!-- omit in toc -->
|
|
8
|
+
|
|
9
|
+
- [Basic usage](#basic-usage)
|
|
10
|
+
- [Configuration](#configuration)
|
|
11
|
+
- [`lineGtfsIds`](#linegtfsids)
|
|
12
|
+
- [`stopGtfsIds`](#stopgtfsids)
|
|
13
|
+
- [`lineRoutesMapping`](#lineroutesmapping)
|
|
14
|
+
- [`bonusLinesMapping`](#bonuslinesmapping)
|
|
15
|
+
- [`timezoneConfig`](#timezoneconfig)
|
|
16
|
+
- [`interpolationMode`](#interpolationmode)
|
|
17
|
+
- [Compatibility](#compatibility)
|
|
18
|
+
|
|
19
|
+
## Basic usage
|
|
20
|
+
|
|
21
|
+
Setting up CoreQuery GTFS looks something like this:
|
|
22
|
+
|
|
23
|
+
> [!NOTE]
|
|
24
|
+
> While CoreQuery GTFS will handle the trip parsing, you are required to write your own logic for fetching the schedule and reading the CSV files into JS objects, as well as fetching the realtime feed and converting it from Protobuf binary data into JSON form.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import {
|
|
28
|
+
GtfsSystem,
|
|
29
|
+
type GtfsConfig,
|
|
30
|
+
type GtfsFeedCsv,
|
|
31
|
+
type RealtimeDataJson,
|
|
32
|
+
} from "corequery-gtfs";
|
|
33
|
+
|
|
34
|
+
// Configure and construct a `GtfsSystem`, which is the primary interface for
|
|
35
|
+
// CoreQuery GTFS. See section below for details on configuration.
|
|
36
|
+
const config: GtfsConfig = {/* ... */};
|
|
37
|
+
const gtfsSystem = GtfsSystem.build(config);
|
|
38
|
+
|
|
39
|
+
async function fetchGtfsScheduleData(): Promise<GtfsFeedCsv> {
|
|
40
|
+
// TODO: Download the schedule data zip, and read the CSV inside (see
|
|
41
|
+
// `GtfsFeedCsv` for the required format).
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function fetchGtfsRealtimeData(): Promise<RealtimeDataJson> {
|
|
45
|
+
// TODO: Fetch from the realtime feed and convert it into JSON form (see
|
|
46
|
+
// `RealtimeDataJson` for the required format).
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Then, when an update to the GTFS schedule data is available, run:
|
|
50
|
+
const scheduleData = await fetchGtfsScheduleData();
|
|
51
|
+
const realtimeData = await fetchGtfsRealtimeData();
|
|
52
|
+
gtfsSystem.onNewScheduleData(scheduleData, realtimeData);
|
|
53
|
+
|
|
54
|
+
// And when an update to the GTFS realtime data is available, but the schedule
|
|
55
|
+
// data is still the same, run:
|
|
56
|
+
const realtimeData = await fetchGtfsRealtimeData();
|
|
57
|
+
gtfsSystem.onNewRealtimeData(realtimeData);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Once setup, you can pass a `GtfsServiceSource` instance to CoreQuery as a service source:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import {
|
|
64
|
+
Corequery,
|
|
65
|
+
Departure,
|
|
66
|
+
Service,
|
|
67
|
+
Tags,
|
|
68
|
+
ServiceOriginatingMovement,
|
|
69
|
+
ServiceRegularMovement,
|
|
70
|
+
ServiceTerminatingMovement,
|
|
71
|
+
ServicePassingMovement,
|
|
72
|
+
EntireVehicleFormsServiceConnection,
|
|
73
|
+
GenericConnection,
|
|
74
|
+
} from "corequery";
|
|
75
|
+
import { GtfsServiceSource } from "corequery-gtfs";
|
|
76
|
+
|
|
77
|
+
const serviceSource = new GtfsServiceSource<
|
|
78
|
+
Departure,
|
|
79
|
+
Service,
|
|
80
|
+
Tags,
|
|
81
|
+
ServiceOriginatingMovement,
|
|
82
|
+
ServiceRegularMovement,
|
|
83
|
+
ServiceTerminatingMovement,
|
|
84
|
+
ServicePassingMovement,
|
|
85
|
+
EntireVehicleFormsServiceConnection,
|
|
86
|
+
GenericConnection
|
|
87
|
+
>({
|
|
88
|
+
// If you use multiple service sources in your CoreQuery app (e.g. you have
|
|
89
|
+
// multiple GTFS feeds from different operators to combine), each one needs a
|
|
90
|
+
// unique ID.
|
|
91
|
+
sourceId: "gtfs",
|
|
92
|
+
|
|
93
|
+
// As built above.
|
|
94
|
+
gtfsSystem: gtfsSystem,
|
|
95
|
+
|
|
96
|
+
// GTFS data can be unbounded, so if you're querying for departures and
|
|
97
|
+
// filtering the result, you could end up with an infinite loop. Set this to
|
|
98
|
+
// `null` if you're brave, otherwise a reasonable limit (e.g. 14 days) can
|
|
99
|
+
// prevent your server iterating for ages in the hopes of finding some
|
|
100
|
+
// theoretical next future departure!
|
|
101
|
+
departureIterationLimitHours: 14 * 24,
|
|
102
|
+
|
|
103
|
+
// The `corequery-gtfs` package has no dependency on `corequery` itself, and
|
|
104
|
+
// therefore cannot instantiate CoreQuery classes directly. This enables it
|
|
105
|
+
// to, via dependency injection.
|
|
106
|
+
buildDeparture: (x) => new Departure(x),
|
|
107
|
+
buildService: (x) => new Service(x),
|
|
108
|
+
buildTags: (x) => new Tags(x),
|
|
109
|
+
buildServiceOriginatingMovement: (x) => new ServiceOriginatingMovement(x),
|
|
110
|
+
buildServiceRegularMovement: (x) => new ServiceRegularMovement(x),
|
|
111
|
+
buildServiceTerminatingMovement: (x) => new ServiceTerminatingMovement(x),
|
|
112
|
+
buildServicePassingMovement: (x) => new ServicePassingMovement(x),
|
|
113
|
+
buildServiceEntireVehicleFormsConnection: (x) =>
|
|
114
|
+
new EntireVehicleFormsServiceConnection(x),
|
|
115
|
+
buildServiceGenericConnection: (x) => new GenericConnection(x),
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const app = new Corequery((app) => ({
|
|
119
|
+
// See https://github.com/dan-schel/corequery for more information on
|
|
120
|
+
// configuring CoreQuery.
|
|
121
|
+
stops: [/* ... */],
|
|
122
|
+
lines: [/* ... */],
|
|
123
|
+
|
|
124
|
+
// ...
|
|
125
|
+
|
|
126
|
+
serviceSources: [serviceSource],
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
// Start the CoreQuery server.
|
|
130
|
+
await app.start();
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Configuration
|
|
134
|
+
|
|
135
|
+
A `GtfsSystem` is configured with 6 fields, 2 of which are optional:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
const config: GtfsConfig = {
|
|
139
|
+
// Maps GTFS route IDs to the line IDs used by your CoreQuery system, e.g.
|
|
140
|
+
// "aus:vic:vic-01-TRN:" in GTFS means Gippsland line (CoreQuery ID #6).
|
|
141
|
+
lineGtfsIds: {/* ... */},
|
|
142
|
+
|
|
143
|
+
// Maps GTFS stop IDs to the stop IDs used by your CoreQuery system, e.g.
|
|
144
|
+
// "nsw:rail:ABY" in GTFS means Albury station (CoreQuery ID #4).
|
|
145
|
+
stopGtfsIds: {/* ... */},
|
|
146
|
+
|
|
147
|
+
// A list of which stops can appear on each line, and in what order. Trips in
|
|
148
|
+
// a GTFS schedule only list the served stops. With the concept of "routes",
|
|
149
|
+
// every trip must match a route, and any stops which appear in the route
|
|
150
|
+
// between stops listed in the GTFS trip will be added as "passing" (a.k.a.
|
|
151
|
+
// express) movements.
|
|
152
|
+
lineRoutesMapping: {/* ... */},
|
|
153
|
+
|
|
154
|
+
// When a trip is matched to a route on a particular line, this mapping
|
|
155
|
+
// specifies which other "bonus" lines the trip could also be on. (This field
|
|
156
|
+
// is optional.)
|
|
157
|
+
//
|
|
158
|
+
// For example, a trip with a route ID of "aus:vic:vic-02-PKM:" will be parsed
|
|
159
|
+
// against routes on the Pakenham line, but it might be the case that the trip
|
|
160
|
+
// could also be considered a Cranbourne line service if it exclusively runs
|
|
161
|
+
// on the section both lines share.
|
|
162
|
+
//
|
|
163
|
+
// Once a successful match is made on the primary line, this mapping tells
|
|
164
|
+
// CoreQuery GTFS which other lines to try matching against. Depending on the
|
|
165
|
+
// configuration, the bonus line ID will either replace or be appended to the
|
|
166
|
+
// list of line IDs associated with the trip.
|
|
167
|
+
bonusLinesMapping: {/* ... */},
|
|
168
|
+
|
|
169
|
+
// Details about the timezone of the GTFS schedule data.
|
|
170
|
+
timezoneConfig: {/* ... */},
|
|
171
|
+
|
|
172
|
+
// Controls how realtime delays are interpolated between given updated times.
|
|
173
|
+
// (This field is optional. If omitted, `follow-spec` is used by default.)
|
|
174
|
+
interpolationMode: "follow-spec",
|
|
175
|
+
};
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### `lineGtfsIds`
|
|
179
|
+
|
|
180
|
+
Maps GTFS route IDs to the line IDs used by your CoreQuery system, e.g. `aus:vic:vic-02-SHM:` in GTFS means Sandringham line (CoreQuery ID `#1`).
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const config: GtfsConfig = {
|
|
184
|
+
lineGtfsIds: {
|
|
185
|
+
1: {
|
|
186
|
+
general: ["aus:vic:vic-02-SHM:"],
|
|
187
|
+
|
|
188
|
+
// Any trips using this GTFS route ID will be ignored, e.g. replacement buses.
|
|
189
|
+
ignored: ["aus:vic:vic-02-SHM-R:"],
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
// ...
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
// ...
|
|
196
|
+
};
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### `stopGtfsIds`
|
|
200
|
+
|
|
201
|
+
Maps GTFS stop IDs to the stop IDs used by your CoreQuery system, e.g. `vic:rail:ACF`, `13738`, and `13739` in GTFS all mean Aircraft station (CoreQuery ID `#1`).
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
const config: GtfsConfig = {
|
|
205
|
+
stopGtfsIds: {
|
|
206
|
+
1: {
|
|
207
|
+
// Trips using GTFS stop ID "vic:rail:ACF" will still be associated with
|
|
208
|
+
// Aircraft station, but will have no position ID at this stop, i.e. the
|
|
209
|
+
// platform will be considered unknown.
|
|
210
|
+
general: ["vic:rail:ACF"],
|
|
211
|
+
|
|
212
|
+
positional: {
|
|
213
|
+
// Trips using GTFS stop ID "13738" will be associated with position #51
|
|
214
|
+
// ("Platform 1").
|
|
215
|
+
51: ["13738"],
|
|
216
|
+
|
|
217
|
+
// Trips using GTFS stop ID "13739" will be associated with position #52
|
|
218
|
+
// ("Platform 2").
|
|
219
|
+
52: ["13739"],
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
// ...
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
// ...
|
|
227
|
+
};
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### `lineRoutesMapping`
|
|
231
|
+
|
|
232
|
+
A list of which stops can appear on each line, and in what order. Trips in a GTFS schedule only list the served stops. With the concept of "routes", every trip must match a route, and any stops which appear in the route between stops listed in the GTFS trip will be added as "passing" (a.k.a. express) movements.
|
|
233
|
+
|
|
234
|
+
```ts
|
|
235
|
+
const config: GtfsConfig = {
|
|
236
|
+
lineRoutesMapping: {
|
|
237
|
+
1: [
|
|
238
|
+
{
|
|
239
|
+
// Note that `stopId` here is the CoreQuery ID, not the GTFS stop ID.
|
|
240
|
+
//
|
|
241
|
+
// Anything marked `hideUnlessServed: true` means services on this route
|
|
242
|
+
// can include this stop, but if they don't, it won't be shown as an
|
|
243
|
+
// express movement in stopping patterns.
|
|
244
|
+
//
|
|
245
|
+
// For example, the Gippsland line doesn't really include East
|
|
246
|
+
// Pakenham as a regular stop, so we don't want all normal services to
|
|
247
|
+
// say "runs express through East Pakenham", but it's fairly common
|
|
248
|
+
// that during disruptions, Gippsland line trains start and end at
|
|
249
|
+
// East Pakenham, so we only show East Pakenham as a stop when it's
|
|
250
|
+
// actually served.
|
|
251
|
+
stops: [
|
|
252
|
+
{ stopId: 240, hideUnlessServed: false },
|
|
253
|
+
{ stopId: 123, hideUnlessServed: false },
|
|
254
|
+
{ stopId: 38, hideUnlessServed: false },
|
|
255
|
+
{ stopId: 178, hideUnlessServed: false },
|
|
256
|
+
{ stopId: 202, hideUnlessServed: false },
|
|
257
|
+
{ stopId: 107, hideUnlessServed: false },
|
|
258
|
+
{ stopId: 92, hideUnlessServed: false },
|
|
259
|
+
{ stopId: 228, hideUnlessServed: false },
|
|
260
|
+
{ stopId: 18, hideUnlessServed: false },
|
|
261
|
+
{ stopId: 307, hideUnlessServed: false },
|
|
262
|
+
{ stopId: 219, hideUnlessServed: false },
|
|
263
|
+
{ stopId: 252, hideUnlessServed: false },
|
|
264
|
+
{ stopId: 224, hideUnlessServed: false },
|
|
265
|
+
{ stopId: 104, hideUnlessServed: false },
|
|
266
|
+
],
|
|
267
|
+
|
|
268
|
+
// Give metadata for any GTFS trips which match this route. Remember
|
|
269
|
+
// that CoreQuery allows services to have colors, independently of the
|
|
270
|
+
// line color, or line diagram color. We can use service tag #1 to mean
|
|
271
|
+
// "Citybound", and then enable filtering by service tag in CoreQuery.
|
|
272
|
+
color: "pink",
|
|
273
|
+
serviceTags: [1],
|
|
274
|
+
},
|
|
275
|
+
|
|
276
|
+
// A route is not bidirectional. If services run in the other direction,
|
|
277
|
+
// too, define a second route.
|
|
278
|
+
{
|
|
279
|
+
stops: [
|
|
280
|
+
{ stopId: 104, hideUnlessServed: false },
|
|
281
|
+
{ stopId: 224, hideUnlessServed: false },
|
|
282
|
+
{ stopId: 252, hideUnlessServed: false },
|
|
283
|
+
{ stopId: 219, hideUnlessServed: false },
|
|
284
|
+
{ stopId: 307, hideUnlessServed: false },
|
|
285
|
+
{ stopId: 18, hideUnlessServed: false },
|
|
286
|
+
{ stopId: 228, hideUnlessServed: false },
|
|
287
|
+
{ stopId: 92, hideUnlessServed: false },
|
|
288
|
+
{ stopId: 107, hideUnlessServed: false },
|
|
289
|
+
{ stopId: 202, hideUnlessServed: false },
|
|
290
|
+
{ stopId: 178, hideUnlessServed: false },
|
|
291
|
+
{ stopId: 38, hideUnlessServed: false },
|
|
292
|
+
{ stopId: 123, hideUnlessServed: false },
|
|
293
|
+
{ stopId: 240, hideUnlessServed: false },
|
|
294
|
+
],
|
|
295
|
+
color: "pink",
|
|
296
|
+
|
|
297
|
+
// We'll use service tag #2 to mean "Outbound".
|
|
298
|
+
serviceTags: [2],
|
|
299
|
+
},
|
|
300
|
+
],
|
|
301
|
+
},
|
|
302
|
+
|
|
303
|
+
// ...
|
|
304
|
+
};
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### `bonusLinesMapping`
|
|
308
|
+
|
|
309
|
+
When a trip is matched to a route on a particular line, this mapping specifies which other "bonus" lines the trip could also be on. (This field is optional.)
|
|
310
|
+
|
|
311
|
+
For example, a trip with a route ID of "aus:vic:vic-02-PKM:" will be parsed against routes on the Pakenham line, but it might be the case that the trip could also be considered a Cranbourne line service if it exclusively runs on the section both lines share.
|
|
312
|
+
|
|
313
|
+
Once a successful match is made on the primary line, this mapping tells CoreQuery GTFS which other lines to try matching against. Depending on the configuration, the bonus line ID will either replace or be appended to the list of line IDs associated with the trip.
|
|
314
|
+
|
|
315
|
+
```ts
|
|
316
|
+
const config: GtfsConfig = {
|
|
317
|
+
bonusLinesMapping: {
|
|
318
|
+
// Add mode: Services designated as Cranbourne line (CoreQuery ID #4)
|
|
319
|
+
// services are eligible to be considered Pakenham line (CoreQuery ID #5)
|
|
320
|
+
// services if they also match a Pakenham line route.
|
|
321
|
+
4: {
|
|
322
|
+
mode: "add",
|
|
323
|
+
lines: [5],
|
|
324
|
+
},
|
|
325
|
+
|
|
326
|
+
// Replace mode: Services designated as Flemington Racecourse line
|
|
327
|
+
// (CoreQuery ID #16) services, but which also match Upfield line (CoreQuery
|
|
328
|
+
// ID #13) and/or Craigieburn line (CoreQuery ID #14) routes will NOT be
|
|
329
|
+
// considered Flemington Racecourse line services anymore, and will instead
|
|
330
|
+
// be associated with the line/lines that matched.
|
|
331
|
+
16: {
|
|
332
|
+
mode: "replace",
|
|
333
|
+
lines: [14, 13],
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
// ...
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
// ...
|
|
340
|
+
};
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### `timezoneConfig`
|
|
344
|
+
|
|
345
|
+
Details about the timezone of the GTFS schedule data.
|
|
346
|
+
|
|
347
|
+
```ts
|
|
348
|
+
const config: GtfsConfig = {
|
|
349
|
+
timezoneConfig: {
|
|
350
|
+
// Which IANA timezone the GTFS schedule data is given in. As per the GTFS
|
|
351
|
+
// spec, all trips listed for a particular "service day" will use the
|
|
352
|
+
// timezone offset of this timezone as at 12 noon local time that day.
|
|
353
|
+
timezone: "Australia/Melbourne",
|
|
354
|
+
|
|
355
|
+
// The minimum and maximum viable timezone offsets that the above timezone
|
|
356
|
+
// can be in. Consumer apps are asked to provide these to enable a small
|
|
357
|
+
// optimization in the departure iteration code. Err on the side of caution,
|
|
358
|
+
// as being too narrow could result in services being skipped during
|
|
359
|
+
// iteration.
|
|
360
|
+
//
|
|
361
|
+
// E.g. Australia/Melbourne is +10 in AEST and +11 in AEDT, and is only ever
|
|
362
|
+
// within that range.
|
|
363
|
+
minimumViableOffsetSeconds: 10 * 60 * 60,
|
|
364
|
+
maximumViableOffsetSeconds: 11 * 60 * 60,
|
|
365
|
+
},
|
|
366
|
+
|
|
367
|
+
// ...
|
|
368
|
+
};
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### `interpolationMode`
|
|
372
|
+
|
|
373
|
+
Controls how realtime delays are interpolated between given updated times. (This field is optional. If omitted, `follow-spec` is used by default.)
|
|
374
|
+
|
|
375
|
+
- `follow-spec` carries known delays forward between updated stops.
|
|
376
|
+
- `lerp` linearly interpolates delays between known updates.
|
|
377
|
+
|
|
378
|
+
Both modes extrapolate the nearest known delay to stops before the first and after the last given updates.
|
|
379
|
+
|
|
380
|
+
## Compatibility
|
|
381
|
+
|
|
382
|
+
The version you should use depends on the version of CoreQuery you are using.
|
|
383
|
+
|
|
384
|
+
| `corequery-gtfs` version | `corequery` version | Notes |
|
|
385
|
+
| ------------------------ | ------------------- | ----- |
|
|
386
|
+
| `1.0.0` - ? | `0.24.0` - ? | N/A |
|
package/dist/config/routes.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type RouteConfig = {
|
|
|
7
7
|
};
|
|
8
8
|
export type RouteStopConfig = {
|
|
9
9
|
readonly stopId: number;
|
|
10
|
-
readonly
|
|
10
|
+
readonly hideUnlessServed: boolean;
|
|
11
11
|
};
|
|
12
12
|
export type BonusLinesMappingConfig = Record<number, BonusLinesConfig>;
|
|
13
13
|
export type BonusLinesConfig = {
|
package/dist/data/index.d.ts
CHANGED
package/dist/data/index.js
CHANGED
package/dist/data/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC"}
|
|
@@ -10,7 +10,7 @@ export type UpdatedTimeJson = {
|
|
|
10
10
|
readonly delay?: number;
|
|
11
11
|
readonly time?: number;
|
|
12
12
|
};
|
|
13
|
-
type StopTimePropertiesJson = {
|
|
13
|
+
export type StopTimePropertiesJson = {
|
|
14
14
|
readonly pickupType?: string;
|
|
15
15
|
readonly dropOffType?: string;
|
|
16
16
|
};
|
|
@@ -29,4 +29,3 @@ export type TripUpdateJson = {
|
|
|
29
29
|
export type RealtimeDataJson = {
|
|
30
30
|
readonly tripUpdates: readonly TripUpdateJson[];
|
|
31
31
|
};
|
|
32
|
-
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { RouteStopConfig } from "../../config/routes.js";
|
|
2
2
|
export type RouteStopFields = {
|
|
3
3
|
readonly stopId: number;
|
|
4
|
-
readonly
|
|
4
|
+
readonly hideUnlessServed: boolean;
|
|
5
5
|
};
|
|
6
6
|
export declare class RouteStop {
|
|
7
7
|
readonly stopId: number;
|
|
8
|
-
readonly
|
|
8
|
+
readonly hideUnlessServed: boolean;
|
|
9
9
|
constructor(fields: RouteStopFields);
|
|
10
10
|
static build(config: RouteStopConfig): RouteStop;
|
|
11
11
|
with(newValues: Partial<RouteStopFields>): RouteStop;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export class RouteStop {
|
|
2
2
|
stopId;
|
|
3
|
-
|
|
3
|
+
hideUnlessServed;
|
|
4
4
|
constructor(fields) {
|
|
5
5
|
this.stopId = fields.stopId;
|
|
6
|
-
this.
|
|
6
|
+
this.hideUnlessServed = fields.hideUnlessServed;
|
|
7
7
|
}
|
|
8
8
|
static build(config) {
|
|
9
9
|
return new RouteStop({
|
|
10
10
|
stopId: config.stopId,
|
|
11
|
-
|
|
11
|
+
hideUnlessServed: config.hideUnlessServed,
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
with(newValues) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-stop.js","sourceRoot":"","sources":["../../../src/data/route/route-stop.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,SAAS;IACX,MAAM,CAAS;IACf,
|
|
1
|
+
{"version":3,"file":"route-stop.js","sourceRoot":"","sources":["../../../src/data/route/route-stop.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,SAAS;IACX,MAAM,CAAS;IACf,gBAAgB,CAAU;IAEnC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAuB;QAClC,OAAO,IAAI,SAAS,CAAC;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;SAC1C,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,SAAmC;QACtC,OAAO,IAAI,SAAS,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -83,16 +83,16 @@ export class GtfsRouteMatcher {
|
|
|
83
83
|
nextServicingMovementIndex++;
|
|
84
84
|
}
|
|
85
85
|
else if (nextServicingMovementIndex > 0 &&
|
|
86
|
-
!routeStop.
|
|
86
|
+
!routeStop.hideUnlessServed) {
|
|
87
87
|
// Otherwise the stop from the route is an `type: "passing"` movement.
|
|
88
88
|
// `nextServicingMovementIndex > 0` stops us adding passing movements
|
|
89
89
|
// from the route before the service originates.
|
|
90
90
|
//
|
|
91
|
-
// For now, I'm skipping adding `
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
//
|
|
91
|
+
// For now, I'm skipping adding `hideUnlessServed` stops as passing
|
|
92
|
+
// movements. This flag means we don't want this stop to show up in
|
|
93
|
+
// stopping patterns normally, unless it's servicing (e.g. East Pakenham
|
|
94
|
+
// on the Gippsland line is one of these). I'm assuming there's nothing
|
|
95
|
+
// downstream that'll need to consider these hidden stops.
|
|
96
96
|
//
|
|
97
97
|
// (If I need to reconsider this decision for some reason, maybe instead
|
|
98
98
|
// of adding those stops back in to this array with some sort of flag, I
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gtfs-route-matcher.js","sourceRoot":"","sources":["../../src/parser/gtfs-route-matcher.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,oBAAoB,GAErB,MAAM,kBAAkB,CAAC;AAe1B,MAAM,OAAO,gBAAgB;IACV,QAAQ,CAA0C;IAElD,kBAAkB,CAAoB;IACtC,kBAAkB,CAAoB;IAEvD,YAAY,MAA8B;QACxC,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;IACjC,CAAC;IAED,KAAK,CACH,MAAc,EACd,kBAAgC,EAChC,oBAA2C;QAE3C,MAAM,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACxD,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAChE,IAAI,YAAY,IAAI,IAAI,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;YACjD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,aAAa,GAAG,IAAI,CAAC,6BAA6B,CACtD,kBAAkB,EAClB,YAAY,EACZ,oBAAoB,CACrB,CAAC;QAEF,MAAM,oBAAoB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAChE,MAA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,EAAE,CAAC;YAC/B,CAAC;iBAAM,IACL,0BAA0B,GAAG,CAAC;gBAC9B,CAAC,SAAS,CAAC,gBAAgB,EAC3B,CAAC;gBACD,sEAAsE;gBACtE,qEAAqE;gBACrE,gDAAgD;gBAChD,EAAE;gBACF,mEAAmE;gBACnE,mEAAmE;gBACnE,wEAAwE;gBACxE,uEAAuE;gBACvE,0DAA0D;gBAC1D,EAAE;gBACF,wEAAwE;gBACxE,wEAAwE;gBACxE,oEAAoE;gBACpE,uEAAuE;gBACvE,mCAAmC;gBACnC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "corequery-gtfs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -18,24 +18,24 @@
|
|
|
18
18
|
"bump-check": "bump-check --ignore \"^renovate\\/\""
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"temporal-polyfill": "1.0.
|
|
21
|
+
"temporal-polyfill": "1.0.6"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@dan-schel/js-utils": "4.14.1",
|
|
25
25
|
"@eslint/js": "10.0.1",
|
|
26
|
-
"@types/node": "25.9.
|
|
27
|
-
"@vitest/coverage-v8": "5.0.
|
|
26
|
+
"@types/node": "25.9.9",
|
|
27
|
+
"@vitest/coverage-v8": "5.0.5",
|
|
28
28
|
"csv-parser": "3.2.1",
|
|
29
|
-
"eslint": "10.
|
|
29
|
+
"eslint": "10.13.0",
|
|
30
30
|
"eslint-config-prettier": "10.1.8",
|
|
31
|
-
"eslint-plugin-prettier": "5.5.
|
|
32
|
-
"knip": "6.
|
|
33
|
-
"prettier": "3.9.
|
|
34
|
-
"tsx": "4.23.
|
|
31
|
+
"eslint-plugin-prettier": "5.5.7",
|
|
32
|
+
"knip": "6.41.0",
|
|
33
|
+
"prettier": "3.9.10",
|
|
34
|
+
"tsx": "4.23.15",
|
|
35
35
|
"typescript": "6.0.3",
|
|
36
|
-
"typescript-eslint": "8.
|
|
37
|
-
"vitest": "5.0.
|
|
38
|
-
"zod": "4.6.
|
|
36
|
+
"typescript-eslint": "8.71.2",
|
|
37
|
+
"vitest": "5.0.5",
|
|
38
|
+
"zod": "4.6.7"
|
|
39
39
|
},
|
|
40
40
|
"author": "dan-schel",
|
|
41
41
|
"description": "Library for parsing services from GTFS feeds for CoreQuery.",
|