@golemio/pid 4.1.6-dev.2109190001 → 4.2.0-rc.2108822276
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/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.d.ts +1 -6
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js +236 -288
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js.map +1 -1
- package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js +1 -2
- package/dist/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.js.map +1 -1
- package/dist/output-gateway/public/controllers/v2/interfaces/PublicParamsInterfaces.d.ts +0 -1
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js +1 -1
- package/dist/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.js.map +1 -1
- package/dist/output-gateway/public/routers/v2/V2PublicDeparturesRouter.js +0 -1
- package/dist/output-gateway/public/routers/v2/V2PublicDeparturesRouter.js.map +1 -1
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.d.ts +1 -1
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js +7 -6
- package/dist/output-gateway/public/service/facade/DepartureBoardFacade.js.map +1 -1
- package/docs/openapi-output.yaml +0 -9
- package/package.json +2 -2
|
@@ -12,11 +12,7 @@ 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)
|
|
16
|
-
private roundToDecimals;
|
|
17
|
-
private shouldReadCoordsFromPrevPoint;
|
|
18
|
-
private setupBearingBetweenPoints;
|
|
19
|
-
private shapePointCompareDistance;
|
|
15
|
+
getComputationObject: (tripId: string) => Promise<IComputationTrip | null>;
|
|
20
16
|
/**
|
|
21
17
|
* Return geometry of anchor points with distance from start along trip track shape
|
|
22
18
|
*
|
|
@@ -26,7 +22,6 @@ export declare class DelayComputationManager {
|
|
|
26
22
|
* @returns {IShapeGeometryAnchorPoint[]} - Result array of geometry points along trip track shape
|
|
27
23
|
*/
|
|
28
24
|
private getShapesGeometryAnchorPoints;
|
|
29
|
-
private getAnchorPointProps;
|
|
30
25
|
/**
|
|
31
26
|
* Generate new shape points from segment of trip shape along original one
|
|
32
27
|
* - preserving start and end shape points belonging to stops
|
|
@@ -34,309 +34,257 @@ class DelayComputationManager {
|
|
|
34
34
|
constructor(gtfsTripsRepository) {
|
|
35
35
|
this.gtfsTripsRepository = gtfsTripsRepository;
|
|
36
36
|
this.METRO_TRIP_PREFIX_REGEX = /^(991|992|993)/;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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, shapesGeometryAnchorPoints, shapePoints, 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;
|
|
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;
|
|
78
48
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
stop_times[shapesGeometryAnchorPoints[i].last_stop_sequence - 1].shape_dist_traveled <=
|
|
83
|
-
distanceAfter) {
|
|
84
|
-
thisStopSequence = shapesGeometryAnchorPoints[i].last_stop_sequence;
|
|
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);
|
|
85
52
|
}
|
|
86
|
-
|
|
87
|
-
|
|
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);
|
|
53
|
+
else if (!stop_times?.length) {
|
|
54
|
+
throw new golemio_errors_1.GeneralError(`getComputationObject: GTFS trip ${tripId} has no stop_times`, this.constructor.name);
|
|
94
55
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
+
});
|
|
105
139
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
:
|
|
111
|
-
|
|
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),
|
|
140
|
+
return {
|
|
141
|
+
trip_id: tripId,
|
|
142
|
+
stop_times: stop_times,
|
|
143
|
+
shapes_anchor_points: shapePoints,
|
|
144
|
+
shapes: this.mapGtfsShapesToTripShapes(shapes),
|
|
145
|
+
};
|
|
134
146
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if (this.shouldReadCoordsFromPrevPoint(source, index)) {
|
|
160
|
-
// take bearing of the previous point (i - 1),
|
|
161
|
-
// as long as current point and prev. point have same coords
|
|
162
|
-
// ... to be saved into previous point (i - 1)
|
|
163
|
-
bearing = target[index - 1].bearing;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
// compute bearing from two shape points
|
|
167
|
-
bearing = turf.bearing(turf.point(source[index - 1].coordinates), turf.point(source[index].coordinates));
|
|
168
|
-
}
|
|
169
|
-
// turf.bearing returns -180 to 180, when 0 is north
|
|
170
|
-
// we need 0 to 359 => modulo 360
|
|
171
|
-
bearing = Math.round((360 + bearing) % 360);
|
|
172
|
-
// save bearing
|
|
173
|
-
target[index - 1].bearing = bearing;
|
|
174
|
-
// for the last shapePoint copy the bearing from last computed one
|
|
175
|
-
if (isLast) {
|
|
176
|
-
bearing = target[index - 1].bearing;
|
|
177
|
-
}
|
|
178
|
-
return bearing;
|
|
179
|
-
}
|
|
180
|
-
shapePointCompareDistance(point, currentStop, nextStop) {
|
|
181
|
-
if (currentStop.shape_dist_traveled === point.shape_dist_traveled) {
|
|
182
|
-
point.shape_at_stop = true;
|
|
183
|
-
}
|
|
184
|
-
if (nextStop) {
|
|
185
|
-
if (point.shape_dist_traveled >= currentStop.shape_dist_traveled &&
|
|
186
|
-
point.shape_dist_traveled <= nextStop.shape_dist_traveled) {
|
|
187
|
-
// current segment
|
|
188
|
-
return 0;
|
|
189
|
-
}
|
|
190
|
-
else if (point.shape_dist_traveled > nextStop.shape_dist_traveled) {
|
|
191
|
-
// future segment
|
|
192
|
-
return 1;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
// previous stop segment OR missing nextStop (currentStop is last stop)
|
|
196
|
-
return -1;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Return geometry of anchor points with distance from start along trip track shape
|
|
200
|
-
*
|
|
201
|
-
* @param {string} shapeId - GTFS shape id
|
|
202
|
-
* @param {ITransformedTripShape[]} shapes - GTFS shape points
|
|
203
|
-
* @param {IStopTime[]} stops
|
|
204
|
-
* @returns {IShapeGeometryAnchorPoint[]} - Result array of geometry points along trip track shape
|
|
205
|
-
*/
|
|
206
|
-
getShapesGeometryAnchorPoints(shapeId, shapes, stops, isMetro = false) {
|
|
207
|
-
try {
|
|
208
|
-
let segmentShapes = [];
|
|
209
|
-
// Splits shapes array to multiple arrays "delimited" by stops
|
|
210
|
-
let startShapeIndex = 0;
|
|
211
|
-
for (let st = 0; st < stops.length; st++) {
|
|
212
|
-
const currentSegment = [];
|
|
213
|
-
for (let sh = startShapeIndex; sh < shapes.length; sh++) {
|
|
214
|
-
const shapePoint = { ...shapes[sh], shape_at_stop: false };
|
|
215
|
-
const shapePointSituation = this.shapePointCompareDistance(shapePoint, stops[st], stops[st + 1]);
|
|
216
|
-
if (shapePointSituation === 0) {
|
|
217
|
-
// next stop iteration (outer for-cycle) can be shorter
|
|
218
|
-
startShapeIndex = sh;
|
|
219
|
-
// each segment starts with "at_stop=true" point
|
|
220
|
-
currentSegment.push(shapePoint);
|
|
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
|
+
}
|
|
221
171
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
break;
|
|
172
|
+
if (currentSegment.length) {
|
|
173
|
+
segmentShapes.push(currentSegment);
|
|
225
174
|
}
|
|
226
175
|
}
|
|
227
|
-
|
|
228
|
-
|
|
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
|
+
];
|
|
229
183
|
}
|
|
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;
|
|
230
225
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
segmentArr.push(...line);
|
|
226
|
+
catch (err) {
|
|
227
|
+
helpers_1.log.error(err);
|
|
228
|
+
helpers_1.log.error(shapeId);
|
|
229
|
+
return [];
|
|
236
230
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
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
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return resultSegmentPoints;
|
|
276
|
+
};
|
|
277
|
+
this.mapGtfsShapesToTripShapes = (shapes) => {
|
|
278
|
+
return shapes.map((shape) => {
|
|
248
279
|
return {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
this_stop_sequence,
|
|
280
|
+
dist: shape.shape_dist_traveled,
|
|
281
|
+
coords: [shape.shape_pt_lon, shape.shape_pt_lat],
|
|
252
282
|
};
|
|
253
283
|
});
|
|
254
|
-
stopCounter++;
|
|
255
|
-
// and lastly shape point for last stop as there is no segment for last stop
|
|
256
|
-
resultArr.push({
|
|
257
|
-
index: resultArr.length,
|
|
258
|
-
...this.getAnchorPointProps(shapes[shapes.length - 1].shape_pt_lon, shapes[shapes.length - 1].shape_pt_lat, stopCounter, stopCounter, shapes[shapes.length - 1].shape_dist_traveled),
|
|
259
|
-
this_stop_sequence: stopCounter,
|
|
260
|
-
});
|
|
261
|
-
return resultArr;
|
|
262
|
-
}
|
|
263
|
-
catch (err) {
|
|
264
|
-
helpers_1.log.error(err);
|
|
265
|
-
helpers_1.log.error(shapeId);
|
|
266
|
-
return [];
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
getAnchorPointProps(lon, lat, last, next, dist) {
|
|
270
|
-
return {
|
|
271
|
-
coordinates: [this.roundToDecimals(lon), this.roundToDecimals(lat)],
|
|
272
|
-
last_stop_sequence: last,
|
|
273
|
-
next_stop_sequence: next,
|
|
274
|
-
shape_dist_traveled: this.roundToDecimals(dist, 1000),
|
|
275
284
|
};
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
* - preserving start and end shape points belonging to stops
|
|
280
|
-
* - creates new set of shape points between stops to get same point distance along original shape
|
|
281
|
-
*
|
|
282
|
-
* @param {ISegmentShape[]} segmentsArr - Original shape points segment between two stops
|
|
283
|
-
* @param {number} distance - Minimal distance for two consequent shape points
|
|
284
|
-
* @returns {ISegmentShape[]} - Result array of new shape points
|
|
285
|
-
*/
|
|
286
|
-
divideSegmentLine(segmentArr, distance = config_1.config.vehiclePositions.stepBetweenPoints) {
|
|
287
|
-
const shapeId = segmentArr[0].shape_id;
|
|
288
|
-
const shapeCount = segmentArr.length;
|
|
289
|
-
const startShapeDistTraveled = segmentArr[0].shape_dist_traveled;
|
|
290
|
-
const endShapeDistTraveled = segmentArr[shapeCount - 1].shape_dist_traveled;
|
|
291
|
-
const shapeDistLength = endShapeDistTraveled - startShapeDistTraveled;
|
|
292
|
-
const segmentLine = turf.lineString(segmentArr.map((s) => {
|
|
293
|
-
return [s.shape_pt_lon, s.shape_pt_lat];
|
|
294
|
-
}));
|
|
295
|
-
// because we dont believe source shape distances, rather compute length with turf.js
|
|
296
|
-
const segmentLength = turf.length(segmentLine);
|
|
297
|
-
const middlePointsCount = Math.floor(segmentLength / distance);
|
|
298
|
-
const distanceOffset = (segmentLength - distance * middlePointsCount) / 2;
|
|
299
|
-
// put first shape point
|
|
300
|
-
const resultSegmentPoints = [
|
|
301
|
-
{
|
|
302
|
-
...segmentArr[0],
|
|
303
|
-
shape_pt_sequence: 1,
|
|
304
|
-
},
|
|
305
|
-
];
|
|
306
|
-
// for each middle point create acording shape point with interpolated origin shape dist traveled
|
|
307
|
-
for (let i = 0; i < middlePointsCount; i++) {
|
|
308
|
-
const currentDistance = i * distance + distanceOffset;
|
|
309
|
-
const currentDistDistance = (shapeDistLength / segmentLength) * currentDistance;
|
|
310
|
-
// There was an idea to skip possibly really small remaining shape distance
|
|
311
|
-
// to the first computed segment point... but it created possibly more issues
|
|
312
|
-
// with trams/buses having stops at crossings and having bearing into next point
|
|
313
|
-
// behind the crossing. Possibly investigate an option to compute points
|
|
314
|
-
// dynamically on a distance +- 50 meters apart between stops, not just shapes
|
|
315
|
-
// between stops (excluding next stop)
|
|
316
|
-
// const minimalDistanceLimit = distance / 10;
|
|
317
|
-
// if (currentDistDistance < minimalDistanceLimit) {
|
|
318
|
-
// // point would be too close, skip it
|
|
319
|
-
// // continue;
|
|
320
|
-
// }
|
|
321
|
-
const newPoint = turf.along(segmentLine, i * distance + distanceOffset);
|
|
322
|
-
resultSegmentPoints.push({
|
|
323
|
-
shape_id: shapeId,
|
|
324
|
-
shape_at_stop: false,
|
|
325
|
-
shape_pt_sequence: resultSegmentPoints.length + 1,
|
|
326
|
-
shape_pt_lat: this.roundToDecimals(newPoint.geometry.coordinates[1]),
|
|
327
|
-
shape_pt_lon: this.roundToDecimals(newPoint.geometry.coordinates[0]),
|
|
328
|
-
shape_dist_traveled: this.roundToDecimals(startShapeDistTraveled + currentDistDistance, 1000),
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
return resultSegmentPoints;
|
|
332
|
-
}
|
|
333
|
-
mapGtfsShapesToTripShapes(shapes) {
|
|
334
|
-
return shapes.map((shape) => {
|
|
335
|
-
return {
|
|
336
|
-
dist: shape.shape_dist_traveled,
|
|
337
|
-
coords: [shape.shape_pt_lon, shape.shape_pt_lat],
|
|
338
|
-
};
|
|
339
|
-
});
|
|
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"));
|
|
340
288
|
}
|
|
341
289
|
}
|
|
342
290
|
exports.DelayComputationManager = DelayComputationManager;
|
|
@@ -1 +1 @@
|
|
|
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,2EAA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AG,CAAC;gBACjD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACpE,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACpE,mBAAmB,EAAE,IAAI,CAAC,eAAe,CAAC,sBAAsB,GAAG,mBAAmB,EAAE,IAAI,CAAC;aAChG,CAAC,CAAC;SACN;QACD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEO,yBAAyB,CAAC,MAAgB;QAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACxB,OAAO;gBACH,IAAI,EAAE,KAAK,CAAC,mBAAmB;gBAC/B,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;aACnD,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApYD,0DAoYC"}
|
|
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;QAYnD;;;;;WAKG;QACI,yBAAoB,GAAG,KAAK,EAAE,MAAc,EAAoC,EAAE;YACrF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC;YACpF,IAAI,CAAC,QAAQ,EAAE;gBACX,aAAG,CAAC,IAAI,CAAC,mCAAmC,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,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,GAAG,QAAQ,GAAG,cAAc,CAAC,CAAC;gBACxE,mBAAmB,CAAC,IAAI,CAAC;oBACrB,QAAQ,EAAE,OAAO;oBACjB,aAAa,EAAE,KAAK;oBACpB,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC;oBACjD,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;oBAC9C,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;oBAC9C,mBAAmB,EAAE,sBAAsB,GAAG,mBAAmB;iBACpE,CAAC,CAAC;aACN;YACD,OAAO,mBAAmB,CAAC;QAC/B,CAAC,CAAC;QAEM,8BAAyB,GAAG,CAAC,MAAgB,EAA2B,EAAE;YAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gBACxB,OAAO;oBACH,IAAI,EAAE,KAAK,CAAC,mBAAmB;oBAC/B,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;iBACnD,CAAC;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"}
|
|
@@ -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);
|
|
15
15
|
if (result === null) {
|
|
16
16
|
res.status(404).send([]);
|
|
17
17
|
return;
|
|
@@ -36,7 +36,6 @@ 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,
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
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,
|
|
1
|
+
{"version":3,"file":"V2PublicDepartureBoardsController.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/controllers/v2/V2PublicDepartureBoardsController.ts"],"names":[],"mappings":";;;AAAA,qCAAsD;AACtD,2DAA6D;AAK7D,+FAA6F;A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,IAAI;YACV,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAe,CAAC,CAAC,CAAC,CAAC,CAAC;YACxD,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,YAAsB,CAAC,CAAC,CAAC,CAAC,EAAE;SACjF,CAAC;IACN,CAAC;IAEO,YAAY,CAAC,gBAA0B;QAC3C,IAAI,MAAM,GAAsC,IAAI,GAAG,EAAE,CAAC;QAE1D,KAAK,MAAM,MAAM,IAAI,gBAAgB,EAAE;YACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAClC,MAAM,QAAQ,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"}
|
|
@@ -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), 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) - 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)
|
|
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;AAGd,IAAM,6BAA6B,2CAAnC,MAAM,6BAA6B;IACtC,YAC2C,cAAwC,EACrD,GAAoB;QADC,mBAAc,GAAd,cAAc,CAAkB;QAC7C,QAAG,GAAH,GAAG,CAAS;QAoB1C,8BAAyB,GAAG,KAAK,EACrC,MAAc,EACd,YAAoB,EACpB,QAAe,EACf,KAAc,EACyB,EAAE;YACzC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;YAEvD,IAAI,cAAwB,CAAC;YAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAEvB,IAAI;gBACA,cAAc,GAAG,MAAM,UAAU,CAAC,aAAa,CAC3C,GAAG,yCAAiC,IAAI,MAAM,EAAE,EAChD,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"PublicGtfsDepartureRepository.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/data-access/redis/PublicGtfsDepartureRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,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AW,CAAC,CAAC;gBAC1G,OAAO,EAAE,CAAC;aACb;YAED,IAAI;gBACA,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,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"}
|
|
@@ -25,7 +25,6 @@ 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(),
|
|
29
28
|
], Validation_1.checkErrors,
|
|
30
29
|
// max-age 3 seconds, stale-while-revalidate 2 seconds
|
|
31
30
|
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;
|
|
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"}
|
|
@@ -11,7 +11,7 @@ export declare class DepartureBoardFacade {
|
|
|
11
11
|
private readonly descriptorRepository;
|
|
12
12
|
private readonly transformation;
|
|
13
13
|
constructor(departureRepository: IGtfsDepartureRepository, tripRepository: IVehiclePositionsRepository, stopTimeRepository: IStopTimeRepository, descriptorRepository: VehicleDescriptorCachedRepository);
|
|
14
|
-
getAll(stopIds: Set<IDepartureBoardsStopIdGroups>, limit: number, routeShortNames: string[] | null, minutesAfter: number
|
|
14
|
+
getAll(stopIds: Set<IDepartureBoardsStopIdGroups>, limit: number, routeShortNames: string[] | null, minutesAfter: 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) {
|
|
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));
|
|
21
21
|
try {
|
|
22
22
|
output = await Promise.all(promises);
|
|
23
23
|
}
|
|
@@ -41,11 +41,10 @@ class DepartureBoardFacade {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
async handleStopGroupDepartures(stopGroup, limit, routeShortNames, minutesAfter
|
|
44
|
+
async handleStopGroupDepartures(stopGroup, limit, routeShortNames, minutesAfter) {
|
|
45
45
|
let outputGroup = [];
|
|
46
46
|
const spanDepartures = (0, trace_provider_1.createChildSpan)(`Departures.${stopGroup.priority}.getPublicDepartureCache`);
|
|
47
|
-
const
|
|
48
|
-
const departures = await this.departureRepository.getPublicGtfsDepartureCache(stopGroup.stopIds, minutesAfter, timeFrom);
|
|
47
|
+
const departures = await this.departureRepository.getPublicGtfsDepartureCache(stopGroup.stopIds, minutesAfter);
|
|
49
48
|
spanDepartures?.end();
|
|
50
49
|
if (departures.length === 0) {
|
|
51
50
|
return null;
|
|
@@ -77,7 +76,9 @@ class DepartureBoardFacade {
|
|
|
77
76
|
try {
|
|
78
77
|
outputGroup = DepartureGroupRefiner_1.DepartureGroupRefiner.filterDeparturesByRouteShortNames(outputGroup, routeShortNames);
|
|
79
78
|
outputGroup = DepartureGroupRefiner_1.DepartureGroupRefiner.sortDeparturesByPredictedTimestamp(outputGroup);
|
|
80
|
-
|
|
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);
|
|
81
82
|
}
|
|
82
83
|
catch (err) {
|
|
83
84
|
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
|
|
1
|
+
{"version":3,"file":"DepartureBoardFacade.js","sourceRoot":"","sources":["../../../../../src/output-gateway/public/service/facade/DepartureBoardFacade.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAU5D,+FAA6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CACJ;AAnKD,oDAmKC"}
|
package/docs/openapi-output.yaml
CHANGED
|
@@ -1957,15 +1957,6 @@ paths:
|
|
|
1957
1957
|
maximum: 360
|
|
1958
1958
|
description: Default is 60. Maximum is 360 (6 hours)
|
|
1959
1959
|
example: 60
|
|
1960
|
-
- in: query
|
|
1961
|
-
name: minutesBefore
|
|
1962
|
-
required: false
|
|
1963
|
-
schema:
|
|
1964
|
-
type: integer
|
|
1965
|
-
minimum: -359
|
|
1966
|
-
maximum: 30
|
|
1967
|
-
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.'
|
|
1968
|
-
example: 0
|
|
1969
1960
|
- in: header
|
|
1970
1961
|
name: Accept-Encoding
|
|
1971
1962
|
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.
|
|
3
|
+
"version": "4.2.0-rc.2108822276",
|
|
4
4
|
"description": "Golemio PID Module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@golemio/core": ">=1.16.0-rc.1551191551"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@golemio/ovapi-gtfs-realtime-bindings": "1.2.
|
|
78
|
+
"@golemio/ovapi-gtfs-realtime-bindings": "1.2.3",
|
|
79
79
|
"@turf/turf": "^6.5.0",
|
|
80
80
|
"cheap-ruler": "^3.0.2",
|
|
81
81
|
"csv-parser": "^3.0.0",
|