@golemio/pid 2.11.1-dev.1130791659 → 2.11.1-rc.1133070620

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.
Files changed (47) hide show
  1. package/db/example/12_metro_line_A_gtfs_trips.sql +4 -4
  2. package/db/example/13_http-propagate-delay.sql +8 -8
  3. package/dist/integration-engine/ioc/Di.d.ts +2 -1
  4. package/dist/integration-engine/ioc/Di.js +5 -7
  5. package/dist/integration-engine/ioc/Di.js.map +1 -1
  6. package/dist/integration-engine/ioc/ModuleContainerToken.d.ts +0 -1
  7. package/dist/integration-engine/ioc/ModuleContainerToken.js +0 -1
  8. package/dist/integration-engine/ioc/ModuleContainerToken.js.map +1 -1
  9. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js +5 -4
  10. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.js.map +1 -1
  11. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionCalculator.d.ts +11 -9
  12. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionCalculator.js +97 -33
  13. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionCalculator.js.map +1 -1
  14. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +23 -28
  15. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js.map +1 -1
  16. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/ValidToCalculator.js +5 -4
  17. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/ValidToCalculator.js.map +1 -1
  18. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js +22 -24
  19. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/RegionalBusPositionsManager.js.map +1 -1
  20. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/interfaces/VPInterfaces.d.ts +1 -1
  21. package/dist/output-gateway/public/ioc/Di.js +1 -5
  22. package/dist/output-gateway/public/ioc/Di.js.map +1 -1
  23. package/dist/output-gateway/public/ioc/OgModuleToken.d.ts +0 -2
  24. package/dist/output-gateway/public/ioc/OgModuleToken.js +0 -2
  25. package/dist/output-gateway/public/ioc/OgModuleToken.js.map +1 -1
  26. package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.d.ts +1 -3
  27. package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js +3 -3
  28. package/dist/output-gateway/public/service/facade/VehiclePositionsFacade.js.map +1 -1
  29. package/dist/output-gateway/public/service/helpers/BoundingBoxHelper.d.ts +3 -6
  30. package/dist/output-gateway/public/service/helpers/BoundingBoxHelper.js +10 -26
  31. package/dist/output-gateway/public/service/helpers/BoundingBoxHelper.js.map +1 -1
  32. package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js +3 -11
  33. package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js.map +1 -1
  34. package/dist/schema-definitions/vehicle-positions/models/interfaces/VPTripsLastPositionInterfaces.d.ts +1 -2
  35. package/package.json +3 -3
  36. package/dist/helpers/geo/GeoMeasurementHelper.d.ts +0 -17
  37. package/dist/helpers/geo/GeoMeasurementHelper.js +0 -65
  38. package/dist/helpers/geo/GeoMeasurementHelper.js.map +0 -1
  39. package/dist/helpers/geo/interfaces/IGeoMeasurementHelper.d.ts +0 -8
  40. package/dist/helpers/geo/interfaces/IGeoMeasurementHelper.js +0 -3
  41. package/dist/helpers/geo/interfaces/IGeoMeasurementHelper.js.map +0 -1
  42. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.d.ts +0 -17
  43. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js +0 -76
  44. package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/anchor-points/AnchorPointSegmenter.js.map +0 -1
  45. package/dist/output-gateway/public/service/helpers/interfaces/IBoundingBoxHelper.d.ts +0 -4
  46. package/dist/output-gateway/public/service/helpers/interfaces/IBoundingBoxHelper.js +0 -3
  47. package/dist/output-gateway/public/service/helpers/interfaces/IBoundingBoxHelper.js.map +0 -1
