@golemio/public-transport 0.1.0-dev.2921861858 → 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/db/migrations/postgresql/20261007000000-add-color-to-gtfs-feeds.js +53 -0
- package/db/migrations/postgresql/sqls/20261007000000-add-color-to-gtfs-feeds-down.sql +1 -0
- package/db/migrations/postgresql/sqls/20261007000000-add-color-to-gtfs-feeds-up.sql +17 -0
- 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/dist/output-gateway/shared/data-access/GtfsFeedRepository.d.ts +3 -1
- package/dist/output-gateway/shared/data-access/GtfsFeedRepository.js +2 -1
- package/dist/output-gateway/shared/data-access/GtfsFeedRepository.js.map +1 -1
- package/dist/schema-definitions/gtfs/interfaces/IGtfsFeedDto.d.ts +1 -0
- package/dist/schema-definitions/gtfs/models/GtfsFeedDto.d.ts +5 -0
- package/dist/schema-definitions/gtfs/models/GtfsFeedDto.js +2 -0
- package/dist/schema-definitions/gtfs/models/GtfsFeedDto.js.map +1 -1
- package/docs/follow-ups.md +11 -5
- package/docs/implementation_documentation.md +7 -0
- package/docs/openapi-output.yaml +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dbm;
|
|
4
|
+
var type;
|
|
5
|
+
var seed;
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
var Promise;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* We receive the dbmigrate dependency from dbmigrate initially.
|
|
12
|
+
* This enables us to not have to rely on NODE_PATH.
|
|
13
|
+
*/
|
|
14
|
+
exports.setup = function(options, seedLink) {
|
|
15
|
+
dbm = options.dbmigrate;
|
|
16
|
+
type = dbm.dataType;
|
|
17
|
+
seed = seedLink;
|
|
18
|
+
Promise = options.Promise;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.up = function(db) {
|
|
22
|
+
var filePath = path.join(__dirname, 'sqls', '20261007000000-add-color-to-gtfs-feeds-up.sql');
|
|
23
|
+
return new Promise( function( resolve, reject ) {
|
|
24
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
25
|
+
if (err) return reject(err);
|
|
26
|
+
console.log('received data: ' + data);
|
|
27
|
+
|
|
28
|
+
resolve(data);
|
|
29
|
+
});
|
|
30
|
+
})
|
|
31
|
+
.then(function(data) {
|
|
32
|
+
return db.runSql(data);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.down = function(db) {
|
|
37
|
+
var filePath = path.join(__dirname, 'sqls', '20261007000000-add-color-to-gtfs-feeds-down.sql');
|
|
38
|
+
return new Promise( function( resolve, reject ) {
|
|
39
|
+
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
|
|
40
|
+
if (err) return reject(err);
|
|
41
|
+
console.log('received data: ' + data);
|
|
42
|
+
|
|
43
|
+
resolve(data);
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
.then(function(data) {
|
|
47
|
+
return db.runSql(data);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports._meta = {
|
|
52
|
+
"version": 1
|
|
53
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE public_transport.gtfs_feeds DROP COLUMN color;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- Per-feed display colour (#rrggbb) used by the map for stops of the feed. NULL means the map
|
|
2
|
+
-- falls back to its default colour, so a newly added feed only needs this column set.
|
|
3
|
+
ALTER TABLE public_transport.gtfs_feeds
|
|
4
|
+
ADD COLUMN color varchar(7) NULL
|
|
5
|
+
CONSTRAINT gtfs_feeds_color_check CHECK (color ~ '^#[0-9A-Fa-f]{6}$');
|
|
6
|
+
|
|
7
|
+
-- Backfill the colours previously hardcoded in the map; codes missing in an environment are skipped.
|
|
8
|
+
UPDATE public_transport.gtfs_feeds f
|
|
9
|
+
SET color = v.color
|
|
10
|
+
FROM (VALUES
|
|
11
|
+
('pid', '#dc301b'),
|
|
12
|
+
('kodis', '#c00000'),
|
|
13
|
+
('ids-jmk', '#007e00'),
|
|
14
|
+
('idzk', '#00437d'),
|
|
15
|
+
('poved', '#008837')
|
|
16
|
+
) AS v(code, color)
|
|
17
|
+
WHERE f.code = v.code;
|
|
@@ -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,KAA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,EAAE;IACpG,oCAAoC;IACpC,OAAO,mBAAS,CAAC,OAAO,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,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AC,CAAA;IAChD,WAAA,IAAA,iBAAM,EAAC,6BAAa,CAAC,wBAAwB,CAAC,CAAA;;GAN1C,yBAAyB,CAiHrC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public view of a gtfs_feeds row. `bbox` is the extent of the feed's stops as
|
|
3
|
-
* [minLon, minLat, maxLon, maxLat], null when the feed has no imported stops yet.
|
|
3
|
+
* [minLon, minLat, maxLon, maxLat], null when the feed has no imported stops yet. `color` is the
|
|
4
|
+
* feed's #rrggbb display colour for the map, null when not set.
|
|
4
5
|
*/
|
|
5
6
|
export interface IGtfsFeedOutput {
|
|
6
7
|
code: string;
|
|
7
8
|
name: string;
|
|
8
9
|
timezone: string | null;
|
|
10
|
+
color: string | null;
|
|
9
11
|
bbox: [number, number, number, number] | null;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
@@ -73,7 +73,7 @@ class GtfsFeedRepository {
|
|
|
73
73
|
this.getAll = async () => {
|
|
74
74
|
try {
|
|
75
75
|
const connection = this.connector.getConnection();
|
|
76
|
-
const rows = await connection.query(`SELECT f.code, f.name, f.timezone, s.min_lon, s.min_lat, s.max_lon, s.max_lat
|
|
76
|
+
const rows = await connection.query(`SELECT f.code, f.name, f.timezone, f.color, s.min_lon, s.min_lat, s.max_lon, s.max_lat
|
|
77
77
|
FROM "${const_1.PG_SCHEMA}".gtfs_feeds f
|
|
78
78
|
LEFT JOIN (
|
|
79
79
|
SELECT feed_id,
|
|
@@ -90,6 +90,7 @@ class GtfsFeedRepository {
|
|
|
90
90
|
code: row.code,
|
|
91
91
|
name: row.name,
|
|
92
92
|
timezone: row.timezone,
|
|
93
|
+
color: row.color,
|
|
93
94
|
bbox: row.min_lon === null || row.min_lat === null || row.max_lon === null || row.max_lat === null
|
|
94
95
|
? null
|
|
95
96
|
: [row.min_lon, row.min_lat, row.max_lon, row.max_lat],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GtfsFeedRepository.js","sourceRoot":"","sources":["../../../../src/output-gateway/shared/data-access/GtfsFeedRepository.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAuC;AAEvC,wEAAqE;AACrE,+DAA+E;AAC/E,6EAAwE;AACxE,oFAA4D;
|
|
1
|
+
{"version":3,"file":"GtfsFeedRepository.js","sourceRoot":"","sources":["../../../../src/output-gateway/shared/data-access/GtfsFeedRepository.ts"],"names":[],"mappings":";;;;;;AAAA,6DAAuC;AAEvC,wEAAqE;AACrE,+DAA+E;AAC/E,6EAAwE;AACxE,oFAA4D;AA0B5D;;;;;;;GAOG;AACH,MAAa,kBAAkB;IAA/B;QACY,cAAS,GAAuB,4BAAsB,CAAC,OAAO,CAAqB,qBAAS,CAAC,iBAAiB,CAAC,CAAC;QAChH,gBAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;QAGxC,iBAAY,GAAoD,IAAI,CAAC;QAEtE,oBAAe,GAAG,KAAK,EAAE,IAAY,EAAmB,EAAE;YAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1C,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACvB,OAAO,MAAM,CAAC;YAClB,CAAC;YAED,IAAI,CAAC;gBACD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAC;gBAClD,MAAM,MAAM,GAA+B,MAAM,UAAU,CAAC,KAAK,CAC7D,wBAAwB,iBAAS,kCAAkC,EACnE;oBACI,YAAY,EAAE,EAAE,IAAI,EAAE;oBACtB,IAAI,EAAE,mBAAS,CAAC,UAAU,CAAC,MAAM;iBACpC,CACJ,CAAC;gBAEF,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;oBAC5B,sFAAsF;oBACtF,MAAM,IAAI,6BAAY,CAAC,qCAAqC,IAAI,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,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6 +5,7 @@ export declare class GtfsFeedDto extends Model<InferAttributes<GtfsFeedDto>, Inf
|
|
|
5
5
|
code: string;
|
|
6
6
|
name: string;
|
|
7
7
|
timezone: CreationOptional<string>;
|
|
8
|
+
color: CreationOptional<string | null>;
|
|
8
9
|
created_at: CreationOptional<Date>;
|
|
9
10
|
updated_at: CreationOptional<Date>;
|
|
10
11
|
static attributeModel: ModelAttributes<GtfsFeedDto>;
|
|
@@ -26,6 +27,10 @@ export declare class GtfsFeedDto extends Model<InferAttributes<GtfsFeedDto>, Inf
|
|
|
26
27
|
type: string;
|
|
27
28
|
nullable: boolean;
|
|
28
29
|
};
|
|
30
|
+
color: {
|
|
31
|
+
type: string;
|
|
32
|
+
nullable: boolean;
|
|
33
|
+
};
|
|
29
34
|
created_at: {
|
|
30
35
|
type: string;
|
|
31
36
|
nullable: boolean;
|
|
@@ -14,6 +14,7 @@ GtfsFeedDto.attributeModel = {
|
|
|
14
14
|
code: { type: sequelize_1.DataTypes.STRING(50), unique: true },
|
|
15
15
|
name: sequelize_1.DataTypes.STRING,
|
|
16
16
|
timezone: sequelize_1.DataTypes.STRING(100),
|
|
17
|
+
color: sequelize_1.DataTypes.STRING(7),
|
|
17
18
|
};
|
|
18
19
|
GtfsFeedDto.jsonSchema = {
|
|
19
20
|
type: "array",
|
|
@@ -24,6 +25,7 @@ GtfsFeedDto.jsonSchema = {
|
|
|
24
25
|
code: { type: "string" },
|
|
25
26
|
name: { type: "string" },
|
|
26
27
|
timezone: { type: "string", nullable: true },
|
|
28
|
+
color: { type: "string", nullable: true },
|
|
27
29
|
created_at: { type: "object", nullable: true },
|
|
28
30
|
updated_at: { type: "object", nullable: true },
|
|
29
31
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GtfsFeedDto.js","sourceRoot":"","sources":["../../../../src/schema-definitions/gtfs/models/GtfsFeedDto.ts"],"names":[],"mappings":";;;AAAA,mEAO6C;AAG7C,MAAa,WACT,SAAQ,iBAAyE;;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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.
|
|
@@ -1485,6 +1485,13 @@ Worker má na starost stahování VYMI (JIS) událostí a infotextů, jejich tra
|
|
|
1485
1485
|
|
|
1486
1486
|
### GTFS v1
|
|
1487
1487
|
|
|
1488
|
+
#### _/v1/public-transport/gtfs/feeds_
|
|
1489
|
+
|
|
1490
|
+
- zdrojové tabulky
|
|
1491
|
+
- `gtfs_feeds`, `gtfs_stops` (bbox zastávek feedu)
|
|
1492
|
+
- `color` je barva feedu v mapě (`#rrggbb`, sloupec `gtfs_feeds.color`); u nového feedu stačí vyplnit
|
|
1493
|
+
`name` a `color`, mapa z nich sestaví popisek (`KÓD – název`) i barvu zastávek bez úpravy kódu
|
|
1494
|
+
|
|
1488
1495
|
#### _/v1/public-transport/gtfs/services_
|
|
1489
1496
|
|
|
1490
1497
|
- zdrojové tabulky
|
package/docs/openapi-output.yaml
CHANGED
|
@@ -2455,6 +2455,7 @@ components:
|
|
|
2455
2455
|
- code
|
|
2456
2456
|
- name
|
|
2457
2457
|
- timezone
|
|
2458
|
+
- color
|
|
2458
2459
|
- bbox
|
|
2459
2460
|
properties:
|
|
2460
2461
|
code:
|
|
@@ -2467,6 +2468,12 @@ components:
|
|
|
2467
2468
|
type: string
|
|
2468
2469
|
nullable: true
|
|
2469
2470
|
example: Europe/Prague
|
|
2471
|
+
color:
|
|
2472
|
+
type: string
|
|
2473
|
+
nullable: true
|
|
2474
|
+
description: Display colour of the feed on the map (#rrggbb). Null when not set.
|
|
2475
|
+
pattern: "^#[0-9A-Fa-f]{6}$"
|
|
2476
|
+
example: "#dc301b"
|
|
2470
2477
|
bbox:
|
|
2471
2478
|
type: array
|
|
2472
2479
|
nullable: true
|