@golemio/public-transport 0.1.0-dev.2922113447 → 0.1.0-dev.2922444769
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/output-gateway/gtfs/models/GTFSStopTimesModel.d.ts +6 -0
- package/dist/output-gateway/gtfs/models/GTFSStopTimesModel.js +40 -0
- package/dist/output-gateway/gtfs/models/GTFSStopTimesModel.js.map +1 -1
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.d.ts +3 -0
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.js +14 -7
- package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.js.map +1 -1
- package/docs/follow-ups.md +11 -5
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IStopTime } from "../../../schema-definitions/gtfs/redis/interfaces/IDelayComputationDto";
|
|
1
2
|
import { SequelizeModel } from "@golemio/core/dist/output-gateway";
|
|
2
3
|
import { IGTFSModels } from "./interfaces/IGTFSModels";
|
|
3
4
|
export declare class GTFSStopTimesModel extends SequelizeModel {
|
|
@@ -24,6 +25,11 @@ export declare class GTFSStopTimesModel extends SequelizeModel {
|
|
|
24
25
|
stop?: boolean;
|
|
25
26
|
feedId?: number;
|
|
26
27
|
}) => Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Stop times of one trip with their stops, in the shape of the delay computation cache.
|
|
30
|
+
* Trip and stop ids are only unique per feed, so both are scoped to the feed.
|
|
31
|
+
*/
|
|
32
|
+
getTripStopTimesWithStops: (tripId: string, feedId: number) => Promise<IStopTime[]>;
|
|
27
33
|
GetOne: (id: any) => Promise<any>;
|
|
28
34
|
private static arrivalTimeComparison;
|
|
29
35
|
}
|
|
@@ -101,6 +101,46 @@ class GTFSStopTimesModel extends output_gateway_1.SequelizeModel {
|
|
|
101
101
|
throw new golemio_errors_1.GeneralError("Database error", "GTFSStopTimesModel", err, 500);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
+
/**
|
|
105
|
+
* Stop times of one trip with their stops, in the shape of the delay computation cache.
|
|
106
|
+
* Trip and stop ids are only unique per feed, so both are scoped to the feed.
|
|
107
|
+
*/
|
|
108
|
+
this.getTripStopTimesWithStops = async (tripId, feedId) => {
|
|
109
|
+
try {
|
|
110
|
+
const stopTimes = await this.sequelizeModel.findAll({
|
|
111
|
+
attributes: [
|
|
112
|
+
"arrival_time",
|
|
113
|
+
"departure_time",
|
|
114
|
+
"shape_dist_traveled",
|
|
115
|
+
"stop_headsign",
|
|
116
|
+
"stop_id",
|
|
117
|
+
"stop_sequence",
|
|
118
|
+
[sequelize_1.default.literal(`EXTRACT(EPOCH FROM "arrival_time"::INTERVAL)::int`), "arrival_time_seconds"],
|
|
119
|
+
[sequelize_1.default.literal(`EXTRACT(EPOCH FROM "departure_time"::INTERVAL)::int`), "departure_time_seconds"],
|
|
120
|
+
[
|
|
121
|
+
sequelize_1.default.literal(`CASE when drop_off_type = '1' and pickup_type = '1' then true else false END`),
|
|
122
|
+
"is_no_stop_waypoint",
|
|
123
|
+
],
|
|
124
|
+
"stop_icons",
|
|
125
|
+
],
|
|
126
|
+
include: [
|
|
127
|
+
{
|
|
128
|
+
as: "stop",
|
|
129
|
+
attributes: ["stop_id", "stop_lat", "stop_lon", "stop_name", "zone_id", "wheelchair_boarding"],
|
|
130
|
+
model: this.dbConnector.getConnection().models[gtfs_1.Gtfs.stops.pgTableName],
|
|
131
|
+
where: { feed_id: feedId },
|
|
132
|
+
required: true,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
where: { trip_id: tripId, feed_id: feedId },
|
|
136
|
+
order: [["stop_sequence", "ASC"]],
|
|
137
|
+
});
|
|
138
|
+
return stopTimes.map((stopTime) => stopTime.get({ plain: true }));
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
throw new golemio_errors_1.GeneralError("Database error ~ getTripStopTimesWithStops", "GTFSStopTimesModel", err, 500);
|
|
142
|
+
}
|
|
143
|
+
};
|
|
104
144
|
this.GetOne = (id) => {
|
|
105
145
|
throw new golemio_errors_1.FatalError("Method not implemented");
|
|
106
146
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GTFSStopTimesModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/gtfs/models/GTFSStopTimesModel.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAuC;AACvC,2DAAiC;AACjC,uFAA6D;
|
|
1
|
+
{"version":3,"file":"GTFSStopTimesModel.js","sourceRoot":"","sources":["../../../../src/output-gateway/gtfs/models/GTFSStopTimesModel.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAuC;AACvC,2DAAiC;AACjC,uFAA6D;AAG7D,sEAAmE;AACnE,gEAAgG;AAChG,6EAAoF;AACpF,oFAA6E;AAG7E,MAAa,kBAAmB,SAAQ,+BAAc;IAGlD;QACI,KAAK,CAAC,WAAI,CAAC,UAAU,CAAC,IAAI,EAAE,WAAI,CAAC,UAAU,CAAC,WAAW,EAAE,2BAAY,CAAC,cAAc,EAAE;YAClF,MAAM,EAAE,iBAAS;SACpB,CAAC,CAAC;QAIA,cAAS,GAAG,CAAC,MAAmB,EAAE,EAAE;YACvC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,cAAc,EAAE;gBAChE,UAAU,EAAE,SAAS;aACxB,CAAC,CAAC;YAEH,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,EAAE;gBAC/D,EAAE,EAAE,MAAM;gBACV,UAAU,EAAE,SAAS;gBACrB,SAAS,EAAE,SAAS;aACvB,CAAC,CAAC;QACP,CAAC,CAAC;QAEF;;;;;;;;;WASG;QACI,WAAM,GAAG,KAAK,EAAE,OAStB,EAAgB,EAAE;YACf,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAA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AAO,CAAC,IAAI,IAAI,WAAW,QAAQ,uCAAuC,CAAC,CAAC;AACjG,CAAC,AAHmC,CAGlC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IPublicApiDetailedTrip } from "../../../../domain/PublicApiDetailedTripInterfaces";
|
|
2
|
+
import { GTFSStopTimesModel } from "../../../../../gtfs/models/GTFSStopTimesModel";
|
|
2
3
|
import { IDelayComputationRepository } from "../../../../domain/repository/IDelayComputationRepository";
|
|
3
4
|
import { IStopTimeRepository } from "../../../../domain/repository/IStopTimeRepository";
|
|
4
5
|
import { IPublicApiCacheDto } from "../../../../../../schema-definitions/vehicle-positions/redis/interfaces/IPublicApiCacheDto";
|
|
@@ -7,8 +8,10 @@ export declare class StopTimesTripScopeHandler extends AbstractDetailedTripScope
|
|
|
7
8
|
private delayComputationRepository;
|
|
8
9
|
private stopTimeRepository;
|
|
9
10
|
private tripStopTimesTransformation;
|
|
11
|
+
protected stopTimesModel: GTFSStopTimesModel;
|
|
10
12
|
constructor(delayComputationRepository: IDelayComputationRepository, stopTimeRepository: IStopTimeRepository);
|
|
11
13
|
handle(output: IPublicApiDetailedTrip, vehiclePosition: IPublicApiCacheDto): Promise<IPublicApiDetailedTrip>;
|
|
14
|
+
private getScheduledStopTimes;
|
|
12
15
|
private filterNoStopWaypoints;
|
|
13
16
|
private checkStopTimesSequence;
|
|
14
17
|
}
|
package/dist/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.js
CHANGED
|
@@ -13,6 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.StopTimesTripScopeHandler = void 0;
|
|
16
|
+
const models_1 = require("../../../../../gtfs/models");
|
|
16
17
|
const PublicCacheKeys_1 = require("../../../../../../schema-definitions/vehicle-positions/redis/PublicCacheKeys");
|
|
17
18
|
const OgModuleToken_1 = require("../../../../ioc/OgModuleToken");
|
|
18
19
|
const PublicVPTripStopTimesTransformation_1 = require("../../../transformations/scopes/PublicVPTripStopTimesTransformation");
|
|
@@ -26,20 +27,17 @@ let StopTimesTripScopeHandler = class StopTimesTripScopeHandler extends Abstract
|
|
|
26
27
|
this.delayComputationRepository = delayComputationRepository;
|
|
27
28
|
this.stopTimeRepository = stopTimeRepository;
|
|
28
29
|
this.tripStopTimesTransformation = new PublicVPTripStopTimesTransformation_1.PublicVPTripStopTimesTransformation();
|
|
30
|
+
this.stopTimesModel = models_1.models.GTFSStopTimesModel;
|
|
29
31
|
}
|
|
30
32
|
async handle(output, vehiclePosition) {
|
|
31
33
|
// same feed source as DetailedTripFacade: vehicle ids are <feedId>-<feedLocalId>
|
|
32
34
|
const feedId = PublicCacheKeys_1.PublicCacheKeys.feedIdFromVehicleId(vehiclePosition.vehicle_id);
|
|
33
|
-
|
|
34
|
-
? null
|
|
35
|
-
: await this.delayComputationRepository.getDelayComputationCacheProperty(feedId, vehiclePosition.gtfs_trip_id, "stop_times");
|
|
36
|
-
// only CIS/MPV pipelines compute delays (UpdateDelayTask); polled GTFS-RT feeds have none, so the
|
|
37
|
-
// scope is empty instead of failing the whole detail response
|
|
38
|
-
if (!delayComputationCache) {
|
|
35
|
+
if (feedId === null) {
|
|
39
36
|
output.stop_times = (0, Geo_1.buildGeojsonFeatureCollection)([]);
|
|
40
37
|
return output;
|
|
41
38
|
}
|
|
42
|
-
const
|
|
39
|
+
const scheduledStopTimes = await this.getScheduledStopTimes(feedId, vehiclePosition.gtfs_trip_id);
|
|
40
|
+
const filteredStopTimes = this.filterNoStopWaypoints(scheduledStopTimes);
|
|
43
41
|
const vpAndFilteredStopTimes = filteredStopTimes.map((stopTime) => ({ stopTime, vehiclePosition }));
|
|
44
42
|
const stopTimes = this.tripStopTimesTransformation.transformArray(vpAndFilteredStopTimes);
|
|
45
43
|
const stopTimesWithDelay = await this.stopTimeRepository.getPublicStopTimeCache(vehiclePosition.vehicle_id, vehiclePosition.gtfs_trip_id);
|
|
@@ -73,6 +71,15 @@ let StopTimesTripScopeHandler = class StopTimesTripScopeHandler extends Abstract
|
|
|
73
71
|
output.stop_times = (0, Geo_1.buildGeojsonFeatureCollection)(stopTimes);
|
|
74
72
|
return output;
|
|
75
73
|
}
|
|
74
|
+
async getScheduledStopTimes(feedId, gtfsTripId) {
|
|
75
|
+
const delayComputationCache = await this.delayComputationRepository.getDelayComputationCacheProperty(feedId, gtfsTripId, "stop_times");
|
|
76
|
+
if (delayComputationCache) {
|
|
77
|
+
return delayComputationCache.stop_times;
|
|
78
|
+
}
|
|
79
|
+
// only CIS/MPV pipelines compute delays (UpdateDelayTask); polled GTFS-RT feeds have none, so their
|
|
80
|
+
// stop times come straight from the feed's static GTFS
|
|
81
|
+
return this.stopTimesModel.getTripStopTimesWithStops(gtfsTripId, feedId);
|
|
82
|
+
}
|
|
76
83
|
filterNoStopWaypoints(stopTimes) {
|
|
77
84
|
return stopTimes.filter((stopTime) => !stopTime.is_no_stop_waypoint);
|
|
78
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StopTimesTripScopeHandler.js","sourceRoot":"","sources":["../../../../../../../src/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"StopTimesTripScopeHandler.js","sourceRoot":"","sources":["../../../../../../../src/output-gateway/public/service/helpers/trip-scope/strategy/StopTimesTripScopeHandler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAIA,uDAAyC;AAGzC,kHAA+E;AAE/E,iEAA6D;AAC7D,6HAAoI;AAGpI,+DAAsF;AAEtF,2DAA2D;AAC3D,iEAAwE;AACxE,yFAAsF;AAG/E,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,mEAAgC;IAI3E,YAC8D,0BAAuD,EACzD,kBAAuC;QAE/F,KAAK,EAAE,CAAC;QAHkD,+BAA0B,GAA1B,0BAA0B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CAAC,wBAAwB,CAAC,CAAA;;GAN1C,yBAAyB,CAiHrC"}
|
package/docs/follow-ups.md
CHANGED
|
@@ -9,8 +9,8 @@ Resolved and removed so far: gtfs_metadata feed scoping; the OG active endpoints
|
|
|
9
9
|
run numbers; the shapes.txt staging limit (stage ingests the full 193 MB fine; the local dev Redis
|
|
10
10
|
still truncates such files — a local-environment quirk, not a code bug); the destructive-migration
|
|
11
11
|
convention (schema changes now pair the squashed init edit with an incremental migration — see
|
|
12
|
-
CLAUDE.md, first instance `20260820000000-widen-trip-number`); the empty public VP detail `shapes`
|
|
13
|
-
polled GTFS-RT feeds (now read from static GTFS, see #13).
|
|
12
|
+
CLAUDE.md, first instance `20260820000000-widen-trip-number`); the empty public VP detail `shapes` and `stop_times`
|
|
13
|
+
scopes for polled GTFS-RT feeds (now read from static GTFS, see #13).
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
@@ -202,13 +202,19 @@ own `refreshPublicTripCache {feedCode}` loop under a per-feed mutex; key format
|
|
|
202
202
|
Vehicle ids are `<feedId>-<vehicle>` for every feed so they stay unique across feeds: the stop-time cache keys
|
|
203
203
|
and the detail endpoint (which derives the feed from the id) rely on it. The detail
|
|
204
204
|
`stop_times`/`shapes` scopes read the delay computation of the vehicle's own feed; only the CIS/MPV pipelines
|
|
205
|
-
(`UpdateDelayTask`) write it. Without it,
|
|
206
|
-
`(feed_id, shape_id)
|
|
207
|
-
polled GTFS-RT feeds (fill it from static GTFS by `(feed_id, trip_id)` when a polled feed needs it). A
|
|
205
|
+
(`UpdateDelayTask`) write it. Without it, both scopes fall back to the feed's static GTFS: `shapes` by
|
|
206
|
+
`(feed_id, shape_id)` (raw GTFS points instead of the resampled ones), `stop_times` by `(feed_id, trip_id)`. A
|
|
208
207
|
vehicle without identity in its feed (no registration or CIS number, e.g. polled GTFS-RT) is keyed by its VP
|
|
209
208
|
trip, so it gets a new `vehicle_id` when its trip changes.
|
|
210
209
|
|
|
211
210
|
Left as is:
|
|
211
|
+
- **The static GTFS fallback is not cached**: each detail request of a polled-feed vehicle queries Postgres
|
|
212
|
+
for its shape and stop times (the map polls an open detail every 10 s; the route only sends a 5 s
|
|
213
|
+
`Cache-Control`). Fine at low traffic; when it grows, cache the per-`(feed_id, trip_id)` static data in Redis
|
|
214
|
+
next to the delay computation cache.
|
|
215
|
+
- **Polled-feed `stop_times` carry no realtime times**: `realtime_arrival_time`/`realtime_departure_time` stay
|
|
216
|
+
NULL because the public stop-time cache has no per-stop delays for them (see #12). Projecting the vehicle's
|
|
217
|
+
current `delay` onto the upcoming stops would fill them.
|
|
212
218
|
- **`vehicle_descriptor` scope** joins descriptors by registration number only (see #6).
|
|
213
219
|
- **The public departures / PID departure and transfer boards** read the cache with `PID_FEED_ID`; they need a
|
|
214
220
|
feed parameter before they serve other feeds.
|