@@ -115,10 +115,10 @@ INSERT INTO vehiclepositions_metro_runs_messages (route_name, message_timestamp,
115
115
  ('A', concat(CURRENT_DATE,'T08:20:13Z')::timestamp, '9', '9', '175', '1209', -15, concat(CURRENT_DATE,'T08:19:58Z')::timestamp, (SELECT origin_datetime FROM init_values), (SELECT origin_datetime FROM init_values));
116
116
 
117
117
  INSERT INTO vehiclepositions_trips (cis_line_id,cis_trip_number,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,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,provider_source_type) VALUES
118
- (NULL,NULL,5,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,'L991','A','991_78_220321',concat(CURRENT_DATE,'T10:32:35+02:00_991_78_220321_5_5'),concat(CURRENT_DATE,'T09:14:51Z')::timestamp,NULL,NULL,'10:32:35',concat(CURRENT_DATE,'T08:32:35Z')::timestamp,1,true,NULL,NULL,NULL,NULL,'DP PRAHA','991','DP PRAHA',NULL,'Skalka',NULL,1,NULL,30,NULL,concat(CURRENT_DATE,'T09:00:40Z')::timestamp,NULL,concat('{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":null,"firstPositionDelay":null},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionDelay":null,"lastPositionId":null,"lastPositionOriginTimestamp":null,"lastPositionTracking":null,"lastPositionCanceled":null,"lastPositionBeforeTrackDelayed":null,"lastPositionState":null,"tripId":"', concat(CURRENT_DATE,'T10:32:35+02:00_991_78_220321_5_5'), '"}')::json, '3'),
119
- (NULL,NULL,5,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,'L991','A','991_77_220901',concat(CURRENT_DATE,'T09:55:10+02:00_991_77_220901_5_5'),concat(CURRENT_DATE,'T09:14:51Z')::timestamp,NULL,NULL,'09:55:10',concat(CURRENT_DATE,'T07:55:10Z')::timestamp,1,true,NULL,NULL,NULL,NULL,'DP PRAHA','991','DP PRAHA',NULL,'Nemocnice Motol',NULL,1,NULL,29,NULL,concat(CURRENT_DATE,'T08:26:20Z')::timestamp,NULL,concat('{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":null,"firstPositionDelay":null},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionDelay":null,"lastPositionId":null,"lastPositionOriginTimestamp":null,"lastPositionTracking":null,"lastPositionCanceled":null,"lastPositionBeforeTrackDelayed":null,"lastPositionState":null,"tripId":"', concat(CURRENT_DATE,'T09:55:10+02:00_991_77_220901_5_5'), '"}')::json, '3'),
120
- (NULL,NULL,5,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,'L991','A','991_124_201230',concat(CURRENT_DATE,'T11:02:40+02:00_991_124_201230_5_5'),concat(CURRENT_DATE,'T09:14:51Z')::timestamp,NULL,NULL,'11:02:40',concat(CURRENT_DATE,'T09:02:40Z')::timestamp,1,true,NULL,NULL,NULL,NULL,'DP PRAHA','991','DP PRAHA',NULL,'Nemocnice Motol',NULL,1,NULL,31,NULL,concat(CURRENT_DATE,'T09:31:20Z')::timestamp,NULL,concat('{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":null,"firstPositionDelay":null},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionDelay":null,"lastPositionId":null,"lastPositionOriginTimestamp":null,"lastPositionTracking":null,"lastPositionCanceled":null,"lastPositionBeforeTrackDelayed":null,"lastPositionState":null,"tripId":"', concat(CURRENT_DATE,'T11:02:40+02:00_991_124_201230_5_5'), '"}')::json, '3'),
121
- (NULL,NULL,9,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,'L991','A','991_294_220901',concat(CURRENT_DATE,'T10:04:35+02:00_991_294_220901_9_9'),concat(CURRENT_DATE,'T06:14:51Z')::timestamp,NULL,NULL,'10:04:35',concat(CURRENT_DATE,'T08:04:35Z')::timestamp,1,true,NULL,NULL,NULL,NULL,'DP PRAHA','991','DP PRAHA',NULL,'Skalka',NULL,1,NULL,32,NULL,concat(CURRENT_DATE,'T08:32:40Z')::timestamp,NULL,concat('{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":null,"firstPositionDelay":null},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionDelay":null,"lastPositionId":null,"lastPositionOriginTimestamp":null,"lastPositionTracking":null,"lastPositionCanceled":null,"lastPositionBeforeTrackDelayed":null,"lastPositionState":null,"tripId":"', concat(CURRENT_DATE,'T10:04:35+02:00_991_294_220901_9_9'), '"}')::json, '3');
118
+ (NULL,NULL,5,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,'L991','A','991_78_220321',concat(CURRENT_DATE,'T10:32:35+02:00_991_78_220321_5_5'),concat(CURRENT_DATE,'T09:14:51Z')::timestamp,NULL,NULL,'10:32:35',concat(CURRENT_DATE,'T08:32:35Z')::timestamp,1,true,NULL,NULL,NULL,NULL,'DP PRAHA','991','DP PRAHA',NULL,'Skalka',NULL,1,NULL,30,NULL,concat(CURRENT_DATE,'T09:00:40Z')::timestamp,NULL,concat('{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":null,"firstPositionDelay":null},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionDelay":null,"lastPositionId":null,"lastPositionOriginTimestamp":null,"lastPositionTracking":null,"lastPositionCanceled":null,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":false,"tripId":"', concat(CURRENT_DATE,'T10:32:35+02:00_991_78_220321_5_5'), '"}')::json, '3'),
119
+ (NULL,NULL,5,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,'L991','A','991_77_220901',concat(CURRENT_DATE,'T09:55:10+02:00_991_77_220901_5_5'),concat(CURRENT_DATE,'T09:14:51Z')::timestamp,NULL,NULL,'09:55:10',concat(CURRENT_DATE,'T07:55:10Z')::timestamp,1,true,NULL,NULL,NULL,NULL,'DP PRAHA','991','DP PRAHA',NULL,'Nemocnice Motol',NULL,1,NULL,29,NULL,concat(CURRENT_DATE,'T08:26:20Z')::timestamp,NULL,concat('{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":null,"firstPositionDelay":null},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionDelay":null,"lastPositionId":null,"lastPositionOriginTimestamp":null,"lastPositionTracking":null,"lastPositionCanceled":null,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":false,"tripId":"', concat(CURRENT_DATE,'T09:55:10+02:00_991_77_220901_5_5'), '"}')::json, '3'),
120
+ (NULL,NULL,5,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,'L991','A','991_124_201230',concat(CURRENT_DATE,'T11:02:40+02:00_991_124_201230_5_5'),concat(CURRENT_DATE,'T09:14:51Z')::timestamp,NULL,NULL,'11:02:40',concat(CURRENT_DATE,'T09:02:40Z')::timestamp,1,true,NULL,NULL,NULL,NULL,'DP PRAHA','991','DP PRAHA',NULL,'Nemocnice Motol',NULL,1,NULL,31,NULL,concat(CURRENT_DATE,'T09:31:20Z')::timestamp,NULL,concat('{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":null,"firstPositionDelay":null},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionDelay":null,"lastPositionId":null,"lastPositionOriginTimestamp":null,"lastPositionTracking":null,"lastPositionCanceled":null,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":false,"tripId":"', concat(CURRENT_DATE,'T11:02:40+02:00_991_124_201230_5_5'), '"}')::json, '3'),
121
+ (NULL,NULL,9,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,'L991','A','991_294_220901',concat(CURRENT_DATE,'T10:04:35+02:00_991_294_220901_9_9'),concat(CURRENT_DATE,'T06:14:51Z')::timestamp,NULL,NULL,'10:04:35',concat(CURRENT_DATE,'T08:04:35Z')::timestamp,1,true,NULL,NULL,NULL,NULL,'DP PRAHA','991','DP PRAHA',NULL,'Skalka',NULL,1,NULL,32,NULL,concat(CURRENT_DATE,'T08:32:40Z')::timestamp,NULL,concat('{"atStopStreak":{"stop_sequence":null,"firstPositionTimestamp":null,"firstPositionDelay":null},"lastPositionLastStop":{"id":null,"sequence":null,"arrival_time":null,"departure_time":null},"lastPositionDelay":null,"lastPositionId":null,"lastPositionOriginTimestamp":null,"lastPositionTracking":null,"lastPositionCanceled":null,"lastPositionBeforeTrackDelayed":null,"isLastPositionAfterTrack":false,"tripId":"', concat(CURRENT_DATE,'T10:04:35+02:00_991_294_220901_9_9'), '"}')::json, '3');
122
122
 
123
123
  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) VALUES
124
124
  (concat(CURRENT_DATE,'T09:14:32Z')::timestamp,NULL,NULL,NULL,'U306Z101P',0,NULL,50.09837,14.36282,'10:20:08',concat(CURRENT_DATE,'T08:20:08Z')::timestamptz,false,concat(CURRENT_DATE,'T10:32:35+02:00_991_78_220321_5_5'),NULL,NULL,NULL,concat(CURRENT_DATE,'T09:14:32Z')::timestamp,NULL,26,NULL,NULL,NULL,NULL,NULL,1,NULL,NULL,NULL,concat(CURRENT_DATE,'T08:32:35Z')::timestamp,concat(CURRENT_DATE,'T08:32:35Z')::timestamp,NULL,'processed','before_track','U157Z102P',NULL,NULL,NULL,NULL,NULL,NULL,concat(CURRENT_DATE,'T09:40:00Z')::timestamp),
