@golemio/pid 2.14.0 → 2.14.1-dev.1345502338
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/20240612135256-fix-delay-in-view-future-stop-times.js +53 -0
- package/db/migrations/postgresql/sqls/20240612135256-fix-delay-in-view-future-stop-times-down.sql +82 -0
- package/db/migrations/postgresql/sqls/20240612135256-fix-delay-in-view-future-stop-times-up.sql +93 -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/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
|
@@ -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', '20240612135256-fix-delay-in-view-future-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', '20240612135256-fix-delay-in-view-future-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
|
+
};
|
package/db/migrations/postgresql/sqls/20240612135256-fix-delay-in-view-future-stop-times-down.sql
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
-- v_public_vehiclepositions_future_stop_times source
|
|
2
|
+
CREATE OR REPLACE VIEW v_public_vehiclepositions_future_stop_times AS
|
|
3
|
+
WITH RECURSIVE stop_times AS (
|
|
4
|
+
SELECT
|
|
5
|
+
rst.trip_id,
|
|
6
|
+
vt.id AS trips_id,
|
|
7
|
+
vt.provider_source_type,
|
|
8
|
+
vp.delay,
|
|
9
|
+
COALESCE(vp.last_stop_sequence, 1) AS initial_stop_sequence,
|
|
10
|
+
vp.state_position,
|
|
11
|
+
rst.stop_id,
|
|
12
|
+
rst.stop_sequence,
|
|
13
|
+
rst.computed_dwell_time_seconds,
|
|
14
|
+
CASE WHEN vp.last_stop_sequence IS NULL THEN
|
|
15
|
+
vp.delay
|
|
16
|
+
ELSE
|
|
17
|
+
vp.delay_stop_arrival
|
|
18
|
+
END AS arrival_delay_seconds,
|
|
19
|
+
CASE WHEN vp.last_stop_sequence IS NULL THEN
|
|
20
|
+
predict_delay_seconds(vp.delay, rst.computed_dwell_time_seconds, vt.provider_source_type)
|
|
21
|
+
WHEN vp.state_position::text = 'at_stop'::text THEN
|
|
22
|
+
CASE WHEN vt.provider_source_type::text = '1'::text THEN
|
|
23
|
+
GREATEST(0, vp.delay)
|
|
24
|
+
ELSE
|
|
25
|
+
vp.delay
|
|
26
|
+
END
|
|
27
|
+
ELSE
|
|
28
|
+
vp.delay_stop_departure
|
|
29
|
+
END AS departure_delay_seconds
|
|
30
|
+
FROM
|
|
31
|
+
ropidgtfs_stop_times rst
|
|
32
|
+
JOIN vehiclepositions_trips vt ON vt.gtfs_trip_id::text = rst.trip_id::text
|
|
33
|
+
JOIN vehiclepositions_positions vp ON vp.id = vt.last_position_id
|
|
34
|
+
AND (vp.valid_to IS NULL
|
|
35
|
+
OR vp.valid_to >= now())
|
|
36
|
+
AND (vp.state_position::text = ANY (ARRAY['on_track'::character varying::text,
|
|
37
|
+
'at_stop'::character varying::text,
|
|
38
|
+
'before_track'::character varying::text,
|
|
39
|
+
'before_track_delayed'::character varying::text]))
|
|
40
|
+
WHERE
|
|
41
|
+
vt.gtfs_trip_id IS NOT NULL
|
|
42
|
+
AND rst.stop_sequence = COALESCE(vp.last_stop_sequence, 1)
|
|
43
|
+
UNION ALL
|
|
44
|
+
SELECT
|
|
45
|
+
rst.trip_id,
|
|
46
|
+
previous_row.trips_id,
|
|
47
|
+
previous_row.provider_source_type,
|
|
48
|
+
previous_row.delay,
|
|
49
|
+
previous_row.initial_stop_sequence,
|
|
50
|
+
previous_row.state_position,
|
|
51
|
+
rst.stop_id,
|
|
52
|
+
rst.stop_sequence,
|
|
53
|
+
rst.computed_dwell_time_seconds,
|
|
54
|
+
CASE WHEN (rst.stop_sequence - previous_row.initial_stop_sequence) = 1
|
|
55
|
+
AND previous_row.state_position::text <> 'at_stop'::text THEN
|
|
56
|
+
previous_row.delay
|
|
57
|
+
ELSE
|
|
58
|
+
previous_row.departure_delay_seconds
|
|
59
|
+
END AS arrival_delay_seconds,
|
|
60
|
+
predict_delay_seconds(
|
|
61
|
+
CASE WHEN (rst.stop_sequence - previous_row.initial_stop_sequence) = 1
|
|
62
|
+
AND previous_row.state_position::text <> 'at_stop'::text THEN
|
|
63
|
+
previous_row.delay
|
|
64
|
+
ELSE
|
|
65
|
+
previous_row.departure_delay_seconds
|
|
66
|
+
END, rst.computed_dwell_time_seconds, previous_row.provider_source_type) AS departure_delay_seconds
|
|
67
|
+
FROM
|
|
68
|
+
stop_times previous_row
|
|
69
|
+
JOIN ropidgtfs_stop_times rst ON rst.trip_id::text = previous_row.trip_id::text
|
|
70
|
+
AND rst.stop_sequence =(previous_row.stop_sequence + 1))
|
|
71
|
+
SELECT
|
|
72
|
+
stop_times.trips_id AS rt_trip_id,
|
|
73
|
+
stop_times.stop_sequence,
|
|
74
|
+
COALESCE(stop_times.arrival_delay_seconds, 0) AS stop_arr_delay,
|
|
75
|
+
COALESCE(stop_times.departure_delay_seconds, 0) AS stop_dep_delay,
|
|
76
|
+
stop_times.stop_id
|
|
77
|
+
FROM
|
|
78
|
+
stop_times
|
|
79
|
+
ORDER BY
|
|
80
|
+
stop_times.trip_id,
|
|
81
|
+
stop_times.stop_sequence;
|
|
82
|
+
|
package/db/migrations/postgresql/sqls/20240612135256-fix-delay-in-view-future-stop-times-up.sql
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
CREATE OR REPLACE VIEW v_public_vehiclepositions_future_stop_times AS
|
|
2
|
+
WITH RECURSIVE stop_times AS (
|
|
3
|
+
SELECT
|
|
4
|
+
rst.trip_id,
|
|
5
|
+
vt.id AS trips_id,
|
|
6
|
+
vt.provider_source_type,
|
|
7
|
+
coalesce(vp.delay, 0) AS delay,
|
|
8
|
+
coalesce(vp.last_stop_sequence, 1) AS initial_stop_sequence,
|
|
9
|
+
vp.state_position,
|
|
10
|
+
rst.stop_id,
|
|
11
|
+
rst.stop_sequence,
|
|
12
|
+
rst.computed_dwell_time_seconds,
|
|
13
|
+
rst.arrival_time,
|
|
14
|
+
rst.departure_time,
|
|
15
|
+
CASE WHEN vp.last_stop_sequence IS NULL THEN
|
|
16
|
+
coalesce(vp.delay, 0)
|
|
17
|
+
ELSE
|
|
18
|
+
coalesce(vp.delay_stop_arrival, 0)
|
|
19
|
+
END AS arrival_delay_seconds,
|
|
20
|
+
CASE WHEN vp.last_stop_sequence IS NULL THEN
|
|
21
|
+
predict_delay_seconds(vp.delay, rst.computed_dwell_time_seconds, vt.provider_source_type)
|
|
22
|
+
WHEN vp.state_position::text = 'at_stop'::text THEN
|
|
23
|
+
CASE WHEN vt.provider_source_type::text = '1'::text THEN
|
|
24
|
+
greatest(0, vp.delay)
|
|
25
|
+
ELSE
|
|
26
|
+
vp.delay
|
|
27
|
+
END
|
|
28
|
+
ELSE
|
|
29
|
+
vp.delay_stop_departure
|
|
30
|
+
END AS departure_delay_seconds
|
|
31
|
+
FROM
|
|
32
|
+
ropidgtfs_stop_times rst
|
|
33
|
+
JOIN vehiclepositions_trips vt ON vt.gtfs_trip_id::text = rst.trip_id::text
|
|
34
|
+
JOIN vehiclepositions_positions vp ON vp.id = vt.last_position_id
|
|
35
|
+
AND (vp.valid_to IS NULL
|
|
36
|
+
OR vp.valid_to >= now())
|
|
37
|
+
AND (vp.state_position::text = ANY (ARRAY['on_track'::character varying::text,
|
|
38
|
+
'at_stop'::character varying::text,
|
|
39
|
+
'before_track'::character varying::text,
|
|
40
|
+
'before_track_delayed'::character varying::text]))
|
|
41
|
+
WHERE
|
|
42
|
+
vt.gtfs_trip_id IS NOT NULL
|
|
43
|
+
AND rst.stop_sequence = coalesce(vp.last_stop_sequence, 1)
|
|
44
|
+
UNION ALL
|
|
45
|
+
SELECT
|
|
46
|
+
rst.trip_id,
|
|
47
|
+
previous_row.trips_id,
|
|
48
|
+
previous_row.provider_source_type,
|
|
49
|
+
previous_row.delay,
|
|
50
|
+
previous_row.initial_stop_sequence,
|
|
51
|
+
previous_row.state_position,
|
|
52
|
+
rst.stop_id,
|
|
53
|
+
rst.stop_sequence,
|
|
54
|
+
rst.computed_dwell_time_seconds,
|
|
55
|
+
rst.arrival_time,
|
|
56
|
+
rst.departure_time,
|
|
57
|
+
CASE WHEN (rst.stop_sequence - previous_row.initial_stop_sequence) = 1
|
|
58
|
+
AND previous_row.state_position::text <> 'at_stop'::text THEN
|
|
59
|
+
CASE WHEN (rst.arrival_time::time +(interval '1 second' * previous_row.delay) < previous_row.departure_time::time +(interval '1 second' *(previous_row.departure_delay_seconds))) THEN
|
|
60
|
+
NULL
|
|
61
|
+
ELSE
|
|
62
|
+
previous_row.delay
|
|
63
|
+
END
|
|
64
|
+
ELSE
|
|
65
|
+
previous_row.departure_delay_seconds
|
|
66
|
+
END AS arrival_delay_seconds,
|
|
67
|
+
predict_delay_seconds(
|
|
68
|
+
CASE WHEN (rst.stop_sequence - previous_row.initial_stop_sequence) = 1
|
|
69
|
+
AND previous_row.state_position::text <> 'at_stop'::text THEN
|
|
70
|
+
previous_row.delay
|
|
71
|
+
ELSE
|
|
72
|
+
previous_row.departure_delay_seconds
|
|
73
|
+
END, rst.computed_dwell_time_seconds, previous_row.provider_source_type) AS departure_delay_seconds
|
|
74
|
+
FROM
|
|
75
|
+
stop_times previous_row
|
|
76
|
+
JOIN ropidgtfs_stop_times rst ON rst.trip_id::text = previous_row.trip_id::text
|
|
77
|
+
AND rst.stop_sequence =(previous_row.stop_sequence + 1))
|
|
78
|
+
SELECT
|
|
79
|
+
stop_times.trips_id AS rt_trip_id,
|
|
80
|
+
stop_times.stop_sequence,
|
|
81
|
+
stop_times.arrival_delay_seconds AS stop_arr_delay,
|
|
82
|
+
CASE WHEN (stop_times.arrival_time::time +(interval '1 second' * coalesce(stop_times.arrival_delay_seconds, 0))) >(stop_times.departure_time::time +(interval '1 second' * coalesce(stop_times.departure_delay_seconds, 0))) THEN
|
|
83
|
+
NULL
|
|
84
|
+
ELSE
|
|
85
|
+
stop_times.departure_delay_seconds
|
|
86
|
+
END AS stop_dep_delay,
|
|
87
|
+
stop_times.stop_id
|
|
88
|
+
FROM
|
|
89
|
+
stop_times
|
|
90
|
+
ORDER BY
|
|
91
|
+
stop_times.trip_id,
|
|
92
|
+
stop_times.stop_sequence;
|
|
93
|
+
|
|
@@ -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
|
+
{"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,mFAAgF;AAChF,iFAA8E;AAC9E,4FAAyF;AACzF,8FAA2F;AAC3F,4GAAyG;AACzG,sGAAmG;AACnG,kGAA+F;AAC/F,mGAAgG;AAChG,+GAA4G;AAC5G,iGAA8F;AAC9F,mFAAgF;AAChF,uFAAoF;AACpF,qFAAkF;AAClF,uHAAoH;AACpH,qHAAkH;AAClH,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,4FAAyF;AACzF,8FAA2F;AAC3F,2HAAwH;AACxH,8HAA2H;AAC3H,4GAAyG;AACzG,+HAA4H;AAC5H,wGAAqG;AACrG,sHAAmH;AACnH,8GAA2G;AAC3G,0HAAuH;AACvH,yDAAsD;AAEtD,wBAAwB;AACxB,MAAM,WAAW,GAAwB,iBAAY,CAAC,oBAAoB,EAAE,CAAC;AA6DpE,kCAAW;AA5DpB,YAAY;AAEZ,qBAAqB;AACrB,WAAW,CAAC,QAAQ,CAAC,mCAAgB,CAAC,gCAAgC,EAAE,mEAAgC,CAAC,CAAC;AAC1G,WAAW,CAAC,iBAAiB,CAAC,mCAAgB,CAAC,2BAA2B,EAAE,yDAA2B,CAAC,CAAC;AACzG,YAAY;AAEZ,sBAAsB;AACtB,WAAW,CAAC,QAAQ,CAAC,mCAAgB,CAAC,cAAc,EAAE,iCAAe,CAAC,CAAC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AAC,qBAAqB,EAAE,6CAAqB,CAAC,CAAC;AACpF,YAAY;AAEZ,eAAe;AACf,WAAW,CAAC,iBAAiB,CAAC,mCAAgB,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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9B,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,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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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
|
}
|