@golemio/pid 2.10.3 → 2.10.4-dev.1111301464
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/20231207135833-vp-gtfs-direction-id.js +53 -0
- package/db/migrations/postgresql/20231208130901-run-number-int.js +53 -0
- package/db/migrations/postgresql/20231213075143-stop-time-origin-route-name.js +53 -0
- package/db/migrations/postgresql/sqls/20231207135833-vp-gtfs-direction-id-down.sql +36 -0
- package/db/migrations/postgresql/sqls/20231207135833-vp-gtfs-direction-id-up.sql +147 -0
- package/db/migrations/postgresql/sqls/20231208130901-run-number-int-down.sql +1 -0
- package/db/migrations/postgresql/sqls/20231208130901-run-number-int-up.sql +1 -0
- package/db/migrations/postgresql/sqls/20231213075143-stop-time-origin-route-name-down.sql +77 -0
- package/db/migrations/postgresql/sqls/20231213075143-stop-time-origin-route-name-up.sql +77 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js +4 -2
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/interfaces/IMetroRunInputForProcessing.d.ts +1 -0
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.js +22 -12
- package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/CommonRunsMessagesTransformation.js +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/CommonRunsMessagesTransformation.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/MetroRunsMessageProcessingTransformation.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/runs/transformations/MetroRunsMessageProcessingTransformation.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.d.ts +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/TripsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/RawQueryProvider.d.ts +0 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/RawQueryProvider.js +4 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/RawQueryProvider.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.d.ts +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.js +6 -4
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/TripsMapper.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/interfaces/TripRepositoryInterfaces.d.ts +2 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +16 -15
- 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/gtfs-trip-run/AbstractGTFSTripRunManager.js +10 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/AbstractGTFSTripRunManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripMetroRunManager.js +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/gtfs-trip-run/GTFSTripMetroRunManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +14 -13
- 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/interfaces/VPInterfaces.d.ts +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.js +2 -1
- package/dist/output-gateway/vehicle-positions/data-access/TripRepository.js.map +1 -1
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.d.ts +3 -0
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js +4 -0
- package/dist/schema-definitions/ropid-gtfs/RopidGTFSPrecomputed.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/CommonRunsModel.d.ts +1 -1
- package/dist/schema-definitions/vehicle-positions/models/CommonRunsModel.js +1 -1
- package/dist/schema-definitions/vehicle-positions/models/CommonRunsModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js +4 -0
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/interfaces/ICommonRunsModel.d.ts +1 -1
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IVPTripsModel.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/interfaces/IGtfsRunTripCacheDto.d.ts +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/GtfsRunTripCacheDtoSchema.js +1 -0
- package/dist/schema-definitions/vehicle-positions/redis/schemas/GtfsRunTripCacheDtoSchema.js.map +1 -1
- package/docs/assets/pid_vp_st_hist_erd.png +0 -0
- package/docs/implementation_documentation.md +6 -5
- 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', '20231207135833-vp-gtfs-direction-id-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', '20231207135833-vp-gtfs-direction-id-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,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', '20231208130901-run-number-int-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', '20231208130901-run-number-int-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,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', '20231213075143-stop-time-origin-route-name-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', '20231213075143-stop-time-origin-route-name-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,36 @@
|
|
|
1
|
+
CREATE or replace PROCEDURE vehiclepositions_data_retention(inout numberOfRows int, in dataRetentionMinutes int)
|
|
2
|
+
LANGUAGE plpgsql
|
|
3
|
+
AS $procedure$
|
|
4
|
+
declare
|
|
5
|
+
idsForDelete varchar(255)[];
|
|
6
|
+
begin
|
|
7
|
+
select array_agg(t.id) from pid.vehiclepositions_trips t
|
|
8
|
+
left join pid.vehiclepositions_positions p on
|
|
9
|
+
p.id = t.last_position_id
|
|
10
|
+
where
|
|
11
|
+
p.valid_to < (NOW() - (dataRetentionMinutes || ' minutes')::interval)
|
|
12
|
+
or (gtfs_trip_id is null and p.created_at < NOW() - (dataRetentionMinutes || ' minutes')::interval) -- entries with valid to is null
|
|
13
|
+
into idsForDelete;
|
|
14
|
+
|
|
15
|
+
INSERT INTO pid.vehiclepositions_trips_history
|
|
16
|
+
select * from pid.vehiclepositions_trips where id = ANY(idsForDelete)
|
|
17
|
+
on conflict do nothing;
|
|
18
|
+
|
|
19
|
+
INSERT INTO pid.vehiclepositions_positions_history
|
|
20
|
+
select * from pid.vehiclepositions_positions where trips_id = ANY(idsForDelete)
|
|
21
|
+
on conflict do nothing;
|
|
22
|
+
|
|
23
|
+
delete from pid.vehiclepositions_positions where trips_id = ANY(idsForDelete);
|
|
24
|
+
delete from pid.vehiclepositions_trips where id = ANY(idsForDelete);
|
|
25
|
+
|
|
26
|
+
select array_length(idsForDelete,1) into numberOfRows;
|
|
27
|
+
end;
|
|
28
|
+
$procedure$;
|
|
29
|
+
|
|
30
|
+
drop view v_vehiclepositions_past_stop_times;
|
|
31
|
+
drop table vehiclepositions_stop_times_history;
|
|
32
|
+
|
|
33
|
+
alter table vehiclepositions_trips drop column gtfs_direction_id;
|
|
34
|
+
alter table vehiclepositions_trips_history drop column gtfs_direction_id;
|
|
35
|
+
|
|
36
|
+
alter table ropidgtfs_precomputed_trip_schedule drop column direction_id;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
alter table ropidgtfs_precomputed_trip_schedule add column direction_id smallint;
|
|
2
|
+
|
|
3
|
+
alter table vehiclepositions_trips add column gtfs_direction_id smallint;
|
|
4
|
+
alter table vehiclepositions_trips_history add column gtfs_direction_id smallint;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
create table vehiclepositions_stop_times_history (
|
|
8
|
+
rt_trip_id varchar(100) not null,
|
|
9
|
+
gtfs_date date,
|
|
10
|
+
gtfs_trip_id varchar(50),
|
|
11
|
+
gtfs_direction_id smallint,
|
|
12
|
+
gtfs_route_short_name varchar(20),
|
|
13
|
+
gtfs_route_type int,
|
|
14
|
+
run_number int,
|
|
15
|
+
vehicle_registration_number int,
|
|
16
|
+
gtfs_stop_sequence smallint not null,
|
|
17
|
+
gtfs_stop_id varchar(20),
|
|
18
|
+
current_stop_arrival timestamp with time zone,
|
|
19
|
+
current_stop_departure timestamp with time zone,
|
|
20
|
+
current_stop_arr_delay int,
|
|
21
|
+
current_stop_dep_delay int,
|
|
22
|
+
|
|
23
|
+
-- audit fields
|
|
24
|
+
create_batch_id bigint,
|
|
25
|
+
created_at timestamp with time zone,
|
|
26
|
+
created_by varchar(150),
|
|
27
|
+
update_batch_id bigint,
|
|
28
|
+
updated_at timestamp with time zone,
|
|
29
|
+
updated_by varchar(150),
|
|
30
|
+
|
|
31
|
+
constraint vehiclepositions_stop_times_history_pkey primary key (rt_trip_id, gtfs_stop_sequence)
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
create view v_vehiclepositions_past_stop_times as
|
|
36
|
+
select
|
|
37
|
+
trips_id as rt_trip_id,
|
|
38
|
+
last_stop_sequence as stop_sequence,
|
|
39
|
+
last_stop_id as stop_id,
|
|
40
|
+
last_stop_arrival_time as stop_arrival,
|
|
41
|
+
last_stop_departure_time as stop_departure,
|
|
42
|
+
min(delay_stop_arrival) as stop_arr_delay,
|
|
43
|
+
max(delay_stop_departure) as stop_dep_delay
|
|
44
|
+
from (
|
|
45
|
+
select
|
|
46
|
+
trips_id,
|
|
47
|
+
last_stop_sequence,
|
|
48
|
+
last_stop_id,
|
|
49
|
+
last_stop_arrival_time,
|
|
50
|
+
last_stop_departure_time,
|
|
51
|
+
delay_stop_arrival,
|
|
52
|
+
delay_stop_departure,
|
|
53
|
+
row_number() over seq as rn
|
|
54
|
+
from
|
|
55
|
+
vehiclepositions_positions rt_position
|
|
56
|
+
where
|
|
57
|
+
(delay_stop_arrival is not null or delay_stop_departure is not null)
|
|
58
|
+
and state_position in ('on_track', 'at_stop', 'after_track')
|
|
59
|
+
window
|
|
60
|
+
seq as (partition by trips_id, last_stop_sequence, state_position order by id)
|
|
61
|
+
) as sub
|
|
62
|
+
where
|
|
63
|
+
rn = 1
|
|
64
|
+
group by
|
|
65
|
+
trips_id,
|
|
66
|
+
last_stop_arrival_time,
|
|
67
|
+
last_stop_departure_time,
|
|
68
|
+
last_stop_sequence,
|
|
69
|
+
last_stop_id
|
|
70
|
+
order by
|
|
71
|
+
trips_id,
|
|
72
|
+
last_stop_sequence;
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
CREATE or replace PROCEDURE vehiclepositions_data_retention(inout numberOfRows int, in dataRetentionMinutes int)
|
|
76
|
+
LANGUAGE plpgsql
|
|
77
|
+
SET search_path FROM CURRENT
|
|
78
|
+
AS $procedure$
|
|
79
|
+
declare
|
|
80
|
+
idsForDelete varchar(255)[];
|
|
81
|
+
begin
|
|
82
|
+
select array_agg(t.id) from vehiclepositions_trips t
|
|
83
|
+
left join vehiclepositions_positions p on
|
|
84
|
+
p.id = t.last_position_id
|
|
85
|
+
where
|
|
86
|
+
p.valid_to < (NOW() - (dataRetentionMinutes || ' minutes')::interval)
|
|
87
|
+
or (gtfs_trip_id is null and p.created_at < NOW() - (dataRetentionMinutes || ' minutes')::interval) -- entries with valid to is null
|
|
88
|
+
into idsForDelete;
|
|
89
|
+
|
|
90
|
+
INSERT INTO vehiclepositions_trips_history
|
|
91
|
+
select * from vehiclepositions_trips where id = ANY(idsForDelete)
|
|
92
|
+
on conflict do nothing;
|
|
93
|
+
|
|
94
|
+
INSERT INTO vehiclepositions_positions_history
|
|
95
|
+
select * from vehiclepositions_positions where trips_id = ANY(idsForDelete)
|
|
96
|
+
on conflict do nothing;
|
|
97
|
+
|
|
98
|
+
insert into vehiclepositions_stop_times_history (
|
|
99
|
+
rt_trip_id,
|
|
100
|
+
gtfs_date,
|
|
101
|
+
gtfs_trip_id,
|
|
102
|
+
gtfs_direction_id,
|
|
103
|
+
gtfs_route_short_name,
|
|
104
|
+
gtfs_route_type,
|
|
105
|
+
run_number,
|
|
106
|
+
vehicle_registration_number,
|
|
107
|
+
gtfs_stop_id,
|
|
108
|
+
gtfs_stop_sequence,
|
|
109
|
+
current_stop_arrival,
|
|
110
|
+
current_stop_departure,
|
|
111
|
+
current_stop_arr_delay,
|
|
112
|
+
current_stop_dep_delay,
|
|
113
|
+
created_at,
|
|
114
|
+
updated_at
|
|
115
|
+
)
|
|
116
|
+
select
|
|
117
|
+
rt_trip.id,
|
|
118
|
+
rt_trip.gtfs_date,
|
|
119
|
+
rt_trip.gtfs_trip_id,
|
|
120
|
+
rt_trip.gtfs_direction_id,
|
|
121
|
+
rt_trip.gtfs_route_short_name,
|
|
122
|
+
rt_trip.gtfs_route_type,
|
|
123
|
+
rt_trip.run_number,
|
|
124
|
+
rt_trip.vehicle_registration_number,
|
|
125
|
+
stop_time.stop_id,
|
|
126
|
+
stop_time.stop_sequence,
|
|
127
|
+
stop_time.stop_arrival,
|
|
128
|
+
stop_time.stop_departure,
|
|
129
|
+
stop_time.stop_arr_delay,
|
|
130
|
+
stop_time.stop_dep_delay,
|
|
131
|
+
now(),
|
|
132
|
+
now()
|
|
133
|
+
from
|
|
134
|
+
vehiclepositions_trips rt_trip
|
|
135
|
+
join
|
|
136
|
+
v_vehiclepositions_past_stop_times stop_time on stop_time.rt_trip_id = rt_trip.id
|
|
137
|
+
where
|
|
138
|
+
rt_trip.id = ANY(idsForDelete)
|
|
139
|
+
on conflict do nothing;
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
delete from vehiclepositions_positions where trips_id = ANY(idsForDelete);
|
|
143
|
+
delete from vehiclepositions_trips where id = ANY(idsForDelete);
|
|
144
|
+
|
|
145
|
+
select array_length(idsForDelete,1) into numberOfRows;
|
|
146
|
+
end;
|
|
147
|
+
$procedure$;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alter table vehiclepositions_runs alter column run_number type varchar(50) using run_number::varchar(50);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alter table vehiclepositions_runs alter column run_number type int using run_number::int;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
drop procedure vehiclepositions_data_retention(int, int);
|
|
2
|
+
alter table vehiclepositions_stop_times_history drop column origin_route_name;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
CREATE PROCEDURE vehiclepositions_data_retention(inout numberOfRows int, in dataRetentionMinutes int)
|
|
6
|
+
LANGUAGE plpgsql
|
|
7
|
+
SET search_path FROM CURRENT
|
|
8
|
+
AS $procedure$
|
|
9
|
+
declare
|
|
10
|
+
idsForDelete varchar(255)[];
|
|
11
|
+
begin
|
|
12
|
+
select array_agg(t.id) from vehiclepositions_trips t
|
|
13
|
+
left join vehiclepositions_positions p on
|
|
14
|
+
p.id = t.last_position_id
|
|
15
|
+
where
|
|
16
|
+
p.valid_to < (NOW() - (dataRetentionMinutes || ' minutes')::interval)
|
|
17
|
+
or (gtfs_trip_id is null and p.created_at < NOW() - (dataRetentionMinutes || ' minutes')::interval) -- entries with valid to is null
|
|
18
|
+
into idsForDelete;
|
|
19
|
+
|
|
20
|
+
INSERT INTO vehiclepositions_trips_history
|
|
21
|
+
select * from vehiclepositions_trips where id = ANY(idsForDelete)
|
|
22
|
+
on conflict do nothing;
|
|
23
|
+
|
|
24
|
+
INSERT INTO vehiclepositions_positions_history
|
|
25
|
+
select * from vehiclepositions_positions where trips_id = ANY(idsForDelete)
|
|
26
|
+
on conflict do nothing;
|
|
27
|
+
|
|
28
|
+
insert into vehiclepositions_stop_times_history (
|
|
29
|
+
rt_trip_id,
|
|
30
|
+
gtfs_date,
|
|
31
|
+
gtfs_trip_id,
|
|
32
|
+
gtfs_direction_id,
|
|
33
|
+
gtfs_route_short_name,
|
|
34
|
+
gtfs_route_type,
|
|
35
|
+
run_number,
|
|
36
|
+
vehicle_registration_number,
|
|
37
|
+
gtfs_stop_id,
|
|
38
|
+
gtfs_stop_sequence,
|
|
39
|
+
current_stop_arrival,
|
|
40
|
+
current_stop_departure,
|
|
41
|
+
current_stop_arr_delay,
|
|
42
|
+
current_stop_dep_delay,
|
|
43
|
+
created_at,
|
|
44
|
+
updated_at
|
|
45
|
+
)
|
|
46
|
+
select
|
|
47
|
+
rt_trip.id,
|
|
48
|
+
rt_trip.gtfs_date,
|
|
49
|
+
rt_trip.gtfs_trip_id,
|
|
50
|
+
rt_trip.gtfs_direction_id,
|
|
51
|
+
rt_trip.gtfs_route_short_name,
|
|
52
|
+
rt_trip.gtfs_route_type,
|
|
53
|
+
rt_trip.run_number,
|
|
54
|
+
rt_trip.vehicle_registration_number,
|
|
55
|
+
stop_time.stop_id,
|
|
56
|
+
stop_time.stop_sequence,
|
|
57
|
+
stop_time.stop_arrival,
|
|
58
|
+
stop_time.stop_departure,
|
|
59
|
+
stop_time.stop_arr_delay,
|
|
60
|
+
stop_time.stop_dep_delay,
|
|
61
|
+
now(),
|
|
62
|
+
now()
|
|
63
|
+
from
|
|
64
|
+
vehiclepositions_trips rt_trip
|
|
65
|
+
join
|
|
66
|
+
v_vehiclepositions_past_stop_times stop_time on stop_time.rt_trip_id = rt_trip.id
|
|
67
|
+
where
|
|
68
|
+
rt_trip.id = ANY(idsForDelete)
|
|
69
|
+
on conflict do nothing;
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
delete from vehiclepositions_positions where trips_id = ANY(idsForDelete);
|
|
73
|
+
delete from vehiclepositions_trips where id = ANY(idsForDelete);
|
|
74
|
+
|
|
75
|
+
select array_length(idsForDelete,1) into numberOfRows;
|
|
76
|
+
end;
|
|
77
|
+
$procedure$;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
alter table vehiclepositions_stop_times_history add column origin_route_name varchar(20);
|
|
2
|
+
|
|
3
|
+
CREATE OR REPLACE PROCEDURE vehiclepositions_data_retention(inout numberOfRows int, in dataRetentionMinutes int)
|
|
4
|
+
LANGUAGE plpgsql
|
|
5
|
+
SET search_path FROM CURRENT
|
|
6
|
+
AS $procedure$
|
|
7
|
+
declare
|
|
8
|
+
idsForDelete varchar(255)[];
|
|
9
|
+
begin
|
|
10
|
+
select array_agg(t.id) from vehiclepositions_trips t
|
|
11
|
+
left join vehiclepositions_positions p on
|
|
12
|
+
p.id = t.last_position_id
|
|
13
|
+
where
|
|
14
|
+
p.valid_to < (NOW() - (dataRetentionMinutes || ' minutes')::interval)
|
|
15
|
+
or (gtfs_trip_id is null and p.created_at < NOW() - (dataRetentionMinutes || ' minutes')::interval) -- entries with valid to is null
|
|
16
|
+
into idsForDelete;
|
|
17
|
+
|
|
18
|
+
INSERT INTO vehiclepositions_trips_history
|
|
19
|
+
select * from vehiclepositions_trips where id = ANY(idsForDelete)
|
|
20
|
+
on conflict do nothing;
|
|
21
|
+
|
|
22
|
+
INSERT INTO vehiclepositions_positions_history
|
|
23
|
+
select * from vehiclepositions_positions where trips_id = ANY(idsForDelete)
|
|
24
|
+
on conflict do nothing;
|
|
25
|
+
|
|
26
|
+
insert into vehiclepositions_stop_times_history (
|
|
27
|
+
rt_trip_id,
|
|
28
|
+
gtfs_date,
|
|
29
|
+
gtfs_trip_id,
|
|
30
|
+
gtfs_direction_id,
|
|
31
|
+
gtfs_route_short_name,
|
|
32
|
+
gtfs_route_type,
|
|
33
|
+
run_number,
|
|
34
|
+
vehicle_registration_number,
|
|
35
|
+
gtfs_stop_id,
|
|
36
|
+
gtfs_stop_sequence,
|
|
37
|
+
current_stop_arrival,
|
|
38
|
+
current_stop_departure,
|
|
39
|
+
current_stop_arr_delay,
|
|
40
|
+
current_stop_dep_delay,
|
|
41
|
+
created_at,
|
|
42
|
+
updated_at,
|
|
43
|
+
origin_route_name
|
|
44
|
+
)
|
|
45
|
+
select
|
|
46
|
+
rt_trip.id,
|
|
47
|
+
rt_trip.gtfs_date,
|
|
48
|
+
rt_trip.gtfs_trip_id,
|
|
49
|
+
rt_trip.gtfs_direction_id,
|
|
50
|
+
rt_trip.gtfs_route_short_name,
|
|
51
|
+
rt_trip.gtfs_route_type,
|
|
52
|
+
rt_trip.run_number,
|
|
53
|
+
rt_trip.vehicle_registration_number,
|
|
54
|
+
stop_time.stop_id,
|
|
55
|
+
stop_time.stop_sequence,
|
|
56
|
+
stop_time.stop_arrival,
|
|
57
|
+
stop_time.stop_departure,
|
|
58
|
+
stop_time.stop_arr_delay,
|
|
59
|
+
stop_time.stop_dep_delay,
|
|
60
|
+
now(),
|
|
61
|
+
now(),
|
|
62
|
+
rt_trip.origin_route_name
|
|
63
|
+
from
|
|
64
|
+
vehiclepositions_trips rt_trip
|
|
65
|
+
join
|
|
66
|
+
v_vehiclepositions_past_stop_times stop_time on stop_time.rt_trip_id = rt_trip.id
|
|
67
|
+
where
|
|
68
|
+
rt_trip.id = ANY(idsForDelete)
|
|
69
|
+
on conflict do nothing;
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
delete from vehiclepositions_positions where trips_id = ANY(idsForDelete);
|
|
73
|
+
delete from vehiclepositions_trips where id = ANY(idsForDelete);
|
|
74
|
+
|
|
75
|
+
select array_length(idsForDelete,1) into numberOfRows;
|
|
76
|
+
end;
|
|
77
|
+
$procedure$;
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js
CHANGED
|
@@ -95,7 +95,8 @@ class TripScheduleRepository extends models_1.PostgresModel {
|
|
|
95
95
|
t0.last_stop_id,
|
|
96
96
|
right(t0.origin_route_id, -1) as origin_route_name,
|
|
97
97
|
t0.trip_number,
|
|
98
|
-
t0.route_licence_number
|
|
98
|
+
t0.route_licence_number,
|
|
99
|
+
t0.direction_id
|
|
99
100
|
FROM (
|
|
100
101
|
SELECT
|
|
101
102
|
t1.route_id AS origin_route_id,
|
|
@@ -118,7 +119,8 @@ class TripScheduleRepository extends models_1.PostgresModel {
|
|
|
118
119
|
t5.stop_id AS first_stop_id,
|
|
119
120
|
t6.stop_id AS last_stop_id,
|
|
120
121
|
t1.trip_number,
|
|
121
|
-
t1.route_licence_number
|
|
122
|
+
t1.route_licence_number,
|
|
123
|
+
t8.direction_id
|
|
122
124
|
FROM "${const_1.PG_SCHEMA}".ropidgtfs_run_numbers${sourceTableSuffix} t1
|
|
123
125
|
INNER JOIN "${const_1.PG_SCHEMA}".ropidgtfs_precomputed_services_calendar_tmp t3 ON t1.service_id = t3.service_id
|
|
124
126
|
INNER JOIN "${const_1.PG_SCHEMA}".ropidgtfs_precomputed_minmax_stop_sequences_tmp t4 ON t1.trip_id = t4.trip_id
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAuC;AACvC,0EAA4C;AAE5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAElF,+EAA4E;AAE5E,MAAa,sBAAuB,SAAQ,sBAAa;IACrD;QACI,KAAK,CACD,wBAAwB,EACxB;YACI,yBAAyB,EAAE,sBAAS,CAAC,YAAY,CAAC,yBAAyB;YAC3E,WAAW,EAAE,sBAAS,CAAC,YAAY,CAAC,WAAW;YAC/C,QAAQ,EAAE,iBAAS;YACnB,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;SACzD,EACD,IAAI,uCAAmB,CAAC,iCAAiC,EAAE,sBAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,CACtG,CAAC;QAGC,YAAO,GAAG,CAAC,OAAoB,EAA2B,EAAE;YAC/D,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,iBAAG,GAAG,EAAE,IAAI,IAAK,OAAO,EAAG,CAAC;QAClE,CAAC,CAAC;QAEK,aAAQ,GAAG,CAAO,iBAAwC,EAAiB,EAAE;YAChF,4BAA4B;YAC5B,MAAM,GAAG,GAAG
|
|
1
|
+
{"version":3,"file":"TripScheduleRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/TripScheduleRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gEAAuC;AACvC,0EAA4C;AAE5C,2EAAoE;AACpE,yEAAqF;AACrF,mFAAkF;AAElF,+EAA4E;AAE5E,MAAa,sBAAuB,SAAQ,sBAAa;IACrD;QACI,KAAK,CACD,wBAAwB,EACxB;YACI,yBAAyB,EAAE,sBAAS,CAAC,YAAY,CAAC,yBAAyB;YAC3E,WAAW,EAAE,sBAAS,CAAC,YAAY,CAAC,WAAW;YAC/C,QAAQ,EAAE,iBAAS;YACnB,UAAU,EAAE,YAAY;YACxB,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;SACzD,EACD,IAAI,uCAAmB,CAAC,iCAAiC,EAAE,sBAAS,CAAC,YAAY,CAAC,gBAAgB,CAAC,CACtG,CAAC;QAGC,YAAO,GAAG,CAAC,OAAoB,EAA2B,EAAE;YAC/D,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,iBAAG,GAAG,EAAE,IAAI,IAAK,OAAO,EAAG,CAAC;QAClE,CAAC,CAAC;QAEK,aAAQ,GAAG,CAAO,iBAAwC,EAAiB,EAAE;YAChF,4BAA4B;YAC5B,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2FI,iBAAS,0BAA0B,iBAAiB;8BAC9C,iBAAS;8BACT,iBAAS;6BACV,iBAAS,oBAAoB,iBAAiB;6BAC9C,iBAAS,qBAAqB,iBAAiB;6BAC/C,iBAAS,yBAAyB,iBAAiB;6BACnD,iBAAS,yBAAyB,iBAAiB;;SAEvE,CAAC;YACF,2BAA2B;YAE3B,IAAI;gBACA,MAAM,QAAQ,GAAG,sBAAS,CAAC,YAAY,CAAC,WAAW,GAAG,6CAAqB,CAAC,GAAG,CAAC;gBAEhF,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CAAC,gBAAgB,iBAAS,KAAK,QAAQ,IAAI,GAAG,GAAG,CAAC,CAAC;aAChG;YAAC,OAAO,GAAG,EAAE;gBACV,aAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACf,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAA,CAAC;IAtHF,CAAC;CAuHJ;AApID,wDAoIC"}
|
|
@@ -16,5 +16,5 @@ export declare class ProcessMetroRunMessagesTask extends AbstractTask<IProcessMe
|
|
|
16
16
|
constructor(queuePrefix: string);
|
|
17
17
|
protected execute({ routeName, messages }: IProcessMetroRunsMessagesInput): Promise<void>;
|
|
18
18
|
private processMessage;
|
|
19
|
-
private
|
|
19
|
+
private enrichRunMessage;
|
|
20
20
|
}
|
package/dist/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.js
CHANGED
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ProcessMetroRunMessagesTask = void 0;
|
|
13
13
|
const cache_1 = require("../../../../ropid-gtfs/data-access/cache");
|
|
14
|
+
const precomputed_1 = require("../../../../ropid-gtfs/data-access/precomputed");
|
|
14
15
|
const MetroRailtrackGPSRepository_1 = require("../../../../ropid-gtfs/workers/railtrack/tasks/data-access/MetroRailtrackGPSRepository");
|
|
15
16
|
const PositionsRepository_1 = require("../../vehicle-positions/data-access/PositionsRepository");
|
|
16
17
|
const TripsRepository_1 = require("../../vehicle-positions/data-access/TripsRepository");
|
|
@@ -18,12 +19,12 @@ const GTFSTripRunManagerFactory_1 = require("../../vehicle-positions/helpers/gtf
|
|
|
18
19
|
const vehicle_positions_1 = require("../../../../../schema-definitions/vehicle-positions");
|
|
19
20
|
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
|
|
20
21
|
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
|
|
22
|
+
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
|
|
23
|
+
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
21
24
|
const CommonRunsRepository_1 = require("../data-access/CommonRunsRepository");
|
|
22
25
|
const MetroMessageFilter_1 = require("../helpers/MetroMessageFilter");
|
|
23
26
|
const MetroTransformedRunsSchema_1 = require("../schema/MetroTransformedRunsSchema");
|
|
24
27
|
const MetroRunsMessageProcessingTransformation_1 = require("../transformations/MetroRunsMessageProcessingTransformation");
|
|
25
|
-
const precomputed_1 = require("../../../../ropid-gtfs/data-access/precomputed");
|
|
26
|
-
const sequelize_1 = require("@golemio/core/dist/shared/sequelize");
|
|
27
28
|
class ProcessMetroRunMessagesTask extends integration_engine_1.AbstractTask {
|
|
28
29
|
constructor(queuePrefix) {
|
|
29
30
|
super(queuePrefix);
|
|
@@ -52,41 +53,50 @@ class ProcessMetroRunMessagesTask extends integration_engine_1.AbstractTask {
|
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
processMessage(message, gpsData) {
|
|
56
|
+
var _a;
|
|
55
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
58
|
const data = yield this.processingTransformation.transform({ message, gpsData });
|
|
57
59
|
if (!data) {
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
let enhancedMessage = null;
|
|
63
|
+
try {
|
|
64
|
+
enhancedMessage = yield this.enrichRunMessage(data.runInput);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
throw new golemio_errors_1.GeneralError(`processMessage: error while fetching trip schedule`, this.constructor.name, err);
|
|
64
68
|
}
|
|
65
|
-
const enhancedMessage = yield this.addTripIdToMessage(data.runInput);
|
|
66
69
|
if (!enhancedMessage) {
|
|
67
70
|
helpers_1.log.verbose(`processMessage: no trip_id for metro run: ${JSON.stringify(data.runInput)}`);
|
|
68
71
|
return;
|
|
69
72
|
}
|
|
73
|
+
const scheduledTrips = yield this.gtfsTripRunManager.setAndReturnScheduledTrips(Object.assign(Object.assign({}, data.runSchedule), {
|
|
74
|
+
// try to use internal run number if available (input run message is not always reliable)
|
|
75
|
+
run_number: (_a = enhancedMessage.internalRunNumber) !== null && _a !== void 0 ? _a : data.runSchedule.run_number }));
|
|
76
|
+
if (scheduledTrips.length === 0) {
|
|
77
|
+
helpers_1.log.verbose(`processMessage: no schedule for metro run: ${JSON.stringify(data.runSchedule)}`);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
70
80
|
const delayMsg = yield this.gtfsTripRunManager.generateDelayMsg(scheduledTrips, enhancedMessage);
|
|
71
81
|
if (delayMsg.updatedTrips.length > 0) {
|
|
72
82
|
yield integration_engine_1.QueueManager.sendMessageToExchange(`${integration_engine_1.config.RABBIT_EXCHANGE_NAME}.${vehicle_positions_1.VehiclePositions.name.toLowerCase()}`, "updateDelay", delayMsg);
|
|
73
83
|
}
|
|
74
84
|
});
|
|
75
85
|
}
|
|
76
|
-
|
|
86
|
+
enrichRunMessage(runInput) {
|
|
77
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const
|
|
79
|
-
attributes: ["trip_id"],
|
|
88
|
+
const tripSchedule = yield this.tripScheduleRepository.findOne({
|
|
89
|
+
attributes: ["trip_id", "run_number"],
|
|
80
90
|
where: {
|
|
81
91
|
trip_number: runInput.trainNumber,
|
|
82
92
|
route_id: `L${runInput.routeId}`,
|
|
83
93
|
[sequelize_1.Op.and]: [sequelize_1.Sequelize.literal("start_timestamp::date = current_date")],
|
|
84
94
|
},
|
|
85
95
|
});
|
|
86
|
-
if (!
|
|
96
|
+
if (!tripSchedule) {
|
|
87
97
|
return null;
|
|
88
98
|
}
|
|
89
|
-
return Object.assign(Object.assign({}, runInput), { tripId:
|
|
99
|
+
return Object.assign(Object.assign({}, runInput), { tripId: tripSchedule.trip_id, internalRunNumber: tripSchedule.run_number });
|
|
90
100
|
});
|
|
91
101
|
}
|
|
92
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProcessMetroRunMessagesTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oEAA2E;AAC3E,wIAA6H;
|
|
1
|
+
{"version":3,"file":"ProcessMetroRunMessagesTask.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/runs/tasks/ProcessMetroRunMessagesTask.ts"],"names":[],"mappings":"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"}
|
|
@@ -57,7 +57,7 @@ class CommonRunsMessagesTransformation extends transformations_1.BaseTransformat
|
|
|
57
57
|
run: {
|
|
58
58
|
id: identifiers.runId,
|
|
59
59
|
route_id: identifiers.routeId,
|
|
60
|
-
run_number: identifiers.runNumber,
|
|
60
|
+
run_number: Number.parseInt(identifiers.runNumber),
|
|
61
61
|
line_short_name: attributes.line,
|
|
62
62
|
registration_number: attributes.evc,
|
|
63
63
|
msg_start_timestamp: element.timestamp,
|