@@ -153,14 +153,14 @@ 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,"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,"lastPositionState":"after_track","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,"lastPositionState":null,"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,"lastPositionState":"after_track","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,"lastPositionState":"after_track","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,"lastPositionState":"after_track","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,"lastPositionState":null,"tripId":"2022-12-23T11:31:00Z_100212_212_1043"}'),
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,"lastPositionState":"after_track","tripId":"2022-12-23T11:54:00Z_100212_212_1046"}'),
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,"lastPositionState":"after_track","tripId":"2022-12-23T12:01:00Z_100212_212_1045"}');
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
+ (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
+ (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
 
165
165
  --(E'2022-12-23 12:36:58.062+01',NULL,9,NULL,NULL,2.408,FALSE,50.10024,14.66322,E'12:36:27',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '12:36:27')*1000,0,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,1671795000000,1671795000000,NULL,NULL,NULL,E'processed',E'after_track',NULL,NULL,NULL,NULL,NULL,NULL,NULL,1671795687000),
166
166
  --(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',EXTRACT(EPOCH FROM (SELECT now_date FROM init_values) + INTERVAL '12:36:27')*1000,2,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,1671795300000,1671795300000,1671795360000,1671795360000,NULL,E'processed',E'at_stop',E'U4137Z1P',5,NULL,NULL,E'Všestarská',NULL,NULL,1671795687000),
@@ -1,2 +1,3 @@
1
- declare const PidContainer: import("tsyringe").DependencyContainer;
1
+ import { DependencyContainer } from "@golemio/core/dist/shared/tsyringe";
2
+ declare const PidContainer: DependencyContainer;
2
3
  export { PidContainer };
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PidContainer = void 0;
4
- const GeoMeasurementHelper_1 = require("../../helpers/geo/GeoMeasurementHelper");
5
4
  const DeparturePresetsRepository_1 = require("../ropid-gtfs/data-access/DeparturePresetsRepository");
6
5
  const RopidDeparturesPresetsTransformation_1 = require("../ropid-gtfs/transformations/RopidDeparturesPresetsTransformation");
7
6
  const PresetLogRepository_1 = require("../ropid-gtfs/workers/presets/data-access/PresetLogRepository");
8
- const PresetLogDataSourceFactory_1 = require("../ropid-gtfs/workers/presets/datasources/PresetLogDataSourceFactory");
9
7
  const GrafanaLokiDataSourceProvider_1 = require("../ropid-gtfs/workers/presets/datasources/grafana-loki/GrafanaLokiDataSourceProvider");
8
+ const PresetLogDataSourceFactory_1 = require("../ropid-gtfs/workers/presets/datasources/PresetLogDataSourceFactory");
10
9
  const LogFilter_1 = require("../ropid-gtfs/workers/presets/helpers/LogFilter");
11
10
  const RopidMonitoringService_1 = require("../ropid-gtfs/workers/presets/helpers/RopidMonitoringService");
12
11
  const PresetLogTransformation_1 = require("../ropid-gtfs/workers/presets/transformations/PresetLogTransformation");
@@ -16,11 +15,6 @@ const ModuleContainerToken_1 = require("./ModuleContainerToken");
16
15
  const PidContainer = Di_1.IntegrationEngineContainer.createChildContainer();
17
16
  exports.PidContainer = PidContainer;
18
17
  //#endregion
19
- //#region Helpers
20
- PidContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.GeoMeasurementHelper, GeoMeasurementHelper_1.GeoMeasurementHelper);
21
- PidContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.PresetLogFilter, LogFilter_1.LogFilter);
22
- PidContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.RopidMonitoringService, RopidMonitoringService_1.RopidMonitoringService);
23
- //#endregion
24
18
  //#region Datasources
25
19
  PidContainer.register(ModuleContainerToken_1.ModuleContainerToken.GrafanaLokiDataSourceProvider, GrafanaLokiDataSourceProvider_1.GrafanaLokiDataSourceProvider);
26
20
  PidContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.PresetLogDataSourceFactory, PresetLogDataSourceFactory_1.PresetLogDataSourceFactory);
@@ -32,4 +26,8 @@ PidContainer.register(ModuleContainerToken_1.ModuleContainerToken.PresetLogRepos
32
26
  //#region Transformations
33
27
  PidContainer.register(ModuleContainerToken_1.ModuleContainerToken.RopidDeparturesPresetsTransformation, RopidDeparturesPresetsTransformation_1.RopidDeparturesPresetsTransformation);
34
28
  PidContainer.register(ModuleContainerToken_1.ModuleContainerToken.PresetLogTransformation, PresetLogTransformation_1.PresetLogTransformation);
29
+ //#endregion
30
+ //#region Helpers
31
+ PidContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.PresetLogFilter, LogFilter_1.LogFilter);
32
+ PidContainer.registerSingleton(ModuleContainerToken_1.ModuleContainerToken.RopidMonitoringService, RopidMonitoringService_1.RopidMonitoringService);
35
33
  //# sourceMappingURL=Di.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,iFAAyE;AACzE,qGAAmG;AACnG,6HAA2H;AAC3H,uGAAqG;AACrG,qHAAmH;AACnH,wIAAsI;AACtI,+EAA6E;AAC7E,yGAAuG;AACvG,mHAAiH;AACjH,qEAA0F;AAC1F,iEAA8D;AAE9D,wBAAwB;AACxB,MAAM,YAAY,GAAG,+BAA0B,CAAC,oBAAoB,EAAE,CAAC;AAwB9D,oCAAY;AAvBrB,YAAY;AAEZ,iBAAiB;AACjB,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,oBAAoB,EAAE,2CAAoB,CAAC,CAAC;AAChG,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,eAAe,EAAE,qBAAS,CAAC,CAAC;AAChF,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,sBAAsB,EAAE,+CAAsB,CAAC,CAAC;AACpG,YAAY;AAEZ,qBAAqB;AACrB,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC;AACzG,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AAC5G,YAAY;AAEZ,qBAAqB;AACrB,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AACnG,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,mBAAmB,EAAE,yCAAmB,CAAC,CAAC;AACrF,YAAY;AAEZ,yBAAyB;AACzB,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,oCAAoC,EAAE,2EAAoC,CAAC,CAAC;AACvH,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"Di.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/Di.ts"],"names":[],"mappings":";;;AAAA,qGAAmG;AACnG,6HAA2H;AAC3H,uGAAqG;AACrG,wIAAsI;AACtI,qHAAmH;AACnH,+EAA6E;AAC7E,yGAAuG;AACvG,mHAAiH;AACjH,qEAA0F;AAE1F,iEAA8D;AAE9D,wBAAwB;AACxB,MAAM,YAAY,GAAwB,+BAA0B,CAAC,oBAAoB,EAAE,CAAC;AAuBnF,oCAAY;AAtBrB,YAAY;AAEZ,qBAAqB;AACrB,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,6BAA6B,EAAE,6DAA6B,CAAC,CAAC;AACzG,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AAC5G,YAAY;AAEZ,qBAAqB;AACrB,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,0BAA0B,EAAE,uDAA0B,CAAC,CAAC;AACnG,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,mBAAmB,EAAE,yCAAmB,CAAC,CAAC;AACrF,YAAY;AAEZ,yBAAyB;AACzB,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,oCAAoC,EAAE,2EAAoC,CAAC,CAAC;AACvH,YAAY,CAAC,QAAQ,CAAC,2CAAoB,CAAC,uBAAuB,EAAE,iDAAuB,CAAC,CAAC;AAC7F,YAAY;AAEZ,iBAAiB;AACjB,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,eAAe,EAAE,qBAAS,CAAC,CAAC;AAChF,YAAY,CAAC,iBAAiB,CAAC,2CAAoB,CAAC,sBAAsB,EAAE,+CAAsB,CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
