@golemio/pid 2.13.9 → 2.13.10-dev.1329140823
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/20240604141644-fixing-view-v-vehiclepositions-past-stop-times.js +53 -0
- package/db/migrations/postgresql/sqls/20240604141644-fixing-view-v-vehiclepositions-past-stop-times-down.sql +49 -0
- package/db/migrations/postgresql/sqls/20240604141644-fixing-view-v-vehiclepositions-past-stop-times-up.sql +44 -0
- package/dist/integration-engine/vehicle-positions/ioc/Di.js +14 -9
- package/dist/integration-engine/vehicle-positions/ioc/Di.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.d.ts +3 -0
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js +3 -0
- package/dist/integration-engine/vehicle-positions/ioc/VPContainerToken.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.d.ts +1 -4
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.js +11 -27
- package/dist/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.d.ts +15 -12
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +419 -399
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/ValidToCalculator.d.ts +15 -6
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/ValidToCalculator.js +71 -45
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/ValidToCalculator.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.d.ts +12 -9
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +366 -347
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.js +5 -4
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/ProcessRegionalBusPositionsTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.d.ts +0 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js +0 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js +2 -5
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.d.ts +3 -6
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js +8 -19
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/MpvMessageTransformation.js.map +1 -1
- package/package.json +3 -3
package/db/migrations/postgresql/20240604141644-fixing-view-v-vehiclepositions-past-stop-times.js
ADDED
|
@@ -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', '20240604141644-fixing-view-v-vehiclepositions-past-stop-times-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', '20240604141644-fixing-view-v-vehiclepositions-past-stop-times-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,49 @@
|
|
|
1
|
+
CREATE OR REPLACE VIEW v_vehiclepositions_past_stop_times
|
|
2
|
+
AS SELECT sub.trips_id AS rt_trip_id,
|
|
3
|
+
sub.last_stop_sequence AS stop_sequence,
|
|
4
|
+
sub.last_stop_id AS stop_id,
|
|
5
|
+
sub.last_stop_arrival_time AS stop_arrival,
|
|
6
|
+
sub.last_stop_departure_time AS stop_departure,
|
|
7
|
+
max(sub.delay_stop_arrival) AS stop_arr_delay,
|
|
8
|
+
min(sub.delay_stop_departure) AS stop_dep_delay,
|
|
9
|
+
sub.last_stop_name as stop_name,
|
|
10
|
+
sub.lat as lat,
|
|
11
|
+
sub.lng as lng
|
|
12
|
+
FROM ( SELECT rt_position.trips_id,
|
|
13
|
+
rt_position.last_stop_sequence,
|
|
14
|
+
rt_position.last_stop_id,
|
|
15
|
+
rt_position.last_stop_arrival_time,
|
|
16
|
+
rt_position.last_stop_departure_time,
|
|
17
|
+
rt_position.delay_stop_arrival,
|
|
18
|
+
rt_position.delay_stop_departure,
|
|
19
|
+
rt_position.last_stop_name,
|
|
20
|
+
rs.stop_lat as lat,
|
|
21
|
+
rs.stop_lon as lng,
|
|
22
|
+
row_number() OVER seq AS rn
|
|
23
|
+
FROM vehiclepositions_positions rt_position
|
|
24
|
+
JOIN ropidgtfs_stops rs ON rs.stop_id = rt_position.last_stop_id
|
|
25
|
+
WHERE (rt_position.delay_stop_arrival IS NOT NULL OR rt_position.delay_stop_departure IS NOT NULL) AND (rt_position.state_position::text = ANY (ARRAY['on_track'::character varying::text, 'at_stop'::character varying::text, 'after_track'::character varying::text]))
|
|
26
|
+
WINDOW seq AS (PARTITION BY rt_position.trips_id, rt_position.last_stop_sequence, rt_position.state_position ORDER BY rt_position.id)) sub
|
|
27
|
+
WHERE sub.rn = 1
|
|
28
|
+
GROUP BY sub.trips_id, sub.last_stop_arrival_time, sub.last_stop_departure_time, sub.last_stop_sequence, sub.last_stop_id, sub.last_stop_name, sub.lat, sub.lng
|
|
29
|
+
ORDER BY sub.trips_id, sub.last_stop_sequence;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
CREATE OR REPLACE VIEW v_public_vehiclepositions_past_stop_times
|
|
33
|
+
AS SELECT sub.trips_id AS rt_trip_id,
|
|
34
|
+
sub.last_stop_sequence AS stop_sequence,
|
|
35
|
+
max(sub.delay_stop_arrival) AS stop_arr_delay,
|
|
36
|
+
min(sub.delay_stop_departure) AS stop_dep_delay,
|
|
37
|
+
sub.last_stop_id AS stop_id
|
|
38
|
+
FROM ( SELECT rt_position.trips_id,
|
|
39
|
+
rt_position.last_stop_id,
|
|
40
|
+
rt_position.last_stop_sequence,
|
|
41
|
+
rt_position.delay_stop_arrival,
|
|
42
|
+
rt_position.delay_stop_departure,
|
|
43
|
+
row_number() OVER seq AS rn
|
|
44
|
+
FROM vehiclepositions_positions rt_position
|
|
45
|
+
WHERE (rt_position.delay_stop_arrival IS NOT NULL OR rt_position.delay_stop_departure IS NOT NULL) AND (rt_position.state_position::text = ANY (ARRAY['on_track'::character varying, 'at_stop'::character varying, 'after_track'::character varying]::text[]))
|
|
46
|
+
WINDOW seq AS (PARTITION BY rt_position.trips_id, rt_position.last_stop_sequence, rt_position.state_position ORDER BY rt_position.id)) sub
|
|
47
|
+
WHERE sub.rn = 1
|
|
48
|
+
GROUP BY sub.trips_id, sub.last_stop_sequence, sub.last_stop_id
|
|
49
|
+
ORDER BY sub.trips_id, sub.last_stop_sequence;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
CREATE OR REPLACE VIEW v_vehiclepositions_past_stop_times
|
|
2
|
+
AS SELECT sub.trips_id AS rt_trip_id,
|
|
3
|
+
sub.last_stop_sequence AS stop_sequence,
|
|
4
|
+
sub.last_stop_id AS stop_id,
|
|
5
|
+
sub.last_stop_arrival_time AS stop_arrival,
|
|
6
|
+
sub.last_stop_departure_time AS stop_departure,
|
|
7
|
+
sub.stop_arr_delay,
|
|
8
|
+
sub.stop_dep_delay,
|
|
9
|
+
sub.stop_name AS stop_name,
|
|
10
|
+
sub.lat,
|
|
11
|
+
sub.lng
|
|
12
|
+
FROM ( SELECT rt_position.trips_id,
|
|
13
|
+
rt_position.last_stop_sequence,
|
|
14
|
+
rt_position.last_stop_id,
|
|
15
|
+
rt_position.last_stop_arrival_time,
|
|
16
|
+
rt_position.last_stop_departure_time,
|
|
17
|
+
rs.stop_name,
|
|
18
|
+
rs.stop_lat AS lat,
|
|
19
|
+
rs.stop_lon AS lng,
|
|
20
|
+
max(rt_position.delay_stop_arrival) AS stop_arr_delay,
|
|
21
|
+
min(rt_position.delay_stop_departure) AS stop_dep_delay
|
|
22
|
+
FROM vehiclepositions_positions rt_position
|
|
23
|
+
JOIN ropidgtfs_stops rs ON rs.stop_id::text = rt_position.last_stop_id::text
|
|
24
|
+
WHERE (rt_position.delay_stop_arrival IS NOT NULL OR rt_position.delay_stop_departure IS NOT NULL) AND (rt_position.state_position::text = ANY (ARRAY['on_track'::character varying::text, 'at_stop'::character varying::text, 'after_track'::character varying::text]))
|
|
25
|
+
GROUP BY rt_position.trips_id, rt_position.last_stop_sequence, rt_position.last_stop_id, rt_position.last_stop_arrival_time, rt_position.last_stop_departure_time, rs.stop_name, rs.stop_lat, rs.stop_lon) sub
|
|
26
|
+
ORDER BY sub.trips_id, sub.last_stop_sequence;
|
|
27
|
+
|
|
28
|
+
CREATE OR REPLACE VIEW v_public_vehiclepositions_past_stop_times
|
|
29
|
+
AS SELECT sub.trips_id AS rt_trip_id,
|
|
30
|
+
sub.last_stop_sequence AS stop_sequence,
|
|
31
|
+
sub.stop_arr_delay,
|
|
32
|
+
sub.stop_dep_delay,
|
|
33
|
+
sub.last_stop_id AS stop_id
|
|
34
|
+
FROM ( SELECT rt_position.trips_id,
|
|
35
|
+
rt_position.last_stop_id,
|
|
36
|
+
rt_position.last_stop_sequence,
|
|
37
|
+
rt_position.delay_stop_arrival,
|
|
38
|
+
rt_position.delay_stop_departure,
|
|
39
|
+
max(rt_position.delay_stop_arrival) AS stop_arr_delay,
|
|
40
|
+
min(rt_position.delay_stop_departure) AS stop_dep_delay
|
|
41
|
+
FROM vehiclepositions_positions rt_position
|
|
42
|
+
WHERE (rt_position.delay_stop_arrival IS NOT NULL OR rt_position.delay_stop_departure IS NOT NULL) AND (rt_position.state_position::text = ANY (ARRAY['on_track'::character varying::text, 'at_stop'::character varying::text, 'after_track'::character varying::text]))
|
|
43
|
+
GROUP BY rt_position.trips_id, rt_position.last_stop_id, rt_position.last_stop_sequence, rt_position.delay_stop_arrival, rt_position.delay_stop_departure) sub
|
|
44
|
+
ORDER BY sub.trips_id, sub.last_stop_sequence;
|
|
@@ -7,14 +7,21 @@ const RegionalBusRunsMessagesRepository_1 = require("../workers/runs/data-access
|
|
|
7
7
|
const RegionalBusCisCacheRepository_1 = require("../workers/runs/data-access/cache/RegionalBusCisCacheRepository");
|
|
8
8
|
const RegionalBusGtfsCacheRepository_1 = require("../workers/runs/data-access/cache/RegionalBusGtfsCacheRepository");
|
|
9
9
|
const BusMessageFilter_1 = require("../workers/runs/helpers/BusMessageFilter");
|
|
10
|
+
const TimestampValidator_1 = require("../workers/runs/helpers/TimestampValidator");
|
|
10
11
|
const TramMessageFilter_1 = require("../workers/runs/helpers/TramMessageFilter");
|
|
11
12
|
const CisLookupManager_1 = require("../workers/runs/helpers/regional-bus/CisLookupManager");
|
|
12
13
|
const GtfsLookupManager_1 = require("../workers/runs/helpers/regional-bus/GtfsLookupManager");
|
|
13
14
|
const RegionalBusMessageFilter_1 = require("../workers/runs/helpers/regional-bus/RegionalBusMessageFilter");
|
|
14
15
|
const RegionalBusRunsFacade_1 = require("../workers/runs/helpers/regional-bus/RegionalBusRunsFacade");
|
|
15
16
|
const TripScheduleManager_1 = require("../workers/runs/helpers/regional-bus/TripScheduleManager");
|
|
17
|
+
const ProcessMetroRunMessagesTask_1 = require("../workers/runs/tasks/ProcessMetroRunMessagesTask");
|
|
16
18
|
const ProcessRegionalBusRunMessagesTask_1 = require("../workers/runs/tasks/ProcessRegionalBusRunMessagesTask");
|
|
17
19
|
const SaveArrivaCityRunsToDBTask_1 = require("../workers/runs/tasks/SaveArrivaCityRunsToDBTask");
|
|
20
|
+
const SaveBusRunsToDBTask_1 = require("../workers/runs/tasks/SaveBusRunsToDBTask");
|
|
21
|
+
const SaveMetroRunsToDBTask_1 = require("../workers/runs/tasks/SaveMetroRunsToDBTask");
|
|
22
|
+
const SaveTramRunsToDBTask_1 = require("../workers/runs/tasks/SaveTramRunsToDBTask");
|
|
23
|
+
const CommonRunsMessagesTransformation_1 = require("../workers/runs/transformations/CommonRunsMessagesTransformation");
|
|
24
|
+
const MetroRunsMessagesTransformation_1 = require("../workers/runs/transformations/MetroRunsMessagesTransformation");
|
|
18
25
|
const RegionalBusRunsMessagesTransformation_1 = require("../workers/runs/transformations/RegionalBusRunsMessagesTransformation");
|
|
19
26
|
const DescriptorRepository_1 = require("../workers/vehicle-descriptors/data-access/DescriptorRepository");
|
|
20
27
|
const DescriptorDataSourceFactory_1 = require("../workers/vehicle-descriptors/datasources/DescriptorDataSourceFactory");
|
|
@@ -27,21 +34,17 @@ const PublicApiCacheRepository_1 = require("../workers/vehicle-positions/data-ac
|
|
|
27
34
|
const PublicStopTimeCacheRepository_1 = require("../workers/vehicle-positions/data-access/cache/PublicStopTimeCacheRepository");
|
|
28
35
|
const CachedMetroRailtrackLookup_1 = require("../workers/vehicle-positions/data-access/metro/CachedMetroRailtrackLookup");
|
|
29
36
|
const PublicStopTimeRepository_1 = require("../workers/vehicle-positions/data-access/views/PublicStopTimeRepository");
|
|
37
|
+
const PositionsManager_1 = require("../workers/vehicle-positions/helpers/PositionsManager");
|
|
38
|
+
const ValidToCalculator_1 = require("../workers/vehicle-positions/helpers/ValidToCalculator");
|
|
30
39
|
const GtfsTripDataFixerFactory_1 = require("../workers/vehicle-positions/helpers/gtfs-trip-data/GtfsTripDataFixerFactory");
|
|
31
40
|
const HttpGtfsTripDataFixer_1 = require("../workers/vehicle-positions/helpers/gtfs-trip-data/strategy/HttpGtfsTripDataFixer");
|
|
32
41
|
const MetroShapePointsFixer_1 = require("../workers/vehicle-positions/helpers/metro/MetroShapePointsFixer");
|
|
42
|
+
const RegionalBusPositionsManager_1 = require("../workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager");
|
|
33
43
|
const RefreshGtfsTripDataTask_1 = require("../workers/vehicle-positions/tasks/RefreshGtfsTripDataTask");
|
|
34
44
|
const RefreshPublicStopTimeCacheTask_1 = require("../workers/vehicle-positions/tasks/RefreshPublicStopTimeCacheTask");
|
|
35
45
|
const RefreshPublicTripCacheTask_1 = require("../workers/vehicle-positions/tasks/RefreshPublicTripCacheTask");
|
|
36
46
|
const PublicApiTripTransformation_1 = require("../workers/vehicle-positions/transformations/PublicApiTripTransformation");
|
|
37
47
|
const VPContainerToken_1 = require("./VPContainerToken");
|
|
38
|
-
const TimestampValidator_1 = require("../workers/runs/helpers/TimestampValidator");
|
|
39
|
-
const CommonRunsMessagesTransformation_1 = require("../workers/runs/transformations/CommonRunsMessagesTransformation");
|
|
40
|
-
const MetroRunsMessagesTransformation_1 = require("../workers/runs/transformations/MetroRunsMessagesTransformation");
|
|
41
|
-
const SaveTramRunsToDBTask_1 = require("../workers/runs/tasks/SaveTramRunsToDBTask");
|
|
42
|
-
const SaveBusRunsToDBTask_1 = require("../workers/runs/tasks/SaveBusRunsToDBTask");
|
|
43
|
-
const SaveMetroRunsToDBTask_1 = require("../workers/runs/tasks/SaveMetroRunsToDBTask");
|
|
44
|
-
const ProcessMetroRunMessagesTask_1 = require("../workers/runs/tasks/ProcessMetroRunMessagesTask");
|
|
45
48
|
//#region Initialization
|
|
46
49
|
const VPContainer = Di_1.PidContainer.createChildContainer();
|
|
47
50
|
exports.VPContainer = VPContainer;
|
|
@@ -81,8 +84,10 @@ VPContainer.registerSingleton(VPContainerToken_1.VPContainerToken.RegionalBusRun
|
|
|
81
84
|
VPContainer.registerSingleton(VPContainerToken_1.VPContainerToken.HttpGtfsTripDataFixer, HttpGtfsTripDataFixer_1.HttpGtfsTripDataFixer);
|
|
82
85
|
VPContainer.registerSingleton(VPContainerToken_1.VPContainerToken.GtfsTripDataFixerFactory, GtfsTripDataFixerFactory_1.GtfsTripDataFixerFactory);
|
|
83
86
|
VPContainer.registerSingleton(VPContainerToken_1.VPContainerToken.TimestampValidator, TimestampValidator_1.TimestampValidator);
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
VPContainer.registerSingleton(VPContainerToken_1.VPContainerToken.TimestampValidator, TimestampValidator_1.TimestampValidator);
|
|
88
|
+
VPContainer.registerSingleton(VPContainerToken_1.VPContainerToken.ValidToCalculator, ValidToCalculator_1.ValidToCalculator);
|
|
89
|
+
VPContainer.registerSingleton(VPContainerToken_1.VPContainerToken.PositionsManager, PositionsManager_1.PositionsManager);
|
|
90
|
+
VPContainer.registerSingleton(VPContainerToken_1.VPContainerToken.RegionalBusPositionsManager, RegionalBusPositionsManager_1.RegionalBusPositionsManager);
|
|
86
91
|
VPContainer.register(VPContainerToken_1.VPContainerToken.MetroShapePointsFixer, MetroShapePointsFixer_1.MetroShapePointsFixer);
|
|
87
92
|
//#endregion
|
|
88
93
|
//#region Tasks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qCAA0C;AAC1C,kIAA6H;AAE7H,qHAAkH;AAClH,mHAAgH;AAChH,qHAAkH;AAClH,+EAA4E;AAC5E,iFAA8E;AAC9E,4FAAyF;AACzF,8FAA2F;AAC3F,4GAAyG;AACzG,sGAAmG;AACnG,kGAA+F;AAC/F,+GAA4G;AAC5G,iGAA8F;AAC9F,iIAA8H;AAC9H,0GAAuG;AACvG,wHAAqH;AACrH,kJAA+I;AAC/I,8FAA2F;AAC3F,wGAAqG;AACrG,sHAAmH;AACnH,8FAA2F;AAC3F,sHAAmH;AACnH,gIAA6H;AAC7H,0HAAuH;AACvH,sHAAmH;AACnH,2HAAwH;AACxH,8HAA2H;AAC3H,4GAAyG;AACzG,wGAAqG;AACrG,sHAAmH;AACnH,8GAA2G;AAC3G,0HAAuH;AACvH,yDAAsD;
|
|
1
|
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AgB,CAAC,sBAAsB,EAAE,+CAAsB,CAAC,CAAC;AAC/F,WAAW,CAAC,iBAAiB,CAAC,mCAAgB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AACvG,WAAW,CAAC,iBAAiB,CAAC,mCAAgB,CAAC,iCAAiC,EAAE,qEAAiC,CAAC,CAAC;AACrH,WAAW,CAAC,iBAAiB,CAAC,mCAAgB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AACvG,WAAW,CAAC,iBAAiB,CAAC,mCAAgB,CAAC,8BAA8B,EAAE,+DAA8B,CAAC,CAAC;AAC/G,WAAW,CAAC,iBAAiB,CAAC,mCAAgB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AACjG,WAAW,CAAC,QAAQ,CAAC,mCAAgB,CAAC,oBAAoB,EAAE,2CAAoB,CAAC,CAAC;AAClF,WAAW,CAAC,QAAQ,CAAC,mCAAgB,CAAC,mBAAmB,EAAE,yCAAmB,CAAC,CAAC;AAChF,WAAW,CAAC,QAAQ,CAAC,mCAAgB,CAAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AACpF,WAAW,CAAC,QAAQ,CAAC,mCAAgB,CAAC,2BAA2B,EAAE,yDAA2B,CAAC,CAAC"}
|
|
@@ -9,6 +9,8 @@ declare const VPContainerToken: {
|
|
|
9
9
|
RefreshPublicTripCacheTask: symbol;
|
|
10
10
|
RefreshPublicStopTimeCacheTask: symbol;
|
|
11
11
|
RefreshGtfsTripDataTask: symbol;
|
|
12
|
+
PositionsManager: symbol;
|
|
13
|
+
RegionalBusPositionsManager: symbol;
|
|
12
14
|
RegionalBusCisCacheRepository: symbol;
|
|
13
15
|
RegionalBusGtfsCacheRepository: symbol;
|
|
14
16
|
RegionalBusRunsMessagesRepository: symbol;
|
|
@@ -39,5 +41,6 @@ declare const VPContainerToken: {
|
|
|
39
41
|
CachedMetroRailTrackLookup: symbol;
|
|
40
42
|
MetroShapePointsFixer: symbol;
|
|
41
43
|
TimestampValidator: symbol;
|
|
44
|
+
ValidToCalculator: symbol;
|
|
42
45
|
};
|
|
43
46
|
export { VPContainerToken };
|
|
@@ -13,6 +13,8 @@ const VPContainerToken = {
|
|
|
13
13
|
RefreshPublicTripCacheTask: Symbol(),
|
|
14
14
|
RefreshPublicStopTimeCacheTask: Symbol(),
|
|
15
15
|
RefreshGtfsTripDataTask: Symbol(),
|
|
16
|
+
PositionsManager: Symbol(),
|
|
17
|
+
RegionalBusPositionsManager: Symbol(),
|
|
16
18
|
//#endregion
|
|
17
19
|
//#region Runs
|
|
18
20
|
RegionalBusCisCacheRepository: Symbol(),
|
|
@@ -52,6 +54,7 @@ const VPContainerToken = {
|
|
|
52
54
|
//#region Helpers
|
|
53
55
|
MetroShapePointsFixer: Symbol(),
|
|
54
56
|
TimestampValidator: Symbol(),
|
|
57
|
+
ValidToCalculator: Symbol(),
|
|
55
58
|
//#endregion
|
|
56
59
|
//#endregion
|
|
57
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VPContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/ioc/VPContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,gBAAgB,GAAG;IACrB,2BAA2B;IAC3B,cAAc,EAAE,MAAM,EAAE;IACxB,wBAAwB,EAAE,MAAM,EAAE;IAClC,wBAAwB,EAAE,MAAM,EAAE;IAClC,6BAA6B,EAAE,MAAM,EAAE;IACvC,2BAA2B,EAAE,MAAM,EAAE;IACrC,wBAAwB,EAAE,MAAM,EAAE;IAClC,qBAAqB,EAAE,MAAM,EAAE;IAC/B,0BAA0B,EAAE,MAAM,EAAE;IACpC,8BAA8B,EAAE,MAAM,EAAE;IACxC,uBAAuB,EAAE,MAAM,EAAE;IACjC,YAAY;IAEZ,cAAc;IACd,6BAA6B,EAAE,MAAM,EAAE;IACvC,8BAA8B,EAAE,MAAM,EAAE;IACxC,iCAAiC,EAAE,MAAM,EAAE;IAC3C,qCAAqC,EAAE,MAAM,EAAE;IAC/C,gBAAgB,EAAE,MAAM,EAAE;IAC1B,iBAAiB,EAAE,MAAM,EAAE;IAC3B,mBAAmB,EAAE,MAAM,EAAE;IAC7B,gBAAgB,EAAE,MAAM,EAAE;IAC1B,iBAAiB,EAAE,MAAM,EAAE;IAC3B,wBAAwB,EAAE,MAAM,EAAE;IAClC,qBAAqB,EAAE,MAAM,EAAE;IAC/B,0BAA0B,EAAE,MAAM,EAAE;IACpC,oBAAoB,EAAE,MAAM,EAAE;IAC9B,mBAAmB,EAAE,MAAM,EAAE;IAC7B,qBAAqB,EAAE,MAAM,EAAE;IAC/B,2BAA2B,EAAE,MAAM,EAAE;IACrC,iCAAiC,EAAE,MAAM,EAAE;IAC3C,+BAA+B,EAAE,MAAM,EAAE;IACzC,gCAAgC,EAAE,MAAM,EAAE;IAE1C,YAAY;IAEZ,6BAA6B;IAC7B,gCAAgC,EAAE,MAAM,EAAE;IAC1C,2BAA2B,EAAE,MAAM,EAAE;IACrC,oBAAoB,EAAE,MAAM,EAAE;IAC9B,wBAAwB,EAAE,MAAM,EAAE;IAClC,gBAAgB,EAAE,MAAM,EAAE;IAC1B,sBAAsB,EAAE,MAAM,EAAE;IAChC,cAAc,EAAE,MAAM,EAAE;IACxB,YAAY;IAEZ,2BAA2B;IAE3B,oBAAoB;IACpB,2BAA2B,EAAE,MAAM,EAAE;IACrC,0BAA0B,EAAE,MAAM,EAAE;IACpC,YAAY;IAEZ,iBAAiB;IACjB,qBAAqB,EAAE,MAAM,EAAE;IAC/B,kBAAkB,EAAE,MAAM,EAAE;IAC5B,YAAY;IAEZ,YAAY;CACf,CAAC;AAEO,4CAAgB"}
|
|
1
|
+
{"version":3,"file":"VPContainerToken.js","sourceRoot":"","sources":["../../../../src/integration-engine/vehicle-positions/ioc/VPContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,gBAAgB,GAAG;IACrB,2BAA2B;IAC3B,cAAc,EAAE,MAAM,EAAE;IACxB,wBAAwB,E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C,cAAc,EAAE,MAAM,EAAE;IACxB,YAAY;IAEZ,2BAA2B;IAE3B,oBAAoB;IACpB,2BAA2B,EAAE,MAAM,EAAE;IACrC,0BAA0B,EAAE,MAAM,EAAE;IACpC,YAAY;IAEZ,iBAAiB;IACjB,qBAAqB,EAAE,MAAM,EAAE;IAC/B,kBAAkB,EAAE,MAAM,EAAE;IAC5B,iBAAiB,EAAE,MAAM,EAAE;IAC3B,YAAY;IAEZ,YAAY;CACf,CAAC;AAEO,4CAAgB"}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { IRegionalBusRunsMessagesModel } from "../../../../../../schema-definitions/vehicle-positions/models/interfaces/IRegionalBusRunsMessagesModel";
|
|
2
|
-
import { ISimpleConfig } from "@golemio/core/dist/helpers/configuration/ISimpleConfig";
|
|
3
2
|
import { ILogger } from "@golemio/core/dist/helpers/logger";
|
|
4
3
|
import { IRegionalBusMessageFilter } from "./interfaces/IRegionalBusMessageFilter";
|
|
5
4
|
import { TimestampValidator } from "../TimestampValidator";
|
|
6
5
|
export declare class RegionalBusMessageFilter implements IRegionalBusMessageFilter {
|
|
7
|
-
private config;
|
|
8
6
|
private logger;
|
|
9
7
|
private timestampValidator;
|
|
10
|
-
constructor(
|
|
8
|
+
constructor(logger: ILogger, timestampValidator: TimestampValidator);
|
|
11
9
|
/**
|
|
12
10
|
* Get messages that are valid for processing
|
|
13
11
|
*/
|
|
14
12
|
getFilteredMessages(messages: IRegionalBusRunsMessagesModel[], timestamp: number): IRegionalBusRunsMessagesModel[];
|
|
15
|
-
private get regNumberWhitelist();
|
|
16
13
|
}
|
|
@@ -19,8 +19,7 @@ const VPContainerToken_1 = require("../../../../ioc/VPContainerToken");
|
|
|
19
19
|
const TimestampValidator_1 = require("../TimestampValidator");
|
|
20
20
|
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
21
21
|
let RegionalBusMessageFilter = exports.RegionalBusMessageFilter = class RegionalBusMessageFilter {
|
|
22
|
-
constructor(
|
|
23
|
-
this.config = config;
|
|
22
|
+
constructor(logger, timestampValidator) {
|
|
24
23
|
this.logger = logger;
|
|
25
24
|
this.timestampValidator = timestampValidator;
|
|
26
25
|
}
|
|
@@ -30,18 +29,13 @@ let RegionalBusMessageFilter = exports.RegionalBusMessageFilter = class Regional
|
|
|
30
29
|
getFilteredMessages(messages, timestamp) {
|
|
31
30
|
let filteredMessages = [];
|
|
32
31
|
for (const message of messages) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (!this.timestampValidator.isTimestampValid(timestamp, message.timestamp)) {
|
|
41
|
-
this.logger.error(new golemio_errors_1.GeneralError(`Message timestamp 'tm' of value ${message.timestamp} is not valid ` +
|
|
42
|
-
`(line ${message.cis_line_id}, trip id ${message.cis_trip_number})`, this.constructor.name, undefined, undefined, "pid"));
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
32
|
+
const isValidMessage = message.cis_line_id && message.cis_trip_number && message.registration_number && message.events !== "";
|
|
33
|
+
if (!this.timestampValidator.isTimestampValid(timestamp, message.timestamp)) {
|
|
34
|
+
this.logger.error(new golemio_errors_1.GeneralError(`Message timestamp 'tm' of value ${message.timestamp} is not valid ` +
|
|
35
|
+
`(line ${message.cis_line_id}, trip id ${message.cis_trip_number})`, this.constructor.name, undefined, undefined, "pid"));
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (isValidMessage) {
|
|
45
39
|
filteredMessages.push(message);
|
|
46
40
|
}
|
|
47
41
|
}
|
|
@@ -50,21 +44,11 @@ let RegionalBusMessageFilter = exports.RegionalBusMessageFilter = class Regional
|
|
|
50
44
|
}
|
|
51
45
|
return filteredMessages;
|
|
52
46
|
}
|
|
53
|
-
get regNumberWhitelist() {
|
|
54
|
-
const valuePath = "old.datasources.pid.vehicle-positions.regNumberWhitelist.regionalBus";
|
|
55
|
-
const whitelistDict = this.config.getValue(valuePath, {});
|
|
56
|
-
const whitelist = Object.values(whitelistDict);
|
|
57
|
-
if (whitelist[0] !== "*") {
|
|
58
|
-
return whitelist;
|
|
59
|
-
}
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
47
|
};
|
|
63
48
|
exports.RegionalBusMessageFilter = RegionalBusMessageFilter = __decorate([
|
|
64
49
|
(0, tsyringe_1.injectable)(),
|
|
65
|
-
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.
|
|
66
|
-
__param(1, (0, tsyringe_1.inject)(
|
|
67
|
-
|
|
68
|
-
__metadata("design:paramtypes", [Object, Object, TimestampValidator_1.TimestampValidator])
|
|
50
|
+
__param(0, (0, tsyringe_1.inject)(CoreToken_1.CoreToken.Logger)),
|
|
51
|
+
__param(1, (0, tsyringe_1.inject)(VPContainerToken_1.VPContainerToken.TimestampValidator)),
|
|
52
|
+
__metadata("design:paramtypes", [Object, TimestampValidator_1.TimestampValidator])
|
|
69
53
|
], RegionalBusMessageFilter);
|
|
70
54
|
//# sourceMappingURL=RegionalBusMessageFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegionalBusMessageFilter.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"RegionalBusMessageFilter.js","sourceRoot":"","sources":["../../../../../../../src/integration-engine/vehicle-positions/workers/runs/helpers/regional-bus/RegionalBusMessageFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AAErE,iEAAwE;AAExE,uEAA8E;AAC9E,8DAA2D;AAC3D,6EAAwE;AAGjE,IAAM,wBAAwB,sCAA9B,MAAM,wBAAwB;IACjC,YACsC,MAAe,EACI,kBAAsC;QADzD,WAAM,GAAN,MAAM,CAAS;QACI,uBAAkB,GAAlB,kBAAkB,CAAoB;IAC5F,CAAC;IAEJ;;OAEG;IACI,mBAAmB,CAAC,QAAyC,EAAE,SAAiB;QACnF,IAAI,gBAAgB,GAAoC,EAAE,CAAC;QAC3D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC5B,MAAM,cAAc,GAChB,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,eAAe,IAAI,OAAO,CAAC,mBAAmB,IAAI,OAAO,CAAC,MAAM,KAAK,EAAE,CAAC;YAC3G,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAU,CAAC,EAAE;gBAC1E,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,IAAI,6BAAY,CACZ,mCAAmC,OAAO,CAAC,SAAS,gBAAgB;oBAChE,SAAS,OAAO,CAAC,WAAW,aAAa,OAAO,CAAC,eAAe,GAAG,EACvE,IAAI,CAAC,WAAW,CAAC,IAAI,EACrB,SAAS,EACT,SAAS,EACT,KAAK,CACR,CACJ,CAAC;gBACF,SAAS;aACZ;YAED,IAAI,cAAc,EAAE;gBAChB,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAClC;SACJ;QAED,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,uDAAuD,CAAC,CAAC;SAChF;QAED,OAAO,gBAAgB,CAAC;IAC5B,CAAC;CACJ,CAAA;mCAvCY,wBAAwB;IADpC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;IACxB,WAAA,IAAA,iBAAM,EAAC,mCAAgB,CAAC,kBAAkB,CAAC,CAAA;6CAA6B,uCAAkB;GAHtF,wBAAwB,CAuCpC"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { IVPTripsLastPositionContext } from "../../../../../schema-definitions/vehicle-positions/models/interfaces/VPTripsLastPositionInterfaces";
|
|
2
2
|
import { IScheduleDto } from "../../../../../schema-definitions/vehicle-positions/redis/interfaces/IGtfsRunTripCacheDto";
|
|
3
3
|
import { IPositionToUpdate, IProcessedPositions, ITripPositionsWithGTFS, IUpdatePositionsIteratorOptions } from "../interfaces/VPInterfaces";
|
|
4
|
-
|
|
4
|
+
import { ValidToCalculator } from "./ValidToCalculator";
|
|
5
|
+
export declare class PositionsManager {
|
|
6
|
+
private validToCalculator;
|
|
7
|
+
constructor(validToCalculator: ValidToCalculator);
|
|
5
8
|
/**
|
|
6
9
|
* Compute positions and return computed positions
|
|
7
10
|
*
|
|
8
11
|
* @param {ITripPositionsWithGTFS} tripPositions - Trip positions with shape anchors data
|
|
9
12
|
* @returns {Promise<IProcessedPositions>} - Returns computed/updated positions
|
|
10
13
|
*/
|
|
11
|
-
|
|
14
|
+
computePositions: (tripPositions: ITripPositionsWithGTFS, schedule: IScheduleDto[] | undefined) => Promise<IProcessedPositions>;
|
|
12
15
|
/**
|
|
13
16
|
* Takes position one by one, set proper handler for type of position, and do the process of position
|
|
14
17
|
*
|
|
@@ -17,18 +20,18 @@ export default class PositionsManager {
|
|
|
17
20
|
* @param {number} cb - Callback function of iterator
|
|
18
21
|
* @returns {void} - void
|
|
19
22
|
*/
|
|
20
|
-
|
|
23
|
+
updatePositions: (options: IUpdatePositionsIteratorOptions, schedule: IScheduleDto[] | undefined) => Promise<{
|
|
21
24
|
context: IVPTripsLastPositionContext;
|
|
22
25
|
positions: IPositionToUpdate[];
|
|
23
26
|
}>;
|
|
24
|
-
private
|
|
27
|
+
private getCurrentContext;
|
|
25
28
|
/**
|
|
26
29
|
* Decide how to process input position data
|
|
27
30
|
*
|
|
28
31
|
* @param {IVPTripsPositionAttributes} position - Input vehiclepositions_positions row data
|
|
29
32
|
* @returns {PositionHandlerEnum} - Returns action handler enum
|
|
30
33
|
*/
|
|
31
|
-
private
|
|
34
|
+
private setPositionUpdateHandler;
|
|
32
35
|
/**
|
|
33
36
|
* Returns estimate of point on shape, where the trip should be with appropriate delay
|
|
34
37
|
*
|
|
@@ -38,7 +41,7 @@ export default class PositionsManager {
|
|
|
38
41
|
* @param {number} startDayTimestamp - Unix timestamp of midnight before trip starts
|
|
39
42
|
* @returns {IPositionToUpdate} - Position object to update
|
|
40
43
|
*/
|
|
41
|
-
private
|
|
44
|
+
private getEstimatedPoint;
|
|
42
45
|
/**
|
|
43
46
|
* Picks only one closest point for multiple possible points based on delay of last position and stop times
|
|
44
47
|
*
|
|
@@ -49,7 +52,7 @@ export default class PositionsManager {
|
|
|
49
52
|
* @param {IComputationTrip} tripGtfsData - GTFS data and all set of known positions
|
|
50
53
|
* @returns {IPositionToUpdate} - Result point as position to update in DB
|
|
51
54
|
*/
|
|
52
|
-
private
|
|
55
|
+
private getClosestPoint;
|
|
53
56
|
/**
|
|
54
57
|
* Corrects time delay at stop with dwelling time
|
|
55
58
|
*
|
|
@@ -60,7 +63,7 @@ export default class PositionsManager {
|
|
|
60
63
|
* @param { departureTime: number; arrivalTime: number } stopTimes - departure and arrival stop times in seconds
|
|
61
64
|
* @returns {number} - Result delay in seconds, can be negative for trip ahead
|
|
62
65
|
*/
|
|
63
|
-
private
|
|
66
|
+
private getCorrectedTimeDelay;
|
|
64
67
|
/**
|
|
65
68
|
* Get delay in seconds for positions before track to ensure correct delay propagation
|
|
66
69
|
*
|
|
@@ -72,7 +75,7 @@ export default class PositionsManager {
|
|
|
72
75
|
* @param positionOriginUnixTimestamp The Unix Epoch timestamp of the current position, in milliseconds
|
|
73
76
|
* @param startDayUnixTimestamp The Unix Epoch timestamp of the start of the service day, in milliseconds
|
|
74
77
|
*/
|
|
75
|
-
private
|
|
78
|
+
private getDelayBeforeTrack;
|
|
76
79
|
/**
|
|
77
80
|
* Compute UTC timestamp of start of day when trip starts
|
|
78
81
|
*
|
|
@@ -80,7 +83,7 @@ export default class PositionsManager {
|
|
|
80
83
|
* @param {number} firstStopTimeScheduledSeconds - Number of seconds from midnight of first stop departure
|
|
81
84
|
* @returns {number} - Returns unix timestamp in milliseconds.
|
|
82
85
|
*/
|
|
83
|
-
private
|
|
84
|
-
private
|
|
85
|
-
private
|
|
86
|
+
private getStartDayTimestamp;
|
|
87
|
+
private getStateAndStopSequences;
|
|
88
|
+
private isAfterTrack;
|
|
86
89
|
}
|