@golemio/pid 4.1.6-dev.2109190001 → 4.1.6-dev.2111571292
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/20251020110708-get-departures-add-aftertrack.js +53 -0
- package/db/migrations/postgresql/sqls/20251020110708-get-departures-add-aftertrack-down.sql +284 -0
- package/db/migrations/postgresql/sqls/20251020110708-get-departures-add-aftertrack-up.sql +289 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.js.map +1 -1
- package/dist/output-gateway/pid/index.d.ts +1 -0
- package/dist/output-gateway/pid/index.js.map +1 -1
- package/dist/output-gateway/pid/models/helpers/SkipHelper.js +9 -2
- package/dist/output-gateway/pid/models/helpers/SkipHelper.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dbm;
|
|
4
|
+
var type;
|
|
5
|
+
var seed;
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var path = require('path');
|
|
8
|
+
var Promise;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* We receive the dbmigrate dependency from dbmigrate initially.
|
|
12
|
+
* This enables us to not have to rely on NODE_PATH.
|
|
13
|
+
*/
|
|
14
|
+
exports.setup = function(options, seedLink) {
|
|
15
|
+
dbm = options.dbmigrate;
|
|
16
|
+
type = dbm.dataType;
|
|
17
|
+
seed = seedLink;
|
|
18
|
+
Promise = options.Promise;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.up = function(db) {
|
|
22
|
+
var filePath = path.join(__dirname, 'sqls', '20251020110708-get-departures-add-aftertrack-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', '20251020110708-get-departures-add-aftertrack-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,284 @@
|
|
|
1
|
+
drop function get_departures;
|
|
2
|
+
drop view v_vehiclepositions_trip_position_vehicle_info;
|
|
3
|
+
|
|
4
|
+
create view v_vehiclepositions_trip_position_vehicle_info as
|
|
5
|
+
select
|
|
6
|
+
"trip->last_position"."delay" as "delay_seconds",
|
|
7
|
+
"trip"."wheelchair_accessible" as "real_wheelchair_accessible",
|
|
8
|
+
"trip->last_position"."is_canceled" as "is_canceled",
|
|
9
|
+
"trip"."agency_name_real" as "trip.agency_name_real",
|
|
10
|
+
"trip"."agency_name_scheduled" as "trip.agency_name_scheduled",
|
|
11
|
+
"trip"."cis_line_id" as "trip.cis_line_id",
|
|
12
|
+
"trip"."cis_line_short_name" as "trip.cis_line_short_name",
|
|
13
|
+
"trip"."cis_trip_number" as "trip.cis_trip_number",
|
|
14
|
+
"trip"."gtfs_block_id" as "trip.gtfs_block_id",
|
|
15
|
+
"trip"."gtfs_route_id" as "trip.gtfs_route_id",
|
|
16
|
+
"trip"."gtfs_route_short_name" as "trip.gtfs_route_short_name",
|
|
17
|
+
"trip"."gtfs_route_type" as "trip.gtfs_route_type",
|
|
18
|
+
"trip"."gtfs_trip_headsign" as "trip.gtfs_trip_headsign",
|
|
19
|
+
"trip"."gtfs_trip_short_name" as "trip.gtfs_trip_short_name",
|
|
20
|
+
"trip"."gtfs_trip_id" as "trip.gtfs_trip_id",
|
|
21
|
+
"trip"."gtfs_date" as "trip.gtfs_date",
|
|
22
|
+
"trip"."id" as "trip.id",
|
|
23
|
+
"trip"."is_canceled" as "trip.is_canceled",
|
|
24
|
+
"trip"."last_position_id" as "trip.last_position_id",
|
|
25
|
+
"trip"."origin_route_name" as "trip.origin_route_name",
|
|
26
|
+
"trip"."run_number" as "trip.run_number",
|
|
27
|
+
"trip"."start_asw_stop_id" as "trip.start_asw_stop_id",
|
|
28
|
+
"trip"."start_cis_stop_id" as "trip.start_cis_stop_id",
|
|
29
|
+
"trip"."start_cis_stop_platform_code" as "trip.start_cis_stop_platform_code",
|
|
30
|
+
"trip"."start_time" as "trip.start_time",
|
|
31
|
+
"trip"."start_timestamp" as "trip.start_timestamp",
|
|
32
|
+
"trip"."end_timestamp" as "trip.end_timestamp",
|
|
33
|
+
"trip"."vehicle_registration_number" as "trip.vehicle_registration_number",
|
|
34
|
+
"trip"."vehicle_type_id" as "trip.vehicle_type_id",
|
|
35
|
+
"trip"."wheelchair_accessible" as "trip.wheelchair_accessible",
|
|
36
|
+
"trip"."internal_route_name" as "trip.internal_route_name",
|
|
37
|
+
"trip"."internal_run_number" as "trip.internal_run_number",
|
|
38
|
+
"trip->last_position"."asw_last_stop_id" as "trip.last_position.asw_last_stop_id",
|
|
39
|
+
"trip->last_position"."bearing" as "trip.last_position.bearing",
|
|
40
|
+
"trip->last_position"."cis_last_stop_id" as "trip.last_position.cis_last_stop_id",
|
|
41
|
+
"trip->last_position"."cis_last_stop_sequence" as "trip.last_position.cis_last_stop_sequence",
|
|
42
|
+
"trip->last_position"."delay" as "trip.last_position.delay",
|
|
43
|
+
"trip->last_position"."delay_stop_arrival" as "trip.last_position.delay_stop_arrival",
|
|
44
|
+
"trip->last_position"."delay_stop_departure" as "trip.last_position.delay_stop_departure",
|
|
45
|
+
"trip->last_position"."id" as "trip.last_position.id",
|
|
46
|
+
"trip->last_position"."is_canceled" as "trip.last_position.is_canceled",
|
|
47
|
+
"trip->last_position"."last_stop_arrival_time" as "trip.last_position.last_stop_arrival_time",
|
|
48
|
+
"trip->last_position"."last_stop_departure_time" as "trip.last_position.last_stop_departure_time",
|
|
49
|
+
"trip->last_position"."last_stop_id" as "trip.last_position.last_stop_id",
|
|
50
|
+
"trip->last_position"."last_stop_sequence" as "trip.last_position.last_stop_sequence",
|
|
51
|
+
"trip->last_position"."lat" as "trip.last_position.lat",
|
|
52
|
+
"trip->last_position"."lng" as "trip.last_position.lng",
|
|
53
|
+
"trip->last_position"."next_stop_arrival_time" as "trip.last_position.next_stop_arrival_time",
|
|
54
|
+
"trip->last_position"."next_stop_departure_time" as "trip.last_position.next_stop_departure_time",
|
|
55
|
+
"trip->last_position"."next_stop_id" as "trip.last_position.next_stop_id",
|
|
56
|
+
"trip->last_position"."next_stop_sequence" as "trip.last_position.next_stop_sequence",
|
|
57
|
+
"trip->last_position"."origin_time" as "trip.last_position.origin_time",
|
|
58
|
+
"trip->last_position"."origin_timestamp" as "trip.last_position.origin_timestamp",
|
|
59
|
+
"trip->last_position"."shape_dist_traveled" as "trip.last_position.shape_dist_traveled",
|
|
60
|
+
"trip->last_position"."speed" as "trip.last_position.speed",
|
|
61
|
+
"trip->last_position"."state_position" as "trip.last_position.state_position",
|
|
62
|
+
"trip->last_position"."state_process" as "trip.last_position.state_process",
|
|
63
|
+
"trip->last_position"."this_stop_id" as "trip.last_position.this_stop_id",
|
|
64
|
+
"trip->last_position"."this_stop_sequence" as "trip.last_position.this_stop_sequence",
|
|
65
|
+
"trip->last_position"."is_tracked" as "trip.last_position.is_tracked",
|
|
66
|
+
"trip->last_position"."trips_id" as "trip.last_position.trips_id",
|
|
67
|
+
"trip->last_position"."tcp_event" as "trip.last_position.tcp_event",
|
|
68
|
+
"trip->last_position"."last_stop_headsign" as "trip.last_position.last_stop_headsign",
|
|
69
|
+
"trip->last_position"."last_stop_name" as "trip.last_position.last_stop_name",
|
|
70
|
+
"trip->last_position"."valid_to" as "trip.last_position.valid_to",
|
|
71
|
+
"trip->last_position"."scheduled_timestamp" as "trip.last_position.scheduled_timestamp",
|
|
72
|
+
"trip->vehicle_descriptor"."id" as "trip.vehicle_descriptor.id",
|
|
73
|
+
"trip->vehicle_descriptor"."is_air_conditioned" as "trip.vehicle_descriptor.is_air_conditioned"
|
|
74
|
+
from
|
|
75
|
+
"vehiclepositions_trips" as "trip"
|
|
76
|
+
inner join "vehiclepositions_positions" as "trip->last_position" on
|
|
77
|
+
"trip"."last_position_id" = "trip->last_position"."id"
|
|
78
|
+
and ("trip->last_position"."valid_to" is null or "trip->last_position"."valid_to" >= current_timestamp)
|
|
79
|
+
and "trip->last_position"."state_position" in ('at_stop', 'before_track', 'before_track_delayed', 'canceled', 'off_track', 'on_track')
|
|
80
|
+
left outer join "vehiclepositions_vehicle_descriptors" as "trip->vehicle_descriptor" on
|
|
81
|
+
"trip"."vehicle_registration_number" = "trip->vehicle_descriptor"."registration_number"
|
|
82
|
+
and trip.gtfs_route_type = "trip->vehicle_descriptor".gtfs_route_type;
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
create function get_departures (
|
|
86
|
+
stopsIds varchar,
|
|
87
|
+
mode int,
|
|
88
|
+
dateDepartureBetweenStart timestamptz,
|
|
89
|
+
dateDepartureBetweenEnd timestamptz,
|
|
90
|
+
isNegativeMinutesBefore int,
|
|
91
|
+
dateCanceledDepartureBetweenStart timestamptz,
|
|
92
|
+
dateCanceledDepartureBetweenEnd timestamptz,
|
|
93
|
+
airconditioninfoenabled int
|
|
94
|
+
)
|
|
95
|
+
returns table (
|
|
96
|
+
departure_datetime_real timestamptz,
|
|
97
|
+
arrival_datetime_real timestamptz,
|
|
98
|
+
stop_sequence int2,
|
|
99
|
+
stop_headsign varchar(70),
|
|
100
|
+
arrival_datetime timestamptz,
|
|
101
|
+
departure_datetime timestamptz,
|
|
102
|
+
stop_id varchar(25),
|
|
103
|
+
platform_code varchar(10),
|
|
104
|
+
wheelchair_boarding int2,
|
|
105
|
+
min_stop_sequence int2,
|
|
106
|
+
max_stop_sequence int2,
|
|
107
|
+
trip_id varchar(50),
|
|
108
|
+
trip_headsign varchar(100),
|
|
109
|
+
trip_short_name varchar(30),
|
|
110
|
+
wheelchair_accessible int2,
|
|
111
|
+
route_short_name varchar(50),
|
|
112
|
+
route_type int2,
|
|
113
|
+
route_id varchar(20),
|
|
114
|
+
is_night bpchar(1),
|
|
115
|
+
is_regional bpchar(1),
|
|
116
|
+
is_substitute_transport bpchar(1),
|
|
117
|
+
next_stop_id varchar(30),
|
|
118
|
+
delay_seconds int4,
|
|
119
|
+
real_wheelchair_accessible bool,
|
|
120
|
+
is_canceled bool,
|
|
121
|
+
"trip.gtfs_trip_short_name" varchar(255),
|
|
122
|
+
"trip.gtfs_date" date,
|
|
123
|
+
"trip.internal_route_name" varchar(50),
|
|
124
|
+
"trip.internal_run_number" int4,
|
|
125
|
+
"trip.start_timestamp" timestamptz,
|
|
126
|
+
"trip.last_position.last_stop_id" varchar(255),
|
|
127
|
+
"trip.last_position.last_stop_sequence" int4,
|
|
128
|
+
"trip.last_position.last_stop_name" varchar(255),
|
|
129
|
+
"trip.last_position.this_stop_sequence" int4,
|
|
130
|
+
"trip.cis_stop_platform_code" varchar(15),
|
|
131
|
+
"trip.vehicle_descriptor.is_air_conditioned" bool,
|
|
132
|
+
delay_minutes int4,
|
|
133
|
+
is_delay_available bool,
|
|
134
|
+
run_number int4,
|
|
135
|
+
planned_start_timestamp timestamptz
|
|
136
|
+
|
|
137
|
+
)
|
|
138
|
+
language SQL
|
|
139
|
+
set search_path from current
|
|
140
|
+
as $$
|
|
141
|
+
select
|
|
142
|
+
departure_boards_detailed."computed.departure_datetime_real",
|
|
143
|
+
departure_boards_detailed."computed.arrival_datetime_real",
|
|
144
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence",
|
|
145
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_headsign",
|
|
146
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.arrival_datetime",
|
|
147
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.departure_datetime",
|
|
148
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_id",
|
|
149
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.platform_code",
|
|
150
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.wheelchair_boarding",
|
|
151
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.min_stop_sequence",
|
|
152
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.max_stop_sequence",
|
|
153
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.trip_id",
|
|
154
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.trip_headsign",
|
|
155
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.trip_short_name",
|
|
156
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.wheelchair_accessible",
|
|
157
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.route_short_name",
|
|
158
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.route_type",
|
|
159
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.route_id",
|
|
160
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.is_night",
|
|
161
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.is_regional",
|
|
162
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.is_substitute_transport",
|
|
163
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.next_stop_id",
|
|
164
|
+
departure_boards_detailed."delay_seconds",
|
|
165
|
+
departure_boards_detailed."real_wheelchair_accessible",
|
|
166
|
+
departure_boards_detailed."is_canceled",
|
|
167
|
+
departure_boards_detailed."trip.gtfs_trip_short_name",
|
|
168
|
+
departure_boards_detailed."trip.gtfs_date",
|
|
169
|
+
departure_boards_detailed."trip.internal_route_name",
|
|
170
|
+
departure_boards_detailed."trip.internal_run_number",
|
|
171
|
+
departure_boards_detailed."trip.start_timestamp",
|
|
172
|
+
departure_boards_detailed."trip.last_position.last_stop_id",
|
|
173
|
+
departure_boards_detailed."trip.last_position.last_stop_sequence",
|
|
174
|
+
departure_boards_detailed."trip.last_position.last_stop_name",
|
|
175
|
+
departure_boards_detailed."trip.last_position.this_stop_sequence",
|
|
176
|
+
departure_boards_detailed.cis_stop_platform_code as "trip.cis_stop_platform_code",
|
|
177
|
+
case when airconditioninfoenabled = 1 then departure_boards_detailed."trip.vehicle_descriptor.is_air_conditioned" else NULL end,
|
|
178
|
+
TRUNC(departure_boards_detailed."trip.last_position.delay"::DECIMAL / 60, 0)::int as "delay_minutes",
|
|
179
|
+
case when departure_boards_detailed."trip.last_position.delay" is null then false else true end as "is_delay_available",
|
|
180
|
+
departure_boards_detailed."run.run_number",
|
|
181
|
+
departure_boards_detailed.planned_start_timestamp
|
|
182
|
+
|
|
183
|
+
from (
|
|
184
|
+
select
|
|
185
|
+
("departure_datetime"
|
|
186
|
+
+ MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end))
|
|
187
|
+
- case when (MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end)) > MAKE_INTERVAL())
|
|
188
|
+
then least (
|
|
189
|
+
MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end)),
|
|
190
|
+
("departure_datetime" - "arrival_datetime")::interval
|
|
191
|
+
)
|
|
192
|
+
else MAKE_INTERVAL()
|
|
193
|
+
end
|
|
194
|
+
) "computed.departure_datetime_real",
|
|
195
|
+
"arrival_datetime" + MAKE_INTERVAL(secs => (
|
|
196
|
+
CASE WHEN "trip.last_position.delay" IS NULL THEN 0 ELSE "trip.last_position.delay" end
|
|
197
|
+
)) "computed.arrival_datetime_real",
|
|
198
|
+
"ropidgtfs_precomputed_departures"."stop_sequence" as "ropidgtfs_precomputed_departures.stop_sequence",
|
|
199
|
+
"ropidgtfs_precomputed_departures"."stop_headsign" as "ropidgtfs_precomputed_departures.stop_headsign",
|
|
200
|
+
"ropidgtfs_precomputed_departures"."pickup_type" as "ropidgtfs_precomputed_departures.pickup_type",
|
|
201
|
+
"ropidgtfs_precomputed_departures"."drop_off_type" as "ropidgtfs_precomputed_departures.drop_off_type",
|
|
202
|
+
"ropidgtfs_precomputed_departures"."arrival_time" as "ropidgtfs_precomputed_departures.arrival_time",
|
|
203
|
+
"ropidgtfs_precomputed_departures"."arrival_datetime" as "ropidgtfs_precomputed_departures.arrival_datetime",
|
|
204
|
+
"ropidgtfs_precomputed_departures"."departure_time" as "ropidgtfs_precomputed_departures.departure_time",
|
|
205
|
+
"ropidgtfs_precomputed_departures"."departure_datetime" as "ropidgtfs_precomputed_departures.departure_datetime",
|
|
206
|
+
"ropidgtfs_precomputed_departures"."stop_id" as "ropidgtfs_precomputed_departures.stop_id",
|
|
207
|
+
"ropidgtfs_precomputed_departures"."stop_name" as "ropidgtfs_precomputed_departures.stop_name",
|
|
208
|
+
"ropidgtfs_precomputed_departures"."platform_code" as "ropidgtfs_precomputed_departures.platform_code",
|
|
209
|
+
"ropidgtfs_precomputed_departures"."wheelchair_boarding" as "ropidgtfs_precomputed_departures.wheelchair_boarding",
|
|
210
|
+
"ropidgtfs_precomputed_departures"."min_stop_sequence" as "ropidgtfs_precomputed_departures.min_stop_sequence",
|
|
211
|
+
"ropidgtfs_precomputed_departures"."max_stop_sequence" as "ropidgtfs_precomputed_departures.max_stop_sequence",
|
|
212
|
+
"ropidgtfs_precomputed_departures"."trip_id" as "ropidgtfs_precomputed_departures.trip_id",
|
|
213
|
+
"ropidgtfs_precomputed_departures"."trip_headsign" as "ropidgtfs_precomputed_departures.trip_headsign",
|
|
214
|
+
"ropidgtfs_precomputed_departures"."trip_short_name" as "ropidgtfs_precomputed_departures.trip_short_name",
|
|
215
|
+
"ropidgtfs_precomputed_departures"."wheelchair_accessible" as "ropidgtfs_precomputed_departures.wheelchair_accessible",
|
|
216
|
+
"ropidgtfs_precomputed_departures"."service_id" as "ropidgtfs_precomputed_departures.service_id",
|
|
217
|
+
"ropidgtfs_precomputed_departures"."date" as "ropidgtfs_precomputed_departures.date",
|
|
218
|
+
"ropidgtfs_precomputed_departures"."route_short_name" as "ropidgtfs_precomputed_departures.route_short_name",
|
|
219
|
+
"ropidgtfs_precomputed_departures"."route_type" as "ropidgtfs_precomputed_departures.route_type",
|
|
220
|
+
"ropidgtfs_precomputed_departures"."route_id" as "ropidgtfs_precomputed_departures.route_id",
|
|
221
|
+
"ropidgtfs_precomputed_departures"."is_night" as "ropidgtfs_precomputed_departures.is_night",
|
|
222
|
+
"ropidgtfs_precomputed_departures"."is_regional" as "ropidgtfs_precomputed_departures.is_regional",
|
|
223
|
+
"ropidgtfs_precomputed_departures"."is_substitute_transport" as "ropidgtfs_precomputed_departures.is_substitute_transport",
|
|
224
|
+
"ropidgtfs_precomputed_departures"."next_stop_sequence" as "ropidgtfs_precomputed_departures.next_stop_sequence",
|
|
225
|
+
"ropidgtfs_precomputed_departures"."next_stop_id" as "ropidgtfs_precomputed_departures.next_stop_id",
|
|
226
|
+
"ropidgtfs_precomputed_departures"."last_stop_sequence" as "ropidgtfs_precomputed_departures.last_stop_sequence",
|
|
227
|
+
"ropidgtfs_precomputed_departures"."last_stop_id" as "ropidgtfs_precomputed_departures.last_stop_id",
|
|
228
|
+
plan_start.planned_departure AS planned_start_timestamp,
|
|
229
|
+
x.*,
|
|
230
|
+
cis_stop.cis_stop_platform_code as "cis_stop_platform_code",
|
|
231
|
+
run.run_number as "run.run_number"
|
|
232
|
+
from
|
|
233
|
+
"ropidgtfs_precomputed_departures" as "ropidgtfs_precomputed_departures"
|
|
234
|
+
left join "ropidgtfs_run_numbers" as run on
|
|
235
|
+
"ropidgtfs_precomputed_departures"."trip_id" = run.trip_id
|
|
236
|
+
and "ropidgtfs_precomputed_departures"."service_id" = run.service_id
|
|
237
|
+
left outer join v_vehiclepositions_trip_position_vehicle_info as x on
|
|
238
|
+
"ropidgtfs_precomputed_departures"."trip_id" = x."trip.gtfs_trip_id"
|
|
239
|
+
left join lateral (
|
|
240
|
+
select pd.departure_datetime as planned_departure
|
|
241
|
+
from ropidgtfs_precomputed_departures pd
|
|
242
|
+
where pd.trip_id = "ropidgtfs_precomputed_departures".trip_id
|
|
243
|
+
and pd.date = "ropidgtfs_precomputed_departures".date
|
|
244
|
+
and pd.stop_sequence = 1
|
|
245
|
+
limit 1
|
|
246
|
+
) as plan_start on true
|
|
247
|
+
left join vehiclepositions_cis_stops as cis_stop on
|
|
248
|
+
cis_stop.rt_trip_id = x."trip.id"
|
|
249
|
+
and cis_stop.cis_stop_group_id = "ropidgtfs_precomputed_departures"."cis_stop_group_id"
|
|
250
|
+
) departure_boards_detailed
|
|
251
|
+
where
|
|
252
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_id" = ANY(STRING_TO_ARRAY(stopsIds,','))
|
|
253
|
+
and (
|
|
254
|
+
(
|
|
255
|
+
(
|
|
256
|
+
(mode = 1 and departure_boards_detailed."computed.arrival_datetime_real" between dateDepartureBetweenStart and dateDepartureBetweenEnd)
|
|
257
|
+
or (mode != 1 and departure_boards_detailed."computed.departure_datetime_real" between dateDepartureBetweenStart and dateDepartureBetweenEnd)
|
|
258
|
+
)
|
|
259
|
+
and
|
|
260
|
+
(
|
|
261
|
+
0 = isNegativeMinutesBefore
|
|
262
|
+
or ( -- pro záporné minutes before
|
|
263
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" >= departure_boards_detailed."trip.last_position.last_stop_sequence"
|
|
264
|
+
or departure_boards_detailed."trip.last_position.last_stop_sequence" IS null
|
|
265
|
+
)
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
)
|
|
269
|
+
or (
|
|
270
|
+
departure_boards_detailed."trip.is_canceled" = true
|
|
271
|
+
and
|
|
272
|
+
(
|
|
273
|
+
(mode = 1 and departure_boards_detailed."computed.arrival_datetime_real" between dateCanceledDepartureBetweenStart and dateCanceledDepartureBetweenEnd)
|
|
274
|
+
or (mode != 1 and departure_boards_detailed."computed.departure_datetime_real" between dateCanceledDepartureBetweenStart and dateCanceledDepartureBetweenEnd)
|
|
275
|
+
)
|
|
276
|
+
)
|
|
277
|
+
) and
|
|
278
|
+
(
|
|
279
|
+
(mode = 1 and (departure_boards_detailed."ropidgtfs_precomputed_departures.pickup_type" != '1' and departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" != departure_boards_detailed."ropidgtfs_precomputed_departures.max_stop_sequence")) -- mode default/departures
|
|
280
|
+
or (mode=2 and (departure_boards_detailed."ropidgtfs_precomputed_departures.drop_off_type" != '1' and departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" != departure_boards_detailed."ropidgtfs_precomputed_departures.min_stop_sequence")) -- mode arrivals
|
|
281
|
+
or (mode=3 and (departure_boards_detailed."ropidgtfs_precomputed_departures.pickup_type" != '1')) -- mode mixed
|
|
282
|
+
);
|
|
283
|
+
$$;
|
|
284
|
+
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
drop function get_departures;
|
|
2
|
+
drop view v_vehiclepositions_trip_position_vehicle_info;
|
|
3
|
+
|
|
4
|
+
create view v_vehiclepositions_trip_position_vehicle_info as
|
|
5
|
+
select
|
|
6
|
+
"trip->last_position"."delay" as "delay_seconds",
|
|
7
|
+
"trip"."wheelchair_accessible" as "real_wheelchair_accessible",
|
|
8
|
+
"trip->last_position"."is_canceled" as "is_canceled",
|
|
9
|
+
"trip"."agency_name_real" as "trip.agency_name_real",
|
|
10
|
+
"trip"."agency_name_scheduled" as "trip.agency_name_scheduled",
|
|
11
|
+
"trip"."cis_line_id" as "trip.cis_line_id",
|
|
12
|
+
"trip"."cis_line_short_name" as "trip.cis_line_short_name",
|
|
13
|
+
"trip"."cis_trip_number" as "trip.cis_trip_number",
|
|
14
|
+
"trip"."gtfs_block_id" as "trip.gtfs_block_id",
|
|
15
|
+
"trip"."gtfs_route_id" as "trip.gtfs_route_id",
|
|
16
|
+
"trip"."gtfs_route_short_name" as "trip.gtfs_route_short_name",
|
|
17
|
+
"trip"."gtfs_route_type" as "trip.gtfs_route_type",
|
|
18
|
+
"trip"."gtfs_trip_headsign" as "trip.gtfs_trip_headsign",
|
|
19
|
+
"trip"."gtfs_trip_short_name" as "trip.gtfs_trip_short_name",
|
|
20
|
+
"trip"."gtfs_trip_id" as "trip.gtfs_trip_id",
|
|
21
|
+
"trip"."gtfs_date" as "trip.gtfs_date",
|
|
22
|
+
"trip"."id" as "trip.id",
|
|
23
|
+
"trip"."is_canceled" as "trip.is_canceled",
|
|
24
|
+
"trip"."last_position_id" as "trip.last_position_id",
|
|
25
|
+
"trip"."origin_route_name" as "trip.origin_route_name",
|
|
26
|
+
"trip"."run_number" as "trip.run_number",
|
|
27
|
+
"trip"."start_asw_stop_id" as "trip.start_asw_stop_id",
|
|
28
|
+
"trip"."start_cis_stop_id" as "trip.start_cis_stop_id",
|
|
29
|
+
"trip"."start_cis_stop_platform_code" as "trip.start_cis_stop_platform_code",
|
|
30
|
+
"trip"."start_time" as "trip.start_time",
|
|
31
|
+
"trip"."start_timestamp" as "trip.start_timestamp",
|
|
32
|
+
"trip"."end_timestamp" as "trip.end_timestamp",
|
|
33
|
+
"trip"."vehicle_registration_number" as "trip.vehicle_registration_number",
|
|
34
|
+
"trip"."vehicle_type_id" as "trip.vehicle_type_id",
|
|
35
|
+
"trip"."wheelchair_accessible" as "trip.wheelchair_accessible",
|
|
36
|
+
"trip"."internal_route_name" as "trip.internal_route_name",
|
|
37
|
+
"trip"."internal_run_number" as "trip.internal_run_number",
|
|
38
|
+
"trip->last_position"."asw_last_stop_id" as "trip.last_position.asw_last_stop_id",
|
|
39
|
+
"trip->last_position"."bearing" as "trip.last_position.bearing",
|
|
40
|
+
"trip->last_position"."cis_last_stop_id" as "trip.last_position.cis_last_stop_id",
|
|
41
|
+
"trip->last_position"."cis_last_stop_sequence" as "trip.last_position.cis_last_stop_sequence",
|
|
42
|
+
"trip->last_position"."delay" as "trip.last_position.delay",
|
|
43
|
+
"trip->last_position"."delay_stop_arrival" as "trip.last_position.delay_stop_arrival",
|
|
44
|
+
"trip->last_position"."delay_stop_departure" as "trip.last_position.delay_stop_departure",
|
|
45
|
+
"trip->last_position"."id" as "trip.last_position.id",
|
|
46
|
+
"trip->last_position"."is_canceled" as "trip.last_position.is_canceled",
|
|
47
|
+
"trip->last_position"."last_stop_arrival_time" as "trip.last_position.last_stop_arrival_time",
|
|
48
|
+
"trip->last_position"."last_stop_departure_time" as "trip.last_position.last_stop_departure_time",
|
|
49
|
+
"trip->last_position"."last_stop_id" as "trip.last_position.last_stop_id",
|
|
50
|
+
"trip->last_position"."last_stop_sequence" as "trip.last_position.last_stop_sequence",
|
|
51
|
+
"trip->last_position"."lat" as "trip.last_position.lat",
|
|
52
|
+
"trip->last_position"."lng" as "trip.last_position.lng",
|
|
53
|
+
"trip->last_position"."next_stop_arrival_time" as "trip.last_position.next_stop_arrival_time",
|
|
54
|
+
"trip->last_position"."next_stop_departure_time" as "trip.last_position.next_stop_departure_time",
|
|
55
|
+
"trip->last_position"."next_stop_id" as "trip.last_position.next_stop_id",
|
|
56
|
+
"trip->last_position"."next_stop_sequence" as "trip.last_position.next_stop_sequence",
|
|
57
|
+
"trip->last_position"."origin_time" as "trip.last_position.origin_time",
|
|
58
|
+
"trip->last_position"."origin_timestamp" as "trip.last_position.origin_timestamp",
|
|
59
|
+
"trip->last_position"."shape_dist_traveled" as "trip.last_position.shape_dist_traveled",
|
|
60
|
+
"trip->last_position"."speed" as "trip.last_position.speed",
|
|
61
|
+
"trip->last_position"."state_position" as "trip.last_position.state_position",
|
|
62
|
+
"trip->last_position"."state_process" as "trip.last_position.state_process",
|
|
63
|
+
"trip->last_position"."this_stop_id" as "trip.last_position.this_stop_id",
|
|
64
|
+
"trip->last_position"."this_stop_sequence" as "trip.last_position.this_stop_sequence",
|
|
65
|
+
"trip->last_position"."is_tracked" as "trip.last_position.is_tracked",
|
|
66
|
+
"trip->last_position"."trips_id" as "trip.last_position.trips_id",
|
|
67
|
+
"trip->last_position"."tcp_event" as "trip.last_position.tcp_event",
|
|
68
|
+
"trip->last_position"."last_stop_headsign" as "trip.last_position.last_stop_headsign",
|
|
69
|
+
"trip->last_position"."last_stop_name" as "trip.last_position.last_stop_name",
|
|
70
|
+
"trip->last_position"."valid_to" as "trip.last_position.valid_to",
|
|
71
|
+
"trip->last_position"."scheduled_timestamp" as "trip.last_position.scheduled_timestamp",
|
|
72
|
+
"trip->vehicle_descriptor"."id" as "trip.vehicle_descriptor.id",
|
|
73
|
+
"trip->vehicle_descriptor"."is_air_conditioned" as "trip.vehicle_descriptor.is_air_conditioned"
|
|
74
|
+
from
|
|
75
|
+
"vehiclepositions_trips" as "trip"
|
|
76
|
+
inner join "vehiclepositions_positions" as "trip->last_position" on
|
|
77
|
+
"trip"."last_position_id" = "trip->last_position"."id"
|
|
78
|
+
and (
|
|
79
|
+
"trip->last_position"."valid_to" is null
|
|
80
|
+
or "trip->last_position"."valid_to" >= current_timestamp
|
|
81
|
+
or "trip->last_position"."state_position" in ('after_track', 'after_track_delayed')
|
|
82
|
+
)
|
|
83
|
+
and "trip->last_position"."state_position" in ('at_stop', 'before_track', 'before_track_delayed', 'canceled', 'off_track', 'on_track', 'after_track', 'after_track_delayed')
|
|
84
|
+
left outer join "vehiclepositions_vehicle_descriptors" as "trip->vehicle_descriptor" on
|
|
85
|
+
"trip"."vehicle_registration_number" = "trip->vehicle_descriptor"."registration_number"
|
|
86
|
+
and trip.gtfs_route_type = "trip->vehicle_descriptor".gtfs_route_type;
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
create function get_departures (
|
|
90
|
+
stopsIds varchar,
|
|
91
|
+
mode int,
|
|
92
|
+
dateDepartureBetweenStart timestamptz,
|
|
93
|
+
dateDepartureBetweenEnd timestamptz,
|
|
94
|
+
isNegativeMinutesBefore int,
|
|
95
|
+
dateCanceledDepartureBetweenStart timestamptz,
|
|
96
|
+
dateCanceledDepartureBetweenEnd timestamptz,
|
|
97
|
+
airconditioninfoenabled int
|
|
98
|
+
)
|
|
99
|
+
returns table (
|
|
100
|
+
departure_datetime_real timestamptz,
|
|
101
|
+
arrival_datetime_real timestamptz,
|
|
102
|
+
stop_sequence int2,
|
|
103
|
+
stop_headsign varchar(70),
|
|
104
|
+
arrival_datetime timestamptz,
|
|
105
|
+
departure_datetime timestamptz,
|
|
106
|
+
stop_id varchar(25),
|
|
107
|
+
platform_code varchar(10),
|
|
108
|
+
wheelchair_boarding int2,
|
|
109
|
+
min_stop_sequence int2,
|
|
110
|
+
max_stop_sequence int2,
|
|
111
|
+
trip_id varchar(50),
|
|
112
|
+
trip_headsign varchar(100),
|
|
113
|
+
trip_short_name varchar(30),
|
|
114
|
+
wheelchair_accessible int2,
|
|
115
|
+
route_short_name varchar(50),
|
|
116
|
+
route_type int2,
|
|
117
|
+
route_id varchar(20),
|
|
118
|
+
is_night bpchar(1),
|
|
119
|
+
is_regional bpchar(1),
|
|
120
|
+
is_substitute_transport bpchar(1),
|
|
121
|
+
next_stop_id varchar(30),
|
|
122
|
+
delay_seconds int4,
|
|
123
|
+
real_wheelchair_accessible bool,
|
|
124
|
+
is_canceled bool,
|
|
125
|
+
"trip.gtfs_trip_short_name" varchar(255),
|
|
126
|
+
"trip.gtfs_date" date,
|
|
127
|
+
"trip.internal_route_name" varchar(50),
|
|
128
|
+
"trip.internal_run_number" int4,
|
|
129
|
+
"trip.start_timestamp" timestamptz,
|
|
130
|
+
"trip.last_position.state_position" varchar(50),
|
|
131
|
+
"trip.last_position.last_stop_id" varchar(255),
|
|
132
|
+
"trip.last_position.last_stop_sequence" int4,
|
|
133
|
+
"trip.last_position.last_stop_name" varchar(255),
|
|
134
|
+
"trip.last_position.this_stop_sequence" int4,
|
|
135
|
+
"trip.cis_stop_platform_code" varchar(15),
|
|
136
|
+
"trip.vehicle_descriptor.is_air_conditioned" bool,
|
|
137
|
+
delay_minutes int4,
|
|
138
|
+
is_delay_available bool,
|
|
139
|
+
run_number int4,
|
|
140
|
+
planned_start_timestamp timestamptz
|
|
141
|
+
|
|
142
|
+
)
|
|
143
|
+
language SQL
|
|
144
|
+
set search_path from current
|
|
145
|
+
as $$
|
|
146
|
+
select
|
|
147
|
+
departure_boards_detailed."computed.departure_datetime_real",
|
|
148
|
+
departure_boards_detailed."computed.arrival_datetime_real",
|
|
149
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence",
|
|
150
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_headsign",
|
|
151
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.arrival_datetime",
|
|
152
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.departure_datetime",
|
|
153
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_id",
|
|
154
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.platform_code",
|
|
155
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.wheelchair_boarding",
|
|
156
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.min_stop_sequence",
|
|
157
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.max_stop_sequence",
|
|
158
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.trip_id",
|
|
159
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.trip_headsign",
|
|
160
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.trip_short_name",
|
|
161
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.wheelchair_accessible",
|
|
162
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.route_short_name",
|
|
163
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.route_type",
|
|
164
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.route_id",
|
|
165
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.is_night",
|
|
166
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.is_regional",
|
|
167
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.is_substitute_transport",
|
|
168
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.next_stop_id",
|
|
169
|
+
departure_boards_detailed."delay_seconds",
|
|
170
|
+
departure_boards_detailed."real_wheelchair_accessible",
|
|
171
|
+
departure_boards_detailed."is_canceled",
|
|
172
|
+
departure_boards_detailed."trip.gtfs_trip_short_name",
|
|
173
|
+
departure_boards_detailed."trip.gtfs_date",
|
|
174
|
+
departure_boards_detailed."trip.internal_route_name",
|
|
175
|
+
departure_boards_detailed."trip.internal_run_number",
|
|
176
|
+
departure_boards_detailed."trip.start_timestamp",
|
|
177
|
+
departure_boards_detailed."trip.last_position.state_position",
|
|
178
|
+
departure_boards_detailed."trip.last_position.last_stop_id",
|
|
179
|
+
departure_boards_detailed."trip.last_position.last_stop_sequence",
|
|
180
|
+
departure_boards_detailed."trip.last_position.last_stop_name",
|
|
181
|
+
departure_boards_detailed."trip.last_position.this_stop_sequence",
|
|
182
|
+
departure_boards_detailed.cis_stop_platform_code as "trip.cis_stop_platform_code",
|
|
183
|
+
case when airconditioninfoenabled = 1 then departure_boards_detailed."trip.vehicle_descriptor.is_air_conditioned" else NULL end,
|
|
184
|
+
TRUNC(departure_boards_detailed."trip.last_position.delay"::DECIMAL / 60, 0)::int as "delay_minutes",
|
|
185
|
+
case when departure_boards_detailed."trip.last_position.delay" is null then false else true end as "is_delay_available",
|
|
186
|
+
departure_boards_detailed."run.run_number",
|
|
187
|
+
departure_boards_detailed.planned_start_timestamp
|
|
188
|
+
|
|
189
|
+
from (
|
|
190
|
+
select
|
|
191
|
+
("departure_datetime"
|
|
192
|
+
+ MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end))
|
|
193
|
+
- case when (MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end)) > MAKE_INTERVAL())
|
|
194
|
+
then least (
|
|
195
|
+
MAKE_INTERVAL(secs => (case when "trip.last_position.delay" is null then 0 else "trip.last_position.delay" end)),
|
|
196
|
+
("departure_datetime" - "arrival_datetime")::interval
|
|
197
|
+
)
|
|
198
|
+
else MAKE_INTERVAL()
|
|
199
|
+
end
|
|
200
|
+
) "computed.departure_datetime_real",
|
|
201
|
+
"arrival_datetime" + MAKE_INTERVAL(secs => (
|
|
202
|
+
CASE WHEN "trip.last_position.delay" IS NULL THEN 0 ELSE "trip.last_position.delay" end
|
|
203
|
+
)) "computed.arrival_datetime_real",
|
|
204
|
+
"ropidgtfs_precomputed_departures"."stop_sequence" as "ropidgtfs_precomputed_departures.stop_sequence",
|
|
205
|
+
"ropidgtfs_precomputed_departures"."stop_headsign" as "ropidgtfs_precomputed_departures.stop_headsign",
|
|
206
|
+
"ropidgtfs_precomputed_departures"."pickup_type" as "ropidgtfs_precomputed_departures.pickup_type",
|
|
207
|
+
"ropidgtfs_precomputed_departures"."drop_off_type" as "ropidgtfs_precomputed_departures.drop_off_type",
|
|
208
|
+
"ropidgtfs_precomputed_departures"."arrival_time" as "ropidgtfs_precomputed_departures.arrival_time",
|
|
209
|
+
"ropidgtfs_precomputed_departures"."arrival_datetime" as "ropidgtfs_precomputed_departures.arrival_datetime",
|
|
210
|
+
"ropidgtfs_precomputed_departures"."departure_time" as "ropidgtfs_precomputed_departures.departure_time",
|
|
211
|
+
"ropidgtfs_precomputed_departures"."departure_datetime" as "ropidgtfs_precomputed_departures.departure_datetime",
|
|
212
|
+
"ropidgtfs_precomputed_departures"."stop_id" as "ropidgtfs_precomputed_departures.stop_id",
|
|
213
|
+
"ropidgtfs_precomputed_departures"."stop_name" as "ropidgtfs_precomputed_departures.stop_name",
|
|
214
|
+
"ropidgtfs_precomputed_departures"."platform_code" as "ropidgtfs_precomputed_departures.platform_code",
|
|
215
|
+
"ropidgtfs_precomputed_departures"."wheelchair_boarding" as "ropidgtfs_precomputed_departures.wheelchair_boarding",
|
|
216
|
+
"ropidgtfs_precomputed_departures"."min_stop_sequence" as "ropidgtfs_precomputed_departures.min_stop_sequence",
|
|
217
|
+
"ropidgtfs_precomputed_departures"."max_stop_sequence" as "ropidgtfs_precomputed_departures.max_stop_sequence",
|
|
218
|
+
"ropidgtfs_precomputed_departures"."trip_id" as "ropidgtfs_precomputed_departures.trip_id",
|
|
219
|
+
"ropidgtfs_precomputed_departures"."trip_headsign" as "ropidgtfs_precomputed_departures.trip_headsign",
|
|
220
|
+
"ropidgtfs_precomputed_departures"."trip_short_name" as "ropidgtfs_precomputed_departures.trip_short_name",
|
|
221
|
+
"ropidgtfs_precomputed_departures"."wheelchair_accessible" as "ropidgtfs_precomputed_departures.wheelchair_accessible",
|
|
222
|
+
"ropidgtfs_precomputed_departures"."service_id" as "ropidgtfs_precomputed_departures.service_id",
|
|
223
|
+
"ropidgtfs_precomputed_departures"."date" as "ropidgtfs_precomputed_departures.date",
|
|
224
|
+
"ropidgtfs_precomputed_departures"."route_short_name" as "ropidgtfs_precomputed_departures.route_short_name",
|
|
225
|
+
"ropidgtfs_precomputed_departures"."route_type" as "ropidgtfs_precomputed_departures.route_type",
|
|
226
|
+
"ropidgtfs_precomputed_departures"."route_id" as "ropidgtfs_precomputed_departures.route_id",
|
|
227
|
+
"ropidgtfs_precomputed_departures"."is_night" as "ropidgtfs_precomputed_departures.is_night",
|
|
228
|
+
"ropidgtfs_precomputed_departures"."is_regional" as "ropidgtfs_precomputed_departures.is_regional",
|
|
229
|
+
"ropidgtfs_precomputed_departures"."is_substitute_transport" as "ropidgtfs_precomputed_departures.is_substitute_transport",
|
|
230
|
+
"ropidgtfs_precomputed_departures"."next_stop_sequence" as "ropidgtfs_precomputed_departures.next_stop_sequence",
|
|
231
|
+
"ropidgtfs_precomputed_departures"."next_stop_id" as "ropidgtfs_precomputed_departures.next_stop_id",
|
|
232
|
+
"ropidgtfs_precomputed_departures"."last_stop_sequence" as "ropidgtfs_precomputed_departures.last_stop_sequence",
|
|
233
|
+
"ropidgtfs_precomputed_departures"."last_stop_id" as "ropidgtfs_precomputed_departures.last_stop_id",
|
|
234
|
+
plan_start.planned_departure AS planned_start_timestamp,
|
|
235
|
+
x.*,
|
|
236
|
+
cis_stop.cis_stop_platform_code as "cis_stop_platform_code",
|
|
237
|
+
run.run_number as "run.run_number"
|
|
238
|
+
from
|
|
239
|
+
"ropidgtfs_precomputed_departures" as "ropidgtfs_precomputed_departures"
|
|
240
|
+
left join "ropidgtfs_run_numbers" as run on
|
|
241
|
+
"ropidgtfs_precomputed_departures"."trip_id" = run.trip_id
|
|
242
|
+
and "ropidgtfs_precomputed_departures"."service_id" = run.service_id
|
|
243
|
+
left outer join v_vehiclepositions_trip_position_vehicle_info as x on
|
|
244
|
+
"ropidgtfs_precomputed_departures"."trip_id" = x."trip.gtfs_trip_id"
|
|
245
|
+
left join lateral (
|
|
246
|
+
select pd.departure_datetime as planned_departure
|
|
247
|
+
from ropidgtfs_precomputed_departures pd
|
|
248
|
+
where pd.trip_id = "ropidgtfs_precomputed_departures".trip_id
|
|
249
|
+
and pd.date = "ropidgtfs_precomputed_departures".date
|
|
250
|
+
and pd.stop_sequence = 1
|
|
251
|
+
limit 1
|
|
252
|
+
) as plan_start on true
|
|
253
|
+
left join vehiclepositions_cis_stops as cis_stop on
|
|
254
|
+
cis_stop.rt_trip_id = x."trip.id"
|
|
255
|
+
and cis_stop.cis_stop_group_id = "ropidgtfs_precomputed_departures"."cis_stop_group_id"
|
|
256
|
+
) departure_boards_detailed
|
|
257
|
+
where
|
|
258
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_id" = ANY(STRING_TO_ARRAY(stopsIds,','))
|
|
259
|
+
and (
|
|
260
|
+
(
|
|
261
|
+
(
|
|
262
|
+
(mode = 1 and departure_boards_detailed."computed.arrival_datetime_real" between dateDepartureBetweenStart and dateDepartureBetweenEnd)
|
|
263
|
+
or (mode != 1 and departure_boards_detailed."computed.departure_datetime_real" between dateDepartureBetweenStart and dateDepartureBetweenEnd)
|
|
264
|
+
)
|
|
265
|
+
and
|
|
266
|
+
(
|
|
267
|
+
0 = isNegativeMinutesBefore
|
|
268
|
+
or ( -- pro záporné minutes before
|
|
269
|
+
departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" >= departure_boards_detailed."trip.last_position.last_stop_sequence"
|
|
270
|
+
or departure_boards_detailed."trip.last_position.last_stop_sequence" IS null
|
|
271
|
+
)
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
)
|
|
275
|
+
or (
|
|
276
|
+
departure_boards_detailed."trip.is_canceled" = true
|
|
277
|
+
and
|
|
278
|
+
(
|
|
279
|
+
(mode = 1 and departure_boards_detailed."computed.arrival_datetime_real" between dateCanceledDepartureBetweenStart and dateCanceledDepartureBetweenEnd)
|
|
280
|
+
or (mode != 1 and departure_boards_detailed."computed.departure_datetime_real" between dateCanceledDepartureBetweenStart and dateCanceledDepartureBetweenEnd)
|
|
281
|
+
)
|
|
282
|
+
)
|
|
283
|
+
) and
|
|
284
|
+
(
|
|
285
|
+
(mode = 1 and (departure_boards_detailed."ropidgtfs_precomputed_departures.pickup_type" != '1' and departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" != departure_boards_detailed."ropidgtfs_precomputed_departures.max_stop_sequence")) -- mode default/departures
|
|
286
|
+
or (mode=2 and (departure_boards_detailed."ropidgtfs_precomputed_departures.drop_off_type" != '1' and departure_boards_detailed."ropidgtfs_precomputed_departures.stop_sequence" != departure_boards_detailed."ropidgtfs_precomputed_departures.min_stop_sequence")) -- mode arrivals
|
|
287
|
+
or (mode=3 and (departure_boards_detailed."ropidgtfs_precomputed_departures.pickup_type" != '1')) -- mode mixed
|
|
288
|
+
);
|
|
289
|
+
$$;
|
|
@@ -148,7 +148,7 @@ class DelayComputationManager {
|
|
|
148
148
|
return 0;
|
|
149
149
|
}
|
|
150
150
|
let bearing;
|
|
151
|
-
if (index > 1 && source[index - 1].this_stop_sequence) {
|
|
151
|
+
if (index > 1 && source[index - 1].this_stop_sequence && !source[index].this_stop_sequence) {
|
|
152
152
|
// Was the previous point at_stop? We'll ignore any bearing computation,
|
|
153
153
|
// it would point possibly to the after stop segment, usually behind a cross
|
|
154
154
|
// or after a curve. Thus we'll use the at_stop's incoming (prev point) bearing,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayComputationManager.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,wEAAqE;AACrE,yEAAsE;AACtE,2EAAoE;AACpE,mEAAuF;AACvF,6EAAwE;AACxE,iDAAmC;AAGnC,MAAa,uBAAuB;IAKhC,YAA6B,mBAAwC;QAAxC,wBAAmB,GAAnB,mBAAmB,CAAqB;QAJ7D,4BAAuB,GAAG,gBAAgB,CAAC;QAK/C,MAAM,YAAY,GAAG,gCAA0B,CAAC,OAAO,CAAgB,qBAAS,CAAC,YAAY,CAAC,CAAC;QAC/F,IAAI,CAAC,iBAAiB,GAAG,eAAM,CAAC,gBAAgB,CAAC,iBAAiB,CAAC;QACnE,IAAI,CAAC,yBAAyB,GAAG,MAAM,CACnC,YAAY,CAAC,QAAQ,CAAC,qEAAqE,EAAE,MAAM,CAAC,CACvG,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,oBAAoB,CAAC,MAAc;QAC5C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,2BAA2B,CAAC,MAAM,CAAC,CAAC;QACpF,IAAI,CAAC,QAAQ,EAAE;YACX,aAAG,CAAC,IAAI,CAAC,mCAAmC,MAAM,gBAAgB,CAAC,CAAC;YACpE,OAAO,IAAI,CAAC;SACf;QAED,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;QAClD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C,eAAe,GAAG,aAAa,CAAC,GAAG,eAAe,CAAC;YAChF,2EAA2E;YAC3E,6EAA6E;YAC7E,gFAAgF;YAChF,wEAAwE;YACxE,8EAA8E;YAC9E,sCAAsC;YACtC,8CAA8C;YAC9C,oDAAoD;YACpD,2CAA2C;YAC3C,mBAAmB;YACnB,IAAI;YACJ,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,GAAG,QAAQ,GAAG,cAAc,CAAC,CAAC;YACxE,mBAAmB,CAAC,IAAI,CAAC;gBACrB,QAAQ,EAAE,OAAO;gBACjB,aAAa,EAAE,KAAK;gBACpB,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC;gBACjD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACpE,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACpE,mBAAmB,EAAE,IAAI,CAAC,eAAe,CAAC,sBAAsB,GAAG,mBAAmB,EAAE,IAAI,CAAC;aAChG,CAAC,CAAC;SACN;QACD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEO,yBAAyB,CAAC,MAAgB;QAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACxB,OAAO;gBACH,IAAI,EAAE,KAAK,CAAC,mBAAmB;gBAC/B,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;aACnD,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApYD,0DAoYC"}
|
|
1
|
+
{"version":3,"file":"DelayComputationManager.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DelayComputationManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;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BACrB,QAAQ,EAAE,OAAO;gBACjB,aAAa,EAAE,KAAK;gBACpB,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,GAAG,CAAC;gBACjD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACpE,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACpE,mBAAmB,EAAE,IAAI,CAAC,eAAe,CAAC,sBAAsB,GAAG,mBAAmB,EAAE,IAAI,CAAC;aAChG,CAAC,CAAC;SACN;QACD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEO,yBAAyB,CAAC,MAAgB;QAC9C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACxB,OAAO;gBACH,IAAI,EAAE,KAAK,CAAC,mBAAmB;gBAC/B,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,YAAY,CAAC;aACnD,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AApYD,0DAoYC"}
|
|
@@ -45,6 +45,7 @@ export interface IPIDDeparture {
|
|
|
45
45
|
"trip.last_position.this_stop_sequence": number | null;
|
|
46
46
|
"trip.cis_stop_platform_code": string | null;
|
|
47
47
|
"trip.vehicle_descriptor.is_air_conditioned"?: boolean | null;
|
|
48
|
+
"trip.last_position.state_position"?: string | null;
|
|
48
49
|
planned_start_timestamp: string | null;
|
|
49
50
|
}
|
|
50
51
|
export interface ITransferAccessibility {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/pid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,4CAA0B;AAC1B,2CAAyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/output-gateway/pid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQA,4CAA0B;AAC1B,2CAAyB;AA8KzB,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,0CAAyB,CAAA;IACzB,sCAAqB,CAAA;IACrB,gCAAe,CAAA;AACnB,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,+BAAa,CAAA;IACb,yCAAuB,CAAA;AAC3B,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,eAQX;AARD,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,2CAAwB,CAAA;IACxB,0DAAuC,CAAA;IACvC,oDAAiC,CAAA;IACjC,mEAAgD,CAAA;IAChD,qEAAkD,CAAA;IAClD,8EAA2D,CAAA;AAC/D,CAAC,EARW,eAAe,+BAAf,eAAe,QAQ1B;AAED,IAAY,aAMX;AAND,WAAY,aAAa;IACrB,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;IACnB,sCAAqB,CAAA;IACrB,mCAAkB,CAAA;IAClB,8BAA8B;AAClC,CAAC,EANW,aAAa,6BAAb,aAAa,QAMxB"}
|
|
@@ -24,7 +24,12 @@ class SkipHelper {
|
|
|
24
24
|
return !!lastNumber && lastNumber === tripNumber;
|
|
25
25
|
}
|
|
26
26
|
static hasNoDelayInfo(departure) {
|
|
27
|
-
|
|
27
|
+
if (!("arrival_datetime" in departure)) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
const statePosition = departure["trip.last_position.state_position"];
|
|
31
|
+
const isFinished = statePosition === "after_track" || statePosition === "after_track_delayed";
|
|
32
|
+
return !departure.is_delay_available || isFinished;
|
|
28
33
|
}
|
|
29
34
|
/**
|
|
30
35
|
* Used exclusively in departure boards when skip[]=missing is requested (without untracked)
|
|
@@ -99,10 +104,12 @@ class SkipHelper {
|
|
|
99
104
|
if (!("arrival_datetime" in departure)) {
|
|
100
105
|
return false;
|
|
101
106
|
}
|
|
107
|
+
const statePosition = departure["trip.last_position.state_position"];
|
|
102
108
|
const isAtStop = departure.stop_sequence === departure["trip.last_position.this_stop_sequence"];
|
|
103
109
|
const isPassStop = !!departure["trip.last_position.last_stop_sequence"] &&
|
|
104
110
|
departure.stop_sequence <= departure["trip.last_position.last_stop_sequence"];
|
|
105
|
-
|
|
111
|
+
const isFinished = statePosition === "after_track" || statePosition === "after_track_delayed";
|
|
112
|
+
return isAtStop || isPassStop || isFinished;
|
|
106
113
|
}
|
|
107
114
|
static isOutsideStartThreshold(minutesToStart, routeType) {
|
|
108
115
|
const isMetro = routeType === RouteTypeEnums_1.GTFSRouteTypeEnum.METRO;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkipHelper.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/models/helpers/SkipHelper.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAG5D,2CAAwC;AACxC,mCAKiB;AAEjB;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAE1C,MAAa,UAAU;IACnB;;;OAGG;IACI,MAAM,CAAC,oBAAoB,CAAC,SAAyB,EAAE,UAAkB;QAC5E,MAAM,aAAa,GAAG,SAAS,CAAC,eAAe,CAAC;QAChD,IAAI,CAAC,aAAa,EAAE;YAChB,OAAO,KAAK,CAAC;SAChB;QAED,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO,CAAC,CAAC,UAAU,IAAI,UAAU,KAAK,UAAU,CAAC;IACrD,CAAC;IAEM,MAAM,CAAC,cAAc,CAAC,SAAyB;QAClD,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"SkipHelper.js","sourceRoot":"","sources":["../../../../../src/output-gateway/pid/models/helpers/SkipHelper.ts"],"names":[],"mappings":";;;AAAA,uEAA4D;AAG5D,2CAAwC;AACxC,mCAKiB;AAE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