@golemio/pid 5.19.1-dev.2799089619 → 5.19.1-dev.2809129013
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/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/BasePositionsManager.d.ts +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/BasePositionsManager.js +5 -54
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/BasePositionsManager.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/DPPUtils.d.ts +2 -2
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/PositionsManager.js +3 -11
- 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/compute-positions/ComputeDelayHelper.js +35 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/ComputeDelayHelper.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.js +35 -5
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/AbstractDelayAtStop.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/compute-positions/strategy/CommonDelayAtStop.js +37 -5
- 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 +37 -5
- 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 +3 -11
- 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/RegionalBusComputeDelayHelper.js +35 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/RegionalBusComputeDelayHelper.js.map +1 -1
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/regional-bus/compute-positions/strategy/BusDelayAtStop.js +37 -5
- 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/helpers/trip-context/TripContextHelper.d.ts +68 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/trip-context/TripContextHelper.js +213 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/trip-context/TripContextHelper.js.map +1 -0
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.js +37 -11
- package/dist/integration-engine/vehicle-positions/workers/vehicle-positions/tasks/abstract/AbstractPropagateDelayTask.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js +22 -10
- package/dist/schema-definitions/vehicle-positions/models/VPTripsModel.js.map +1 -1
- package/dist/schema-definitions/vehicle-positions/models/interfaces/VPTripsLastPositionInterfaces.d.ts +8 -8
- package/docs/asyncapi.yaml +0 -9
- package/docs/cache/types/psql.md +6 -11
- package/docs/processing/index.md +1 -0
- package/docs/processing/trip_context/index.md +85 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VPTripsModel.js","sourceRoot":"","sources":["../../../../src/schema-definitions/vehicle-positions/models/VPTripsModel.ts"],"names":[],"mappings":";;;AAAA,8EAA6E;AAE7E,mEAAwF;AAKxF,MAAa,YAAa,SAAQ,iBAAmB;;AAArD,
|
|
1
|
+
{"version":3,"file":"VPTripsModel.js","sourceR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B;qCACJ;iCACJ;gCACD,gBAAgB,EAAE;oCACd,KAAK,EAAE;wCACH;4CACI,IAAI,EAAE,QAAQ;4CACd,QAAQ,EAAE,CAAC,aAAa,CAAC;yCAC5B;wCACD;4CACI,IAAI,EAAE,QAAQ;yCACjB;wCACD;4CACI,IAAI,EAAE,MAAM;4CACZ,QAAQ,EAAE,IAAI;yCACjB;qCACJ;iCACJ;6BACJ;yBACJ;wBACD;4BACI,IAAI,EAAE,MAAM;4BACZ,QAAQ,EAAE,IAAI;yBACjB;qBACJ;iBACJ;gBACD,iBAAiB,EAAE;oBACf,KAAK,EAAE;wBACH;4BACI,IAAI,EAAE,QAAQ;yBACjB;wBACD;4BACI,IAAI,EAAE,MAAM;4BACZ,QAAQ,EAAE,IAAI;yBACjB;qBACJ;iBACJ;gBACD,uBAAuB,EAAE;oBACrB,KAAK,EAAE;wBACH;4BACI,IAAI,EAAE,QAAQ;4BACd,MAAM,EAAE,WAAW;yBACtB;wBACD;4BACI,IAAI,EAAE,MAAM;4BACZ,QAAQ,EAAE,IAAI;yBACjB;qBACJ;iBACJ;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,QAAQ;iBACjB;aACJ;YACD,QAAQ,EAAE,CAAC,sBAAsB,EAAE,cAAc,EAAE,QAAQ,CAAC;SAC/D;KACJ;CACJ,CAAC"}
|
|
@@ -6,29 +6,29 @@ export interface IVPTripsComputedPositionAtStopStreak {
|
|
|
6
6
|
firstPositionDelay: number | null;
|
|
7
7
|
stop_sequence: number | null;
|
|
8
8
|
}
|
|
9
|
+
type VPTripsTrackingFields = "bearing" | "shape_dist_traveled" | "tcp_event" | "last_stop_sequence" | "last_stop_id" | "last_stop_arrival_time" | "last_stop_departure_time";
|
|
10
|
+
export type IVPTripsTrackingProperties = Pick<IVPTripsPositionAttributes, VPTripsTrackingFields>;
|
|
9
11
|
export interface IVPTripsLastPositionContext {
|
|
10
12
|
lastPositionId: string | null;
|
|
11
|
-
lastPositionLat
|
|
12
|
-
lastPositionLng
|
|
13
|
+
lastPositionLat: number | null;
|
|
14
|
+
lastPositionLng: number | null;
|
|
13
15
|
lastPositionOriginTimestamp: number | null;
|
|
14
|
-
lastPositionTracking: Feature<Point,
|
|
16
|
+
lastPositionTracking: Feature<Point, IVPTripsTrackingProperties> | null;
|
|
15
17
|
lastPositionCanceled: boolean | null;
|
|
16
18
|
lastPositionLastStop: {
|
|
17
|
-
id: string | null;
|
|
18
19
|
sequence: number | null;
|
|
19
|
-
arrival_time: number | null;
|
|
20
20
|
arrival_delay: number | null;
|
|
21
|
-
departure_time: number | null;
|
|
22
21
|
departure_delay: number | null;
|
|
23
22
|
};
|
|
24
23
|
lastPositionDelay: number | null;
|
|
25
24
|
atStopStreak: IVPTripsComputedPositionAtStopStreak;
|
|
26
25
|
lastPositionBeforeTrackDelayed: {
|
|
27
26
|
delay: number | null;
|
|
28
|
-
origin_timestamp: Date;
|
|
27
|
+
origin_timestamp: string | Date | null;
|
|
29
28
|
} | null;
|
|
30
29
|
lastPositionState: StatePositionEnum | null;
|
|
31
|
-
lastStopSequence
|
|
30
|
+
lastStopSequence: number | null;
|
|
32
31
|
lastPositionStateChange: string | null;
|
|
33
32
|
tripId: string;
|
|
34
33
|
}
|
|
34
|
+
export {};
|
package/docs/asyncapi.yaml
CHANGED
|
@@ -1254,21 +1254,12 @@ components:
|
|
|
1254
1254
|
lastPositionLastStop:
|
|
1255
1255
|
type: object
|
|
1256
1256
|
properties:
|
|
1257
|
-
id:
|
|
1258
|
-
type: string
|
|
1259
|
-
nullable: true
|
|
1260
1257
|
sequence:
|
|
1261
1258
|
type: number
|
|
1262
1259
|
nullable: true
|
|
1263
|
-
arrival_time:
|
|
1264
|
-
type: number
|
|
1265
|
-
nullable: true
|
|
1266
1260
|
arrival_delay:
|
|
1267
1261
|
type: number
|
|
1268
1262
|
nullable: true
|
|
1269
|
-
departure_time:
|
|
1270
|
-
type: number
|
|
1271
|
-
nullable: true
|
|
1272
1263
|
departure_delay:
|
|
1273
1264
|
type: number
|
|
1274
1265
|
nullable: true
|
package/docs/cache/types/psql.md
CHANGED
|
@@ -5,31 +5,29 @@
|
|
|
5
5
|
- Uložen jako JSON objekt s variabilními daty a atributy - v závislosti na stavu vozidla/spoje některé atributy chybí nebo jsou prázdné/null
|
|
6
6
|
- Pokud se jedná o první pozici na spoji, pak všechny atributy kromě `tripId` budou null a nepovinné atributy můžou chybět
|
|
7
7
|
- Aktuální interface viz [IVPTripsLastPositionContext](../../../src/schema-definitions/vehicle-positions/models/interfaces/VPTripsLastPositionInterfaces.ts)
|
|
8
|
+
- Invarianty mutace kontextu (kdo a jak smí kontext měnit) viz [Trip context](../../processing/trip_context/index.md)
|
|
8
9
|
|
|
9
10
|
```typescript
|
|
10
11
|
interface IVPTripsLastPositionContext {
|
|
11
12
|
lastPositionId: string | null;
|
|
12
|
-
lastPositionLat
|
|
13
|
-
lastPositionLng
|
|
13
|
+
lastPositionLat: number | null;
|
|
14
|
+
lastPositionLng: number | null;
|
|
14
15
|
lastPositionOriginTimestamp: number | null;
|
|
15
|
-
lastPositionTracking: Feature<Point,
|
|
16
|
+
lastPositionTracking: Feature<Point, IVPTripsTrackingProperties> | null;
|
|
16
17
|
lastPositionCanceled: boolean | null;
|
|
17
18
|
lastPositionLastStop: {
|
|
18
|
-
id: string | null;
|
|
19
19
|
sequence: number | null;
|
|
20
|
-
arrival_time: number | null;
|
|
21
20
|
arrival_delay: number | null;
|
|
22
|
-
departure_time: number | null;
|
|
23
21
|
departure_delay: number | null;
|
|
24
22
|
};
|
|
25
23
|
lastPositionDelay: number | null;
|
|
26
24
|
atStopStreak: IVPTripsComputedPositionAtStopStreak;
|
|
27
25
|
lastPositionBeforeTrackDelayed: {
|
|
28
26
|
delay: number | null;
|
|
29
|
-
origin_timestamp: Date;
|
|
27
|
+
origin_timestamp: string | Date | null;
|
|
30
28
|
} | null;
|
|
31
29
|
lastPositionState: StatePositionEnum | null;
|
|
32
|
-
lastStopSequence
|
|
30
|
+
lastStopSequence: number | null;
|
|
33
31
|
lastPositionStateChange: string | null;
|
|
34
32
|
tripId: string;
|
|
35
33
|
}
|
|
@@ -49,11 +47,8 @@ interface IVPTripsLastPositionContext {
|
|
|
49
47
|
- _poznámka_: využití během aktualizace tripu v databázi. Zbytečné a lze nahradit stavem pozice
|
|
50
48
|
- **lastPositionLastStop** - informace o poslední zastávce, kterou vozidlo projelo
|
|
51
49
|
- _poznámka_: využití pouze pro výpočet zpoždění na zastávce
|
|
52
|
-
- **id** - GTFS ID zastávky. V současnosti je vždy null a nepoužívá se
|
|
53
50
|
- **sequence** - pořadí zastávky v rámci GTFS stop times
|
|
54
|
-
- **arrival_time** - čas příjezdu na zastávku podle GTFS
|
|
55
51
|
- **arrival_delay** - vypočítané zpoždění příjezdu na zastávku oproti GTFS v sekundách
|
|
56
|
-
- **departure_time** - čas odjezdu ze zastávky podle GTFS
|
|
57
52
|
- **departure_delay** - vypočítané zpoždění odjezdu ze zastávky oproti GTFS v sekundách
|
|
58
53
|
- **lastPositionDelay** - poslední vypočítané zpoždění vozidla na spoji
|
|
59
54
|
- _poznámka_: využití pouze pro výpočet zpoždění na zastávce
|
package/docs/processing/index.md
CHANGED
|
@@ -16,3 +16,4 @@
|
|
|
16
16
|
- [TCP Telmax Arriva City](./state_position_tracking/tcp_telmax_arriva_city.md)
|
|
17
17
|
- [**Mapování MPVNet vehicle type na GTFS**](./vehicle_types.md)
|
|
18
18
|
- [**Mapování MPVNet spojů na GTFS**](./trip_matching.md)
|
|
19
|
+
- [**Trip context (stav spoje mezi pozicemi)**](./trip_context/index.md)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Trip context (`IVPTripsLastPositionContext`)
|
|
2
|
+
|
|
3
|
+
Per-trip state carried between consecutive vehicle position updates. It represents what is known
|
|
4
|
+
about a trip's last processed position - id, coordinates, state, delay bookkeeping, cancellation
|
|
5
|
+
and a small tracking snapshot. One context instance exists per `tripId` for the lifetime of the
|
|
6
|
+
trip's real-time processing.
|
|
7
|
+
|
|
8
|
+
- **Created**: `TripContextHelper.createInitial(tripId)` when a trip is seen for the first time
|
|
9
|
+
in a processing run and has no persisted context yet.
|
|
10
|
+
- **Updated**: mutated in place while positions for the trip are processed (see below).
|
|
11
|
+
- **Persisted**: serialized to JSON and stored (Postgres); reloaded on the next run and merged back
|
|
12
|
+
into the working context.
|
|
13
|
+
|
|
14
|
+
Defined in `src/schema-definitions/vehicle-positions/models/interfaces/VPTripsLastPositionInterfaces.ts`.
|
|
15
|
+
|
|
16
|
+
## Helper write boundary
|
|
17
|
+
|
|
18
|
+
[`TripContextHelper.ts`](../../../src/integration-engine/vehicle-positions/workers/vehicle-positions/helpers/trip-context/TripContextHelper.ts)
|
|
19
|
+
is the only module allowed to mutate `IVPTripsLastPositionContext` fields. Callers (`PositionsManager`,
|
|
20
|
+
`RegionalBusPositionsManager`, `ComputeDelayHelper`, delay-propagation tasks, ...) always go through one
|
|
21
|
+
of its exported functions instead of writing to the context object directly. New processing logic that
|
|
22
|
+
needs to change the context must add or reuse a function here rather than mutating the context inline.
|
|
23
|
+
|
|
24
|
+
## Timestamp rule (`transitionState`)
|
|
25
|
+
|
|
26
|
+
`transitionState(context, state, options?)` stamps `lastPositionStateChange` (ISO string, `new Date().toISOString()`)
|
|
27
|
+
only when `state` actually differs from `context.lastPositionState` - a state that repeats across
|
|
28
|
+
consecutive positions does not re-stamp the timestamp.
|
|
29
|
+
|
|
30
|
+
The one exception is `options.forceTimestamp`, used by delay propagation
|
|
31
|
+
(`TripContextHelper.recordPropagatedDelay`) to force a fresh `BEFORE_TRACK_DELAYED` transition and
|
|
32
|
+
timestamp even when the state did not change, since the propagated delay itself is new information.
|
|
33
|
+
|
|
34
|
+
## Cancellation: sticky vs. plain
|
|
35
|
+
|
|
36
|
+
`lastPositionCanceled` means different things depending on which manager writes it, both via the same
|
|
37
|
+
`TripContextHelper.commitValidPosition(context, position, positionToUpdate, canceled)` call:
|
|
38
|
+
|
|
39
|
+
- **`PositionsManager`** treats it as a sticky accumulator: once a position sets it (via
|
|
40
|
+
`lastPositionStaysCanceled`, driven by `hasTcpEventOrCancel`), later positions keep it canceled
|
|
41
|
+
even if they themselves are not canceled (`lastPositionStaysCanceled || position.is_canceled`).
|
|
42
|
+
A trip cannot un-cancel itself here.
|
|
43
|
+
- **`RegionalBusPositionsManager`** passes the plain per-position `position.is_canceled` with no
|
|
44
|
+
stickiness - the flag reflects only the current position.
|
|
45
|
+
|
|
46
|
+
Do not assume `lastPositionCanceled` is sticky across all managers; check which manager owns the trip.
|
|
47
|
+
|
|
48
|
+
## Sticky seed: `lastPositionBeforeTrackDelayed`
|
|
49
|
+
|
|
50
|
+
`context.lastPositionBeforeTrackDelayed` stores `{ delay, origin_timestamp }` for the last
|
|
51
|
+
`BEFORE_TRACK_DELAYED` position, written by `TripContextHelper.recordBeforeTrackDelayed` and
|
|
52
|
+
`TripContextHelper.recordPropagatedDelay`. The timestamp is stored as-is (`Date` or whatever was
|
|
53
|
+
passed in) - it is never re-derived by calling `.getTime()` on an already-stored value. Treat it as an
|
|
54
|
+
opaque, already-resolved snapshot rather than something to recompute from.
|
|
55
|
+
|
|
56
|
+
## Date/string contract on `origin_timestamp`-family fields
|
|
57
|
+
|
|
58
|
+
`lastPositionBeforeTrackDelayed.origin_timestamp` is typed `string | Date | null`. A context persisted
|
|
59
|
+
to Postgres round-trips through `JSON.stringify`/`JSON.parse`, which serializes a `Date` to an ISO
|
|
60
|
+
string - so a freshly created context in memory holds a `Date`, while one reloaded from storage holds a
|
|
61
|
+
`string`. Both must be handled on read.
|
|
62
|
+
|
|
63
|
+
Because of this, and because `null` is a valid value distinct from "not a Date/string", consumers must
|
|
64
|
+
never narrow with `=== null` (or `!== null`) alone - use `??`/`== null` so both `null` and `undefined`
|
|
65
|
+
are treated consistently.
|
|
66
|
+
|
|
67
|
+
## Lean tracking shape: `lastPositionTracking`
|
|
68
|
+
|
|
69
|
+
`context.lastPositionTracking` is a GeoJSON `Feature<Point, IVPTripsTrackingProperties>` written by
|
|
70
|
+
`TripContextHelper.recordTracking`, only for positions in `AT_STOP` or `ON_TRACK` state.
|
|
71
|
+
`IVPTripsTrackingProperties` (`VPTripsLastPositionInterfaces.ts`) is a `Pick` limited to exactly the
|
|
72
|
+
7 fields actually read downstream:
|
|
73
|
+
|
|
74
|
+
- `bearing`
|
|
75
|
+
- `shape_dist_traveled`
|
|
76
|
+
- `tcp_event`
|
|
77
|
+
- `last_stop_sequence`
|
|
78
|
+
- `last_stop_id`
|
|
79
|
+
- `last_stop_arrival_time`
|
|
80
|
+
- `last_stop_departure_time`
|
|
81
|
+
|
|
82
|
+
This replaces a wider legacy shape that carried unused fields. Each field is written as an explicit
|
|
83
|
+
`?? null` literal, so a missing value persists as `null` (kept by `JSON.stringify`) rather than
|
|
84
|
+
`undefined` (dropped) - do not add new fields to this shape without confirming they are actually
|
|
85
|
+
consumed elsewhere.
|