1
  declare const ModuleContainerToken: {
2
- GeoMeasurementHelper: symbol;
3
2
  DeparturePresetsRepository: symbol;
4
3
  RopidDeparturesPresetsTransformation: symbol;
5
4
  GrafanaLokiDataSourceProvider: symbol;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ModuleContainerToken = void 0;
4
4
  const ModuleContainerToken = {
5
- GeoMeasurementHelper: Symbol(),
6
5
  DeparturePresetsRepository: Symbol(),
7
6
  RopidDeparturesPresetsTransformation: Symbol(),
8
7
  GrafanaLokiDataSourceProvider: Symbol(),
@@ -1 +1 @@
1
- {"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/ModuleContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG;IACzB,oBAAoB,EAAE,MAAM,EAAE;IAC9B,0BAA0B,EAAE,MAAM,EAAE;IACpC,oCAAoC,EAAE,MAAM,EAAE;IAC9C,6BAA6B,EAAE,MAAM,EAAE;IACvC,0BAA0B,EAAE,MAAM,EAAE;IACpC,uBAAuB,EAAE,MAAM,EAAE;IACjC,mBAAmB,EAAE,MAAM,EAAE;IAC7B,eAAe,EAAE,MAAM,EAAE;IACzB,sBAAsB,EAAE,MAAM,EAAE;CACnC,CAAC;AAEO,oDAAoB"}
1
+ {"version":3,"file":"ModuleContainerToken.js","sourceRoot":"","sources":["../../../src/integration-engine/ioc/ModuleContainerToken.ts"],"names":[],"mappings":";;;AAAA,MAAM,oBAAoB,GAAG;IACzB,0BAA0B,EAAE,MAAM,EAAE;IACpC,oCAAoC,EAAE,MAAM,EAAE;IAC9C,6BAA6B,EAAE,MAAM,EAAE;IACvC,0BAA0B,EAAE,MAAM,EAAE;IACpC,uBAAuB,EAAE,MAAM,EAAE;IACjC,mBAAmB,EAAE,MAAM,EAAE;IAC7B,eAAe,EAAE,MAAM,EAAE;IACzB,sBAAsB,EAAE,MAAM,EAAE;CACnC,CAAC;AAEO,oDAAoB"}
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const ModuleContainerToken_1 = require("../../../../ioc/ModuleContainerToken");
4
- const Di_1 = require("../../../ioc/Di");
6
+ const PositionCalculator_1 = __importDefault(require("./PositionCalculator"));
5
7
  class DPPUtils {
6
8
  static isOnTheWayFromGarage(originTimestamp, firstSegment, currentCoordinates, firstStopCoordinates) {
7
- const geoHelper = Di_1.VPContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.GeoMeasurementHelper);
8
9
  if (originTimestamp.getTime() < new Date(firstSegment.start_timestamp).valueOf() - this.TIME_THRESHOLD_IN_MS) {
9
- const distanceFromFirstStop = geoHelper.getDistanceInKilometers(currentCoordinates, firstStopCoordinates);
10
+ const distanceFromFirstStop = PositionCalculator_1.default.getDistanceInKilometers(currentCoordinates, firstStopCoordinates);
10
11
  return distanceFromFirstStop > this.DISTANCE_THRESHOLD_IN_KM;
11
12
  }
12
13
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"DPPUtils.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.ts"],"names":[],"mappings":";;AACA,+EAAoE;AACpE,wCAA2D;AAK3D,MAAqB,QAAQ;IAiCjB,MAAM,CAAC,oBAAoB,CAC/B,eAAqB,EACrB,YAA0B,EAC1B,kBAAoC,EACpC,oBAAsC;QAEtC,MAAM,SAAS,GAAG,gBAAW,CAAC,OAAO,CAAwB,2CAAoB,CAAC,oBAAoB,CAAC,CAAC;QAExG,IAAI,eAAe,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,oBAAoB,EAAE;YAC1G,MAAM,qBAAqB,GAAG,SAAS,CAAC,uBAAuB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;YAC1G,OAAO,qBAAqB,GAAG,IAAI,CAAC,wBAAwB,CAAC;SAChE;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAC7B,WAAyB,EACzB,UAAkB,EAClB,SAAkB,EAClB,oBAAuE;QAEvE,qGAAqG;QACrG,+GAA+G;QAC/G,OAAO,WAAW,CAAC,OAAO,KAAK,UAAU,IAAI,CAAC,SAAS,IAAI,oBAAoB,IAAI,IAAI,CAAC;IAC5F,CAAC;;AAzDa,wBAAe,GAAG,UAAU,CAAC;AAC7B,6BAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACrC,iCAAwB,GAAG,GAAG,CAAC;AAE7C,4FAA4F;AAC9E,oBAAW,GAAG,CACxB,mBAA2B,EAC3B,eAAqB,EACrB,cAAsB,EACtB,kBAAoC,EACpC,oBAAsC,EACtC,QAAoC,EACpC,UAAkB,EAClB,oBAAuE,EACvE,SAAkB,EACX,EAAE;;IACT,uFAAuF;IACvF,qFAAqF;IACrF,IAAI,mBAAmB,KAAK,QAAQ,CAAC,eAAe;QAAE,OAAO,KAAK,CAAC;IACnE,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,MAAM,QAAQ,GAAG,MAAA,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,IAAI,cAAc,CAAC,0CAAE,IAAI,CAAC;IACvG,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,IAAI,QAAQ,CAAC,CAAC;IACjE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExD,OAAO,CACH,QAAQ,CAAC,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,CAAC;QACtG,QAAQ,CAAC,kBAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,CAAC,CACxF,CAAC;AACN,CAAC,CAAC;kBA/Be,QAAQ"}
1
+ {"version":3,"file":"DPPUtils.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.ts"],"names":[],"mappings":";;;;;AAGA,8EAAsD;AAEtD,MAAqB,QAAQ;IAiCjB,MAAM,CAAC,oBAAoB,CAC/B,eAAqB,EACrB,YAA0B,EAC1B,kBAAoC,EACpC,oBAAsC;QAEtC,IAAI,eAAe,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,oBAAoB,EAAE;YAC1G,MAAM,qBAAqB,GAAG,4BAAkB,CAAC,uBAAuB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;YAEnH,OAAO,qBAAqB,GAAG,IAAI,CAAC,wBAAwB,CAAC;SAChE;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,MAAM,CAAC,kBAAkB,CAC7B,WAAyB,EACzB,UAAkB,EAClB,SAAkB,EAClB,oBAAuE;QAEvE,qGAAqG;QACrG,+GAA+G;QAC/G,OAAO,WAAW,CAAC,OAAO,KAAK,UAAU,IAAI,CAAC,SAAS,IAAI,oBAAoB,IAAI,IAAI,CAAC;IAC5F,CAAC;;AAxDa,wBAAe,GAAG,UAAU,CAAC;AAC7B,6BAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACrC,iCAAwB,GAAG,GAAG,CAAC;AAE7C,4FAA4F;AAC9E,oBAAW,GAAG,CACxB,mBAA2B,EAC3B,eAAqB,EACrB,cAAsB,EACtB,kBAAoC,EACpC,oBAAsC,EACtC,QAAoC,EACpC,UAAkB,EAClB,oBAAuE,EACvE,SAAkB,EACX,EAAE;;IACT,uFAAuF;IACvF,qFAAqF;IACrF,IAAI,mBAAmB,KAAK,QAAQ,CAAC,eAAe;QAAE,OAAO,KAAK,CAAC;IACnE,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,MAAM,QAAQ,GAAG,MAAA,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,IAAI,cAAc,CAAC,0CAAE,IAAI,CAAC;IACvG,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,IAAI,QAAQ,CAAC,CAAC;IACjE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACpC,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExD,OAAO,CACH,QAAQ,CAAC,oBAAoB,CAAC,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,oBAAoB,CAAC;QACtG,QAAQ,CAAC,kBAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,oBAAoB,CAAC,CACxF,CAAC;AACN,CAAC,CAAC;kBA/Be,QAAQ"}
@@ -1,13 +1,15 @@
1
+ import * as turf from "@turf/turf";
1
2
  import { Feature, Point } from "@turf/turf";
