@golemio/pid 2.20.1-dev.1446959449 → 2.20.1-dev.1447504019

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.
@@ -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', '20240909153245-add-values-to-vehicle-descriptor-state-enum-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', '20240909153245-add-values-to-vehicle-descriptor-state-enum-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,15 @@
1
+ ALTER TYPE vehicle_descriptor_state RENAME TO vehicle_descriptor_state_old;
2
+
3
+ CREATE TYPE vehicle_descriptor_state AS ENUM(
4
+ 'dilny',
5
+ 'doco',
6
+ 'nzr',
7
+ 'zar'
8
+ );
9
+
10
+ ALTER TABLE vehiclepositions_vehicle_descriptors
11
+ ALTER COLUMN state TYPE vehicle_descriptor_state
12
+ USING state::text::vehicle_descriptor_state;
13
+
14
+ DROP TYPE vehicle_descriptor_state_old;
15
+
@@ -0,0 +1,21 @@
1
+ ALTER TYPE vehicle_descriptor_state
2
+ ADD VALUE 'muz';
3
+
4
+ ALTER TYPE vehicle_descriptor_state
5
+ ADD VALUE 'nez';
6
+
7
+ ALTER TYPE vehicle_descriptor_state
8
+ ADD VALUE 'ods';
9
+
10
+ ALTER TYPE vehicle_descriptor_state
11
+ ADD VALUE 'sluz';
12
+
13
+ ALTER TYPE vehicle_descriptor_state
14
+ ADD VALUE 'prod';
15
+
16
+ ALTER TYPE vehicle_descriptor_state
17
+ ADD VALUE 'zrus';
18
+
19
+ ALTER TYPE vehicle_descriptor_state
20
+ ADD VALUE 'vrak';
21
+
@@ -1 +1 @@
1
- {"version":3,"file":"DescriptorFilter.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-descriptors/helpers/DescriptorFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AAErE,iEAAwE;AAExE,0FAA4G;AAIrG,IAAM,gBAAgB,8BAAtB,MAAM,gBAAgB;IACzB,YAAsC,MAAuB;QAAf,WAAM,GAAN,MAAM,CAAS;QAoCrD,iBAAY,GAAG,CAAC,KAAa,EAAuC,EAAE;YAC1E,OAAO,MAAM,CAAC,MAAM,CAAC,mDAA0B,CAAC,CAAC,QAAQ,CAAC,KAAmC,CAAC,CAAC;QACnG,CAAC,CAAC;QAEM,oBAAe,GAAG,CAAC,QAAgB,EAA6C,EAAE;YACtF,OAAO,MAAM,CAAC,MAAM,CAAC,sDAA6B,CAAC,CAAC,QAAQ,CAAC,QAAyC,CAAC,CAAC;QAC5G,CAAC,CAAC;IA1C8D,CAAC;IAEjE;;;OAGG;IACI,CAAC,wBAAwB,CAAC,WAAmC;QAChE,MAAM,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,C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I,eAAe,IAAI,MAAM,CAAC,MAAM,CAAC,mDAA0B,CAAC,CAAC,OAAO,CACjG,KAAmC,CACtC,EAAE,CAAC;IACR,CAAC;CACJ,CAAA;2BAlDY,gBAAgB;IAD5B,IAAA,qBAAU,GAAE;IAEI,WAAA,IAAA,iBAAM,EAAC,qBAAS,CAAC,MAAM,CAAC,CAAA;;GAD5B,gBAAgB,CAkD5B"}
1
+ {"version":3,"file":"DescriptorFilter.js","sourceRoot":"","sources":["../../../../../../src/integration-engine/vehicle-positions/workers/vehicle-descriptors/helpers/DescriptorFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,wEAAqE;AAErE,iEAAwE;AAExE,0FAA4G;AAGrG,IAAM,gBAAgB,8BAAtB,MAAM,gBAAgB;IACzB,YAAsC,MAAuB;QAAf,WAAM,GAAN,MAAM,CAAS;QAoCrD,iBAAY,GAAG,CAAC,KAAa,EAAuC,EAAE;YAC1E,OAAO,MAAM,CAAC,MAAM,CAAC,mDAA0B,CAAC,CAAC,QAAQ,CAAC,KAAmC,CAAC,CAAC;QACnG,CAAC,CAAC;QAEM,oBAAe,GAAG,CAAC,QAAgB,EAA6C,EAAE;YACtF,OAAO,MAAM,CAAC,MAAM,CAAC,sDAA6B,CAAC,CAAC,QAAQ,CAAC,QAAyC,CAAC,CAAC;QAC5G,CAAC,CAAC;IA1C8D,CAAC;IAEjE;;;OAGG;IACI,CAAC,wBAAwB,CAAC,WAAmC;QAChE,MAAM,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAChD,IACI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC;gBACvE,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,KAAK,CAAC,EACzE;gBACE,OAAO,CAAC,CAAC,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
  /v2/vehiclepositions:
571
571
  get:
572
572
  summary: GET All Vehicle Positions
573
- description: ""
573
+ description: |
574
+ Positions in one the following states are included by default:
575
+ - `at_stop` - The position is tracking and the closest anchor point or metro rail track segment is a stop.
576
+ - `on_track` - The position is tracking, but is neither `at_stop` nor `off_track`.
577
+
578
+ Using the `includeNotTracking` parameter, positions in one the following states can be additionally included:
579
+ - `after_track` - The position is not tracking and the trip's last known position is tracking. For metro positions, this can also mean that it is tracking, the vehicle is 200+ meters from the closest metro rail track segment of its track and the vehicle's message attributes `tm` and `odch` or higher than the arrival to the final stop. For other positions from TCP sources (DPP buses and trams), this can also mean that it is tracking and the vehicle sent a message while at the final stop or sent a message with the `tjr` attribute higher than the arrival to the final stop.
580
+ - `before_track` - The position is not tracking and either the trip's previous position is not known, or the previous position's state is `at_stop` or `on_track`.
581
+ - `before_track_delayed` - The last position of the vehicle's trip that is of state `before_track` or `invisible`, with a delay predicted based on the vehicle's previous trip.
582
+ - `canceled` - The position is canceled.
583
+ - `off_track` - The position is tracking and the vehicle is 200+ meters from the closest anchor point or metro rail track segment of its track. For metro positions, it is additionally required that the vehicle's message attributes `tm` and `odch` or less than or equal to the arrival to the final stop.
584
+
585
+ Using the `includeNotPublic` parameter, positions in the following state can be additionally included:
586
+ - `not_public` - The position belongs to a non-public trip (trip without run schedule).
587
+
588
+ The following states also exist internally but are excluded from the API output:
589
+ - `duplicate` - The position is not tracking, the trip's last known position is tracking and there is another position with identical `origin_timestamp`.
590
+ - `invisible` - The position is not tracking and either:
591
+ - the trip's previous position is not known or the previous position's state is `at_stop` or `on_track`, and the vehicle is on its way from the garage;
592
+ - or the trip's last known position is tracking and the vehicle is on its way to the garage.
593
+ - `mismatched` - The position does not make sense (e.g. it was sent late and thus has a mismatched stop sequence).
594
+ - `unknown` - The position is not yet processed (or was determined to never be processed).
574
595
  tags:
575
596
  - 🛤 PID Realtime Positions (v2)
576
597
  parameters:
@@ -2570,8 +2591,7 @@ components:
2570
2591
  type: string
2571
2592
  example: "service-3-8585"
2572
2593
  state_position:
2573
- type: string
2574
- example: "at_stop"
2594
+ $ref: "#/components/schemas/StatePosition"
2575
2595
  required:
2576
2596
  - gtfs_trip_id
2577
2597
  - route_type
@@ -2630,17 +2650,8 @@ components:
2630
2650
  description: "Delay of the vehicle in seconds."
2631
2651
  example: 10
2632
2652
  state_position:
2633
- type: string
2634
- nullable: false
2635
- example: at_stop
2636
- enum:
2637
- - before_track
2638
- - before_track_delayed
2639
- - at_stop
2640
- - on_track
2641
- - off_track
2642
- - after_track
2643
- - unknown
2653
+ nullable: true
2654
+ $ref: "#/components/schemas/StatePosition"
2644
2655
  last_stop_sequence:
2645
2656
  type: integer
2646
2657
  nullable: true
@@ -2746,6 +2757,34 @@ components:
2746
2757
  nullable: true
2747
2758
  example: true
2748
2759
 
2760
+ StatePosition:
2761
+ type: string
2762
+ example: at_stop
2763
+ enum:
2764
+ - at_stop
2765
+ - before_track
2766
+ - before_track_delayed
2767
+ - canceled
2768
+ - off_track
2769
+ - on_track
2770
+ description: |
2771
+ - `at_stop` - The position is tracking and the closest anchor point or metro rail track segment is a stop.
2772
+ - `before_track` - The position is not tracking and either the trip's previous position is not known, or the previous position's state is `at_stop` or `on_track`.
2773
+ - `before_track_delayed` - The last position of the vehicle's trip that is of state `before_track` or `invisible`, with a delay predicted based on the vehicle's previous trip.
2774
+ - `canceled` - The position is canceled.
2775
+ - `off_track` - The position is tracking and the vehicle is 200+ meters from the closest anchor point or metro rail track segment of its track. For metro positions, it is additionally required that the vehicle's message attributes `tm` and `odch` or less than or equal to the arrival to the final stop.
2776
+ - `on_track` - The position is tracking, but is neither `at_stop` nor `off_track`.
2777
+
2778
+ The following states also exist internally but are excluded from the API output:
2779
+ - `after_track` - The position is not tracking and the trip's last known position is tracking. For metro positions, this can also mean that it is tracking, the vehicle is 200+ meters from the closest metro rail track segment of its track and the vehicle's message attributes `tm` and `odch` or higher than the arrival to the final stop. For other positions from TCP sources (DPP buses and trams), this can also mean that it is tracking and the vehicle sent a message while at the final stop or sent a message with the `tjr` attribute higher than the arrival to the final stop.
2780
+ - `duplicate` - The position is not tracking, the trip's last known position is tracking and there is another position with identical `origin_timestamp`.
2781
+ - `invisible` - The position is not tracking and either:
2782
+ - the trip's previous position is not known or the previous position's state is `at_stop` or `on_track`, and the vehicle is on its way from the garage;
2783
+ - or the trip's last known position is tracking and the vehicle is on its way to the garage.
2784
+ - `mismatched` - The position does not make sense (e.g. it was sent late and thus has a mismatched stop sequence).
2785
+ - `not_public` - The position belongs to a non-public trip (trip without run schedule).
2786
+ - `unknown` - The position is not yet processed (or was determined to never be processed).
2787
+
2749
2788
  PublicTripShapeFeatureCollection:
2750
2789
  type: object
2751
2790
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/pid",
3
- "version": "2.20.1-dev.1446959449",
3
+ "version": "2.20.1-dev.1447504019",
4
4
  "description": "Golemio PID Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",