@golemio/pid 4.1.6-dev.2100685482 → 4.1.6-dev.2103611002

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.
@@ -12,7 +12,11 @@ export declare class DelayComputationManager {
12
12
  * @param {string} tripId - Internal DB trip id
13
13
  * @returns {IComputationTrip} - Result with shape anchor points
14
14
  */
15
- getComputationObject: (tripId: string) => Promise<IComputationTrip | null>;
15
+ getComputationObject(tripId: string): Promise<IComputationTrip | null>;
16
+ private roundToDecimals;
17
+ private shouldReadCoordsFromPrevPrevPoint;
18
+ private setupBearingBetweenPoints;
19
+ private shapePointCompareDistance;
16
20
  /**
17
21
  * Return geometry of anchor points with distance from start along trip track shape
18
22
  *
@@ -34,257 +34,308 @@ class DelayComputationManager {
34
34
  constructor(gtfsTripsRepository) {
35
35
  this.gtfsTripsRepository = gtfsTripsRepository;
36
36
  this.METRO_TRIP_PREFIX_REGEX = /^(991|992|993)/;
37
- /**
38
- * Return shape anchor points along trip track shape with stop times parameters
39
- *
40
- * @param {string} tripId - Internal DB trip id
41
- * @returns {IComputationTrip} - Result with shape anchor points
42
- */
43
- this.getComputationObject = async (tripId) => {
44
- const gtfsTrip = await this.gtfsTripsRepository.findByIdForDelayComputation(tripId);
45
- if (!gtfsTrip) {
46
- helpers_1.log.info(`getComputationObject: GTFS trip ${tripId} was not found`);
47
- return null;
37
+ const simpleConfig = ioc_1.IntegrationEngineContainer.resolve(CoreToken_1.CoreToken.SimpleConfig);
38
+ this.stepBetweenPoints = config_1.config.vehiclePositions.stepBetweenPoints;
39
+ this.stepBetweenPointsforMetro = Number(simpleConfig.getValue("module.pid.vehicle-positions.shapes.metro.stepBetweenPointsForMetro", "0.05"));
40
+ }
41
+ /**
42
+ * Return shape anchor points along trip track shape with stop times parameters
43
+ *
44
+ * @param {string} tripId - Internal DB trip id
45
+ * @returns {IComputationTrip} - Result with shape anchor points
46
+ */
47
+ async getComputationObject(tripId) {
48
+ const gtfsTrip = await this.gtfsTripsRepository.findByIdForDelayComputation(tripId);
49
+ if (!gtfsTrip) {
50
+ helpers_1.log.info(`getComputationObject: GTFS trip ${tripId} was not found`);
51
+ return null;
52
+ }
53
+ const { shape_id, shapes, stop_times } = gtfsTrip;
54
+ if (!shapes?.length) {
55
+ throw new golemio_errors_1.GeneralError(`getComputationObject: GTFS trip ${tripId} has no shapes`, this.constructor.name);
56
+ }
57
+ else if (!stop_times?.length) {
58
+ throw new golemio_errors_1.GeneralError(`getComputationObject: GTFS trip ${tripId} has no stop_times`, this.constructor.name);
59
+ }
60
+ const isMetro = this.METRO_TRIP_PREFIX_REGEX.test(tripId);
61
+ const shapesGeometryAnchorPoints = this.getShapesGeometryAnchorPoints(shape_id, shapes, stop_times, isMetro);
62
+ // MAKING COPY
63
+ const shapePoints = [];
64
+ const lastPointIndex = shapesGeometryAnchorPoints.length - 1;
65
+ // const to determine shape points of stops (in meters)
66
+ const distanceBefore = 0.1;
67
+ const distanceAfter = 0.05;
68
+ for (let i = 0; i < shapesGeometryAnchorPoints.length; i++) {
69
+ const isLastPoint = i === lastPointIndex;
70
+ const bearing = this.setupBearingBetweenPoints(i, shapePoints, shapesGeometryAnchorPoints, isLastPoint);
71
+ // init values
72
+ let thisStopSequence = null;
73
+ let lastStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
74
+ let nextStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
75
+ // these are origin stop_times shape point fron shapes table, clearly at stops points
76
+ if (shapesGeometryAnchorPoints[i].this_stop_sequence) {
77
+ thisStopSequence = shapesGeometryAnchorPoints[i].this_stop_sequence;
48
78
  }
49
- const { shape_id, shapes, stop_times } = gtfsTrip;
50
- if (!shapes?.length) {
51
- throw new golemio_errors_1.GeneralError(`getComputationObject: GTFS trip ${tripId} has no shapes`, this.constructor.name);
79
+ // if is shape anchor point in close distance AFTER LAST stop, then set it also AT STOP
80
+ else if (i > 0 &&
81
+ shapesGeometryAnchorPoints[i].shape_dist_traveled -
82
+ stop_times[shapesGeometryAnchorPoints[i].last_stop_sequence - 1].shape_dist_traveled <=
83
+ distanceAfter) {
84
+ thisStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
52
85
  }
53
- else if (!stop_times?.length) {
54
- throw new golemio_errors_1.GeneralError(`getComputationObject: GTFS trip ${tripId} has no stop_times`, this.constructor.name);
86
+ // if is shape anchor point in close distance BEFORE NEXT stop, then set it also AT STOP
87
+ else if (i < shapesGeometryAnchorPoints.length - 1 &&
88
+ stop_times[shapesGeometryAnchorPoints[i].next_stop_sequence - 1].shape_dist_traveled -
89
+ shapesGeometryAnchorPoints[i].shape_dist_traveled <=
90
+ distanceBefore) {
91
+ thisStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
92
+ lastStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
93
+ nextStopSequence = Math.min(shapesGeometryAnchorPoints[i].next_stop_sequence + 1, stop_times.length);
55
94
  }
56
- const isMetro = this.METRO_TRIP_PREFIX_REGEX.test(tripId);
57
- const shapesGeometryAnchorPoints = this.getShapesGeometryAnchorPoints(shape_id, shapes, stop_times, isMetro);
58
- // MAKING COPY
59
- const shapePoints = [];
60
- // const to determine shape points of stops (in meters)
61
- const distanceBefore = 0.1;
62
- const distanceAfter = 0.05;
63
- for (let i = 0; i < shapesGeometryAnchorPoints.length; i++) {
64
- let bearing = 0;
65
- // add bearing from shape computed for previous shapePoint
66
- if (i > 0) {
67
- // compute bearing from two shape points
68
- let shapePointBearing = Math.round(turf.bearing(turf.point(shapesGeometryAnchorPoints[i - 1].coordinates), turf.point(shapesGeometryAnchorPoints[i].coordinates)));
69
- // turf.bearing returns -180 to 180, when 0 is north
70
- // we need 0 to 359, for negative value we substract from 360
71
- if (shapePointBearing < 0) {
72
- shapePointBearing = 360 - Math.abs(shapePointBearing);
73
- }
74
- // save bearing
75
- shapePoints[i - 1].bearing = shapePointBearing;
76
- // for the last shapePoint copy the bearing from last one
77
- if (shapesGeometryAnchorPoints.length - 1 === i) {
78
- bearing = shapePoints[i - 1].bearing;
79
- }
80
- }
81
- // init values
82
- let thisStopSequence = null;
83
- let lastStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
84
- let nextStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
85
- // these are origin stop_times shape point fron shapes table, clearly at stops points
86
- if (shapesGeometryAnchorPoints[i].this_stop_sequence) {
87
- thisStopSequence = shapesGeometryAnchorPoints[i].this_stop_sequence;
88
- }
89
- // if is shape anchor point in close distance AFTER LAST stop, then set it also AT STOP
90
- else if (i > 0 &&
91
- shapesGeometryAnchorPoints[i].shape_dist_traveled -
92
- stop_times[shapesGeometryAnchorPoints[i].last_stop_sequence - 1].shape_dist_traveled <=
93
- distanceAfter) {
94
- thisStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
95
- }
96
- // if is shape anchor point in close distance BEFORE NEXT stop, then set it also AT STOP
97
- else if (i < shapesGeometryAnchorPoints.length - 1 &&
98
- stop_times[shapesGeometryAnchorPoints[i].next_stop_sequence - 1].shape_dist_traveled -
99
- shapesGeometryAnchorPoints[i].shape_dist_traveled <=
100
- distanceBefore) {
101
- thisStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
102
- lastStopSequence = shapesGeometryAnchorPoints[i].next_stop_sequence;
103
- nextStopSequence = Math.min(shapesGeometryAnchorPoints[i].next_stop_sequence + 1, stop_times.length);
104
- }
105
- let shapeDistTraveled = shapesGeometryAnchorPoints[i].shape_dist_traveled;
106
- let distanceFromLastStop;
107
- // fallback to shape_dist_traveled from GTFS stop_times, if the vehicle is at stop
108
- // and set distance from last stop to 0 (the stop is literally at stop)
109
- if (thisStopSequence !== null) {
110
- shapeDistTraveled = stop_times[thisStopSequence - 1].shape_dist_traveled;
111
- distanceFromLastStop = 0;
112
- }
113
- else {
114
- distanceFromLastStop =
115
- Math.round((shapeDistTraveled - stop_times[lastStopSequence - 1].shape_dist_traveled) * 1000) / 1000;
116
- }
117
- // if is trip at stop than set departure by this stop
118
- // between stops do linear interpolation from departure from last stop and arrival of next stop
119
- const timeScheduledSeconds = thisStopSequence !== null
120
- ? stop_times[lastStopSequence - 1].arrival_time_seconds
121
- : stop_times[lastStopSequence - 1].departure_time_seconds +
122
- Math.round(((stop_times[nextStopSequence - 1].arrival_time_seconds -
123
- stop_times[lastStopSequence - 1].departure_time_seconds) *
124
- distanceFromLastStop) /
125
- (stop_times[nextStopSequence - 1].shape_dist_traveled -
126
- stop_times[lastStopSequence - 1].shape_dist_traveled));
127
- shapePoints.push({
128
- index: i,
129
- at_stop: thisStopSequence !== null,
130
- bearing,
131
- coordinates: shapesGeometryAnchorPoints[i].coordinates,
132
- distance_from_last_stop: distanceFromLastStop,
133
- last_stop_sequence: lastStopSequence,
134
- next_stop_sequence: nextStopSequence,
135
- shape_dist_traveled: shapeDistTraveled,
136
- this_stop_sequence: thisStopSequence,
137
- time_scheduled_seconds: timeScheduledSeconds,
138
- });
95
+ let shapeDistTraveled = shapesGeometryAnchorPoints[i].shape_dist_traveled;
96
+ let distanceFromLastStop;
97
+ // fallback to shape_dist_traveled from GTFS stop_times, if the vehicle is at stop
98
+ // and set distance from last stop to 0 (the stop is literally at stop)
99
+ if (thisStopSequence !== null) {
100
+ shapeDistTraveled = stop_times[thisStopSequence - 1].shape_dist_traveled;
101
+ distanceFromLastStop = 0;
139
102
  }
140
- return {
141
- trip_id: tripId,
142
- stop_times: stop_times,
143
- shapes_anchor_points: shapePoints,
144
- shapes: this.mapGtfsShapesToTripShapes(shapes),
145
- };
103
+ else {
104
+ distanceFromLastStop = this.roundToDecimals(shapeDistTraveled - stop_times[lastStopSequence - 1].shape_dist_traveled, 1000);
105
+ }
106
+ // if is trip at stop than set departure by this stop
107
+ // between stops do linear interpolation from departure from last stop and arrival of next stop
108
+ const timeScheduledSeconds = thisStopSequence !== null
109
+ ? stop_times[lastStopSequence - 1].arrival_time_seconds
110
+ : stop_times[lastStopSequence - 1].departure_time_seconds +
111
+ Math.round(((stop_times[nextStopSequence - 1].arrival_time_seconds -
112
+ stop_times[lastStopSequence - 1].departure_time_seconds) *
113
+ distanceFromLastStop) /
114
+ (stop_times[nextStopSequence - 1].shape_dist_traveled -
115
+ stop_times[lastStopSequence - 1].shape_dist_traveled));
116
+ shapePoints.push({
117
+ index: i,
118
+ at_stop: thisStopSequence !== null,
119
+ bearing,
120
+ coordinates: shapesGeometryAnchorPoints[i].coordinates,
121
+ distance_from_last_stop: distanceFromLastStop,
122
+ last_stop_sequence: lastStopSequence,
123
+ next_stop_sequence: nextStopSequence,
124
+ shape_dist_traveled: shapeDistTraveled,
125
+ this_stop_sequence: thisStopSequence,
126
+ time_scheduled_seconds: timeScheduledSeconds,
127
+ });
128
+ }
129
+ return {
130
+ trip_id: tripId,
131
+ stop_times: stop_times,
132
+ shapes_anchor_points: shapePoints,
133
+ shapes: this.mapGtfsShapesToTripShapes(shapes),
146
134
  };
147
- /**
148
- * Return geometry of anchor points with distance from start along trip track shape
149
- *
150
- * @param {string} shapeId - GTFS shape id
151
- * @param {ITransformedTripShape[]} shapes - GTFS shape points
152
- * @param {IStopTime[]} stops
153
- * @returns {IShapeGeometryAnchorPoint[]} - Result array of geometry points along trip track shape
154
- */
155
- this.getShapesGeometryAnchorPoints = (shapeId, shapes, stops, isMetro = false) => {
156
- try {
157
- let segmentShapes = [];
158
- // Splits shapes array to multiple arrays "delimited" by stops
159
- for (let st = 0; st < stops.length; st++) {
160
- let currentSegment = [];
161
- for (let sh = 0; sh < shapes.length; sh++) {
162
- let shapePoint = { ...shapes[sh], shape_at_stop: false };
163
- if (stops[st].shape_dist_traveled === shapes[sh].shape_dist_traveled) {
164
- shapePoint.shape_at_stop = true;
165
- }
166
- if (st < stops.length - 1 &&
167
- shapePoint.shape_dist_traveled >= stops[st].shape_dist_traveled &&
168
- shapePoint.shape_dist_traveled <= stops[st + 1].shape_dist_traveled) {
169
- currentSegment.push(shapePoint);
170
- }
135
+ }
136
+ roundToDecimals(n, fraction = 100000) {
137
+ return Math.round(n * fraction) / fraction;
138
+ }
139
+ shouldReadCoordsFromPrevPrevPoint(points, i) {
140
+ if (i <= 1) {
141
+ return false;
142
+ }
143
+ return (points[i - 1].coordinates[0] === points[i].coordinates[0] && points[i - 1].coordinates[1] === points[i].coordinates[1]);
144
+ }
145
+ setupBearingBetweenPoints(index, target, source, isLast) {
146
+ // add bearing from shape computed for previous shapePoint
147
+ if (index === 0) {
148
+ return 0;
149
+ }
150
+ let bearing;
151
+ if (this.shouldReadCoordsFromPrevPrevPoint(source, index)) {
152
+ // take bearing of the pre-previous point (i - 2),
153
+ // ... to be saved into previous point (i - 1)
154
+ bearing = target[index - 2].bearing;
155
+ }
156
+ else {
157
+ // compute bearing from two shape points
158
+ bearing = Math.round(turf.bearing(turf.point(source[index - 1].coordinates), turf.point(source[index].coordinates)));
159
+ }
160
+ // turf.bearing returns -180 to 180, when 0 is north
161
+ // we need 0 to 359, for negative value we substract from 360
162
+ if (bearing < 0) {
163
+ bearing = 360 - Math.abs(bearing);
164
+ }
165
+ // save bearing
166
+ target[index - 1].bearing = bearing;
167
+ // for the last shapePoint copy the bearing from last one
168
+ if (isLast) {
169
+ bearing = target[index - 1].bearing;
170
+ }
171
+ return bearing;
172
+ }
173
+ shapePointCompareDistance(point, currentStop, nextStop) {
174
+ if (currentStop.shape_dist_traveled === point.shape_dist_traveled) {
175
+ point.shape_at_stop = true;
176
+ }
177
+ if (nextStop) {
178
+ if (point.shape_dist_traveled >= currentStop.shape_dist_traveled &&
179
+ point.shape_dist_traveled <= nextStop.shape_dist_traveled) {
180
+ // current segment
181
+ return 0;
182
+ }
183
+ else if (point.shape_dist_traveled > nextStop.shape_dist_traveled) {
184
+ // future segment
185
+ return 1;
186
+ }
187
+ }
188
+ // previous stop segment OR missing nextStop (currentStop is last stop)
189
+ return -1;
190
+ }
191
+ /**
192
+ * Return geometry of anchor points with distance from start along trip track shape
193
+ *
194
+ * @param {string} shapeId - GTFS shape id
195
+ * @param {ITransformedTripShape[]} shapes - GTFS shape points
196
+ * @param {IStopTime[]} stops
197
+ * @returns {IShapeGeometryAnchorPoint[]} - Result array of geometry points along trip track shape
198
+ */
199
+ getShapesGeometryAnchorPoints(shapeId, shapes, stops, isMetro = false) {
200
+ try {
201
+ let segmentShapes = [];
202
+ // Splits shapes array to multiple arrays "delimited" by stops
203
+ let startShapeIndex = 0;
204
+ for (let st = 0; st < stops.length; st++) {
205
+ const currentSegment = [];
206
+ for (let sh = startShapeIndex; sh < shapes.length; sh++) {
207
+ const shapePoint = { ...shapes[sh], shape_at_stop: false };
208
+ const shapePointSituation = this.shapePointCompareDistance(shapePoint, stops[st], stops[st + 1]);
209
+ if (shapePointSituation === 0) {
210
+ // next stop iteration (outer for-cycle) can be shorter
211
+ startShapeIndex = sh;
212
+ // each segment starts with "at_stop=true" point
213
+ currentSegment.push(shapePoint);
171
214
  }
172
- if (currentSegment.length) {
173
- segmentShapes.push(currentSegment);
215
+ else if (shapePointSituation === 1) {
216
+ // no need to iterate over all future stops segments
217
+ break;
174
218
  }
175
219
  }
176
- let segmentArr = [];
177
- // concat arrays of stop divided segments with distributed shape points
178
- for (const segment of segmentShapes) {
179
- segmentArr = [
180
- ...segmentArr,
181
- ...this.divideSegmentLine(segment, isMetro ? this.stepBetweenPointsforMetro : this.stepBetweenPoints),
182
- ];
220
+ if (currentSegment.length) {
221
+ segmentShapes.push(currentSegment);
183
222
  }
184
- // Make initial shapesGeometryAnchorPoints
185
- let stopCounter = 0;
186
- const resultArr = segmentArr.map((segment, index) => {
187
- let this_stop_sequence;
188
- let last_stop_sequence;
189
- let next_stop_sequence;
190
- if (segment.shape_at_stop) {
191
- stopCounter++;
192
- this_stop_sequence = stopCounter;
193
- }
194
- else {
195
- this_stop_sequence = null;
196
- }
197
- last_stop_sequence = stopCounter;
198
- next_stop_sequence = stopCounter + 1;
199
- return {
200
- index,
201
- coordinates: [
202
- Math.round(segment.shape_pt_lon * 100000) / 100000,
203
- Math.round(segment.shape_pt_lat * 100000) / 100000,
204
- ],
205
- last_stop_sequence,
206
- next_stop_sequence,
207
- shape_dist_traveled: Math.round(segment.shape_dist_traveled * 1000) / 1000,
208
- this_stop_sequence,
209
- };
210
- });
211
- stopCounter++;
212
- // and lastly shape point for last stop as there is no segment for last stop
213
- resultArr.push({
214
- index: resultArr.length,
215
- coordinates: [
216
- Math.round(shapes[shapes.length - 1].shape_pt_lon * 100000) / 100000,
217
- Math.round(shapes[shapes.length - 1].shape_pt_lat * 100000) / 100000,
218
- ],
219
- last_stop_sequence: stopCounter,
220
- next_stop_sequence: stopCounter,
221
- shape_dist_traveled: Math.round(shapes[shapes.length - 1].shape_dist_traveled * 1000) / 1000,
222
- this_stop_sequence: stopCounter,
223
- });
224
- return resultArr;
225
- }
226
- catch (err) {
227
- helpers_1.log.error(err);
228
- helpers_1.log.error(shapeId);
229
- return [];
230
223
  }
231
- };
232
- /**
233
- * Generate new shape points from segment of trip shape along original one
234
- * - preserving start and end shape points belonging to stops
235
- * - creates new set of shape points between stops to get same point distance along original shape
236
- *
237
- * @param {ISegmentShape[]} segmentsArr - Original shape points segment between two stops
238
- * @param {number} distance - Minimal distance for two consequent shape points
239
- * @returns {ISegmentShape[]} - Result array of new shape points
240
- */
241
- this.divideSegmentLine = (segmentArr, distance = config_1.config.vehiclePositions.stepBetweenPoints) => {
242
- const shapeId = segmentArr[0].shape_id;
243
- const shapeCount = segmentArr.length;
244
- const startShapeDistTraveled = segmentArr[0].shape_dist_traveled;
245
- const endShapeDistTraveled = segmentArr[shapeCount - 1].shape_dist_traveled;
246
- const shapeDistLength = endShapeDistTraveled - startShapeDistTraveled;
247
- const segmentLine = turf.lineString(segmentArr.map((s) => {
248
- return [s.shape_pt_lon, s.shape_pt_lat];
249
- }));
250
- // because we dont believe source shape distances, rather compute length with turf.js
251
- const segmentLength = turf.length(segmentLine);
252
- const middlePointsCount = Math.floor(segmentLength / distance);
253
- const distanceOffset = (segmentLength - distance * middlePointsCount) / 2;
254
- // put first shape point
255
- const resultSegmentPoints = [
256
- {
257
- ...segmentArr[0],
258
- shape_pt_sequence: 1,
259
- },
260
- ];
261
- // for each middle point create acording shape point with interpolated origin shape dist traveled
262
- for (let i = 0; i < middlePointsCount; i++) {
263
- const currentDistance = i * distance + distanceOffset;
264
- const currentDistDistance = (shapeDistLength / segmentLength) * currentDistance;
265
- const newPoint = turf.along(segmentLine, i * distance + distanceOffset);
266
- resultSegmentPoints.push({
267
- shape_id: shapeId,
268
- shape_at_stop: false,
269
- shape_pt_sequence: resultSegmentPoints.length + 1,
270
- shape_pt_lat: newPoint.geometry.coordinates[1],
271
- shape_pt_lon: newPoint.geometry.coordinates[0],
272
- shape_dist_traveled: startShapeDistTraveled + currentDistDistance,
273
- });
224
+ let segmentArr = [];
225
+ // concat arrays of stop divided segments with distributed shape points
226
+ for (const segment of segmentShapes) {
227
+ const line = this.divideSegmentLine(segment, isMetro ? this.stepBetweenPointsforMetro : this.stepBetweenPoints);
228
+ segmentArr.push(...line);
274
229
  }
275
- return resultSegmentPoints;
276
- };
277
- this.mapGtfsShapesToTripShapes = (shapes) => {
278
- return shapes.map((shape) => {
230
+ // Make initial shapesGeometryAnchorPoints
231
+ let stopCounter = 0;
232
+ const resultArr = segmentArr.map((segment, index) => {
233
+ let this_stop_sequence;
234
+ let last_stop_sequence;
235
+ let next_stop_sequence;
236
+ if (segment.shape_at_stop) {
237
+ stopCounter++;
238
+ this_stop_sequence = stopCounter;
239
+ }
240
+ else {
241
+ this_stop_sequence = null;
242
+ }
243
+ last_stop_sequence = stopCounter;
244
+ next_stop_sequence = stopCounter + 1;
245
+ const coordinates = [
246
+ this.roundToDecimals(segment.shape_pt_lon),
247
+ this.roundToDecimals(segment.shape_pt_lat),
248
+ ];
279
249
  return {
280
- dist: shape.shape_dist_traveled,
281
- coords: [shape.shape_pt_lon, shape.shape_pt_lat],
250
+ index,
251
+ coordinates,
252
+ last_stop_sequence,
253
+ next_stop_sequence,
254
+ shape_dist_traveled: this.roundToDecimals(segment.shape_dist_traveled, 1000),
255
+ this_stop_sequence,
282
256
  };
283
257
  });
284
- };
285
- const simpleConfig = ioc_1.IntegrationEngineContainer.resolve(CoreToken_1.CoreToken.SimpleConfig);
286
- this.stepBetweenPoints = config_1.config.vehiclePositions.stepBetweenPoints;
287
- this.stepBetweenPointsforMetro = Number(simpleConfig.getValue("module.pid.vehicle-positions.shapes.metro.stepBetweenPointsForMetro", "0.025"));
258
+ stopCounter++;
259
+ // and lastly shape point for last stop as there is no segment for last stop
260
+ resultArr.push({
261
+ index: resultArr.length,
262
+ coordinates: [
263
+ this.roundToDecimals(shapes[shapes.length - 1].shape_pt_lon),
264
+ this.roundToDecimals(shapes[shapes.length - 1].shape_pt_lat),
265
+ ],
266
+ last_stop_sequence: stopCounter,
267
+ next_stop_sequence: stopCounter,
268
+ shape_dist_traveled: this.roundToDecimals(shapes[shapes.length - 1].shape_dist_traveled, 1000),
269
+ this_stop_sequence: stopCounter,
270
+ });
271
+ return resultArr;
272
+ }
273
+ catch (err) {
274
+ helpers_1.log.error(err);
275
+ helpers_1.log.error(shapeId);
276
+ return [];
277
+ }
278
+ }
279
+ /**
280
+ * Generate new shape points from segment of trip shape along original one
281
+ * - preserving start and end shape points belonging to stops
282
+ * - creates new set of shape points between stops to get same point distance along original shape
283
+ *
284
+ * @param {ISegmentShape[]} segmentsArr - Original shape points segment between two stops
285
+ * @param {number} distance - Minimal distance for two consequent shape points
286
+ * @returns {ISegmentShape[]} - Result array of new shape points
287
+ */
288
+ divideSegmentLine(segmentArr, distance = config_1.config.vehiclePositions.stepBetweenPoints) {
289
+ const shapeId = segmentArr[0].shape_id;
290
+ const shapeCount = segmentArr.length;
291
+ const minimalDistanceLimit = distance / 2;
292
+ const startShapeDistTraveled = segmentArr[0].shape_dist_traveled;
293
+ const endShapeDistTraveled = segmentArr[shapeCount - 1].shape_dist_traveled;
294
+ const shapeDistLength = endShapeDistTraveled - startShapeDistTraveled;
295
+ const segmentLine = turf.lineString(segmentArr.map((s) => {
296
+ return [s.shape_pt_lon, s.shape_pt_lat];
297
+ }));
298
+ // because we dont believe source shape distances, rather compute length with turf.js
299
+ const segmentLength = turf.length(segmentLine);
300
+ const middlePointsCount = Math.floor(segmentLength / distance);
301
+ const distanceOffset = (segmentLength - distance * middlePointsCount) / 2;
302
+ // put first shape point
303
+ const resultSegmentPoints = [
304
+ {
305
+ ...segmentArr[0],
306
+ shape_pt_lat: this.roundToDecimals(segmentArr[0].shape_pt_lat),
307
+ shape_pt_lon: this.roundToDecimals(segmentArr[0].shape_pt_lon),
308
+ shape_dist_traveled: this.roundToDecimals(segmentArr[0].shape_dist_traveled, 1000),
309
+ shape_pt_sequence: 1,
310
+ },
311
+ ];
312
+ // for each middle point create acording shape point with interpolated origin shape dist traveled
313
+ for (let i = 0; i < middlePointsCount; i++) {
314
+ const currentDistance = i * distance + distanceOffset;
315
+ const currentDistDistance = (shapeDistLength / segmentLength) * currentDistance;
316
+ if (currentDistDistance < minimalDistanceLimit) {
317
+ // point would be too close, skip it
318
+ continue;
319
+ }
320
+ const newPoint = turf.along(segmentLine, i * distance + distanceOffset);
321
+ resultSegmentPoints.push({
322
+ shape_id: shapeId,
323
+ shape_at_stop: false,
324
+ shape_pt_sequence: resultSegmentPoints.length + 1,
325
+ shape_pt_lat: this.roundToDecimals(newPoint.geometry.coordinates[1]),
326
+ shape_pt_lon: this.roundToDecimals(newPoint.geometry.coordinates[0]),
327
+ shape_dist_traveled: this.roundToDecimals(startShapeDistTraveled + currentDistDistance, 1000),
328
+ });
329
+ }
330
+ return resultSegmentPoints;
331
+ }
332
+ mapGtfsShapesToTripShapes(shapes) {
333
+ return shapes.map((shape) => {
334
+ return {
335
+ dist: shape.shape_dist_traveled,
336
+ coords: [shape.shape_pt_lon, shape.shape_pt_lat],
337
+ };
338
+ });
288
339
  }
289
340
  }
290
341
  exports.DelayComputationManager = DelayComputationManager;
@@ -1 +1 @@
1
- {"version":3,"file":"DelayComputationManager.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/work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C;YACN,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QAvSE,MAAM,YAAY,GAAG,gCAA0B,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QAC/F,IAAI,CAAC,iBAAiB,GAAG,eAAM,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;QACnE,IAAI,CAAC,yBAAyB,GAAG,MAAM,CACnC,YAAY,CAAC,QAAQ,CAAC,qEAAqE,EAAE,OAAO,CAAC,CACxG,CAAC;IACN,CAAC;CAmSJ;AA9SD,0DA8SC"}
1
+ {"version":3,"file":"DelayComputationManager.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wEAAqE;AACrE,yEAAsE;AACtE,2EAAoE;AACpE,mEAAuF;AACvF,6EAAwE;AACxE,iDAAmC;AAGnC,MAAa,uBAAuB;IAKhC,YAA6B,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAJ7D,4BAAuB,GAAG,gBAAgB,CAAC;QAK/C,MAAM,YAAY,GAAG,gCAA0B,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QAC/F,IAAI,CAAC,iBAAiB,GAAG,eAAM,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;QACnE,IAAI,CAAC,yBAAyB,GAAG,MAAM,CACnC,YAAY,CAAC,QAAQ,CAAC,qEAAqE,EAAE,MAAM,CAAC,CACvG,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAAc;QAC5C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC;QACpF,IAAI,CAAC,QAAQ,EAAE;YACX,aAAG,CAAC,IAAI,CAAC,mCAAmC,MAAM,gBAAgB,CAAC,CAAC;YACpE,OAAO,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AC,CAAC,CAAC;IACP,CAAC;CACJ;AA3WD,0DA2WC"}
@@ -11,7 +11,7 @@ class V2PublicDepartureBoardsController {
11
11
  try {
12
12
  const facade = Di_1.OgPublicContainer.resolve(OgModuleToken_1.OgModuleToken.DepartureBoardFacade);
13
13
  const params = this.parseDepartureParams(req.query);
14
- const result = await facade.getAll(params.stopIds, params.limit, params.routeShortNames, params.minutesAfter);
14
+ const result = await facade.getAll(params.stopIds, params.limit, params.routeShortNames, params.minutesAfter, params.minutesBefore);
15
15
  if (result === null) {
16
16
  res.status(404).send([]);
17
17
  return;
@@ -36,6 +36,7 @@ class V2PublicDepartureBoardsController {
36
36
  : null,
37
37
  limit: query.limit ? parseInt(query.limit) : 5,
38
38
  minutesAfter: query.minutesAfter ? parseInt(query.minutesAfter) : 60,
39
+ minutesBefore: query.minutesBefore ? parseInt(query.minutesBefore) : 0,
39
40
  };
40
41
  }
41
42
  parseStopIds(stopIdsFromInput) {
@@ -1 +1 @@
1
- {"version":3,"file":"V2PublicDepartureBoardsController.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AACtD,2DAA6D;AAK7D,+FAA6F;AAE7F,MAAa,iCAAiC;IAC1C;QAEO,WAAM,GAAmB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YACrD,MAAM,IAAI,GAAG,IAAA,gCAAe,EAAC,0CAA0C,CAAC,CAAC;YAEzE,IAAI;gBACA,MAAM,MAAM,GAAG,sBAAiB,CAAC,OAAO,CAAuB,6BAAa,CAAC,oBAAoB,CAAC,CAAC;gBACnG,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACpD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,eAA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AQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YACxC,MAAM,OAAO,GAAa,MAAM,CAAC,QAAQ,CAAC,CAAC;YAE3C,MAAM,CAAC,GAAG,CAAC;gBACP,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACnC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;aACjC,CAAC,CAAC;SACN;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AApDD,8EAoDC"}
1
+ {"version":3,"file":"V2PublicDepartureBoardsController.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AACtD,2DAA6D;AAK7D,+FAA6F;AAE7F,MAAa,iCAAiC;IAC1C;QAEO,WAAM,GAAmB,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YACrD,MAAM,IAAI,GAAG,IAAA,gCAAe,EAAC,0CAA0C,CAAC,CAAC;YAEzE,IAAI;gBACA,MAAM,MAAM,GAAG,sBAAiB,CAAC,OAAO,CAAuB,6BAAa,CAAC,oBAAoB,CAAC,CAAC;gBACnG,MAAM,MAAM,GAAG,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBACpD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAC9B,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,eAAe,EACtB,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,aAAa,CACvB,CAAC;gBAEF,IAAI,MAAM,KAAK,IAAI,EAAE;oBACjB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;oBACzB,OAAO;iBACV;gBACD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,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AM,CAAC,QAAQ,CAAC,CAAC;YAE3C,MAAM,CAAC,GAAG,CAAC;gBACP,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;gBACnC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;aACjC,CAAC,CAAC;SACN;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA3DD,8EA2DC"}
@@ -24,4 +24,5 @@ export interface IDepartureBoardsParams {
24
24
  limit: number;
25
25
  routeShortNames: string[] | null;
26
26
  minutesAfter: number;
27
+ minutesBefore: number;
27
28
  }
@@ -29,7 +29,7 @@ let PublicGtfsDepartureRepository = exports.PublicGtfsDepartureRepository = clas
29
29
  let departureCache;
30
30
  const now = Date.now();
31
31
  try {
32
- departureCache = await connection.zrangebyscore(`${const_1.PUBLIC_DEPARTURE_NAMESPACE_PREFIX}:${stopId}`, Math.round((timeFrom?.getTime() ?? now) / 1000) - ONE_SECOND, Math.round((timeFrom?.getTime() ?? now) / 1000) + minutesAfter * 60, "LIMIT", 0, limit || 100 // max on v2 is 30, max on v4 SHOULD BE similar (usually 2x the board-rows)
32
+ departureCache = await connection.zrangebyscore(`${const_1.PUBLIC_DEPARTURE_NAMESPACE_PREFIX}:${stopId}`, Math.round((timeFrom?.getTime() ?? now) / 1000), Math.round((timeFrom?.getTime() ?? now) / 1000) + minutesAfter * 60, "LIMIT", 0, limit || 100 // max on v2 is 30, max on v4 SHOULD BE similar (usually 2x the board-rows)
33
33
  );
34
34
  }
35
35
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"PublicGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iFAAgF;AAEhF,oGAAiG;AACjG,wEAAqE;AAErE,+DAAuE;AACvE,6EAAwE;AACxE,iEAAwE;AAExE,MAAM,UAAU,GAAG,CAAC,CAAC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,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAiC,CAAC,CAAC;aAC3F;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAClB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,0CAA0C,GAAG,CAAC,OAAO,EAAE,EAC/E,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,GAAG,CACN,CAAC;aACL;QACL,CAAC,CAAC;IA7DC,CAAC;IAEG,KAAK,CAAC,2BAA2B,CACpC,OAAiB,EACjB,YAAoB,EACpB,QAAe,EACf,KAAc;QAEd,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE;YACpC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACvC;QAED,MAAM,aAAa,GAAqC,MAAM,OAAO,CAAC,GAAG,CACrE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CACjG,CAAC;QAEF,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;CA6CJ,CAAA;wCAlEY,6BAA6B;IADzC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCADsC,mCAAgB;GAF1E,6BAA6B,CAkEzC"}
1
+ {"version":3,"file":"PublicGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,iFAAgF;AAEhF,oGAAiG;AACjG,wEAAqE;AAErE,+DAAuE;AACvE,6EAAwE;AACxE,iEAAwE;AAExE,MAAM,UAAU,GAAG,CAAC,CAAC;AAGd,IAAM,6BAA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,KAAK,CAAiC,CAAC,CAAC;aAC3F;YAAC,OAAO,GAAG,EAAE;gBACV,MAAM,IAAI,6BAAY,CAClB,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,0CAA0C,GAAG,CAAC,OAAO,EAAE,EAC/E,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,GAAG,CACN,CAAC;aACL;QACL,CAAC,CAAC;IA7DC,CAAC;IAEG,KAAK,CAAC,2BAA2B,CACpC,OAAiB,EACjB,YAAoB,EACpB,QAAe,EACf,KAAc;QAEd,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE;YACpC,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;SACvC;QAED,MAAM,aAAa,GAAqC,MAAM,OAAO,CAAC,GAAG,CACrE,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CACjG,CAAC;QAEF,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;IAChC,CAAC;CA6CJ,CAAA;wCAlEY,6BAA6B;IADzC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,oBAAc,CAAC,cAAc,CAAC,CAAA;IACrC,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;qCADsC,mCAAgB;GAF1E,6BAA6B,CAkEzC"}
@@ -25,6 +25,7 @@ class V2PublicDeparturesRouter extends AbstractRouter_1.AbstractRouter {
25
25
  (0, express_validator_1.query)("limit").optional().isInt({ min: 1, max: 30 }).not().isArray(),
26
26
  (0, express_validator_1.query)("routeShortNames").optional().not().isEmpty({ ignore_whitespace: true }),
27
27
  (0, express_validator_1.query)("minutesAfter").optional().isInt({ min: 1, max: 360 }).not().isArray(),
28
+ (0, express_validator_1.query)("minutesBefore").optional().isInt({ min: -359, max: 30 }).not().isArray(),
28
29
  ], Validation_1.checkErrors,
29
30
  // max-age 3 seconds, stale-while-revalidate 2 seconds
30
31
  this.cacheHeaderMiddleware.getMiddleware(3, 2), this.compressionByDefaultMiddleware.getMiddleware(), this.departureController.getAll);
@@ -1 +1 @@
1
- {"version":3,"file":"V2PublicDeparturesRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/routers/v2/V2PublicDeparturesRouter.ts"],"names":[],"mappings":";;;AAAA,8GAAgH;AAChH,qCAAsD;AACtD,yDAAoD;AACpD,sFAAmF;AAGnF,6EAA2E;AAC3E,+DAAuE;AACvE,+DAA2D;AAC3D,mFAAoE;AACpE,qFAAkF;AAElF,MAAa,wBAAyB,SAAQ,+BAAc;IAMxD;QACI,KAAK,CAAC,wBAAY,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,qBAAqB,GAAG,sBAAiB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QACpH,IAAI,CAAC,8BAA8B,GAAG,sBAAiB,CAAC,OAAO,CAC3D,oBAAc,CAAC,8BAA8B,CAChD,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,IAAI,qEAAiC,EAAE,CAAC;QACnE,IAAI,CAAC,UAAU,EAAE,CAAC;IACtB,CAAC;IAES,UAAU;QAChB,IAAI,CAAC,MAAM,CAAC,GAAG,CACX,GAAG,EACH;YACI,IAAA,yBAAK,EAAC,SAAS,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,uDAA0B,CAAC,QAAQ,CAAC;YACrE,IAAA,yBAAK,EAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;YACpE,IAAA,yBAAK,EAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC;YAC9E,IAAA,yBAAK,EAAC,cAAc,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;SAC/E,EACD,wBAAW;QACX,sDAAsD;QACtD,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAC9C,IAAI,CAAC,8BAA8B,CAAC,aAAa,EAAE,EACnD,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAClC,CAAC;IACN,CAAC;CACJ;AAjCD,4DAiCC;AAED,MAAM,wBAAwB,GAAmB,IAAI,wBAAwB,EAAE,CAAC;AACvE,4DAAwB"}
1
+ {"version":3,"file":"V2PublicDeparturesRouter.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/routers/v2/V2PublicDeparturesRouter.ts"],"names":[],"mappings":";;;AAAA,8GAAgH;AAChH,qCAAsD;AACtD,yDAAoD;AACpD,sFAAmF;AAGnF,6EAA2E;AAC3E,+DAAuE;AACvE,+DAA2D;AAC3D,mFAAoE;AACpE,qFAAkF;AAElF,MAAa,wBAAyB,SAAQ,+BAAc;IAMxD;QACI,KAAK,CAAC,wBAAY,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;QACvB,IAAI,CAAC,qBAAqB,GAAG,sBAAiB,CAAC,OAAO,CAAwB,oBAAc,CAAC,qBAAqB,CAAC,CAAC;QACpH,IAAI,CAAC,8BAA8B,GAAG,sBAAiB,CAAC,OAAO,CAC3D,oBAAc,CAAC,8BAA8B,CAChD,CAAC;QACF,IAAI,CAAC,mBAAmB,GAAG,IAAI,qEAAiC,EAAE,CAAC;QACnE,IAA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
13
  constructor(departureRepository: IGtfsDepartureRepository, tripRepository: IVehiclePositionsRepository, stopTimeRepository: IStopTimeRepository, descriptorRepository: VehicleDescriptorCachedRepository);
14
- getAll(stopIds: Set<IDepartureBoardsStopIdGroups>, limit: number, routeShortNames: string[] | null, minutesAfter: number): Promise<PublicApiDepartureBoardGroup[] | null>;
14
+ getAll(stopIds: Set<IDepartureBoardsStopIdGroups>, limit: number, routeShortNames: string[] | null, minutesAfter: number, minutesBefore: number): Promise<PublicApiDepartureBoardGroup[] | null>;
15
15
  private handleStopGroupDepartures;
16
16
  private duplicateDeparturesWithDifferentVehicleIds;
17
17
  private sortStopGroupsByPriority;
@@ -14,10 +14,10 @@ class DepartureBoardFacade {
14
14
  this.descriptorRepository = descriptorRepository;
15
15
  this.transformation = new PublicDepartureTransformation_1.PublicDepartureTransformation();
16
16
  }
17
- async getAll(stopIds, limit, routeShortNames, minutesAfter) {
17
+ async getAll(stopIds, limit, routeShortNames, minutesAfter, minutesBefore) {
18
18
  let output;
19
19
  const sortedStopGroups = this.sortStopGroupsByPriority(stopIds);
20
- const promises = sortedStopGroups.map(async (stopGroup) => await this.handleStopGroupDepartures(stopGroup, limit, routeShortNames, minutesAfter));
20
+ const promises = sortedStopGroups.map(async (stopGroup) => await this.handleStopGroupDepartures(stopGroup, limit, routeShortNames, minutesAfter, minutesBefore));
21
21
  try {
22
22
  output = await Promise.all(promises);
23
23
  }
@@ -41,10 +41,11 @@ class DepartureBoardFacade {
41
41
  });
42
42
  }
43
43
  }
44
- async handleStopGroupDepartures(stopGroup, limit, routeShortNames, minutesAfter) {
44
+ async handleStopGroupDepartures(stopGroup, limit, routeShortNames, minutesAfter, minutesBefore) {
45
45
  let outputGroup = [];
46
46
  const spanDepartures = (0, trace_provider_1.createChildSpan)(`Departures.${stopGroup.priority}.getPublicDepartureCache`);
47
- const departures = await this.departureRepository.getPublicGtfsDepartureCache(stopGroup.stopIds, minutesAfter);
47
+ const timeFrom = new Date(Date.now() - minutesBefore * 60 * 1000);
48
+ const departures = await this.departureRepository.getPublicGtfsDepartureCache(stopGroup.stopIds, minutesAfter, timeFrom);
48
49
  spanDepartures?.end();
49
50
  if (departures.length === 0) {
50
51
  return null;
@@ -76,9 +77,7 @@ class DepartureBoardFacade {
76
77
  try {
77
78
  outputGroup = DepartureGroupRefiner_1.DepartureGroupRefiner.filterDeparturesByRouteShortNames(outputGroup, routeShortNames);
78
79
  outputGroup = DepartureGroupRefiner_1.DepartureGroupRefiner.sortDeparturesByPredictedTimestamp(outputGroup);
79
- // minutesBefore is set to 0 because we want to display departures that are already happening
80
- // this may change in the future
81
- outputGroup = DepartureGroupRefiner_1.DepartureGroupRefiner.removeDeparturesOutsideTimeRange(outputGroup, 0, minutesAfter).slice(0, limit);
80
+ outputGroup = DepartureGroupRefiner_1.DepartureGroupRefiner.removeDeparturesOutsideTimeRange(outputGroup, minutesBefore, minutesAfter).slice(0, limit);
82
81
  }
83
82
  catch (err) {
84
83
  throw new golemio_errors_1.GeneralError("Error while manipulating departures", this.constructor.name, err, 500);
@@ -1 +1 @@
1
- {"version":3,"file":"DepartureBoardFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/facade/DepartureBoardFacade.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAU5D,+FAA6F;AAC7F,6EAA8F;AAC9F,4EAAyE;AACzE,oGAAiG;AAEjG,MAAa,oBAAoB;IAG7B,YACqB,mBAA6C,EAC7C,cAA2C,EAC3C,kBAAuC,EACvC,oBAAuD;QAHvD,wBAAmB,GAAnB,mBAAmB,CAA0B;QAC7C,mBAAc,GAAd,cAAc,CAA6B;QAC3C,uBAAkB,GAAlB,kBAAkB,CAAqB;QACvC,yBAAoB,GAApB,oBAAoB,CAAmC;QAExE,IAAI,CAAC,cAAc,GAAG,IAAI,6DAA6B,EAAE,CAAC;IAC9D,CAAC;IAEM,KAAK,CAAC,MAAM,CACf,OAA0C,EAC1C,KAAa,EACb,eAAgC,EAChC,YAAoB;QAEpB,IAA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e,GAAmC,IAAI,CAAC;YAE3D,kEAAkE;YAClE,2FAA2F;YAC3F,IAAI,eAAe,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,EAAE;gBACxD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,CAClE,eAAe,CAAC,UAAU,EAC1B,SAAS,CAAC,OAAO,CACpB,CAAC;gBAEF,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC;aACzG;YAED,WAAW,CAAC,IAAI,CACZ,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC;gBACjC,SAAS;gBACT,eAAe;gBACf,iBAAiB;gBACjB,QAAQ,EAAE,eAAe;aAC5B,CAAC,CACL,CAAC;SACL;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;IAEO,wBAAwB,CAAC,OAA0C;QACvE,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvE,CAAC;CACJ;AAnKD,oDAmKC"}
1
+ {"version":3,"file":"DepartureBoardFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/facade/DepartureBoardFacade.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAU5D,+FAA6F;AAC7F,6EAA8F;AAC9F,4EAAyE;AACzE,oGAAiG;AAEjG,MAAa,oBAAoB;IAG7B,YACqB,mBAA6C,EAC7C,cAA2C,EAC3C,kBAAuC,EACvC,oBAAuD;QAHvD,wBAAmB,GAAnB,mBAAmB,CAA0B;QAC7C,mBAAc,GAAd,cAAc,CAA6B;QAC3C,uBAAkB,GAAlB,kBAAkB,CAAqB;QACvC,yBAAoB,GAApB,oBAAoB,CAAm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AA+D;QAC/D,KAAK,MAAM,eAAe,IAAI,gBAAgB,EAAE;YAC5C,MAAM,iBAAiB,GAAG,eAAe,EAAE,aAAa,CAAC,mBAAmB;gBACxE,CAAC,CAAC,MAAM,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAC7C,SAAS,CAAC,UAAU,EACpB,eAAe,EAAE,aAAa,CAAC,mBAAmB,CACrD;gBACH,CAAC,CAAC,IAAI,CAAC;YAEX,IAAI,eAAe,GAAmC,IAAI,CAAC;YAE3D,kEAAkE;YAClE,2FAA2F;YAC3F,IAAI,eAAe,CAAC,UAAU,KAAK,kCAAiB,CAAC,KAAK,EAAE;gBACxD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,CAClE,eAAe,CAAC,UAAU,EAC1B,SAAS,CAAC,OAAO,CACpB,CAAC;gBAEF,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC;aACzG;YAED,WAAW,CAAC,IAAI,CACZ,IAAI,CAAC,cAAc,CAAC,gBAAgB,CAAC;gBACjC,SAAS;gBACT,eAAe;gBACf,iBAAiB;gBACjB,QAAQ,EAAE,eAAe;aAC5B,CAAC,CACL,CAAC;SACL;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;IAEO,wBAAwB,CAAC,OAA0C;QACvE,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IACvE,CAAC;CACJ;AAzKD,oDAyKC"}
@@ -1949,6 +1949,15 @@ paths:
1949
1949
  maximum: 360
1950
1950
  description: Default is 60. Maximum is 360 (6 hours)
1951
1951
  example: 60
1952
+ - in: query
1953
+ name: minutesBefore
1954
+ required: false
1955
+ schema:
1956
+ type: integer
1957
+ minimum: -359
1958
+ maximum: 30
1959
+ description: Set the starting point of the departure retrieval window, in minutes, relative to now (or to timeFrom, if used). Positive values will return departures starting earlier in the past. Negative values will return departures starting later in the future. This setting helps account for walking time to the stop. Example: 2 returns departures that left 2 minutes ago. -10 returns departures no earlier then 10 minutes from now. Default is set to 0. Maximum value is 30. Minimum value is -359.
1960
+ example: 0
1952
1961
  - in: header
1953
1962
  name: Accept-Encoding
1954
1963
  description: Indicate the content encoding (usually a compression algorithm) that the client can understand. See [mdn](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) for more details. Note that for this endpoint, if no value is given, gzip compression will be used by default (the `identity` value can be used to opt out of the default compression).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "4.1.6-dev.2100685482",
3
+ "version": "4.1.6-dev.2103611002",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",