2
3
  import { ICurrentPositionProperties, IShapeAnchorPoint } from "../interfaces/VPInterfaces";
3
4
  export default class PositionCalculator {
4
- private geoHelper;
5
- private currentPosition;
6
- constructor(currentPosition: Feature<Point, ICurrentPositionProperties>);
7
- /** Find all shape points in polygon circle, get segments with consequenting points */
8
- getShapePointsAroundPosition: (tripShapePoints: IShapeAnchorPoint[], lastStopSequence: number | null) => IShapeAnchorPoint[][];
9
- /** Sorts all points in radius by index in ascending order */
10
- getFlatPointsForPositionAdjustment: (ptsInRadius: IShapeAnchorPoint[][]) => IShapeAnchorPoint[];
11
- /** Picks only one closest point for each segment/array of points of shape */
12
- getClosestPoints: (ptsInRadius: IShapeAnchorPoint[][]) => IShapeAnchorPoint[];
5
+ static getShapePointsAroundPosition: (tripShapePoints: IShapeAnchorPoint[], currentPosition: Feature<Point, ICurrentPositionProperties>, radius: number, tripId: string) => IShapeAnchorPoint[][];
6
+ static getDistanceInKilometers(coords1: [number, number], coords2: [number, number]): number;
7
+ /**
8
+ * Picks only one closest point for each segment/array of points of shape
9
+ *
10
+ * @param {IShapeAnchorPoint[][]} ptsInRadius - Feature Point of current position
11
+ * @param {Feature<Point, ICurrentPositionProperties>} currentPosition - Feature Point of current position
12
+ * @returns {IShapeAnchorPoint[]} - Result closest point for each segment
13
+ */
14
+ static getClosestPoints: (ptsInRadius: IShapeAnchorPoint[][], currentPosition: turf.helpers.Feature<turf.helpers.Point, ICurrentPositionProperties>) => Promise<IShapeAnchorPoint[]>;
13
15
  }
