@golemio/pid 2.9.4-dev.1030101988 → 2.9.4-dev.1032936652
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/example/02_pid_line_example_115.sql +5 -5
- package/db/example/03_ropidgtfs_dump.sql +5 -5
- package/db/example/05_vehicle_positions_dump.sql +22 -22
- package/db/example/08_update_delay_dump.sql +100 -100
- package/db/example/10_cancelledTrip_example.sql +2 -2
- package/db/example/12_metro_line_A_gtfs_trips.sql +9 -9
- package/db/example/13_http-propagate-delay.sql +15 -15
- package/db/example/14_nightDelays.sql +2 -2
- package/db/migrations/postgresql/20231009141316-positions-tracked.js +53 -0
- package/db/migrations/postgresql/sqls/20231009141316-positions-tracked-down.sql +191 -0
- package/db/migrations/postgresql/sqls/20231009141316-positions-tracked-up.sql +191 -0
- package/dist/const.d.ts +0 -4
- package/dist/const.js +1 -6
- package/dist/const.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsRepository.js +3 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/PositionsRepository.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/PositionsMapper.js +14 -8
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/data-access/helpers/PositionsMapper.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js +4 -5
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.d.ts +0 -4
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +27 -36
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.d.ts +2 -3
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.js +3 -4
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/VPUtils.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/CommonDelayAtStop.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/CommonDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/MetroDelayAtStop.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/MetroDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +33 -22
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/strategy/BusDelayAtStop.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/strategy/BusDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/interfaces/TransformationInterfaces.d.ts +11 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/interfaces/VPInterfaces.d.ts +1 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateDelayTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.js +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/UpdateGtfsTripIdTask.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PositionsTransformation.d.ts +1 -12
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PositionsTransformation.js +6 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/transformations/PositionsTransformation.js.map +1 -1
- package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.js +1 -2
- package/dist/output-gateway/vehicle-positions/data-access/helpers/PositionOutputMapper.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/PositionDto.d.ts +2 -2
- package/dist/schema-definitions/vehicle-positions/models/PositionDto.js +2 -2
- package/dist/schema-definitions/vehicle-positions/models/PositionDto.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IPositionDto.d.ts +2 -2
- package/dist/schema-definitions/vehicle-positions/models/interfaces/IVPTripsPositionAttributes.d.ts +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/TripWithLastPositionModel.d.ts +2 -2
- package/dist/schema-definitions/vehicle-positions/models/views/TripWithLastPositionModel.js +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/TripWithLastPositionModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/views/interfaces/ITripWithLastPositionDto.d.ts +2 -2
- package/package.json +1 -1
|
@@ -153,12 +153,12 @@ VALUES
|
|
|
153
153
|
WITH init_values AS (SELECT NOW()::DATE AS now_date)
|
|
154
154
|
INSERT INTO "vehiclepositions_trips" ("cis_line_id","cis_trip_number","run_number","internal_run_number","cis_line_short_name","created_at","gtfs_route_id","gtfs_route_short_name","gtfs_trip_id","id","updated_at","start_cis_stop_id","start_cis_stop_platform_code","start_time","start_timestamp","vehicle_type_id","wheelchair_accessible","create_batch_id","created_by","update_batch_id","updated_by","agency_name_scheduled","origin_route_name","internal_route_name","agency_name_real","vehicle_registration_number","gtfs_trip_headsign","start_asw_stop_id","gtfs_route_type","gtfs_block_id","last_position_id","is_canceled","end_timestamp","gtfs_trip_short_name","last_position_context")
|
|
155
155
|
VALUES
|
|
156
|
-
--(E'100212',1044,2,E'212',E'2022-12-23 11:54:16.664+01',E'L212',E'212',E'212_365_221211',E'2022-12-23T11:24:00Z_100212_212_1044',E'2022-12-23 13:01:17.635+01',58701,E'A',E'12:24:00',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '12:24:00')*1000,3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212',E'STENBUS',1712,E'Nádraží Klánovice-sever',NULL,3,NULL,1564165759,FALSE,1671795000000,NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671795011000,"firstPositionDelay":11},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564165759","lastPositionOriginTimestamp":1671796852000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":196,"delay":36,"id":"1563938739","lat":50.08797,"lng":14.66552,"origin_time":"12:30:36","origin_timestamp":1671795036000,"shape_dist_traveled":2.408,"
|
|
157
|
-
--(E'100212',1043,2,E'212',E'2022-12-23 12:01:12.172+01',E'L212',E'212',E'212_366_221211',E'2022-12-23T11:31:00Z_100212_212_1043',E'2022-12-23 13:07:38.147+01',27935,E'C',E'12:31:00',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '12:31:00')*1000,3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212',E'STENBUS',1712,E'Nepasické náměstí',NULL,3,NULL,1564213175,FALSE,1671795360000,NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671795477000,"firstPositionDelay":117},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564213175","lastPositionOriginTimestamp":1671797202000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":38,"delay":117,"id":"1563990184","lat":50.1036,"lng":14.6586,"origin_time":"12:37:57","origin_timestamp":1671795477000,"shape_dist_traveled":2.491,"
|
|
158
|
-
--(E'100212',1046,2,E'212',E'2022-12-23 12:24:16.404+01',E'L212',E'212',E'212_367_221211',E'2022-12-23T11:54:00Z_100212_212_1046',E'2022-12-23 13:30:11.782+01',58701,E'A',E'12:54:00',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '12:54:00')*1000,3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212',E'STENBUS',1712,E'Nádraží Klánovice-sever',NULL,3,NULL,1564383076,FALSE,1671796800000,NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671796785000,"firstPositionDelay":-15},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564383076","lastPositionOriginTimestamp":1671798580000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":196,"delay":-15,"id":"1564155786","lat":50.08828,"lng":14.66574,"origin_time":"12:59:45","origin_timestamp":1671796785000,"shape_dist_traveled":2.408,"
|
|
159
|
-
--(E'100212',1045,2,E'212',E'2022-12-23 12:31:20.392+01',E'L212',E'212',E'212_368_221211',E'2022-12-23T12:01:00Z_100212_212_1045',E'2022-12-23 13:36:04.603+01',27935,E'C',E'13:01:00',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '13:01:00')*1000,3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212',E'STENBUS',1712,E'Nepasické náměstí',NULL,3,NULL,1564424455,FALSE,1671797160000,NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671797087000,"firstPositionDelay":-13},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564424455","lastPositionOriginTimestamp":1671798943000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":359,"delay":-7,"id":"1564202112","lat":50.10244,"lng":14.65803,"origin_time":"13:05:33","origin_timestamp":1671797133000,"shape_dist_traveled":2.289,"
|
|
160
|
-
(E'100212',1044,2,2,E'212',E'2022-12-23 11:54:16.664+01',E'L212',E'212',E'212_365_221211',E'2022-12-23T11:24:00Z_100212_212_1044',E'2022-12-23 13:01:17.635+01',58701,E'A',E'12:24:00',((SELECT now_date FROM init_values) + INTERVAL '12:24:00') at time zone 'Europe/Prague',3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212','212',E'STENBUS',1712,E'Nádraží Klánovice-sever',NULL,3,NULL,1564165759,FALSE,((SELECT now_date FROM init_values) + INTERVAL '12:30:00' ) at time zone 'Europe/Prague',NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671795011000,"firstPositionDelay":11},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564165759","lastPositionOriginTimestamp":1671796852000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":196,"delay":36,"id":"1563938739","lat":50.08797,"lng":14.66552,"origin_time":"12:30:36","origin_timestamp":1671795036000,"shape_dist_traveled":2.408,"
|
|
161
|
-
(E'100212',1043,2,2,E'212',E'2022-12-23 12:01:12.172+01',E'L212',E'212',E'212_366_221211',E'2022-12-23T11:31:00Z_100212_212_1043',E'2022-12-23 13:07:38.147+01',27935,E'C',E'12:31:00',((SELECT now_date FROM init_values) + INTERVAL '12:31:00') at time zone 'Europe/Prague',3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212','212',E'STENBUS',1712,E'Nepasické náměstí',NULL,3,NULL,1564213175,FALSE,((SELECT now_date FROM init_values) + INTERVAL '12:36:00') at time zone 'Europe/Prague',NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671795477000,"firstPositionDelay":117},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564213175","lastPositionOriginTimestamp":1671797202000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":38,"delay":117,"id":"1563990184","lat":50.1036,"lng":14.6586,"origin_time":"12:37:57","origin_timestamp":1671795477000,"shape_dist_traveled":2.491,"
|
|
156
|
+
--(E'100212',1044,2,E'212',E'2022-12-23 11:54:16.664+01',E'L212',E'212',E'212_365_221211',E'2022-12-23T11:24:00Z_100212_212_1044',E'2022-12-23 13:01:17.635+01',58701,E'A',E'12:24:00',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '12:24:00')*1000,3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212',E'STENBUS',1712,E'Nádraží Klánovice-sever',NULL,3,NULL,1564165759,FALSE,1671795000000,NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671795011000,"firstPositionDelay":11},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564165759","lastPositionOriginTimestamp":1671796852000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":196,"delay":36,"id":"1563938739","lat":50.08797,"lng":14.66552,"origin_time":"12:30:36","origin_timestamp":1671795036000,"shape_dist_traveled":2.408,"is_tracked":true,"is_canceled":false,"state_position":"at_stop","state_process":"processed","tcp_event":null,"this_stop_sequence":7,"last_stop_sequence":7,"last_stop_id":"U454Z4P","last_stop_arrival_time":1671795000000,"last_stop_departure_time":1671795000000,"next_stop_id":"U454Z4P","next_stop_name":"Nádraží Klánovice-sever","last_stop_name":"Nádraží Klánovice-sever","next_stop_sequence":7,"next_stop_arrival_time":1671795000000,"next_stop_departure_time":1671795000000,"this_stop_id":"U454Z4P","this_stop_name":"Nádraží Klánovice-sever","valid_to":1671795336000},"geometry":{"type":"Point","coordinates":[14.66552,50.08797]}},"lastPositionCanceled":false,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":true,"tripId":"2022-12-23T11:24:00Z_100212_212_1044"}'),
|
|
157
|
+
--(E'100212',1043,2,E'212',E'2022-12-23 12:01:12.172+01',E'L212',E'212',E'212_366_221211',E'2022-12-23T11:31:00Z_100212_212_1043',E'2022-12-23 13:07:38.147+01',27935,E'C',E'12:31:00',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '12:31:00')*1000,3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212',E'STENBUS',1712,E'Nepasické náměstí',NULL,3,NULL,1564213175,FALSE,1671795360000,NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671795477000,"firstPositionDelay":117},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564213175","lastPositionOriginTimestamp":1671797202000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":38,"delay":117,"id":"1563990184","lat":50.1036,"lng":14.6586,"origin_time":"12:37:57","origin_timestamp":1671795477000,"shape_dist_traveled":2.491,"is_tracked":true,"is_canceled":false,"state_position":"at_stop","state_process":"processed","tcp_event":null,"this_stop_sequence":6,"last_stop_sequence":6,"last_stop_id":"U4107Z1P","last_stop_arrival_time":1671795360000,"last_stop_departure_time":1671795360000,"next_stop_id":"U4107Z1P","next_stop_name":"Nepasické náměstí","last_stop_name":"Nepasické náměstí","next_stop_sequence":6,"next_stop_arrival_time":1671795360000,"next_stop_departure_time":1671795360000,"this_stop_id":"U4107Z1P","this_stop_name":"Nepasické náměstí","valid_to":1671795777000},"geometry":{"type":"Point","coordinates":[14.6586,50.1036]}},"lastPositionCanceled":false,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":false,"tripId":"2022-12-23T11:31:00Z_100212_212_1043"}'),
|
|
158
|
+
--(E'100212',1046,2,E'212',E'2022-12-23 12:24:16.404+01',E'L212',E'212',E'212_367_221211',E'2022-12-23T11:54:00Z_100212_212_1046',E'2022-12-23 13:30:11.782+01',58701,E'A',E'12:54:00',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '12:54:00')*1000,3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212',E'STENBUS',1712,E'Nádraží Klánovice-sever',NULL,3,NULL,1564383076,FALSE,1671796800000,NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671796785000,"firstPositionDelay":-15},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564383076","lastPositionOriginTimestamp":1671798580000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":196,"delay":-15,"id":"1564155786","lat":50.08828,"lng":14.66574,"origin_time":"12:59:45","origin_timestamp":1671796785000,"shape_dist_traveled":2.408,"is_tracked":true,"is_canceled":false,"state_position":"at_stop","state_process":"processed","tcp_event":null,"this_stop_sequence":7,"last_stop_sequence":7,"last_stop_id":"U454Z4P","last_stop_arrival_time":1671796800000,"last_stop_departure_time":1671796800000,"next_stop_id":"U454Z4P","next_stop_name":"Nádraží Klánovice-sever","last_stop_name":"Nádraží Klánovice-sever","next_stop_sequence":7,"next_stop_arrival_time":1671796800000,"next_stop_departure_time":1671796800000,"this_stop_id":"U454Z4P","this_stop_name":"Nádraží Klánovice-sever","valid_to":1671797085000},"geometry":{"type":"Point","coordinates":[14.66574,50.08828]}},"lastPositionCanceled":false,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":true,"tripId":"2022-12-23T11:54:00Z_100212_212_1046"}'),
|
|
159
|
+
--(E'100212',1045,2,E'212',E'2022-12-23 12:31:20.392+01',E'L212',E'212',E'212_368_221211',E'2022-12-23T12:01:00Z_100212_212_1045',E'2022-12-23 13:36:04.603+01',27935,E'C',E'13:01:00',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '13:01:00')*1000,3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212',E'STENBUS',1712,E'Nepasické náměstí',NULL,3,NULL,1564424455,FALSE,1671797160000,NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671797087000,"firstPositionDelay":-13},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564424455","lastPositionOriginTimestamp":1671798943000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":359,"delay":-7,"id":"1564202112","lat":50.10244,"lng":14.65803,"origin_time":"13:05:33","origin_timestamp":1671797133000,"shape_dist_traveled":2.289,"is_tracked":true,"is_canceled":false,"state_position":"on_track","state_process":"processed","tcp_event":null,"last_stop_sequence":5,"last_stop_id":"U4137Z1P","last_stop_arrival_time":1671797100000,"last_stop_departure_time":1671797100000,"next_stop_id":"U4107Z1P","next_stop_name":"Nepasické náměstí","last_stop_name":"Všestarská","next_stop_sequence":6,"next_stop_arrival_time":1671797160000,"next_stop_departure_time":1671797160000,"valid_to":1671797433000},"geometry":{"type":"Point","coordinates":[14.65803,50.10244]}},"lastPositionCanceled":false,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":true,"tripId":"2022-12-23T12:01:00Z_100212_212_1045"}');
|
|
160
|
+
(E'100212',1044,2,2,E'212',E'2022-12-23 11:54:16.664+01',E'L212',E'212',E'212_365_221211',E'2022-12-23T11:24:00Z_100212_212_1044',E'2022-12-23 13:01:17.635+01',58701,E'A',E'12:24:00',((SELECT now_date FROM init_values) + INTERVAL '12:24:00') at time zone 'Europe/Prague',3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212','212',E'STENBUS',1712,E'Nádraží Klánovice-sever',NULL,3,NULL,1564165759,FALSE,((SELECT now_date FROM init_values) + INTERVAL '12:30:00' ) at time zone 'Europe/Prague',NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671795011000,"firstPositionDelay":11},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564165759","lastPositionOriginTimestamp":1671796852000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":196,"delay":36,"id":"1563938739","lat":50.08797,"lng":14.66552,"origin_time":"12:30:36","origin_timestamp":1671795036000,"shape_dist_traveled":2.408,"is_tracked":false,"is_canceled":false,"state_position":"after_track","state_process":"processed","tcp_event":null,"this_stop_sequence":7,"last_stop_sequence":7,"last_stop_id":"U454Z4P","last_stop_arrival_time":1671795000000,"last_stop_departure_time":1671795000000,"next_stop_id":"U454Z4P","next_stop_name":"Nádraží Klánovice-sever","last_stop_name":"Nádraží Klánovice-sever","next_stop_sequence":7,"next_stop_arrival_time":1671795000000,"next_stop_departure_time":1671795000000,"this_stop_id":"U454Z4P","this_stop_name":"Nádraží Klánovice-sever","valid_to":1671795336000},"geometry":{"type":"Point","coordinates":[14.66552,50.08797]}},"lastPositionCanceled":false,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":true,"tripId":"2022-12-23T11:24:00Z_100212_212_1044"}'),
|
|
161
|
+
(E'100212',1043,2,2,E'212',E'2022-12-23 12:01:12.172+01',E'L212',E'212',E'212_366_221211',E'2022-12-23T11:31:00Z_100212_212_1043',E'2022-12-23 13:07:38.147+01',27935,E'C',E'12:31:00',((SELECT now_date FROM init_values) + INTERVAL '12:31:00') at time zone 'Europe/Prague',3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212','212',E'STENBUS',1712,E'Nepasické náměstí',NULL,3,NULL,1564213175,FALSE,((SELECT now_date FROM init_values) + INTERVAL '12:36:00') at time zone 'Europe/Prague',NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671795477000,"firstPositionDelay":117},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564213175","lastPositionOriginTimestamp":1671797202000,"lastPositionTracking":{"type":"Feature","properties":{"bearing":38,"delay":117,"id":"1563990184","lat":50.1036,"lng":14.6586,"origin_time":"12:37:57","origin_timestamp":1671795477000,"shape_dist_traveled":2.491,"is_tracked":false,"is_canceled":false,"state_position":"after_track","state_process":"processed","tcp_event":null,"this_stop_sequence":6,"last_stop_sequence":6,"last_stop_id":"U4107Z1P","last_stop_arrival_time":1671795360000,"last_stop_departure_time":1671795360000,"next_stop_id":"U4107Z1P","next_stop_name":"Nepasické náměstí","last_stop_name":"Nepasické náměstí","next_stop_sequence":6,"next_stop_arrival_time":1671795360000,"next_stop_departure_time":1671795360000,"this_stop_id":"U4107Z1P","this_stop_name":"Nepasické náměstí","valid_to":1671795777000},"geometry":{"type":"Point","coordinates":[14.6586,50.1036]}},"lastPositionCanceled":false,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":false,"tripId":"2022-12-23T11:31:00Z_100212_212_1043"}'),
|
|
162
162
|
(E'100212',1046,2,2,E'212',E'2022-12-23 12:24:16.404+01',E'L212',E'212',E'212_367_221211',E'2022-12-23T11:54:00Z_100212_212_1046',E'2022-12-23 13:30:11.782+01',58701,E'A',E'12:54:00',((SELECT now_date FROM init_values) + INTERVAL '12:54:00') at time zone 'Europe/Prague',3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212','212',E'STENBUS',1712,E'Nádraží Klánovice-sever',NULL,3,NULL,1564383076,FALSE,((SELECT now_date FROM init_values) + INTERVAL '13:00:00') at time zone 'Europe/Prague',NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671796785000,"firstPositionDelay":-15},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564383076","lastPositionOriginTimestamp":1671798580000,"lastPositionTracking":null,"lastPositionCanceled":false,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":true,"tripId":"2022-12-23T11:54:00Z_100212_212_1046"}'),
|
|
163
163
|
(E'100212',1045,2,2,E'212',E'2022-12-23 12:31:20.392+01',E'L212',E'212',E'212_368_221211',E'2022-12-23T12:01:00Z_100212_212_1045',E'2022-12-23 13:36:04.603+01',27935,E'C',E'13:01:00',((SELECT now_date FROM init_values) + INTERVAL '13:01:00') at time zone 'Europe/Prague',3,TRUE,NULL,NULL,NULL,NULL,E'STENBUS',E'212','212',E'STENBUS',1712,E'Nepasické náměstí',NULL,3,NULL,1564424455,FALSE,((SELECT now_date FROM init_values) + INTERVAL '13:06:00') at time zone 'Europe/Prague',NULL,E'{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":1671797087000,"firstPositionDelay":-13},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionId":"1564424455","lastPositionOriginTimestamp":1671798943000,"lastPositionTracking":null,"lastPositionCanceled":false,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":true,"tripId":"2022-12-23T12:01:00Z_100212_212_1045"}');
|
|
164
164
|
|
|
@@ -170,7 +170,7 @@ VALUES
|
|
|
170
170
|
-- positions
|
|
171
171
|
|
|
172
172
|
WITH init_values AS (SELECT NOW()::DATE AS now_date)
|
|
173
|
-
INSERT INTO "vehiclepositions_positions"("created_at","delay","delay_stop_arrival","delay_stop_departure","next_stop_id","shape_dist_traveled","is_canceled","lat","lng","origin_time","origin_timestamp","
|
|
173
|
+
INSERT INTO "vehiclepositions_positions"("created_at","delay","delay_stop_arrival","delay_stop_departure","next_stop_id","shape_dist_traveled","is_canceled","lat","lng","origin_time","origin_timestamp","is_tracked","trips_id","create_batch_id","created_by","update_batch_id","updated_at","updated_by","id","bearing","cis_last_stop_id","cis_last_stop_sequence","last_stop_id","last_stop_sequence","next_stop_sequence","speed","last_stop_arrival_time","last_stop_departure_time","next_stop_arrival_time","next_stop_departure_time","asw_last_stop_id","state_process","state_position","this_stop_id","this_stop_sequence","tcp_event","last_stop_headsign","last_stop_name","next_stop_name","this_stop_name","valid_to")
|
|
174
174
|
VALUES
|
|
175
175
|
--(E'2022-12-23 12:34:19.655+01',NULL,9,NULL,NULL,2.408,FALSE,50.09074,14.6669,E'12:33:47',EXTRACT(EPOCH FROM ((SELECT now_date FROM init_values) + INTERVAL '12:33:47') at time zone 'Europe/Prague')*1000,0,E'2022-12-23T11:24:00Z_100212_212_1044',NULL,NULL,NULL,E'2022-12-23 12:34:20.694+01',NULL,1563962101,16,27935,7,E'U454Z4P',7,NULL,26,1671795000000,1671795000000,NULL,NULL,NULL,E'processed',E'after_track',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1671795527000),
|
|
176
176
|
--(E'2022-12-23 12:34:36.599+01',NULL,9,NULL,NULL,2.408,FALSE,50.09074,14.6669,E'12:33:47',EXTRACT(EPOCH FROM ((SELECT now_date FROM init_values) + INTERVAL '12:33:47') at time zone 'Europe/Prague')*1000,0,E'2022-12-23T11:24:00Z_100212_212_1044',NULL,NULL,NULL,E'2022-12-23 12:34:37.46+01',NULL,1563964089,16,27935,7,E'U454Z4P',7,NULL,26,1671795000000,1671795000000,NULL,NULL,NULL,E'processed',E'duplicate',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1671795527000),
|
|
@@ -208,11 +208,11 @@ VALUES
|
|
|
208
208
|
--(E'2022-12-23 12:36:24.164+01',NULL,NULL,NULL,E'U4107Z1P',0,FALSE,50.09938,14.66568,E'12:36:02',EXTRACT(EPOCH FROM ((SELECT now_date FROM init_values) + INTERVAL '12:36:02') at time zone 'Europe/Prague')*1000,0,E'2022-12-23T11:54:00Z_100212_212_1046',NULL,NULL,NULL,E'2022-12-23 12:36:25.072+01',NULL,1563977160,297,NULL,NULL,NULL,NULL,1,29,NULL,NULL,1671796440000,1671796440000,NULL,E'processed',E'before_track',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1671795662000),
|
|
209
209
|
--(E'2022-12-23 12:36:41.462+01',NULL,NULL,NULL,E'U454Z3P',0,FALSE,50.09938,14.66568,E'12:36:02',EXTRACT(EPOCH FROM ((SELECT now_date FROM init_values) + INTERVAL '12:36:02') at time zone 'Europe/Prague')*1000,0,E'2022-12-23T12:01:00Z_100212_212_1045',NULL,NULL,NULL,E'2022-12-23 12:36:42.641+01',NULL,1563979131,297,NULL,NULL,NULL,NULL,1,29,NULL,NULL,1671796860000,1671796860000,NULL,E'processed',E'before_track',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1671795662000),
|
|
210
210
|
--(E'2022-12-23 12:36:24.164+01',NULL,NULL,NULL,E'U454Z3P',0,FALSE,50.09938,14.66568,E'12:36:02',EXTRACT(EPOCH FROM ((SELECT now_date FROM init_values) + INTERVAL '12:36:02') at time zone 'Europe/Prague')*1000,0,E'2022-12-23T12:01:00Z_100212_212_1045',NULL,NULL,NULL,E'2022-12-23 12:36:25.076+01',NULL,1563977159,297,NULL,NULL,NULL,NULL,1,29,NULL,NULL,1671796860000,1671796860000,NULL,E'processed',E'before_track',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1671795662000),
|
|
211
|
-
(E'2022-12-23 12:36:58.062+01',NULL,9,NULL,NULL,2.408,FALSE,50.10024,14.66322,E'12:36:27',((SELECT now_date FROM init_values) + INTERVAL '12:36:27') at time zone 'Europe/Prague',
|
|
212
|
-
(E'2022-12-23 12:36:58.062+01',87,NULL,87,E'U4107Z1P',1.887,FALSE,50.10024,14.66322,E'12:36:27',((SELECT now_date FROM init_values) + INTERVAL '12:36:27') at time zone 'Europe/Prague',
|
|
213
|
-
(E'2022-12-23 12:36:58.062+01',NULL,NULL,NULL,E'U4107Z1P',0,FALSE,50.10024,14.66322,E'12:36:27',((SELECT now_date FROM init_values) + INTERVAL '12:36:27') at time zone 'Europe/Prague',
|
|
214
|
-
(E'2022-12-23 12:36:58.062+01',NULL,NULL,NULL,E'U454Z3P',0,FALSE,50.10024,14.66322,E'12:36:27',((SELECT now_date FROM init_values) + INTERVAL '12:36:27') at time zone 'Europe/Prague',
|
|
215
|
-
(E'2022-12-23 12:36:58.063+01',NULL,9,NULL,NULL,2.408,FALSE,50.10024,14.66322,E'12:56:28',((SELECT now_date FROM init_values) + INTERVAL '12:56:28') at time zone 'Europe/Prague',
|
|
216
|
-
(E'2022-12-23 12:36:58.063+01',87,NULL,87,E'U4107Z1P',1.887,FALSE,50.10024,14.66322,E'12:56:28',((SELECT now_date FROM init_values) + INTERVAL '12:56:28') at time zone 'Europe/Prague',
|
|
217
|
-
(E'2022-12-23 12:36:58.063+01',NULL,NULL,NULL,E'U4107Z1P',0,FALSE,50.10024,14.66322,E'12:56:28',((SELECT now_date FROM init_values) + INTERVAL '12:56:28') at time zone 'Europe/Prague',
|
|
218
|
-
(E'2022-12-23 12:36:58.063+01',NULL,NULL,NULL,E'U454Z3P',0,FALSE,50.10024,14.66322,E'12:56:28',((SELECT now_date FROM init_values) + INTERVAL '12:56:28') at time zone 'Europe/Prague',
|
|
211
|
+
(E'2022-12-23 12:36:58.062+01',NULL,9,NULL,NULL,2.408,FALSE,50.10024,14.66322,E'12:36:27',((SELECT now_date FROM init_values) + INTERVAL '12:36:27') at time zone 'Europe/Prague',false,E'2022-12-23T11:24:00Z_100212_212_1044',NULL,NULL,NULL,E'2022-12-23 12:36:59.26+01',NULL,1563981366,297,27935,7,E'U454Z4P',7,NULL,28,'2022-12-23T11:30:00.000Z','2022-12-23T11:30:00.000Z',NULL,NULL,NULL,E'processed',E'after_track',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2022-12-23T11:41:27.000Z'),
|
|
212
|
+
(E'2022-12-23 12:36:58.062+01',87,NULL,87,E'U4107Z1P',1.887,FALSE,50.10024,14.66322,E'12:36:27',((SELECT now_date FROM init_values) + INTERVAL '12:36:27') at time zone 'Europe/Prague',true,E'2022-12-23T11:31:00Z_100212_212_1043',NULL,NULL,NULL,E'2022-12-23 12:36:59.261+01',NULL,1563981365,270,59545,5,E'U4137Z1P',5,6,28,'2022-12-23T11:35:00.000Z','2022-12-23T11:35:00.000Z','2022-12-23T11:36:00.000Z','2022-12-23T11:36:00.000Z',NULL,E'processed',E'at_stop',E'U4137Z1P',5,NULL,NULL,E'Všestarská',NULL,NULL,'2022-12-23T11:41:27.000Z'),
|
|
213
|
+
(E'2022-12-23 12:36:58.062+01',NULL,NULL,NULL,E'U4107Z1P',0,FALSE,50.10024,14.66322,E'12:36:27',((SELECT now_date FROM init_values) + INTERVAL '12:36:27') at time zone 'Europe/Prague',false,E'2022-12-23T11:54:00Z_100212_212_1046',NULL,NULL,NULL,E'2022-12-23 12:36:59.264+01',NULL,1563981368,297,NULL,NULL,NULL,NULL,1,28,NULL,NULL,'2022-12-23T11:54:00.000Z','2022-12-23T11:54:00.000Z',NULL,E'processed',E'before_track',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2022-12-23T11:41:27.000Z'),
|
|
214
|
+
(E'2022-12-23 12:36:58.062+01',NULL,NULL,NULL,E'U454Z3P',0,FALSE,50.10024,14.66322,E'12:36:27',((SELECT now_date FROM init_values) + INTERVAL '12:36:27') at time zone 'Europe/Prague',false,E'2022-12-23T12:01:00Z_100212_212_1045',NULL,NULL,NULL,E'2022-12-23 12:36:59.262+01',NULL,1563981367,297,NULL,NULL,NULL,NULL,1,28,NULL,NULL,'2022-12-23T12:01:00.000Z','2022-12-23T12:01:00.000Z',NULL,E'processed',E'before_track',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2022-12-23T11:41:27.000Z'),
|
|
215
|
+
(E'2022-12-23 12:36:58.063+01',NULL,9,NULL,NULL,2.408,FALSE,50.10024,14.66322,E'12:56:28',((SELECT now_date FROM init_values) + INTERVAL '12:56:28') at time zone 'Europe/Prague',false,E'2022-12-23T11:24:00Z_100212_212_1044',NULL,NULL,NULL,E'2022-12-23 12:36:59.26+01',NULL,2563981366,297,27935,7,E'U454Z4P',7,NULL,28,'2022-12-23T11:30:00.000Z','2022-12-23T11:30:00.000Z',NULL,NULL,NULL,E'input',E'unknown',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2022-12-23T11:41:27.000Z'),
|
|
216
|
+
(E'2022-12-23 12:36:58.063+01',87,NULL,87,E'U4107Z1P',1.887,FALSE,50.10024,14.66322,E'12:56:28',((SELECT now_date FROM init_values) + INTERVAL '12:56:28') at time zone 'Europe/Prague',true,E'2022-12-23T11:31:00Z_100212_212_1043',NULL,NULL,NULL,E'2022-12-23 12:36:59.261+01',NULL,2563981365,270,59545,5,E'U4137Z1P',5,6,28,'2022-12-23T11:35:00.000Z','2022-12-23T11:35:00.000Z','2022-12-23T11:36:00.000Z','2022-12-23T11:36:00.000Z',NULL,E'input',E'unknown',E'U4137Z1P',5,NULL,NULL,E'Všestarská',NULL,NULL,'2022-12-23T11:41:27.000Z'),
|
|
217
|
+
(E'2022-12-23 12:36:58.063+01',NULL,NULL,NULL,E'U4107Z1P',0,FALSE,50.10024,14.66322,E'12:56:28',((SELECT now_date FROM init_values) + INTERVAL '12:56:28') at time zone 'Europe/Prague',false,E'2022-12-23T11:54:00Z_100212_212_1046',NULL,NULL,NULL,E'2022-12-23 12:36:59.264+01',NULL,2563981368,297,NULL,NULL,NULL,NULL,1,28,NULL,NULL,'2022-12-23T11:54:00.000Z','2022-12-23T11:54:00.000Z',NULL,E'input',E'unknown',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2022-12-23T11:41:27.000Z'),
|
|
218
|
+
(E'2022-12-23 12:36:58.063+01',NULL,NULL,NULL,E'U454Z3P',0,FALSE,50.10024,14.66322,E'12:56:28',((SELECT now_date FROM init_values) + INTERVAL '12:56:28') at time zone 'Europe/Prague',false,E'2022-12-23T12:01:00Z_100212_212_1045',NULL,NULL,NULL,E'2022-12-23 12:36:59.262+01',NULL,2563981367,297,NULL,NULL,NULL,NULL,1,28,NULL,NULL,'2022-12-23T12:01:00.000Z','2022-12-23T12:01:00.000Z',NULL,E'input',E'unknown',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'2022-12-23T11:41:27.000Z');
|
|
@@ -7,8 +7,8 @@ INSERT INTO vehiclepositions_trips
|
|
|
7
7
|
VALUES(NULL, NULL, 65, NULL, '2023-03-21 00:00:15.399', 'L94', '94', '94_979_230320', '2023-03-21T01:30:00+01:00_94_979_230320_8388', '2023-03-21 02:44:25.833', NULL, NULL, '01:30:00', '2023-03-21T00:30:00.000Z', 6, false, NULL, NULL, NULL, NULL, 'DP PRAHA', '94', 'DP PRAHA', 8388, 'Sídliště Barrandov', NULL, 0, NULL, 554214346, NULL, '2023-03-21T01:40:00.000Z', NULL, NULL, 65, '94',current_date - interval '1 day');
|
|
8
8
|
|
|
9
9
|
INSERT INTO vehiclepositions_positions
|
|
10
|
-
(created_at, delay, delay_stop_arrival, delay_stop_departure, next_stop_id, shape_dist_traveled, is_canceled, lat, lng, origin_time, origin_timestamp,
|
|
11
|
-
VALUES('2023-03-21 02:44:25.787', 10, NULL, NULL, 'U1019Z2P', 22.263, NULL, 50.03141, 14.36749, '02:44:20', '2023-03-21T01:44:20.000Z',
|
|
10
|
+
(created_at, delay, delay_stop_arrival, delay_stop_departure, next_stop_id, shape_dist_traveled, is_canceled, lat, lng, origin_time, origin_timestamp, is_tracked, trips_id, create_batch_id, created_by, update_batch_id, updated_at, updated_by, id, bearing, cis_last_stop_id, cis_last_stop_sequence, last_stop_id, last_stop_sequence, next_stop_sequence, speed, last_stop_arrival_time, last_stop_departure_time, next_stop_arrival_time, next_stop_departure_time, asw_last_stop_id, state_process, state_position, this_stop_id, this_stop_sequence, tcp_event, last_stop_headsign, last_stop_name, next_stop_name, this_stop_name, valid_to, scheduled_timestamp)
|
|
11
|
+
VALUES('2023-03-21 02:44:25.787', 10, NULL, NULL, 'U1019Z2P', 22.263, NULL, 50.03141, 14.36749, '02:44:20', '2023-03-21T01:44:20.000Z', true, '2023-03-21T01:30:00+01:00_94_979_230320_8388', NULL, NULL, NULL, '2023-03-21 02:44:25.822', NULL, 554214346, 257, NULL, NULL, 'U1019Z2P', 8, 8, NULL, '2023-03-21T01:40:00.000Z', '2023-03-21T01:40:00.000Z', '2023-03-21T01:40:00.000Z', '2023-03-21T01:40:00.000Z', '10190002', 'processed', 'on_track', '10190002', NULL, 'V', NULL, 'Sídliště Barrandov', NULL, NULL, NULL, '2023-03-21T01:40:00.000Z');
|
|
12
12
|
|
|
13
13
|
WITH init_values AS (SELECT NOW()::DATE AS now_date)
|
|
14
14
|
INSERT INTO ropidgtfs_calendar_actual (end_date,friday,monday,saturday,service_id,start_date,sunday,thursday,tuesday,wednesday,create_batch_id,created_at,created_by,update_batch_id,updated_at,updated_by) VALUES
|
|
@@ -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', '20231009141316-positions-tracked-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', '20231009141316-positions-tracked-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,191 @@
|
|
|
1
|
+
drop view v_vehiclepositions_alerts_last_position;
|
|
2
|
+
drop view v_vehiclepositions_all_trips_with_last_position;
|
|
3
|
+
drop view v_vehiclepositions_trip_position_vehicle_info;
|
|
4
|
+
|
|
5
|
+
alter table vehiclepositions_positions rename column is_tracked to tracking;
|
|
6
|
+
alter table vehiclepositions_positions alter column tracking type int using case tracking when true then 2 else 0 end;
|
|
7
|
+
|
|
8
|
+
alter table vehiclepositions_positions_history rename column is_tracked to tracking;
|
|
9
|
+
alter table vehiclepositions_positions_history alter column tracking type int using case tracking when true then 2 else 0 end;
|
|
10
|
+
|
|
11
|
+
-- recreate views
|
|
12
|
+
create view v_vehiclepositions_alerts_last_position as
|
|
13
|
+
SELECT t2.created_at,
|
|
14
|
+
t2.updated_at,
|
|
15
|
+
t2.delay,
|
|
16
|
+
t2.delay_stop_arrival,
|
|
17
|
+
t2.delay_stop_departure,
|
|
18
|
+
t2.next_stop_id,
|
|
19
|
+
t2.shape_dist_traveled,
|
|
20
|
+
t2.is_canceled,
|
|
21
|
+
t2.lat,
|
|
22
|
+
t2.lng,
|
|
23
|
+
t2.origin_time,
|
|
24
|
+
t2.origin_timestamp,
|
|
25
|
+
t2.tracking,
|
|
26
|
+
t2.trips_id,
|
|
27
|
+
t2.create_batch_id,
|
|
28
|
+
t2.created_by,
|
|
29
|
+
t2.update_batch_id,
|
|
30
|
+
t2.updated_by,
|
|
31
|
+
t2.id,
|
|
32
|
+
t2.bearing,
|
|
33
|
+
t2.cis_last_stop_id,
|
|
34
|
+
t2.cis_last_stop_sequence,
|
|
35
|
+
t2.last_stop_id,
|
|
36
|
+
t2.last_stop_sequence,
|
|
37
|
+
t2.next_stop_sequence,
|
|
38
|
+
t2.speed,
|
|
39
|
+
t2.last_stop_arrival_time,
|
|
40
|
+
t2.last_stop_departure_time,
|
|
41
|
+
t2.next_stop_arrival_time,
|
|
42
|
+
t2.next_stop_departure_time,
|
|
43
|
+
t2.asw_last_stop_id,
|
|
44
|
+
t1.gtfs_route_id,
|
|
45
|
+
t1.gtfs_route_short_name,
|
|
46
|
+
t1.gtfs_route_type,
|
|
47
|
+
t1.gtfs_trip_id,
|
|
48
|
+
t1.gtfs_trip_headsign,
|
|
49
|
+
t1.vehicle_type_id,
|
|
50
|
+
t1.wheelchair_accessible
|
|
51
|
+
FROM (vehiclepositions_trips t1
|
|
52
|
+
LEFT JOIN vehiclepositions_positions t2 ON ((t1.last_position_id = t2.id)))
|
|
53
|
+
WHERE ((t2.updated_at > (now() - '00:10:00'::interval)) AND ((t2.state_position)::text = ANY (ARRAY[('on_track'::character varying)::text, ('off_track'::character varying)::text, ('at_stop'::character varying)::text, ('before_track'::character varying)::text, ('after_track'::character varying)::text, ('canceled'::character varying)::text])))
|
|
54
|
+
ORDER BY t2.trips_id, t2.updated_at DESC;
|
|
55
|
+
|
|
56
|
+
comment on view v_vehiclepositions_alerts_last_position is '
|
|
57
|
+
Used only for alerting purposes.
|
|
58
|
+
';
|
|
59
|
+
|
|
60
|
+
create view v_vehiclepositions_all_trips_with_last_position as
|
|
61
|
+
select
|
|
62
|
+
vt.id,
|
|
63
|
+
vt.agency_name_real,
|
|
64
|
+
vt.agency_name_scheduled,
|
|
65
|
+
vt.cis_line_id,
|
|
66
|
+
vt.cis_trip_number,
|
|
67
|
+
vt.gtfs_route_id,
|
|
68
|
+
vt.gtfs_route_short_name,
|
|
69
|
+
vt.gtfs_route_type,
|
|
70
|
+
vt.gtfs_trip_headsign,
|
|
71
|
+
vt.gtfs_trip_short_name,
|
|
72
|
+
vt.gtfs_trip_id,
|
|
73
|
+
vt.origin_route_name,
|
|
74
|
+
vt.run_number,
|
|
75
|
+
vt.vehicle_registration_number,
|
|
76
|
+
vt.vehicle_type_id,
|
|
77
|
+
vt.wheelchair_accessible,
|
|
78
|
+
vt.updated_at,
|
|
79
|
+
convert_timestamptz_to_iso_string(vt.start_timestamp) as start_timestamp_isostring,
|
|
80
|
+
vp.bearing,
|
|
81
|
+
vp.delay,
|
|
82
|
+
vp.delay_stop_arrival,
|
|
83
|
+
vp.delay_stop_departure,
|
|
84
|
+
vp.is_canceled,
|
|
85
|
+
vp.last_stop_id,
|
|
86
|
+
vp.last_stop_sequence,
|
|
87
|
+
vp.last_stop_headsign,
|
|
88
|
+
vp.lat,
|
|
89
|
+
vp.lng,
|
|
90
|
+
vp.next_stop_id,
|
|
91
|
+
vp.next_stop_sequence,
|
|
92
|
+
vp.shape_dist_traveled,
|
|
93
|
+
vp.speed,
|
|
94
|
+
vp.state_position,
|
|
95
|
+
vp.tracking,
|
|
96
|
+
convert_timestamptz_to_iso_string(vp.last_stop_arrival_time) as last_stop_arrival_time_isostring,
|
|
97
|
+
convert_timestamptz_to_iso_string(vp.last_stop_departure_time) as last_stop_departure_time_isostring,
|
|
98
|
+
convert_timestamptz_to_iso_string(vp.next_stop_arrival_time) as next_stop_arrival_time_isostring,
|
|
99
|
+
convert_timestamptz_to_iso_string(vp.next_stop_departure_time) as next_stop_departure_time_isostring,
|
|
100
|
+
convert_timestamptz_to_iso_string(vp.origin_timestamp) as origin_timestamp_isostring
|
|
101
|
+
from
|
|
102
|
+
vehiclepositions_trips vt
|
|
103
|
+
inner join vehiclepositions_positions vp on
|
|
104
|
+
vt.last_position_id = vp.id
|
|
105
|
+
and (vp.valid_to is null
|
|
106
|
+
or vp.valid_to >= now())
|
|
107
|
+
and vp.state_process = 'processed';
|
|
108
|
+
|
|
109
|
+
comment on view v_vehiclepositions_all_trips_with_last_position is '
|
|
110
|
+
View of all trips with last processed position. Used for serving data to the vehiclepositions output API.
|
|
111
|
+
';
|
|
112
|
+
|
|
113
|
+
create view v_vehiclepositions_trip_position_vehicle_info as
|
|
114
|
+
select
|
|
115
|
+
"trip->last_position"."delay" as "delay_seconds",
|
|
116
|
+
"trip"."wheelchair_accessible" as "real_wheelchair_accessible",
|
|
117
|
+
"trip->last_position"."is_canceled" as "is_canceled",
|
|
118
|
+
"trip"."agency_name_real" as "trip.agency_name_real",
|
|
119
|
+
"trip"."agency_name_scheduled" as "trip.agency_name_scheduled",
|
|
120
|
+
"trip"."cis_line_id" as "trip.cis_line_id",
|
|
121
|
+
"trip"."cis_line_short_name" as "trip.cis_line_short_name",
|
|
122
|
+
"trip"."cis_trip_number" as "trip.cis_trip_number",
|
|
123
|
+
"trip"."gtfs_block_id" as "trip.gtfs_block_id",
|
|
124
|
+
"trip"."gtfs_route_id" as "trip.gtfs_route_id",
|
|
125
|
+
"trip"."gtfs_route_short_name" as "trip.gtfs_route_short_name",
|
|
126
|
+
"trip"."gtfs_route_type" as "trip.gtfs_route_type",
|
|
127
|
+
"trip"."gtfs_trip_headsign" as "trip.gtfs_trip_headsign",
|
|
128
|
+
"trip"."gtfs_trip_short_name" as "trip.gtfs_trip_short_name",
|
|
129
|
+
"trip"."gtfs_trip_id" as "trip.gtfs_trip_id",
|
|
130
|
+
"trip"."gtfs_date" as "trip.gtfs_date",
|
|
131
|
+
"trip"."id" as "trip.id",
|
|
132
|
+
"trip"."is_canceled" as "trip.is_canceled",
|
|
133
|
+
"trip"."last_position_id" as "trip.last_position_id",
|
|
134
|
+
"trip"."origin_route_name" as "trip.origin_route_name",
|
|
135
|
+
"trip"."run_number" as "trip.run_number",
|
|
136
|
+
"trip"."start_asw_stop_id" as "trip.start_asw_stop_id",
|
|
137
|
+
"trip"."start_cis_stop_id" as "trip.start_cis_stop_id",
|
|
138
|
+
"trip"."start_cis_stop_platform_code" as "trip.start_cis_stop_platform_code",
|
|
139
|
+
"trip"."start_time" as "trip.start_time",
|
|
140
|
+
"trip"."start_timestamp" as "trip.start_timestamp",
|
|
141
|
+
"trip"."end_timestamp" as "trip.end_timestamp",
|
|
142
|
+
"trip"."vehicle_registration_number" as "trip.vehicle_registration_number",
|
|
143
|
+
"trip"."vehicle_type_id" as "trip.vehicle_type_id",
|
|
144
|
+
"trip"."wheelchair_accessible" as "trip.wheelchair_accessible",
|
|
145
|
+
"trip"."internal_route_name" as "trip.internal_route_name",
|
|
146
|
+
"trip"."internal_run_number" as "trip.internal_run_number",
|
|
147
|
+
"trip->last_position"."asw_last_stop_id" as "trip.last_position.asw_last_stop_id",
|
|
148
|
+
"trip->last_position"."bearing" as "trip.last_position.bearing",
|
|
149
|
+
"trip->last_position"."cis_last_stop_id" as "trip.last_position.cis_last_stop_id",
|
|
150
|
+
"trip->last_position"."cis_last_stop_sequence" as "trip.last_position.cis_last_stop_sequence",
|
|
151
|
+
"trip->last_position"."delay" as "trip.last_position.delay",
|
|
152
|
+
"trip->last_position"."delay_stop_arrival" as "trip.last_position.delay_stop_arrival",
|
|
153
|
+
"trip->last_position"."delay_stop_departure" as "trip.last_position.delay_stop_departure",
|
|
154
|
+
"trip->last_position"."id" as "trip.last_position.id",
|
|
155
|
+
"trip->last_position"."is_canceled" as "trip.last_position.is_canceled",
|
|
156
|
+
"trip->last_position"."last_stop_arrival_time" as "trip.last_position.last_stop_arrival_time",
|
|
157
|
+
"trip->last_position"."last_stop_departure_time" as "trip.last_position.last_stop_departure_time",
|
|
158
|
+
"trip->last_position"."last_stop_id" as "trip.last_position.last_stop_id",
|
|
159
|
+
"trip->last_position"."last_stop_sequence" as "trip.last_position.last_stop_sequence",
|
|
160
|
+
"trip->last_position"."lat" as "trip.last_position.lat",
|
|
161
|
+
"trip->last_position"."lng" as "trip.last_position.lng",
|
|
162
|
+
"trip->last_position"."next_stop_arrival_time" as "trip.last_position.next_stop_arrival_time",
|
|
163
|
+
"trip->last_position"."next_stop_departure_time" as "trip.last_position.next_stop_departure_time",
|
|
164
|
+
"trip->last_position"."next_stop_id" as "trip.last_position.next_stop_id",
|
|
165
|
+
"trip->last_position"."next_stop_sequence" as "trip.last_position.next_stop_sequence",
|
|
166
|
+
"trip->last_position"."origin_time" as "trip.last_position.origin_time",
|
|
167
|
+
"trip->last_position"."origin_timestamp" as "trip.last_position.origin_timestamp",
|
|
168
|
+
"trip->last_position"."shape_dist_traveled" as "trip.last_position.shape_dist_traveled",
|
|
169
|
+
"trip->last_position"."speed" as "trip.last_position.speed",
|
|
170
|
+
"trip->last_position"."state_position" as "trip.last_position.state_position",
|
|
171
|
+
"trip->last_position"."state_process" as "trip.last_position.state_process",
|
|
172
|
+
"trip->last_position"."this_stop_id" as "trip.last_position.this_stop_id",
|
|
173
|
+
"trip->last_position"."this_stop_sequence" as "trip.last_position.this_stop_sequence",
|
|
174
|
+
"trip->last_position"."tracking" as "trip.last_position.tracking",
|
|
175
|
+
"trip->last_position"."trips_id" as "trip.last_position.trips_id",
|
|
176
|
+
"trip->last_position"."tcp_event" as "trip.last_position.tcp_event",
|
|
177
|
+
"trip->last_position"."last_stop_headsign" as "trip.last_position.last_stop_headsign",
|
|
178
|
+
"trip->last_position"."last_stop_name" as "trip.last_position.last_stop_name",
|
|
179
|
+
"trip->last_position"."valid_to" as "trip.last_position.valid_to",
|
|
180
|
+
"trip->last_position"."scheduled_timestamp" as "trip.last_position.scheduled_timestamp",
|
|
181
|
+
"trip->vehicle_descriptor"."id" as "trip.vehicle_descriptor.id",
|
|
182
|
+
"trip->vehicle_descriptor"."is_air_conditioned" as "trip.vehicle_descriptor.is_air_conditioned"
|
|
183
|
+
from
|
|
184
|
+
"vehiclepositions_trips" as "trip"
|
|
185
|
+
inner join "vehiclepositions_positions" as "trip->last_position" on
|
|
186
|
+
"trip"."last_position_id" = "trip->last_position"."id"
|
|
187
|
+
and ("trip->last_position"."valid_to" is null or "trip->last_position"."valid_to" >= current_timestamp)
|
|
188
|
+
and "trip->last_position"."state_position" in ('at_stop', 'before_track', 'before_track_delayed', 'canceled', 'off_track', 'on_track')
|
|
189
|
+
left outer join "vehiclepositions_vehicle_descriptors" as "trip->vehicle_descriptor" on
|
|
190
|
+
"trip"."vehicle_registration_number" = "trip->vehicle_descriptor"."registration_number"
|
|
191
|
+
and trip.gtfs_route_type = "trip->vehicle_descriptor".gtfs_route_type;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
drop view v_vehiclepositions_alerts_last_position;
|
|
2
|
+
drop view v_vehiclepositions_all_trips_with_last_position;
|
|
3
|
+
drop view v_vehiclepositions_trip_position_vehicle_info;
|
|
4
|
+
|
|
5
|
+
alter table vehiclepositions_positions rename column tracking to is_tracked;
|
|
6
|
+
alter table vehiclepositions_positions alter column is_tracked type boolean using is_tracked::boolean;
|
|
7
|
+
|
|
8
|
+
alter table vehiclepositions_positions_history rename column tracking to is_tracked;
|
|
9
|
+
alter table vehiclepositions_positions_history alter column is_tracked type boolean using is_tracked::boolean;
|
|
10
|
+
|
|
11
|
+
-- recreate views
|
|
12
|
+
create view v_vehiclepositions_alerts_last_position as
|
|
13
|
+
SELECT t2.created_at,
|
|
14
|
+
t2.updated_at,
|
|
15
|
+
t2.delay,
|
|
16
|
+
t2.delay_stop_arrival,
|
|
17
|
+
t2.delay_stop_departure,
|
|
18
|
+
t2.next_stop_id,
|
|
19
|
+
t2.shape_dist_traveled,
|
|
20
|
+
t2.is_canceled,
|
|
21
|
+
t2.lat,
|
|
22
|
+
t2.lng,
|
|
23
|
+
t2.origin_time,
|
|
24
|
+
t2.origin_timestamp,
|
|
25
|
+
t2.is_tracked,
|
|
26
|
+
t2.trips_id,
|
|
27
|
+
t2.create_batch_id,
|
|
28
|
+
t2.created_by,
|
|
29
|
+
t2.update_batch_id,
|
|
30
|
+
t2.updated_by,
|
|
31
|
+
t2.id,
|
|
32
|
+
t2.bearing,
|
|
33
|
+
t2.cis_last_stop_id,
|
|
34
|
+
t2.cis_last_stop_sequence,
|
|
35
|
+
t2.last_stop_id,
|
|
36
|
+
t2.last_stop_sequence,
|
|
37
|
+
t2.next_stop_sequence,
|
|
38
|
+
t2.speed,
|
|
39
|
+
t2.last_stop_arrival_time,
|
|
40
|
+
t2.last_stop_departure_time,
|
|
41
|
+
t2.next_stop_arrival_time,
|
|
42
|
+
t2.next_stop_departure_time,
|
|
43
|
+
t2.asw_last_stop_id,
|
|
44
|
+
t1.gtfs_route_id,
|
|
45
|
+
t1.gtfs_route_short_name,
|
|
46
|
+
t1.gtfs_route_type,
|
|
47
|
+
t1.gtfs_trip_id,
|
|
48
|
+
t1.gtfs_trip_headsign,
|
|
49
|
+
t1.vehicle_type_id,
|
|
50
|
+
t1.wheelchair_accessible
|
|
51
|
+
FROM (vehiclepositions_trips t1
|
|
52
|
+
LEFT JOIN vehiclepositions_positions t2 ON ((t1.last_position_id = t2.id)))
|
|
53
|
+
WHERE ((t2.updated_at > (now() - '00:10:00'::interval)) AND ((t2.state_position)::text = ANY (ARRAY[('on_track'::character varying)::text, ('off_track'::character varying)::text, ('at_stop'::character varying)::text, ('before_track'::character varying)::text, ('after_track'::character varying)::text, ('canceled'::character varying)::text])))
|
|
54
|
+
ORDER BY t2.trips_id, t2.updated_at DESC;
|
|
55
|
+
|
|
56
|
+
comment on view v_vehiclepositions_alerts_last_position is '
|
|
57
|
+
Used only for alerting purposes.
|
|
58
|
+
';
|
|
59
|
+
|
|
60
|
+
create view v_vehiclepositions_all_trips_with_last_position as
|
|
61
|
+
select
|
|
62
|
+
vt.id,
|
|
63
|
+
vt.agency_name_real,
|
|
64
|
+
vt.agency_name_scheduled,
|
|
65
|
+
vt.cis_line_id,
|
|
66
|
+
vt.cis_trip_number,
|
|
67
|
+
vt.gtfs_route_id,
|
|
68
|
+
vt.gtfs_route_short_name,
|
|
69
|
+
vt.gtfs_route_type,
|
|
70
|
+
vt.gtfs_trip_headsign,
|
|
71
|
+
vt.gtfs_trip_short_name,
|
|
72
|
+
vt.gtfs_trip_id,
|
|
73
|
+
vt.origin_route_name,
|
|
74
|
+
vt.run_number,
|
|
75
|
+
vt.vehicle_registration_number,
|
|
76
|
+
vt.vehicle_type_id,
|
|
77
|
+
vt.wheelchair_accessible,
|
|
78
|
+
vt.updated_at,
|
|
79
|
+
convert_timestamptz_to_iso_string(vt.start_timestamp) as start_timestamp_isostring,
|
|
80
|
+
vp.bearing,
|
|
81
|
+
vp.delay,
|
|
82
|
+
vp.delay_stop_arrival,
|
|
83
|
+
vp.delay_stop_departure,
|
|
84
|
+
vp.is_canceled,
|
|
85
|
+
vp.last_stop_id,
|
|
86
|
+
vp.last_stop_sequence,
|
|
87
|
+
vp.last_stop_headsign,
|
|
88
|
+
vp.lat,
|
|
89
|
+
vp.lng,
|
|
90
|
+
vp.next_stop_id,
|
|
91
|
+
vp.next_stop_sequence,
|
|
92
|
+
vp.shape_dist_traveled,
|
|
93
|
+
vp.speed,
|
|
94
|
+
vp.state_position,
|
|
95
|
+
vp.is_tracked,
|
|
96
|
+
convert_timestamptz_to_iso_string(vp.last_stop_arrival_time) as last_stop_arrival_time_isostring,
|
|
97
|
+
convert_timestamptz_to_iso_string(vp.last_stop_departure_time) as last_stop_departure_time_isostring,
|
|
98
|
+
convert_timestamptz_to_iso_string(vp.next_stop_arrival_time) as next_stop_arrival_time_isostring,
|
|
99
|
+
convert_timestamptz_to_iso_string(vp.next_stop_departure_time) as next_stop_departure_time_isostring,
|
|
100
|
+
convert_timestamptz_to_iso_string(vp.origin_timestamp) as origin_timestamp_isostring
|
|
101
|
+
from
|
|
102
|
+
vehiclepositions_trips vt
|
|
103
|
+
inner join vehiclepositions_positions vp on
|
|
104
|
+
vt.last_position_id = vp.id
|
|
105
|
+
and (vp.valid_to is null
|
|
106
|
+
or vp.valid_to >= now())
|
|
107
|
+
and vp.state_process = 'processed';
|
|
108
|
+
|
|
109
|
+
comment on view v_vehiclepositions_all_trips_with_last_position is '
|
|
110
|
+
View of all trips with last processed position. Used for serving data to the vehiclepositions output API.
|
|
111
|
+
';
|
|
112
|
+
|
|
113
|
+
create view v_vehiclepositions_trip_position_vehicle_info as
|
|
114
|
+
select
|
|
115
|
+
"trip->last_position"."delay" as "delay_seconds",
|
|
116
|
+
"trip"."wheelchair_accessible" as "real_wheelchair_accessible",
|
|
117
|
+
"trip->last_position"."is_canceled" as "is_canceled",
|
|
118
|
+
"trip"."agency_name_real" as "trip.agency_name_real",
|
|
119
|
+
"trip"."agency_name_scheduled" as "trip.agency_name_scheduled",
|
|
120
|
+
"trip"."cis_line_id" as "trip.cis_line_id",
|
|
121
|
+
"trip"."cis_line_short_name" as "trip.cis_line_short_name",
|
|
122
|
+
"trip"."cis_trip_number" as "trip.cis_trip_number",
|
|
123
|
+
"trip"."gtfs_block_id" as "trip.gtfs_block_id",
|
|
124
|
+
"trip"."gtfs_route_id" as "trip.gtfs_route_id",
|
|
125
|
+
"trip"."gtfs_route_short_name" as "trip.gtfs_route_short_name",
|
|
126
|
+
"trip"."gtfs_route_type" as "trip.gtfs_route_type",
|
|
127
|
+
"trip"."gtfs_trip_headsign" as "trip.gtfs_trip_headsign",
|
|
128
|
+
"trip"."gtfs_trip_short_name" as "trip.gtfs_trip_short_name",
|
|
129
|
+
"trip"."gtfs_trip_id" as "trip.gtfs_trip_id",
|
|
130
|
+
"trip"."gtfs_date" as "trip.gtfs_date",
|
|
131
|
+
"trip"."id" as "trip.id",
|
|
132
|
+
"trip"."is_canceled" as "trip.is_canceled",
|
|
133
|
+
"trip"."last_position_id" as "trip.last_position_id",
|
|
134
|
+
"trip"."origin_route_name" as "trip.origin_route_name",
|
|
135
|
+
"trip"."run_number" as "trip.run_number",
|
|
136
|
+
"trip"."start_asw_stop_id" as "trip.start_asw_stop_id",
|
|
137
|
+
"trip"."start_cis_stop_id" as "trip.start_cis_stop_id",
|
|
138
|
+
"trip"."start_cis_stop_platform_code" as "trip.start_cis_stop_platform_code",
|
|
139
|
+
"trip"."start_time" as "trip.start_time",
|
|
140
|
+
"trip"."start_timestamp" as "trip.start_timestamp",
|
|
141
|
+
"trip"."end_timestamp" as "trip.end_timestamp",
|
|
142
|
+
"trip"."vehicle_registration_number" as "trip.vehicle_registration_number",
|
|
143
|
+
"trip"."vehicle_type_id" as "trip.vehicle_type_id",
|
|
144
|
+
"trip"."wheelchair_accessible" as "trip.wheelchair_accessible",
|
|
145
|
+
"trip"."internal_route_name" as "trip.internal_route_name",
|
|
146
|
+
"trip"."internal_run_number" as "trip.internal_run_number",
|
|
147
|
+
"trip->last_position"."asw_last_stop_id" as "trip.last_position.asw_last_stop_id",
|
|
148
|
+
"trip->last_position"."bearing" as "trip.last_position.bearing",
|
|
149
|
+
"trip->last_position"."cis_last_stop_id" as "trip.last_position.cis_last_stop_id",
|
|
150
|
+
"trip->last_position"."cis_last_stop_sequence" as "trip.last_position.cis_last_stop_sequence",
|
|
151
|
+
"trip->last_position"."delay" as "trip.last_position.delay",
|
|
152
|
+
"trip->last_position"."delay_stop_arrival" as "trip.last_position.delay_stop_arrival",
|
|
153
|
+
"trip->last_position"."delay_stop_departure" as "trip.last_position.delay_stop_departure",
|
|
154
|
+
"trip->last_position"."id" as "trip.last_position.id",
|
|
155
|
+
"trip->last_position"."is_canceled" as "trip.last_position.is_canceled",
|
|
156
|
+
"trip->last_position"."last_stop_arrival_time" as "trip.last_position.last_stop_arrival_time",
|
|
157
|
+
"trip->last_position"."last_stop_departure_time" as "trip.last_position.last_stop_departure_time",
|
|
158
|
+
"trip->last_position"."last_stop_id" as "trip.last_position.last_stop_id",
|
|
159
|
+
"trip->last_position"."last_stop_sequence" as "trip.last_position.last_stop_sequence",
|
|
160
|
+
"trip->last_position"."lat" as "trip.last_position.lat",
|
|
161
|
+
"trip->last_position"."lng" as "trip.last_position.lng",
|
|
162
|
+
"trip->last_position"."next_stop_arrival_time" as "trip.last_position.next_stop_arrival_time",
|
|
163
|
+
"trip->last_position"."next_stop_departure_time" as "trip.last_position.next_stop_departure_time",
|
|
164
|
+
"trip->last_position"."next_stop_id" as "trip.last_position.next_stop_id",
|
|
165
|
+
"trip->last_position"."next_stop_sequence" as "trip.last_position.next_stop_sequence",
|
|
166
|
+
"trip->last_position"."origin_time" as "trip.last_position.origin_time",
|
|
167
|
+
"trip->last_position"."origin_timestamp" as "trip.last_position.origin_timestamp",
|
|
168
|
+
"trip->last_position"."shape_dist_traveled" as "trip.last_position.shape_dist_traveled",
|
|
169
|
+
"trip->last_position"."speed" as "trip.last_position.speed",
|
|
170
|
+
"trip->last_position"."state_position" as "trip.last_position.state_position",
|
|
171
|
+
"trip->last_position"."state_process" as "trip.last_position.state_process",
|
|
172
|
+
"trip->last_position"."this_stop_id" as "trip.last_position.this_stop_id",
|
|
173
|
+
"trip->last_position"."this_stop_sequence" as "trip.last_position.this_stop_sequence",
|
|
174
|
+
"trip->last_position"."is_tracked" as "trip.last_position.is_tracked",
|
|
175
|
+
"trip->last_position"."trips_id" as "trip.last_position.trips_id",
|
|
176
|
+
"trip->last_position"."tcp_event" as "trip.last_position.tcp_event",
|
|
177
|
+
"trip->last_position"."last_stop_headsign" as "trip.last_position.last_stop_headsign",
|
|
178
|
+
"trip->last_position"."last_stop_name" as "trip.last_position.last_stop_name",
|
|
179
|
+
"trip->last_position"."valid_to" as "trip.last_position.valid_to",
|
|
180
|
+
"trip->last_position"."scheduled_timestamp" as "trip.last_position.scheduled_timestamp",
|
|
181
|
+
"trip->vehicle_descriptor"."id" as "trip.vehicle_descriptor.id",
|
|
182
|
+
"trip->vehicle_descriptor"."is_air_conditioned" as "trip.vehicle_descriptor.is_air_conditioned"
|
|
183
|
+
from
|
|
184
|
+
"vehiclepositions_trips" as "trip"
|
|
185
|
+
inner join "vehiclepositions_positions" as "trip->last_position" on
|
|
186
|
+
"trip"."last_position_id" = "trip->last_position"."id"
|
|
187
|
+
and ("trip->last_position"."valid_to" is null or "trip->last_position"."valid_to" >= current_timestamp)
|
|
188
|
+
and "trip->last_position"."state_position" in ('at_stop', 'before_track', 'before_track_delayed', 'canceled', 'off_track', 'on_track')
|
|
189
|
+
left outer join "vehiclepositions_vehicle_descriptors" as "trip->vehicle_descriptor" on
|
|
190
|
+
"trip"."vehicle_registration_number" = "trip->vehicle_descriptor"."registration_number"
|
|
191
|
+
and trip.gtfs_route_type = "trip->vehicle_descriptor".gtfs_route_type;
|
package/dist/const.d.ts
CHANGED
|
@@ -27,9 +27,5 @@ export declare enum TCPEventEnum {
|
|
|
27
27
|
export declare enum RegionalBusEventEnum {
|
|
28
28
|
DEPARTURED = "R"
|
|
29
29
|
}
|
|
30
|
-
export declare enum PositionTrackingEnum {
|
|
31
|
-
NOT_TRACKING = 0,
|
|
32
|
-
TRACKING = 2
|
|
33
|
-
}
|
|
34
30
|
export declare const ArrayNotPublicRegistrationNumbers: string[];
|
|
35
31
|
export declare const DATA_RETENTION_IN_MINUTES = 30;
|
package/dist/const.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DATA_RETENTION_IN_MINUTES = exports.ArrayNotPublicRegistrationNumbers = exports.
|
|
3
|
+
exports.DATA_RETENTION_IN_MINUTES = exports.ArrayNotPublicRegistrationNumbers = exports.RegionalBusEventEnum = exports.TCPEventEnum = exports.StateProcessEnum = exports.StatePositionEnum = void 0;
|
|
4
4
|
var StatePositionEnum;
|
|
5
5
|
(function (StatePositionEnum) {
|
|
6
6
|
StatePositionEnum["OFF_TRACK"] = "off_track";
|
|
@@ -34,11 +34,6 @@ var RegionalBusEventEnum;
|
|
|
34
34
|
(function (RegionalBusEventEnum) {
|
|
35
35
|
RegionalBusEventEnum["DEPARTURED"] = "R";
|
|
36
36
|
})(RegionalBusEventEnum || (exports.RegionalBusEventEnum = RegionalBusEventEnum = {}));
|
|
37
|
-
var PositionTrackingEnum;
|
|
38
|
-
(function (PositionTrackingEnum) {
|
|
39
|
-
PositionTrackingEnum[PositionTrackingEnum["NOT_TRACKING"] = 0] = "NOT_TRACKING";
|
|
40
|
-
PositionTrackingEnum[PositionTrackingEnum["TRACKING"] = 2] = "TRACKING";
|
|
41
|
-
})(PositionTrackingEnum || (exports.PositionTrackingEnum = PositionTrackingEnum = {}));
|
|
42
37
|
exports.ArrayNotPublicRegistrationNumbers = ["2210", "5572"];
|
|
43
38
|
exports.DATA_RETENTION_IN_MINUTES = 30;
|
|
44
39
|
//# sourceMappingURL=const.js.map
|
package/dist/const.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IACzB,4CAAuB,CAAA;IACvB,wCAAmB,CAAA;IACnB,0CAAqB,CAAA;IACrB,kDAA6B,CAAA;IAC7B,gDAA2B,CAAA;IAC3B,0CAAqB,CAAA;IACrB,4CAAuB,CAAA;IACvB,wCAAmB,CAAA;IACnB,kEAA6C,CAAA;IAC7C,4CAAuB,CAAA;IACvB,8CAAyB,CAAA;IACzB,8CAAyB,CAAA;AAC7B,CAAC,EAbW,iBAAiB,iCAAjB,iBAAiB,QAa5B;AAED,IAAY,gBAKX;AALD,WAAY,gBAAgB;IACxB,2CAAuB,CAAA;IACvB,2CAAuB,CAAA;IACvB,mCAAe,CAAA;IACf,2CAAuB,CAAA;AAC3B,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAED,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,uCAAuB,CAAA;IACvB,gCAAgB,CAAA;IAChB,gCAAgB,CAAA;IAChB,0BAAU,CAAA;AACd,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC5B,wCAAgB,CAAA;AACpB,CAAC,EAFW,oBAAoB,oCAApB,oBAAoB,QAE/B;
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../src/const.ts"],"names":[],"mappings":";;;AAAA,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IACzB,4CAAuB,CAAA;IACvB,wCAAmB,CAAA;IACnB,0CAAqB,CAAA;IACrB,kDAA6B,CAAA;IAC7B,gDAA2B,CAAA;IAC3B,0CAAqB,CAAA;IACrB,4CAAuB,CAAA;IACvB,wCAAmB,CAAA;IACnB,kEAA6C,CAAA;IAC7C,4CAAuB,CAAA;IACvB,8CAAyB,CAAA;IACzB,8CAAyB,CAAA;AAC7B,CAAC,EAbW,iBAAiB,iCAAjB,iBAAiB,QAa5B;AAED,IAAY,gBAKX;AALD,WAAY,gBAAgB;IACxB,2CAAuB,CAAA;IACvB,2CAAuB,CAAA;IACvB,mCAAe,CAAA;IACf,2CAAuB,CAAA;AAC3B,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B;AAED,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,uCAAuB,CAAA;IACvB,gCAAgB,CAAA;IAChB,gCAAgB,CAAA;IAChB,0BAAU,CAAA;AACd,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED,IAAY,oBAEX;AAFD,WAAY,oBAAoB;IAC5B,wCAAgB,CAAA;AACpB,CAAC,EAFW,oBAAoB,oCAApB,oBAAoB,QAE/B;AAEY,QAAA,iCAAiC,GAAa,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/D,QAAA,yBAAyB,GAAG,EAAE,CAAC"}
|