@golemio/pid 4.1.6-dev.2111220952 → 4.1.6-dev.2111649397
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/ropid-gtfs/data-access/precomputed/DeparturesRepository.js +1 -0
- package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map +1 -1
- package/dist/integration-engine/ropid-gtfs/interfaces/IPublicDepartureDto.d.ts +1 -0
- package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js +1 -1
- package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.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
|
+
$$;
|
package/dist/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeparturesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uEAA4D;AAG5D,gEAAuC;AACvC,8FAAqE;AAErE,wEAAqE;AAErE,yEAAqF;AACrF,6EAAwE;AACxE,mFAAkF;AAClF,mEAAiF;AACjF,iEAAwE;AACxE,+EAA4E;AAGrE,IAAM,oBAAoB,kCAA1B,MAAM,oBAAqB,SAAQ,sBAAa;IACnD,YACoC,MAA6B,EACnC,MAAuB;QAEjD,KAAK,CACD,sBAAsB,EACtB;YACI,WAAW,EAAE,6BAAe,CAAC,UAAU;YACvC,QAAQ,EAAE,iBAAS;YACnB,yBAAyB,EAAE,6BAAe,CAAC,cAAc;YACzD,kBAAkB,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,YAAY,CAAC;YACtD,UAAU,EAAE,YAAY;SAC3B,EACD,IAAI,uCAAmB,CAAC,sBAAsB,EAAE,6BAAe,CAAC,UAAU,CAAC,CAC9E,CAAC;QAbsC,WAAM,GAAN,MAAM,CAAe;QAC3B,WAAM,GAAN,MAAM,CAAS;QAe9C,sBAAiB,GAAG,KAAK,EAAE,iBAAwC,EAAiB,EAAE;YACzF,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;YACpE,MAAM,qBAAqB,GACvB,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,4EAA4E,CAAC,CAAC,CAAC,EAAE,CAAC;YAE3G,4BAA4B;YAC5B,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAiCmB,iBAAiB;2CACb,iBAAi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YACpE,IAAI;gBACA,MAAM,SAAS,GAAG,6BAAe,CAAC,UAAU,CAAC;gBAC7C,MAAM,YAAY,GAAG,SAAS,GAAG,6CAAqB,CAAC,GAAG,CAAC;gBAC3D,MAAM,aAAa,GAAG,SAAS,GAAG,6CAAqB,CAAC,IAAI,CAAC;gBAE7D,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CACtC;2CAC2B,iBAAS;uBAC7B,SAAS;8BACF,SAAS,cAAc,aAAa;8BACpC,YAAY,cAAc,SAAS;6BACpC,aAAa,WAAW,EACrC,EAAE,WAAW,EAAE,CAClB,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACvB,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAC;QAEK,YAAO,GAAG,KAAK,IAAmB,EAAE;YACvC,IAAI;gBACA,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CACtC,WAAW,iBAAS,IAAI,6BAAe,CAAC,UAAU,GAAG,6CAAqB,CAAC,GAAG,GAAG,CACpF,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACvB,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"DeparturesRepository.js","sourceRoot":"","sources":["../../../../../src/integration-engine/ropid-gtfs/data-access/precomputed/DeparturesRepository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uEAA4D;AAG5D,gEAAuC;AACvC,8FAAqE;AAErE,wEAAqE;AAErE,yEAAqF;AACrF,6EAAwE;AACxE,mFAAkF;AAClF,mEAAiF;AACjF,iEAAwE;AACxE,+EAA4E;AAGrE,IAAM,oBAAoB,kCAA1B,MAAM,oBAAqB,SAAQ,sBAAa;IACnD,YACoC,MAA6B,EACnC,MAAuB;QAEj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AAC;aACb;QACL,CAAC,CAAC;QAEK,YAAO,GAAG,KAAK,IAAmB,EAAE;YACvC,IAAI;gBACA,MAAM,IAAI,CAAC,cAAc,CAAC,SAAU,CAAC,KAAK,CACtC,WAAW,iBAAS,IAAI,6BAAe,CAAC,UAAU,GAAG,6CAAqB,CAAC,GAAG,GAAG,CACpF,CAAC;aACL;YAAC,OAAO,GAAG,EAAE;gBACV,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACvB,MAAM,GAAG,CAAC;aACb;QACL,CAAC,CAAC;IA1KF,CAAC;CA2KJ,CAAA;+BA3LY,oBAAoB;IADhC,IAAA,qBAAU,GAAE;IAGJ,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,YAAY,CAAC,CAAA;IAC9B,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GAHpB,oBAAoB,CA2LhC"}
|
package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js
CHANGED
|
@@ -23,7 +23,7 @@ let PublicDepartureCacheTransformation = exports.PublicDepartureCacheTransformat
|
|
|
23
23
|
trip_id: inputDto.trip_id,
|
|
24
24
|
stop_sequence: inputDto.stop_sequence,
|
|
25
25
|
platform_code: inputDto.platform_code,
|
|
26
|
-
trip_headsign: inputDto.trip_headsign,
|
|
26
|
+
trip_headsign: inputDto.stop_headsign ?? inputDto.trip_headsign,
|
|
27
27
|
};
|
|
28
28
|
return outputDto;
|
|
29
29
|
};
|
package/dist/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PublicDepartureCacheTransformation.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6GAA0G;AAC1G,iEAAgE;AAIzD,IAAM,kCAAkC,gDAAxC,MAAM,kCAAmC,SAAQ,+CAGvD;IAHM;;QAII,SAAI,GAAG,oCAAoC,CAAC;QAEzC,sBAAiB,GAAG,CAAC,QAA6B,EAAE,EAAE;YAC5D,MAAM,SAAS,GAAiC;gBAC5C,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,WAAW,EAAE;gBAC7D,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,EAAE,WAAW,EAAE,IAAI,IAAI;gBAClE,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;gBAC3C,UAAU,EAAE,QAAQ,CAAC,UAAU;gBAC/B,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,aAAa,EAAE,QAAQ,CAAC,aAAa;gBACrC,aAAa,EAAE,QAAQ,CAAC,aAAa;gBACrC,aAAa,EAAE,QAAQ,CAAC,aAAa;
|
|
1
|
+
{"version":3,"file":"PublicDepartureCacheTransformation.js","sourceRoot":"","sources":["../../../../src/integration-engine/ropid-gtfs/transformations/PublicDepartureCacheTransformation.ts"],"names":[],"mappings":";;;;;;;;;AACA,6GAA0G;AAC1G,iEAAgE;AAIzD,IAAM,kCAAkC,gDAAxC,MAAM,kCAAmC,SAAQ,+CAGvD;IAHM;;QAII,SAAI,GAAG,oCAAoC,CAAC;QAEzC,sBAAiB,GAAG,CAAC,QAA6B,EAAE,EAAE;YAC5D,MAAM,SAAS,GAAiC;gBAC5C,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB,CAAC,WAAW,EAAE;gBAC7D,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,EAAE,WAAW,EAAE,IAAI,IAAI;gBAClE,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB;gBAC3C,UAAU,EAAE,QAAQ,CAAC,UAAU;gBAC/B,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,aAAa,EAAE,QAAQ,CAAC,aAAa;gBACrC,aAAa,EAAE,QAAQ,CAAC,aAAa;gBACrC,aAAa,EAAE,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,aAAa;aAClE,CAAC;YAEF,OAAO,SAAS,CAAC;QACrB,CAAC,CAAC;IACN,CAAC;CAAA,CAAA;6CArBY,kCAAkC;IAD9C,IAAA,qBAAU,GAAE;GACA,kCAAkC,CAqB9C"}
|
|
@@ -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;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,IAAI,CAAC,CAAC,kBAAkB,IAAI,SAAS,CAAC,EAAE;YAC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