@@ -1,43 +1,107 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ var _a;
2
15
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const ModuleContainerToken_1 = require("../../../../ioc/ModuleContainerToken");
4
- const Di_1 = require("../../../ioc/Di");
5
- const AnchorPointSegmenter_1 = require("./anchor-points/AnchorPointSegmenter");
6
- // Radius around GPS position (200 meters radius, 16 points polygon aka circle)
7
- const POSITION_RADIUS_IN_KM = 0.2;
16
+ const integration_engine_1 = require("@golemio/core/dist/integration-engine");
17
+ const cheap_ruler_1 = __importDefault(require("cheap-ruler"));
18
+ const ruler = (0, cheap_ruler_1.default)(50);
8
19
  class PositionCalculator {
9
- constructor(currentPosition) {
10
- /** Find all shape points in polygon circle, get segments with consequenting points */
11
- this.getShapePointsAroundPosition = (tripShapePoints, lastStopSequence) => {
12
- const anchorPointSegmenter = new AnchorPointSegmenter_1.AnchorPointSegmenter(tripShapePoints, this.currentPosition);
13
- return anchorPointSegmenter.getAnchorPointsInRadius(lastStopSequence, POSITION_RADIUS_IN_KM);
14
- };
15
- /** Sorts all points in radius by index in ascending order */
16
- this.getFlatPointsForPositionAdjustment = (ptsInRadius) => {
17
- return ptsInRadius.flat().sort((a, b) => a.index - b.index);
18
- };
19
- /** Picks only one closest point for each segment/array of points of shape */
20
- this.getClosestPoints = (ptsInRadius) => {
21
- let closestPts = [];
22
- for (const shapePoints of ptsInRadius) {
23
- let closestPoint = null;
24
- let closestDistance = Infinity;
25
- for (const point of shapePoints) {
26
- const distance = this.geoHelper.getDistanceInKilometers(this.currentPosition.geometry.coordinates, point.coordinates);
27
- if (distance < closestDistance) {
28
- closestPoint = point;
29
- closestDistance = distance;
20
+ //form [longitude, latitude]
21
+ static getDistanceInKilometers(coords1, coords2) {
22
+ return ruler.distance(coords1, coords2);
23
+ }
24
+ }
25
+ _a = PositionCalculator;
26
+ // FIND ALL SHAPE POINTS IN POLYGON CIRCLE, GET SEGMENTS WITH CONSEQUENTING POINTS
27
+ PositionCalculator.getShapePointsAroundPosition = (tripShapePoints, currentPosition, radius, tripId) => {
28
+ try {
29
+ const ptsInRadius = [];
30
+ let segmentIndex = 0;
31
+ let lastWasIn = true;
32
+ // FIND ALL SHAPE POINTS IN POLYGON CIRCLE, GET SEGMENTS WITH CONSEQUENTING POINTS
33
+ for (let i = 0; i < tripShapePoints.length; i++) {
34
+ if (ruler.distance(tripShapePoints[i].coordinates, currentPosition.geometry.coordinates) <=
35
+ radius) {
36
+ if (!lastWasIn) {
37
+ if (ptsInRadius[segmentIndex] !== undefined) {
38
+ segmentIndex++;
30
39
  }
40
+ lastWasIn = true;
31
41
  }
32
- if (closestPoint !== null) {
33
- closestPts.push(closestPoint);
42
+ if (ptsInRadius[segmentIndex] === undefined) {
43
+ ptsInRadius[segmentIndex] = [];
34
44
  }
45
+ ptsInRadius[segmentIndex].push(tripShapePoints[i]);
46
+ }
47
+ else {
48
+ lastWasIn = false;
35
49
  }
36
- return closestPts;
37
- };
38
- this.geoHelper = Di_1.VPContainer.resolve(ModuleContainerToken_1.ModuleContainerToken.GeoMeasurementHelper);
39
- this.currentPosition = currentPosition;
50
+ }
51
+ return ptsInRadius;
40
52
  }
41
- }
53
+ catch (err) {
54
+ integration_engine_1.log.error(
55
+ // eslint-disable-next-line max-len
56
+ `Unable to calculate getShapePointsAroundPosition for tripId: ${tripId}, tripShapePoints.length: ${tripShapePoints.length}, error message: ${err.message}`);
57
+ return [];
58
+ }
59
+ };
60
+ /**
61
+ * Picks only one closest point for each segment/array of points of shape
62
+ *
63
+ * @param {IShapeAnchorPoint[][]} ptsInRadius - Feature Point of current position
64
+ * @param {Feature<Point, ICurrentPositionProperties>} currentPosition - Feature Point of current position
65
+ * @returns {IShapeAnchorPoint[]} - Result closest point for each segment
66
+ */
67
+ PositionCalculator.getClosestPoints = (ptsInRadius, currentPosition) => __awaiter(void 0, void 0, void 0, function* () {
68
+ const closestPts = [];
69
+ const innerPtsInRadiusIterator = (i, options, cb) => {
70
+ // end of iteration
71
+ if (ptsInRadius[i].length === options.k) {
72
+ return cb(options.nPt);
73
+ }
74
+ const distance = ruler.distance(currentPosition.geometry.coordinates, ptsInRadius[i][options.k].coordinates);
75
+ if (distance < options.nPt.distance) {
76
+ options.nPt = ptsInRadius[i][options.k];
77
+ options.nPt.distance = distance;
78
+ }
79
+ // next step
80
+ options.k++;
81
+ innerPtsInRadiusIterator(i, options, cb);
82
+ };
83
+ const ptsInRadiusIterator = (i, cb) => {
84
+ // end of iteration
85
+ if (ptsInRadius.length === i) {
86
+ return cb();
87
+ }
88
+ const nPt = { distance: Infinity };
89
+ innerPtsInRadiusIterator(i, {
90
+ k: 0,
91
+ nPt,
92
+ }, (res) => {
93
+ // so now you have all possible nearest points on shape
94
+ // (could be more if shape line is overlaping itself)
95
+ closestPts.push(res);
96
+ // next step
97
+ ptsInRadiusIterator(i + 1, cb);
98
+ });
99
+ };
100
+ return new Promise((resolve) => {
101
+ ptsInRadiusIterator(0, () => {
102
+ resolve(closestPts);
103
+ });
104
+ });
105
+ });
42
106
  exports.default = PositionCalculator;
43
107
  //# sourceMappingURL=PositionCalculator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PositionCalculator.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionCalculator.ts"],"names":[],"mappings":";;AACA,+EAAoE;AACpE,wCAA2D;AAG3D,+EAA4E;AAE5E,+EAA+E;AAC/E,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC,MAAqB,kBAAkB;IAInC,YAAY,eAA2D;QAKvE,sFAAsF;QAC/E,iCAA4B,GAAG,CAClC,eAAoC,EACpC,gBAA+B,EACV,EAAE;YACvB,MAAM,oBAAoB,GAAG,IAAI,2CAAoB,CAAC,eAAe,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;YAC7F,OAAO,oBAAoB,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,CAAC;QACjG,CAAC,CAAC;QAEF,6DAA6D;QACtD,uCAAkC,GAAG,CAAC,WAAkC,EAAuB,EAAE;YACpG,OAAO,WAAW,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;QAChE,CAAC,CAAC;QAEF,6EAA6E;QACtE,qBAAgB,GAAG,CAAC,WAAkC,EAAuB,EAAE;YAClF,IAAI,UAAU,GAAwB,EAAE,CAAC;YAEzC,KAAK,MAAM,WAAW,IAAI,WAAW,EAAE;gBACnC,IAAI,YAAY,GAA6B,IAAI,CAAC;gBAClD,IAAI,eAAe,GAAG,QAAQ,CAAC;gBAE/B,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE;oBAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,uBAAuB,CACnD,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,WAAW,EACzC,KAAK,CAAC,WAAW,CACpB,CAAC;oBAEF,IAAI,QAAQ,GAAG,eAAe,EAAE;wBAC5B,YAAY,GAAG,KAAK,CAAC;wBACrB,eAAe,GAAG,QAAQ,CAAC;qBAC9B;iBACJ;gBAED,IAAI,YAAY,KAAK,IAAI,EAAE;oBACvB,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;iBACjC;aACJ;YAED,OAAO,UAAU,CAAC;QACtB,CAAC,CAAC;QA5CE,IAAI,CAAC,SAAS,GAAG,gBAAW,CAAC,OAAO,CAAwB,2CAAoB,CAAC,oBAAoB,CAAC,CAAC;QACvG,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;CA2CJ;AAlDD,qCAkDC"}
1
+ {"version":3,"file":"PositionCalculator.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionCalculator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8EAA4D;AAG5D,8DAAqC;AAGrC,MAAM,KAAK,GAAG,IAAA,qBAAU,EAAC,EAAE,CAAC,CAAC;AAE7B,MAAqB,kBAAkB;IA4CnC,4BAA4B;IACrB,MAAM,CAAC,uBAAuB,CAAC,OAAyB,EAAE,OAAyB;QACtF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;;;AA9CD,kFAAkF;AACpE,+CAA4B,GAAG,CACzC,eAAoC,EACpC,eAA2D,EAC3D,MAAc,EACd,MAAc,EACO,EAAE;IACvB,IAAI;QACA,MAAM,WAAW,GAA0B,EAAE,CAAC;QAC9C,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,kFAAkF;QAClF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC7C,IACI,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,eAAe,CAAC,QAAQ,CAAC,WAA+B,CAAC;gBACxG,MAAM,EACR;gBACE,IAAI,CAAC,SAAS,EAAE;oBACZ,IAAI,WAAW,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE;wBACzC,YAAY,EAAE,CAAC;qBAClB;oBACD,SAAS,GAAG,IAAI,CAAC;iBACpB;gBACD,IAAI,WAAW,CAAC,YAAY,CAAC,KAAK,SAAS,EAAE;oBACzC,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;iBAClC;gBACD,WAAW,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;aACtD;iBAAM;gBACH,SAAS,GAAG,KAAK,CAAC;aACrB;SACJ;QAED,OAAO,WAAW,CAAC;KACtB;IAAC,OAAO,GAAG,EAAE;QACV,wBAAG,CAAC,KAAK;QACL,mCAAmC;QACnC,gEAAgE,MAAM,6BAA6B,eAAe,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,CAC7J,CAAC;QACF,OAAO,EAAE,CAAC;KACb;AACL,CAAC,AAxCyC,CAwCxC;AAOF;;;;;;GAMG;AACW,mCAAgB,GAAG,CAC7B,WAAkC,EAClC,eAAqF,EACzD,EAAE;IAC9B,MAAM,UAAU,GAAwB,EAAE,CAAC;IAE3C,MAAM,wBAAwB,GAAG,CAC7B,CAAS,EACT,OAGC,EACD,EAAsB,EAClB,EAAE;QACN,mBAAmB;QACnB,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,EAAE;YACrC,OAAO,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;SAC1B;QAED,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAC3B,eAAe,CAAC,QAAQ,CAAC,WAA+B,EACxD,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CACxC,CAAC;QACF,IAAI,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE;YACjC,OAAO,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAC;SACnC;QAED,YAAY;QACZ,OAAO,CAAC,CAAC,EAAE,CAAC;QACZ,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC;IACF,MAAM,mBAAmB,GAAG,CAAC,CAAS,EAAE,EAAc,EAAQ,EAAE;QAC5D,mBAAmB;QACnB,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC1B,OAAO,EAAE,EAAE,CAAC;SACf;QAED,MAAM,GAAG,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;QACnC,wBAAwB,CACpB,CAAC,EACD;YACI,CAAC,EAAE,CAAC;YACJ,GAAG;SACN,EACD,CAAC,GAAG,EAAE,EAAE;YACJ,uDAAuD;YACvD,qDAAqD;YACrD,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAErB,YAAY;YACZ,mBAAmB,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;QACnC,CAAC,CACJ,CAAC;IACN,CAAC,CAAC;IACF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE;YACxB,OAAO,CAAC,UAAU,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAA,AA5D6B,CA4D5B;kBApHe,kBAAkB"}
@@ -172,7 +172,7 @@ PositionsManager.computePositions = (tripPositions, schedule) => __awaiter(void
172
172
  * @returns {void} - void
173
173
  */
174
174
  PositionsManager.updatePositions = (options, schedule) => __awaiter(void 0, void 0, void 0, function* () {
175
- var _b, _c, _d, _e, _f, _g, _h;
175
+ var _b, _c, _d, _e, _f, _g;
176
176
  const { tripPositions, startDayTimestamp, startTimestamp, endTimestamp, context, computedPositions, gtfsRouteType } = options;
177
177
  for (let i = 0; i < tripPositions.positions.length; i++) {
178
178
  const position = tripPositions.positions[i];
@@ -249,12 +249,15 @@ PositionsManager.updatePositions = (options, schedule) => __awaiter(void 0, void
249
249
  positionToUpdate.valid_to = ValidToCalculator_1.default.getValidToAttribute(positionToUpdate, position, gtfsRouteType, tripPositions.gtfsData, startTimestamp, startDayTimestamp);
250
250
  computedPositions.push(positionToUpdate);
251
251
  }
252
- context.lastPositionState = (_f = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.state_position) !== null && _f !== void 0 ? _f : position.state_position;
252
+ // set if last position is AFTER_TRACK
253
+ context.isLastPositionAfterTrack =
254
+ (positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.state_position) === const_1.StatePositionEnum.AFTER_TRACK ||
255
+ position.state_position === const_1.StatePositionEnum.AFTER_TRACK;
253
256
  // set last known BEFORE_TRACK_DELAYED position
254
257
  if (position.state_position === const_1.StatePositionEnum.BEFORE_TRACK_DELAYED) {
255
258
  context.lastPositionBeforeTrackDelayed = {
256
- delay: (_g = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.delay) !== null && _g !== void 0 ? _g : position.delay,
257
- origin_timestamp: (_h = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.origin_timestamp) !== null && _h !== void 0 ? _h : position.origin_timestamp,
259
+ delay: (_f = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.delay) !== null && _f !== void 0 ? _f : position.delay,
260
+ origin_timestamp: (_g = positionToUpdate === null || positionToUpdate === void 0 ? void 0 : positionToUpdate.origin_timestamp) !== null && _g !== void 0 ? _g : position.origin_timestamp,
258
261
  };
259
262
  }
260
263
  // set last position tracking (only for at_stop and on_track)
@@ -323,7 +326,7 @@ PositionsManager.getCurrentContext = (tripPositions) => {
323
326
  lastPositionTracking: null,
324
327
  lastPositionCanceled: null,
325
328
  lastPositionBeforeTrackDelayed: null,
326
- lastPositionState: null,
329
+ isLastPositionAfterTrack: false,
327
330
  tripId: tripPositions.id,
328
331
  };
329
332
  return context;
@@ -354,42 +357,34 @@ PositionsManager.setPositionUpdateHandler = (position) => {
354
357
  * @returns {IPositionToUpdate} - Position object to update
355
358
  */
356
359
  PositionsManager.getEstimatedPoint = (tripGtfsData, currentPosition, context, startDayTimestamp, gtfsRouteType) => __awaiter(void 0, void 0, void 0, function* () {
357
- var _j, _k, _l, _m, _o, _p, _q, _r;
358
- const positionCalculator = new PositionCalculator_1.default(currentPosition);
360
+ var _h, _j, _k, _l, _m, _o, _p, _q;
361
+ // init radius around GPS position ( 200 meters radius, 16 points polygon aka circle)
362
+ const radius = 0.2;
359
363
  const defaultStatePosition = const_1.StatePositionEnum.OFF_TRACK;
360
364
  // Initial value
361
365
  let estimatedPoint = Object.assign({ id: currentPosition.properties.id, state_position: defaultStatePosition, state_process: const_1.StateProcessEnum.PROCESSED, tcp_event: currentPosition.properties.tcp_event, valid_to: ValidToCalculator_1.default.getDefaultValidToAttribute(currentPosition.properties.origin_timestamp) }, (context &&
362
- ((_j = context.lastPositionTracking) === null || _j === void 0 ? void 0 : _j.properties.last_stop_sequence) && {
363
- shape_dist_traveled: (_k = context.lastPositionTracking) === null || _k === void 0 ? void 0 : _k.properties.shape_dist_traveled,
364
- last_stop_arrival_time: ((_l = context.lastPositionTracking) === null || _l === void 0 ? void 0 : _l.properties.last_stop_arrival_time)
365
- ? new Date((_m = context.lastPositionTracking) === null || _m === void 0 ? void 0 : _m.properties.last_stop_arrival_time)
366
+ ((_h = context.lastPositionTracking) === null || _h === void 0 ? void 0 : _h.properties.last_stop_sequence) && {
367
+ shape_dist_traveled: (_j = context.lastPositionTracking) === null || _j === void 0 ? void 0 : _j.properties.shape_dist_traveled,
368
+ last_stop_arrival_time: ((_k = context.lastPositionTracking) === null || _k === void 0 ? void 0 : _k.properties.last_stop_arrival_time)
369
+ ? new Date((_l = context.lastPositionTracking) === null || _l === void 0 ? void 0 : _l.properties.last_stop_arrival_time)
366
370
  : undefined,
367
- last_stop_departure_time: ((_o = context.lastPositionTracking) === null || _o === void 0 ? void 0 : _o.properties.last_stop_departure_time)
368
- ? new Date((_p = context.lastPositionTracking) === null || _p === void 0 ? void 0 : _p.properties.last_stop_departure_time)
371
+ last_stop_departure_time: ((_m = context.lastPositionTracking) === null || _m === void 0 ? void 0 : _m.properties.last_stop_departure_time)
372
+ ? new Date((_o = context.lastPositionTracking) === null || _o === void 0 ? void 0 : _o.properties.last_stop_departure_time)
369
373
  : undefined,
370
- last_stop_sequence: (_q = context.lastPositionTracking) === null || _q === void 0 ? void 0 : _q.properties.last_stop_sequence,
371
- last_stop_id: (_r = context.lastPositionTracking) === null || _r === void 0 ? void 0 : _r.properties.last_stop_id,
374
+ last_stop_sequence: (_p = context.lastPositionTracking) === null || _p === void 0 ? void 0 : _p.properties.last_stop_sequence,
375
+ last_stop_id: (_q = context.lastPositionTracking) === null || _q === void 0 ? void 0 : _q.properties.last_stop_id,
372
376
  }));
373
- let lastStopSequence = null;
374
- if ((context === null || context === void 0 ? void 0 : context.lastPositionState) === const_1.StatePositionEnum.BEFORE_TRACK) {
375
- lastStopSequence = 1;
376
- }
377
- else if (context === null || context === void 0 ? void 0 : context.lastPositionTracking) {
378
- lastStopSequence = context.lastPositionTracking.properties.last_stop_sequence;
379
- }
380
377
  // returns array of segments (row of points) of shape anchor points around gps
381
- const ptsInRadius = positionCalculator.getShapePointsAroundPosition(tripGtfsData.shapes_anchor_points, lastStopSequence);
378
+ const ptsInRadius = yield PositionCalculator_1.default.getShapePointsAroundPosition(tripGtfsData.shapes_anchor_points, currentPosition, radius, tripGtfsData.trip_id);
382
379
  if (ptsInRadius.length < 1) {
383
380
  return estimatedPoint;
384
381
  }
385
- // if TCP arrival is announced, expand available points so we can push trip into the nearest at_stop point later
386
- const closestPts = lastStopSequence && currentPosition.properties.tcp_event === const_1.TCPEventEnum.ARRIVAL_ANNOUNCED
387
- ? positionCalculator.getFlatPointsForPositionAdjustment(ptsInRadius)
388
- : positionCalculator.getClosestPoints(ptsInRadius);
382
+ // picks only closest point for each segment
383
+ const closestPts = yield PositionCalculator_1.default.getClosestPoints(ptsInRadius, currentPosition);
389
384
  if (closestPts.length < 1) {
390
385
  return estimatedPoint;
391
386
  }
392
- // decide which point is the best
387
+ // DECIDE WHICH POINT IS PROBABLY RIGHT
393
388
  return _a.getClosestPoint(currentPosition, context, startDayTimestamp, closestPts, tripGtfsData, gtfsRouteType);
394
389
  });
395
390
  /**