grm-shared-library 1.1.241 → 1.1.243
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/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/modules/dispatch/index.js +1 -0
- package/dist/cjs/modules/dispatch/index.js.map +1 -1
- package/dist/cjs/modules/dispatch/interfaces/dispatch-analytics.js +3 -0
- package/dist/cjs/modules/dispatch/interfaces/dispatch-analytics.js.map +1 -0
- package/dist/cjs/modules/permission/data/permissions.data.js +9 -0
- package/dist/cjs/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js +21 -0
- package/dist/cjs/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/cjs/modules/permission/enums/permissions-module.enum.js +1 -0
- package/dist/cjs/modules/permission/enums/permissions-module.enum.js.map +1 -1
- package/dist/cjs/modules/responder/constants/responder.const.js +124 -0
- package/dist/cjs/modules/responder/constants/responder.const.js.map +1 -0
- package/dist/cjs/modules/responder/dtos/responder.dto.js +582 -0
- package/dist/cjs/modules/responder/dtos/responder.dto.js.map +1 -0
- package/dist/cjs/modules/responder/enums/responder.enums.js +142 -0
- package/dist/cjs/modules/responder/enums/responder.enums.js.map +1 -0
- package/dist/cjs/modules/responder/index.js +29 -0
- package/dist/cjs/modules/responder/index.js.map +1 -0
- package/dist/cjs/modules/responder/interfaces/responder-dispatch.js +3 -0
- package/dist/cjs/modules/responder/interfaces/responder-dispatch.js.map +1 -0
- package/dist/cjs/modules/responder/interfaces/responder-policy.js +3 -0
- package/dist/cjs/modules/responder/interfaces/responder-policy.js.map +1 -0
- package/dist/cjs/modules/responder/interfaces/responder.js +3 -0
- package/dist/cjs/modules/responder/interfaces/responder.js.map +1 -0
- package/dist/cjs/modules/responder/utils/responder.util.js +65 -0
- package/dist/cjs/modules/responder/utils/responder.util.js.map +1 -0
- package/dist/cjs/modules/role/data/roles.data.js +30 -4
- package/dist/cjs/modules/role/data/roles.data.js.map +1 -1
- package/dist/cjs/modules/tracking/dtos/units-analytics-query.dto.js +58 -0
- package/dist/cjs/modules/tracking/dtos/units-analytics-query.dto.js.map +1 -0
- package/dist/cjs/modules/tracking/enums/tracking-provider-code.enum.js +8 -0
- package/dist/cjs/modules/tracking/enums/tracking-provider-code.enum.js.map +1 -1
- package/dist/cjs/modules/tracking/index.js +3 -0
- package/dist/cjs/modules/tracking/index.js.map +1 -1
- package/dist/cjs/modules/tracking/interfaces/tracking-analytics.js +14 -0
- package/dist/cjs/modules/tracking/interfaces/tracking-analytics.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/modules/dispatch/index.js +1 -0
- package/dist/esm/modules/dispatch/index.js.map +1 -1
- package/dist/esm/modules/dispatch/interfaces/dispatch-analytics.js +2 -0
- package/dist/esm/modules/dispatch/interfaces/dispatch-analytics.js.map +1 -0
- package/dist/esm/modules/permission/data/permissions.data.js +9 -0
- package/dist/esm/modules/permission/data/permissions.data.js.map +1 -1
- package/dist/esm/modules/permission/enums/permission-actions.enum.js +21 -0
- package/dist/esm/modules/permission/enums/permission-actions.enum.js.map +1 -1
- package/dist/esm/modules/permission/enums/permissions-module.enum.js +1 -0
- package/dist/esm/modules/permission/enums/permissions-module.enum.js.map +1 -1
- package/dist/esm/modules/responder/constants/responder.const.js +121 -0
- package/dist/esm/modules/responder/constants/responder.const.js.map +1 -0
- package/dist/esm/modules/responder/dtos/responder.dto.js +560 -0
- package/dist/esm/modules/responder/dtos/responder.dto.js.map +1 -0
- package/dist/esm/modules/responder/enums/responder.enums.js +139 -0
- package/dist/esm/modules/responder/enums/responder.enums.js.map +1 -0
- package/dist/esm/modules/responder/index.js +13 -0
- package/dist/esm/modules/responder/index.js.map +1 -0
- package/dist/esm/modules/responder/interfaces/responder-dispatch.js +2 -0
- package/dist/esm/modules/responder/interfaces/responder-dispatch.js.map +1 -0
- package/dist/esm/modules/responder/interfaces/responder-policy.js +2 -0
- package/dist/esm/modules/responder/interfaces/responder-policy.js.map +1 -0
- package/dist/esm/modules/responder/interfaces/responder.js +2 -0
- package/dist/esm/modules/responder/interfaces/responder.js.map +1 -0
- package/dist/esm/modules/responder/utils/responder.util.js +59 -0
- package/dist/esm/modules/responder/utils/responder.util.js.map +1 -0
- package/dist/esm/modules/role/data/roles.data.js +29 -3
- package/dist/esm/modules/role/data/roles.data.js.map +1 -1
- package/dist/esm/modules/tracking/dtos/units-analytics-query.dto.js +54 -0
- package/dist/esm/modules/tracking/dtos/units-analytics-query.dto.js.map +1 -0
- package/dist/esm/modules/tracking/enums/tracking-provider-code.enum.js +8 -0
- package/dist/esm/modules/tracking/enums/tracking-provider-code.enum.js.map +1 -1
- package/dist/esm/modules/tracking/index.js +3 -0
- package/dist/esm/modules/tracking/index.js.map +1 -1
- package/dist/esm/modules/tracking/interfaces/tracking-analytics.js +13 -0
- package/dist/esm/modules/tracking/interfaces/tracking-analytics.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/modules/dispatch/index.d.ts +1 -0
- package/dist/types/modules/dispatch/interfaces/dispatch-analytics.d.ts +158 -0
- package/dist/types/modules/permission/enums/permission-actions.enum.d.ts +4 -0
- package/dist/types/modules/permission/enums/permissions-module.enum.d.ts +2 -1
- package/dist/types/modules/responder/constants/responder.const.d.ts +67 -0
- package/dist/types/modules/responder/dtos/responder.dto.d.ts +144 -0
- package/dist/types/modules/responder/enums/responder.enums.d.ts +128 -0
- package/dist/types/modules/responder/index.d.ts +7 -0
- package/dist/types/modules/responder/interfaces/responder-dispatch.d.ts +144 -0
- package/dist/types/modules/responder/interfaces/responder-policy.d.ts +55 -0
- package/dist/types/modules/responder/interfaces/responder.d.ts +113 -0
- package/dist/types/modules/responder/utils/responder.util.d.ts +24 -0
- package/dist/types/modules/role/data/roles.data.d.ts +7 -0
- package/dist/types/modules/tracking/dtos/units-analytics-query.dto.d.ts +17 -0
- package/dist/types/modules/tracking/enums/tracking-provider-code.enum.d.ts +9 -1
- package/dist/types/modules/tracking/index.d.ts +2 -0
- package/dist/types/modules/tracking/interfaces/tracking-analytics.d.ts +192 -0
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ResponderReportField } from '../enums/responder.enums';
|
|
2
|
+
/** One item of the closure checklist an organization asks its responders to confirm. */
|
|
3
|
+
export interface ResponderChecklistItem {
|
|
4
|
+
/** Stable id, so an answer survives the label being reworded. */
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An organization's operational rules for its responders. Trusted configuration:
|
|
11
|
+
* served by clarion-organization, enforced by the services that own each rule.
|
|
12
|
+
*/
|
|
13
|
+
export interface ResponderPolicy {
|
|
14
|
+
location: {
|
|
15
|
+
onDutyIntervalSeconds: number;
|
|
16
|
+
activeIntervalSeconds: number;
|
|
17
|
+
distanceFilterMetres: number;
|
|
18
|
+
maxAccuracyMetres: number;
|
|
19
|
+
staleAfterSeconds: number;
|
|
20
|
+
};
|
|
21
|
+
arrival: {
|
|
22
|
+
/** Within this distance of the incident a GPS arrival is accepted. */
|
|
23
|
+
radiusMetres: number;
|
|
24
|
+
/** Whether a responder outside the radius (or without a fix) may confirm arrival by hand. */
|
|
25
|
+
allowManualConfirmation: boolean;
|
|
26
|
+
manualReasonRequired: boolean;
|
|
27
|
+
};
|
|
28
|
+
dispatch: {
|
|
29
|
+
allowDecline: boolean;
|
|
30
|
+
declineReasonRequired: boolean;
|
|
31
|
+
};
|
|
32
|
+
report: {
|
|
33
|
+
/** The responder cannot mark the dispatch COMPLETED before submitting a report. */
|
|
34
|
+
requiredToComplete: boolean;
|
|
35
|
+
requiredFields: ResponderReportField[];
|
|
36
|
+
checklist: ResponderChecklistItem[];
|
|
37
|
+
minPhotos: number;
|
|
38
|
+
};
|
|
39
|
+
evidence: {
|
|
40
|
+
allowPhotos: boolean;
|
|
41
|
+
allowDocuments: boolean;
|
|
42
|
+
allowVideo: boolean;
|
|
43
|
+
maxImageMegabytes: number;
|
|
44
|
+
maxDocumentMegabytes: number;
|
|
45
|
+
maxVideoMegabytes: number;
|
|
46
|
+
};
|
|
47
|
+
reporterContact: {
|
|
48
|
+
/** Whether a responder sees the (non-anonymous) reporter's name and number. */
|
|
49
|
+
visible: boolean;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** A partial override as stored on the organization; anything absent keeps the default. */
|
|
53
|
+
export type ResponderPolicyOverride = {
|
|
54
|
+
[K in keyof ResponderPolicy]?: Partial<ResponderPolicy[K]>;
|
|
55
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ResponseUnitAvailability } from '../../response-unit/enums/response-unit/response-unit-availability.enum';
|
|
2
|
+
import { ResponderDutyEndReason, ResponderDutySessionStatus } from '../enums/responder.enums';
|
|
3
|
+
import { ResponderPolicy } from './responder-policy';
|
|
4
|
+
/** A unit as the responder app shows it: enough to pick it and to recognise it. */
|
|
5
|
+
export interface ResponderUnitSummary {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
/** `Vehicle`, `Person` or `Team`. */
|
|
9
|
+
type: string;
|
|
10
|
+
/** Vehicle units: `Ambulance`, `Security`, ... */
|
|
11
|
+
vehicleType: string | null;
|
|
12
|
+
registrationNumber: string | null;
|
|
13
|
+
/** The unit's own phone (vehicle / person units); teams have none. */
|
|
14
|
+
phoneNumber: string | null;
|
|
15
|
+
capabilities: string[];
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
/** The manual status the control room sets (`Operational`, `On Duty`, ...). */
|
|
18
|
+
operationalStatus: string | null;
|
|
19
|
+
/** From the manual status only; an active dispatch makes a unit ENGAGED in clarion-incident. */
|
|
20
|
+
availability: ResponseUnitAvailability;
|
|
21
|
+
organizationId: number;
|
|
22
|
+
controlCentreId: number | null;
|
|
23
|
+
station: {
|
|
24
|
+
name?: string | null;
|
|
25
|
+
address?: string | null;
|
|
26
|
+
} | null;
|
|
27
|
+
}
|
|
28
|
+
/** One stretch of duty: a responder staffing one unit. */
|
|
29
|
+
export interface ResponderDutySession {
|
|
30
|
+
id: number;
|
|
31
|
+
userId: number;
|
|
32
|
+
responseUnitId: number;
|
|
33
|
+
/** Copied at start so the record reads right after a rename. */
|
|
34
|
+
responseUnitName: string;
|
|
35
|
+
organizationId: number;
|
|
36
|
+
controlCentreId: number | null;
|
|
37
|
+
status: ResponderDutySessionStatus;
|
|
38
|
+
startedAt: string;
|
|
39
|
+
endedAt: string | null;
|
|
40
|
+
endReason: ResponderDutyEndReason | null;
|
|
41
|
+
endReasonText: string | null;
|
|
42
|
+
/** Who ended it - the responder, or the control-room user. */
|
|
43
|
+
endedByUserId: number | null;
|
|
44
|
+
}
|
|
45
|
+
export interface ResponderOrganizationSummary {
|
|
46
|
+
id: number;
|
|
47
|
+
name: string;
|
|
48
|
+
logo: string | null;
|
|
49
|
+
phoneNumber: string | null;
|
|
50
|
+
email: string | null;
|
|
51
|
+
countryCode: string | null;
|
|
52
|
+
}
|
|
53
|
+
export interface ResponderControlCentreSummary {
|
|
54
|
+
id: number;
|
|
55
|
+
name: string;
|
|
56
|
+
phoneNumber: string | null;
|
|
57
|
+
email: string | null;
|
|
58
|
+
logo: string | null;
|
|
59
|
+
}
|
|
60
|
+
/** `GET /responder/me` - everything the app needs to know who and where the responder is. */
|
|
61
|
+
export interface ResponderProfile {
|
|
62
|
+
userId: number;
|
|
63
|
+
organization: ResponderOrganizationSummary;
|
|
64
|
+
controlCentre: ResponderControlCentreSummary | null;
|
|
65
|
+
/** The units the responder may go on duty with (memberships), active ones first. */
|
|
66
|
+
units: ResponderUnitSummary[];
|
|
67
|
+
activeDuty: ResponderDutySession | null;
|
|
68
|
+
/** The organization's effective policy (defaults merged with its override). */
|
|
69
|
+
policy: ResponderPolicy;
|
|
70
|
+
/** The server's clock, so the app can tell how far off the phone's is. */
|
|
71
|
+
serverTime: string;
|
|
72
|
+
}
|
|
73
|
+
/** A responder linked to a unit, as the admin's unit screen lists them. */
|
|
74
|
+
export interface ResponseUnitResponder {
|
|
75
|
+
id: number;
|
|
76
|
+
responseUnitId: number;
|
|
77
|
+
userId: number;
|
|
78
|
+
organizationId: number;
|
|
79
|
+
controlCentreId: number | null;
|
|
80
|
+
createdByUserId: number | null;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
/** The account, when clarion-authentication could be read; null otherwise. */
|
|
83
|
+
user: {
|
|
84
|
+
id: number;
|
|
85
|
+
name: string;
|
|
86
|
+
email: string | null;
|
|
87
|
+
phoneNumber: string | null;
|
|
88
|
+
} | null;
|
|
89
|
+
/** Set while this responder is on duty with THIS unit. */
|
|
90
|
+
activeDuty: {
|
|
91
|
+
sessionId: number;
|
|
92
|
+
startedAt: string;
|
|
93
|
+
} | null;
|
|
94
|
+
}
|
|
95
|
+
/** Internal: a user's units, duty and policy - for clarion-incident and clarion-response-tracking. */
|
|
96
|
+
export interface ResponderInternalUnits {
|
|
97
|
+
userId: number;
|
|
98
|
+
organizationId: number | null;
|
|
99
|
+
controlCentreId: number | null;
|
|
100
|
+
/** Units the user is a member of (whatever their status). */
|
|
101
|
+
responseUnitIds: number[];
|
|
102
|
+
activeDuty: {
|
|
103
|
+
sessionId: number;
|
|
104
|
+
responseUnitId: number;
|
|
105
|
+
startedAt: string;
|
|
106
|
+
} | null;
|
|
107
|
+
policy: ResponderPolicy;
|
|
108
|
+
}
|
|
109
|
+
/** Internal: who is on duty with a unit - for clarion-notification's dispatch pushes. */
|
|
110
|
+
export interface ResponderInternalUnitOnDuty {
|
|
111
|
+
responseUnitId: number;
|
|
112
|
+
userIds: number[];
|
|
113
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ResponseUnitDispatchStatus } from '../../dispatch/enums/response-unit-dispatch-status.enum';
|
|
2
|
+
import { ResponderPolicy, ResponderPolicyOverride } from '../interfaces/responder-policy';
|
|
3
|
+
/**
|
|
4
|
+
* The organization's effective policy: the defaults with its override laid over
|
|
5
|
+
* them, part by part. Unknown keys in a stored override are ignored, so an old
|
|
6
|
+
* row can never smuggle a setting the code no longer knows into the app.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveResponderPolicy(override: ResponderPolicyOverride | null | undefined): ResponderPolicy;
|
|
9
|
+
/** Whether a responder may move a dispatch from `from` to `to`, before policy. */
|
|
10
|
+
export declare function canResponderTransitionDispatch(from: ResponseUnitDispatchStatus, to: ResponseUnitDispatchStatus): boolean;
|
|
11
|
+
/** The statuses a responder may set next, with the policy applied (no decline when it is off). */
|
|
12
|
+
export declare function responderAllowedDispatchStatuses(from: ResponseUnitDispatchStatus, policy: Pick<ResponderPolicy, 'dispatch'>): ResponseUnitDispatchStatus[];
|
|
13
|
+
/** What a responder's report is missing under the policy - field names and `checklist:<id>`. */
|
|
14
|
+
export declare function missingResponderReportItems(report: {
|
|
15
|
+
summary?: string | null;
|
|
16
|
+
actionsTaken?: string | null;
|
|
17
|
+
personsContacted?: string | null;
|
|
18
|
+
handoverTo?: string | null;
|
|
19
|
+
remarks?: string | null;
|
|
20
|
+
checklist?: {
|
|
21
|
+
itemId: string;
|
|
22
|
+
checked: boolean;
|
|
23
|
+
}[] | null;
|
|
24
|
+
}, policy: Pick<ResponderPolicy, 'report'>): string[];
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import { Role } from "../interfaces/role";
|
|
2
|
+
/**
|
|
3
|
+
* The responder app, for the people who staff a response unit. Each action is
|
|
4
|
+
* confined to the caller's own memberships, duty and unit by the service that
|
|
5
|
+
* owns it (clarion-organization, clarion-incident, clarion-response-tracking),
|
|
6
|
+
* so holding one says nothing about anybody else's unit.
|
|
7
|
+
*/
|
|
8
|
+
export declare const RESPONDER_APP_PERMISSIONS: string[];
|
|
2
9
|
export declare const ROLES_DATA: Role[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The period a Units & Tracking analytics read covers (both halves: tracking and
|
|
3
|
+
* dispatch), and optionally one control centre. Both ends optional: no `from` is
|
|
4
|
+
* "forever", no `to` is now.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnitsAnalyticsQueryDto {
|
|
7
|
+
from?: string;
|
|
8
|
+
to?: string;
|
|
9
|
+
timeZone?: string;
|
|
10
|
+
/** Super-Admin only: one organization's figures instead of every organization's. Ignored for anybody else. */
|
|
11
|
+
organizationId?: number;
|
|
12
|
+
/**
|
|
13
|
+
* One control centre's figures. Within the caller's own organization (a Super-Admin's
|
|
14
|
+
* pick of one); control-centre staff see their own centre whatever this says.
|
|
15
|
+
*/
|
|
16
|
+
controlCentreId?: number;
|
|
17
|
+
}
|
|
@@ -22,5 +22,13 @@ export declare enum TrackingProviderCode {
|
|
|
22
22
|
/** Generic WebSocket adapter (reserved). */
|
|
23
23
|
GENERIC_WEBSOCKET = "GENERIC_WEBSOCKET",
|
|
24
24
|
/** Generic HTTP polling adapter (reserved). */
|
|
25
|
-
GENERIC_HTTP_POLLING = "GENERIC_HTTP_POLLING"
|
|
25
|
+
GENERIC_HTTP_POLLING = "GENERIC_HTTP_POLLING",
|
|
26
|
+
/**
|
|
27
|
+
* The responder app: the phone of the responder on duty with a unit reports
|
|
28
|
+
* the unit's position (`POST /tracking/responder/positions`). Inbound only -
|
|
29
|
+
* there is no connection to open, so the connector never runs a session
|
|
30
|
+
* for it. Used only for units with no enabled hardware tracker binding, so
|
|
31
|
+
* a vehicle's tracker and a crew member's phone never compete.
|
|
32
|
+
*/
|
|
33
|
+
MOBILE_APP = "MOBILE_APP"
|
|
26
34
|
}
|
|
@@ -14,6 +14,8 @@ export * from './interfaces/tracking-unit-current-state';
|
|
|
14
14
|
export * from './interfaces/tracking-socket-payloads';
|
|
15
15
|
export * from './interfaces/tracking-realtime-envelope';
|
|
16
16
|
export * from './interfaces/tracking-provider-descriptor';
|
|
17
|
+
export * from './interfaces/tracking-analytics';
|
|
18
|
+
export * from './dtos/units-analytics-query.dto';
|
|
17
19
|
export * from './constants/tracking-kafka.const';
|
|
18
20
|
export * from './utils/tracking-event-id.util';
|
|
19
21
|
export * from './utils/tracking-validation.util';
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Units & Tracking analytics, the tracking half (the admin's Units & Tracking
|
|
3
|
+
* Analytics): the response units in scope and how they are tracked - computed by
|
|
4
|
+
* clarion-response-tracking. The other half, what was dispatched and how it went, is
|
|
5
|
+
* DispatchAnalytics (clarion-incident); both answer the same query.
|
|
6
|
+
*
|
|
7
|
+
* The fleet and its live status are as they stand NOW. Everything else is the period's,
|
|
8
|
+
* counted by the hour a position was recorded (`eventTime`): the service keeps an hourly
|
|
9
|
+
* rollup of the position history, so a year costs no more to read than a day. Counts,
|
|
10
|
+
* rates and durations only - never a position, a route or a device identifier.
|
|
11
|
+
*/
|
|
12
|
+
/** How the period is cut into points for the charts. Chosen by the service from the length of the period. */
|
|
13
|
+
export type UnitsAnalyticsBucket = 'hour' | 'day' | 'week' | 'month';
|
|
14
|
+
export interface UnitsAnalyticsRange {
|
|
15
|
+
/** Inclusive, ISO 8601. For "forever", the start of the data in scope. */
|
|
16
|
+
from: string;
|
|
17
|
+
/** Exclusive, ISO 8601. */
|
|
18
|
+
to: string;
|
|
19
|
+
bucket: UnitsAnalyticsBucket;
|
|
20
|
+
/** IANA time zone the buckets (and the dispatch hour-of-week grid) are cut in. */
|
|
21
|
+
timeZone: string;
|
|
22
|
+
}
|
|
23
|
+
/** Whose figures these are, as the service decided from the caller. */
|
|
24
|
+
export interface UnitsAnalyticsScope {
|
|
25
|
+
/** Null: every organization (a Super-Admin's platform view). */
|
|
26
|
+
organizationId: number | null;
|
|
27
|
+
/** Null: every control centre of the organization. */
|
|
28
|
+
controlCentreId: number | null;
|
|
29
|
+
platform: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** A count by a key (a type, a status, a provider), largest first unless the section says otherwise. */
|
|
32
|
+
export interface UnitsAnalyticsCount<K extends string = string> {
|
|
33
|
+
key: K;
|
|
34
|
+
count: number;
|
|
35
|
+
}
|
|
36
|
+
/** Median and 90th percentile of one duration, in seconds; null when nothing was measured. */
|
|
37
|
+
export interface UnitsAnalyticsDuration {
|
|
38
|
+
samples: number;
|
|
39
|
+
medianSeconds: number | null;
|
|
40
|
+
p90Seconds: number | null;
|
|
41
|
+
}
|
|
42
|
+
/** The response units in scope, as they stand now (deleted units are left out). */
|
|
43
|
+
export interface TrackingAnalyticsFleet {
|
|
44
|
+
total: number;
|
|
45
|
+
enabled: number;
|
|
46
|
+
disabled: number;
|
|
47
|
+
byType: UnitsAnalyticsCount[];
|
|
48
|
+
byOperationalStatus: UnitsAnalyticsCount[];
|
|
49
|
+
/** Enabled units with an enabled device binding: the service is told where they are. */
|
|
50
|
+
tracked: number;
|
|
51
|
+
/** Enabled units with no enabled binding. */
|
|
52
|
+
untracked: number;
|
|
53
|
+
/** Tracked units by the provider of their binding's connection (a unit bound twice counts under each). */
|
|
54
|
+
trackedByProvider: UnitsAnalyticsCount[];
|
|
55
|
+
}
|
|
56
|
+
/** The tracked units' state now - the same states as the live map. */
|
|
57
|
+
export interface TrackingAnalyticsLive {
|
|
58
|
+
online: number;
|
|
59
|
+
stale: number;
|
|
60
|
+
offline: number;
|
|
61
|
+
/** Tracked units with no position in the live store (never reported, or not for a long while). */
|
|
62
|
+
noPosition: number;
|
|
63
|
+
}
|
|
64
|
+
/** Which units reported in the period. */
|
|
65
|
+
export interface TrackingAnalyticsReporting {
|
|
66
|
+
/** Units that reported at least one position. */
|
|
67
|
+
reportingUnits: number;
|
|
68
|
+
/** The same for the previous period of the same length; null for "forever". */
|
|
69
|
+
previousReportingUnits: number | null;
|
|
70
|
+
/** Tracked units (now) that reported nothing in the period. */
|
|
71
|
+
silentTrackedUnits: number;
|
|
72
|
+
/** Tracked units that reported, as a percentage of the tracked units; null without tracked units. */
|
|
73
|
+
reportingRate: number | null;
|
|
74
|
+
}
|
|
75
|
+
/** The positions recorded in the period. */
|
|
76
|
+
export interface TrackingAnalyticsPositions {
|
|
77
|
+
total: number;
|
|
78
|
+
/** Null for "forever". */
|
|
79
|
+
previousTotal: number | null;
|
|
80
|
+
/** Positions per reporting unit per hour it reported in. */
|
|
81
|
+
perUnitHour: number | null;
|
|
82
|
+
/** Percentages of the positions that say: reported while moving, with the ignition on. */
|
|
83
|
+
movingRate: number | null;
|
|
84
|
+
ignitionOnRate: number | null;
|
|
85
|
+
byProvider: UnitsAnalyticsCount[];
|
|
86
|
+
}
|
|
87
|
+
/** How long a position took to reach Clarion once the device recorded it, in bands. */
|
|
88
|
+
export type TrackingDelayBand = 'WITHIN_5S' | 'WITHIN_10S' | 'WITHIN_30S' | 'WITHIN_1M' | 'WITHIN_2M' | 'WITHIN_5M' | 'WITHIN_15M' | 'LATER';
|
|
89
|
+
/** Delivery delay: `receivedAt - eventTime` of every position in the period. */
|
|
90
|
+
export interface TrackingAnalyticsDelivery {
|
|
91
|
+
/** Estimated from the bands (interpolated within the band the percentile falls in). */
|
|
92
|
+
medianSeconds: number | null;
|
|
93
|
+
p90Seconds: number | null;
|
|
94
|
+
meanSeconds: number | null;
|
|
95
|
+
/** Every band, fastest first, zero counts included. */
|
|
96
|
+
bands: UnitsAnalyticsCount<TrackingDelayBand>[];
|
|
97
|
+
/** Positions that took longer than 5 minutes, as a percentage. */
|
|
98
|
+
lateRate: number | null;
|
|
99
|
+
}
|
|
100
|
+
/** What the ingestion flagged about the period's positions, and the provider units nobody has bound. */
|
|
101
|
+
export interface TrackingAnalyticsQuality {
|
|
102
|
+
outOfOrder: number;
|
|
103
|
+
duplicates: number;
|
|
104
|
+
invalidCoordinates: number;
|
|
105
|
+
/** Positions that jumped implausibly far from the previous one. */
|
|
106
|
+
jumpSuspected: number;
|
|
107
|
+
/** Positions with an accuracy worse than 100 m. */
|
|
108
|
+
poorAccuracy: number;
|
|
109
|
+
/** Provider units reporting without a binding: open now, resolved, and how often they were seen. */
|
|
110
|
+
unmappedOpen: number;
|
|
111
|
+
unmappedResolved: number;
|
|
112
|
+
unmappedOccurrences: number;
|
|
113
|
+
}
|
|
114
|
+
export interface TrackingAnalyticsTimelinePoint {
|
|
115
|
+
/** Start of the bucket, ISO 8601. */
|
|
116
|
+
at: string;
|
|
117
|
+
positions: number;
|
|
118
|
+
reportingUnits: number;
|
|
119
|
+
/** Positions that took longer than 5 minutes to arrive. */
|
|
120
|
+
late: number;
|
|
121
|
+
}
|
|
122
|
+
/** A provider connection in scope: its configuration and health now, and its positions in the period. */
|
|
123
|
+
export interface TrackingAnalyticsConnectionRow {
|
|
124
|
+
id: number;
|
|
125
|
+
organizationId: number;
|
|
126
|
+
controlCentreId: number | null;
|
|
127
|
+
name: string;
|
|
128
|
+
providerCode: string;
|
|
129
|
+
enabled: boolean;
|
|
130
|
+
connectionStatus: string;
|
|
131
|
+
lastEventAt: string | null;
|
|
132
|
+
lastErrorAt: string | null;
|
|
133
|
+
lastErrorCode: string | null;
|
|
134
|
+
/** Enabled bindings through it now. */
|
|
135
|
+
boundUnits: number;
|
|
136
|
+
positions: number;
|
|
137
|
+
reportingUnits: number;
|
|
138
|
+
medianDelaySeconds: number | null;
|
|
139
|
+
lateRate: number | null;
|
|
140
|
+
}
|
|
141
|
+
/** A response unit in scope: what it is and how it is tracked now, and what it reported in the period. */
|
|
142
|
+
export interface TrackingAnalyticsUnitRow {
|
|
143
|
+
responseUnitId: number;
|
|
144
|
+
organizationId: number;
|
|
145
|
+
controlCentreId: number | null;
|
|
146
|
+
name: string | null;
|
|
147
|
+
responseUnitType: string | null;
|
|
148
|
+
enabled: boolean;
|
|
149
|
+
tracked: boolean;
|
|
150
|
+
/** The providers its enabled bindings use. */
|
|
151
|
+
providers: string[];
|
|
152
|
+
/** ONLINE, STALE or OFFLINE now; null when not tracked or without a position. */
|
|
153
|
+
liveStatus: string | null;
|
|
154
|
+
/** Its newest position in the period. */
|
|
155
|
+
lastPositionAt: string | null;
|
|
156
|
+
positions: number;
|
|
157
|
+
/** Hours in which it reported at least once. */
|
|
158
|
+
hoursReporting: number;
|
|
159
|
+
medianDelaySeconds: number | null;
|
|
160
|
+
}
|
|
161
|
+
/** Platform view only: one row per organization. */
|
|
162
|
+
export interface TrackingAnalyticsOrganizationRow {
|
|
163
|
+
organizationId: number;
|
|
164
|
+
units: number;
|
|
165
|
+
tracked: number;
|
|
166
|
+
reportingUnits: number;
|
|
167
|
+
positions: number;
|
|
168
|
+
connections: number;
|
|
169
|
+
lateRate: number | null;
|
|
170
|
+
}
|
|
171
|
+
export interface TrackingAnalytics {
|
|
172
|
+
generatedAt: string;
|
|
173
|
+
range: UnitsAnalyticsRange;
|
|
174
|
+
scope: UnitsAnalyticsScope;
|
|
175
|
+
fleet: TrackingAnalyticsFleet;
|
|
176
|
+
live: TrackingAnalyticsLive;
|
|
177
|
+
reporting: TrackingAnalyticsReporting;
|
|
178
|
+
positions: TrackingAnalyticsPositions;
|
|
179
|
+
delivery: TrackingAnalyticsDelivery;
|
|
180
|
+
quality: TrackingAnalyticsQuality;
|
|
181
|
+
timeline: TrackingAnalyticsTimelinePoint[];
|
|
182
|
+
connections: TrackingAnalyticsConnectionRow[];
|
|
183
|
+
/** The units in scope, most positions first; capped (see `unitsTruncated`). */
|
|
184
|
+
units: TrackingAnalyticsUnitRow[];
|
|
185
|
+
unitsTruncated: boolean;
|
|
186
|
+
/** Platform view only; null otherwise. */
|
|
187
|
+
byOrganization: TrackingAnalyticsOrganizationRow[] | null;
|
|
188
|
+
/** The rollup is complete up to this instant: positions recorded later are not counted yet. */
|
|
189
|
+
rollupThrough: string | null;
|
|
190
|
+
/** History older than this is still being rolled up (the first hours after release); null once complete. */
|
|
191
|
+
backfillingBefore: string | null;
|
|
192
|
+
}
|