grm-shared-library 1.1.238 → 1.1.239

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.
@@ -15,24 +15,33 @@ const class_transformer_1 = require("class-transformer");
15
15
  const class_validator_1 = require("class-validator");
16
16
  const incident_priority_enum_1 = require("../../incident/enums/incident-priority.enum");
17
17
  const incident_sla_stage_enum_1 = require("../enums/incident-sla-stage.enum");
18
- /** `GET /incident-sla/analytics` - by instance start time, default the last 30 days. */
18
+ /**
19
+ * `GET /incident-sla/analytics` - the emergencies raised in a period. Both ends
20
+ * optional: no `from` is "forever", no `to` is now.
21
+ */
19
22
  class IncidentSlaAnalyticsQueryDto {
20
23
  }
21
24
  exports.IncidentSlaAnalyticsQueryDto = IncidentSlaAnalyticsQueryDto;
22
25
  __decorate([
23
- (0, swagger_1.ApiPropertyOptional)(),
26
+ (0, swagger_1.ApiPropertyOptional)({ example: '2026-09-01T00:00:00+03:00', description: 'Inclusive. Omit for "forever".' }),
24
27
  (0, class_validator_1.IsOptional)(),
25
- (0, class_validator_1.IsISO8601)(),
28
+ (0, class_validator_1.IsISO8601)({ strict: true }),
26
29
  __metadata("design:type", String)
27
30
  ], IncidentSlaAnalyticsQueryDto.prototype, "from", void 0);
28
31
  __decorate([
29
- (0, swagger_1.ApiPropertyOptional)(),
32
+ (0, swagger_1.ApiPropertyOptional)({ example: '2026-09-30T23:59:59+03:00', description: 'Exclusive. Omit for "now".' }),
30
33
  (0, class_validator_1.IsOptional)(),
31
- (0, class_validator_1.IsISO8601)(),
34
+ (0, class_validator_1.IsISO8601)({ strict: true }),
32
35
  __metadata("design:type", String)
33
36
  ], IncidentSlaAnalyticsQueryDto.prototype, "to", void 0);
34
37
  __decorate([
35
- (0, swagger_1.ApiPropertyOptional)(),
38
+ (0, swagger_1.ApiPropertyOptional)({ example: 'Africa/Nairobi', description: 'IANA time zone for the chart buckets and the hour-of-week grid.' }),
39
+ (0, class_validator_1.IsOptional)(),
40
+ (0, class_validator_1.IsTimeZone)(),
41
+ __metadata("design:type", String)
42
+ ], IncidentSlaAnalyticsQueryDto.prototype, "timeZone", void 0);
43
+ __decorate([
44
+ (0, swagger_1.ApiPropertyOptional)({ description: 'Super-Admin only' }),
36
45
  (0, class_validator_1.IsOptional)(),
37
46
  (0, class_transformer_1.Type)(() => Number),
38
47
  (0, class_validator_1.IsInt)(),
@@ -1 +1 @@
1
- {"version":3,"file":"incident-sla-analytics-query.dto.js","sourceRoot":"","sources":["../../../../../src/modules/incident-sla/dtos/incident-sla-analytics-query.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AACtD,yDAAyC;AACzC,qDAAmF;AACnF,wFAA+E;AAC/E,8EAAoE;AAEpE,wFAAwF;AACxF,MAAa,4BAA4B;CA4BxC;AA5BD,oEA4BC;AA1BG;IADC,IAAA,6BAAmB,GAAE;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,2BAAS,GAAE;;0DACnC;AAGd;IADC,IAAA,6BAAmB,GAAE;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,2BAAS,GAAE;;wDACrC;AAIZ;IADC,IAAA,6BAAmB,GAAE;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,IAAA,uBAAK,GAAE;IAAE,IAAA,4BAAU,GAAE;;oEACvD;AAGxB;IADC,IAAA,6BAAmB,GAAE;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,IAAA,uBAAK,GAAE;IAAE,IAAA,4BAAU,GAAE;;qEACtD;AAGzB;IADC,IAAA,6BAAmB,EAAC,EAAE,IAAI,EAAE,yCAAgB,EAAE,CAAC;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,wBAAM,EAAC,yCAAgB,CAAC;;8DAC5D;AAG5B;IADC,IAAA,6BAAmB,EAAC,EAAE,IAAI,EAAE,0CAAgB,EAAE,CAAC;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,wBAAM,EAAC,0CAAgB,CAAC;;2DAC/D;AAGzB;IADC,IAAA,6BAAmB,GAAE;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,IAAA,uBAAK,GAAE;IAAE,IAAA,4BAAU,GAAE;;4DAC/D;AAGhB;IADC,IAAA,6BAAmB,GAAE;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,IAAA,uBAAK,GAAE;IAAE,IAAA,4BAAU,GAAE;;gEAC3D;AAGpB;IADC,IAAA,6BAAmB,GAAE;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,IAAA,uBAAK,GAAE;IAAE,IAAA,4BAAU,GAAE;;oEACvD"}
1
+ {"version":3,"file":"incident-sla-analytics-query.dto.js","sourceRoot":"","sources":["../../../../../src/modules/incident-sla/dtos/incident-sla-analytics-query.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAsD;AACtD,yDAAyC;AACzC,qDAA+F;AAC/F,wFAA+E;AAC/E,8EAAoE;AAEpE;;;GAGG;AACH,MAAa,4BAA4B;CAsCxC;AAtCD,oEAsCC;AAnCG;IAFC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAC5G,IAAA,4BAAU,GAAE;IAAE,IAAA,2BAAS,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;0DAC5B;AAId;IAFC,IAAA,6BAAmB,EAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;IACxG,IAAA,4BAAU,GAAE;IAAE,IAAA,2BAAS,EAAC,EAAE,M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A,6BAAmB,GAAE;IAAE,IAAA,4BAAU,GAAE;IAAE,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,IAAA,uBAAK,GAAE;IAAE,IAAA,4BAAU,GAAE;;oEACvD"}
@@ -9,26 +9,35 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  import { ApiPropertyOptional } from '@nestjs/swagger';
11
11
  import { Type } from 'class-transformer';
12
- import { IsEnum, IsInt, IsISO8601, IsOptional, IsPositive } from 'class-validator';
12
+ import { IsEnum, IsInt, IsISO8601, IsOptional, IsPositive, IsTimeZone } from 'class-validator';
13
13
  import { IncidentPriority } from '../../incident/enums/incident-priority.enum';
14
14
  import { IncidentSlaStage } from '../enums/incident-sla-stage.enum';
15
- /** `GET /incident-sla/analytics` - by instance start time, default the last 30 days. */
15
+ /**
16
+ * `GET /incident-sla/analytics` - the emergencies raised in a period. Both ends
17
+ * optional: no `from` is "forever", no `to` is now.
18
+ */
16
19
  export class IncidentSlaAnalyticsQueryDto {
17
20
  }
18
21
  __decorate([
19
- ApiPropertyOptional(),
22
+ ApiPropertyOptional({ example: '2026-09-01T00:00:00+03:00', description: 'Inclusive. Omit for "forever".' }),
20
23
  IsOptional(),
21
- IsISO8601(),
24
+ IsISO8601({ strict: true }),
22
25
  __metadata("design:type", String)
23
26
  ], IncidentSlaAnalyticsQueryDto.prototype, "from", void 0);
24
27
  __decorate([
25
- ApiPropertyOptional(),
28
+ ApiPropertyOptional({ example: '2026-09-30T23:59:59+03:00', description: 'Exclusive. Omit for "now".' }),
26
29
  IsOptional(),
27
- IsISO8601(),
30
+ IsISO8601({ strict: true }),
28
31
  __metadata("design:type", String)
29
32
  ], IncidentSlaAnalyticsQueryDto.prototype, "to", void 0);
30
33
  __decorate([
31
- ApiPropertyOptional(),
34
+ ApiPropertyOptional({ example: 'Africa/Nairobi', description: 'IANA time zone for the chart buckets and the hour-of-week grid.' }),
35
+ IsOptional(),
36
+ IsTimeZone(),
37
+ __metadata("design:type", String)
38
+ ], IncidentSlaAnalyticsQueryDto.prototype, "timeZone", void 0);
39
+ __decorate([
40
+ ApiPropertyOptional({ description: 'Super-Admin only' }),
32
41
  IsOptional(),
33
42
  Type(() => Number),
34
43
  IsInt(),
@@ -1 +1 @@
1
- {"version":3,"file":"incident-sla-analytics-query.dto.js","sourceRoot":"","sources":["../../../../../src/modules/incident-sla/dtos/incident-sla-analytics-query.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,wFAAwF;AACxF,MAAM,OAAO,4BAA4B;CA4BxC;AA1BG;IADC,mBAAmB,EAAE;IAAE,UAAU,EAAE;IAAE,SAAS,EAAE;;0DACnC;AAGd;IADC,mBAAmB,EAAE;IAAE,UAAU,EAAE;IAAE,SAAS,EAAE;;wDACrC;AAIZ;IADC,mBAAmB,EAAE;IAAE,UAAU,EAAE;IAAE,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE;IAAE,UAAU,EAAE;;oEACvD;AAGxB;IADC,mBAAmB,EAAE;IAAE,UAAU,EAAE;IAAE,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE;IAAE,UAAU,EAAE;;qEACtD;AAGzB;IADC,mBAAmB,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;IAAE,UAAU,EAAE;IAAE,MAAM,CAAC,gBAAgB,CAAC;;8DAC5D;AAG5B;IADC,mBAAmB,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC;IAAE,UAAU,EAAE;IAAE,MAAM,CAAC,gBAAgB,CAAC;;2DAC/D;AAGzB;IADC,mBAAmB,EAAE;IAAE,UAAU,EAAE;IAAE,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE;IAAE,UAAU,EAAE;;4DAC/D;AAGhB;IADC,mBAAmB,EAAE;IAAE,UAAU,EAAE;IAAE,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE;IAAE,UAAU,EAAE;;gEAC3D;AAGpB;IADC,mBAAmB,EAAE;IAAE,UAAU,EAAE;IAAE,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE;IAAE,UAAU,EAAE;;oEACvD"}
1
+ {"version":3,"file":"incident-sla-analytics-query.dto.js","sourceRoot":"","sources":["../../../../../src/modules/incident-sla/dtos/incident-sla-analytics-query.dto.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE;;;GAGG;AACH,MAAM,OAAO,4BAA4B;CAsCxC;AAnCG;IAFC,mBAAmB,CAAC,EAAE,OAAO,EAAE,2BAA2B,EAAE,WAAW,EAAE,gCAAgC,EAAE,CAAC;IAC5G,UAAU,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;0DAC5B;AAId;IAFC,mBAAmB,CAAC,EAAE,OAAO,EAAE,2BAA2B,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D"}
@@ -1,15 +1,23 @@
1
1
  import { IncidentPriority } from '../../incident/enums/incident-priority.enum';
2
2
  import { IncidentSlaStage } from '../enums/incident-sla-stage.enum';
3
- /** `GET /incident-sla/analytics` - by instance start time, default the last 30 days. */
3
+ /**
4
+ * `GET /incident-sla/analytics` - the emergencies raised in a period. Both ends
5
+ * optional: no `from` is "forever", no `to` is now.
6
+ */
4
7
  export declare class IncidentSlaAnalyticsQueryDto {
5
8
  from?: string;
6
9
  to?: string;
10
+ timeZone?: string;
7
11
  /** Honoured for Super-Admin only; everybody else is held to their own scope. */
8
12
  organizationId?: number;
13
+ /** Narrows an organization's figures to one control centre; a control centre's staff are held to their own. */
9
14
  controlCentreId?: number;
15
+ /** The priority each emergency was measured at. */
10
16
  priority?: IncidentPriority;
17
+ /** Narrows the stage figures (compliance, durations) to one stage. */
11
18
  stage?: IncidentSlaStage;
12
19
  typeId?: number;
13
20
  categoryId?: number;
21
+ /** The emergencies a unit was dispatched to. */
14
22
  responseUnitId?: number;
15
23
  }
@@ -1,4 +1,50 @@
1
+ import { IncidentPriority } from '../../incident/enums/incident-priority.enum';
1
2
  import { IncidentSlaStage } from '../enums/incident-sla-stage.enum';
3
+ import { SlaPriorityLevel } from '../enums/sla-overall-state.enum';
4
+ /**
5
+ * Emergency SLA analytics (the admin's SLA Analytics): how fast the control room
6
+ * and the response units answered the emergencies raised over a period, stage by
7
+ * stage, against the targets of the policy each emergency ran under - and what
8
+ * happened when they did not (escalations, alternative units, pauses, exceptions,
9
+ * notifications).
10
+ *
11
+ * One read, computed by clarion-incident from one consistent snapshot. Counts,
12
+ * rates and durations only.
13
+ *
14
+ * How it is counted:
15
+ * - Everything belongs to the period its EMERGENCY was raised in (the incident's
16
+ * creation): its stage clocks, dispatches, escalations and notifications, even
17
+ * when they happened after the period ended. So every figure on the page is
18
+ * about the same emergencies.
19
+ * - Compliance = met / (met + breached), over stage clocks that were decided.
20
+ * An approved exception shows in its own figure; the breach stays a breach.
21
+ * - Durations are in SECONDS, measured from the incident's creation (the SLA's
22
+ * start) unless the field says otherwise; stage durations exclude paused time.
23
+ * - Only measured emergencies count: INCIDENT class, reaching a control room.
24
+ */
25
+ /** How the period is cut into points for the charts. Chosen by the service from the length of the period. */
26
+ export type IncidentSlaAnalyticsBucket = 'hour' | 'day' | 'week' | 'month';
27
+ export interface IncidentSlaAnalyticsRange {
28
+ /** Inclusive, ISO 8601. The first emergency when the period asked for was "forever". */
29
+ from: string;
30
+ /** Exclusive, ISO 8601. */
31
+ to: string;
32
+ bucket: IncidentSlaAnalyticsBucket;
33
+ /** IANA time zone the buckets and the hour-of-week grid are cut in. */
34
+ timeZone: string;
35
+ }
36
+ /** A count by a key, largest first unless the section says otherwise. */
37
+ export interface IncidentSlaAnalyticsCount<K extends string = string> {
38
+ key: K;
39
+ count: number;
40
+ }
41
+ /** Median and 90th percentile of one duration, in seconds; null when nothing was measured. */
42
+ export interface IncidentSlaDurationSummary {
43
+ median: number | null;
44
+ p90: number | null;
45
+ /** How many were measured. */
46
+ count: number;
47
+ }
2
48
  /**
3
49
  * Durations at percentiles, in seconds. Percentiles are the point: an average
4
50
  * hides the slow tail, and the slow tail is the emergency that went wrong.
@@ -10,26 +56,301 @@ export interface IncidentSlaDurationPercentiles {
10
56
  p95: number | null;
11
57
  p99: number | null;
12
58
  average: number | null;
59
+ /** How many were measured. */
60
+ count: number;
61
+ }
62
+ /** The headline figures of a period. */
63
+ export interface IncidentSlaAnalyticsSummary {
64
+ /** Measured emergencies raised in the period. */
65
+ emergencies: number;
66
+ /** Of those, still being worked (not yet closed / ended). */
67
+ openNow: number;
68
+ /** With at least one breached stage. */
69
+ breachedEmergencies: number;
70
+ breachedEmergencyPercent: number | null;
71
+ /** Stage clocks decided: met + breached. */
72
+ decided: number;
73
+ met: number;
74
+ breached: number;
75
+ breachedWithApprovedException: number;
76
+ compliancePercent: number | null;
77
+ complianceWithExceptionsPercent: number | null;
78
+ acknowledged: number;
79
+ dispatched: number;
80
+ /** A unit reached the scene. */
81
+ arrived: number;
82
+ resolved: number;
83
+ closed: number;
84
+ autoClosed: number;
85
+ /** Raised to acknowledged. */
86
+ timeToAcknowledge: IncidentSlaDurationSummary;
87
+ /** Raised to the first dispatch. */
88
+ timeToDispatch: IncidentSlaDurationSummary;
89
+ /** Raised to the first unit on scene - the response time the reporter lives through. */
90
+ timeToArrival: IncidentSlaDurationSummary;
91
+ /** First unit assigned to first unit on scene - the travel. */
92
+ travelTime: IncidentSlaDurationSummary;
93
+ /** Raised to resolved. */
94
+ timeToResolve: IncidentSlaDurationSummary;
95
+ escalations: number;
96
+ alternativesRecommended: number;
97
+ reassignments: number;
98
+ /** Notification requests that reached nobody or only some (FAILED, PARTIAL). */
99
+ notificationsFailed: number;
13
100
  }
101
+ /** One stage across the period's emergencies. */
14
102
  export interface IncidentSlaStageAnalytics {
15
103
  stage: IncidentSlaStage;
104
+ /** Clocks of this stage (one per dispatch for acceptance and mobilization). */
16
105
  instances: number;
17
106
  met: number;
18
107
  breached: number;
19
108
  breachedWithApprovedException: number;
109
+ /** Still running, or paused. */
110
+ open: number;
111
+ waived: number;
112
+ /** Ended with the incident before its milestone (expired), or never started (cancelled). */
113
+ expired: number;
114
+ cancelled: number;
115
+ /** Reached the warning (75 %) / at-risk (90 %) mark. */
116
+ warned: number;
117
+ atRisk: number;
20
118
  compliancePercent: number | null;
21
119
  complianceWithExceptionsPercent: number | null;
22
- /** Start to milestone, pauses excluded, over the instances that reached it. */
120
+ /** The target most of these clocks ran against (median), seconds. */
121
+ targetSeconds: number | null;
122
+ /** Start to milestone, pauses excluded, over the clocks that reached it. */
23
123
  duration: IncidentSlaDurationPercentiles;
124
+ /** By how much the breached ones were late. */
125
+ overrun: IncidentSlaDurationSummary;
126
+ }
127
+ /** One stage of one priority, for the priority × stage grid. */
128
+ export interface IncidentSlaStageCell {
129
+ stage: IncidentSlaStage;
130
+ met: number;
131
+ breached: number;
132
+ compliancePercent: number | null;
133
+ medianSeconds: number | null;
134
+ }
135
+ export interface IncidentSlaPriorityRow {
136
+ priority: IncidentPriority;
137
+ level: SlaPriorityLevel;
138
+ emergencies: number;
139
+ breachedEmergencies: number;
140
+ met: number;
141
+ breached: number;
142
+ compliancePercent: number | null;
143
+ medianSecondsToAcknowledge: number | null;
144
+ medianSecondsToArrival: number | null;
145
+ stages: IncidentSlaStageCell[];
146
+ }
147
+ /** One point of the charts. `bucket` is its start, local to the range's zone, without an offset. */
148
+ export interface IncidentSlaTimelinePoint {
149
+ bucket: string;
150
+ emergencies: number;
151
+ breachedEmergencies: number;
152
+ met: number;
153
+ breached: number;
154
+ compliancePercent: number | null;
155
+ medianSecondsToAcknowledge: number | null;
156
+ medianSecondsToArrival: number | null;
157
+ escalations: number;
158
+ }
159
+ export interface IncidentSlaControlCentreRow {
160
+ /** Null: emergencies no control centre was set on. */
161
+ controlCentreId: number | null;
162
+ emergencies: number;
163
+ breachedEmergencies: number;
164
+ met: number;
165
+ breached: number;
166
+ compliancePercent: number | null;
167
+ medianSecondsToAcknowledge: number | null;
168
+ medianSecondsToDispatch: number | null;
169
+ medianSecondsToArrival: number | null;
170
+ escalations: number;
171
+ }
172
+ export interface IncidentSlaTypeRow {
173
+ typeId: number | null;
174
+ typeName: string | null;
175
+ categoryId: number | null;
176
+ categoryName: string | null;
177
+ emergencies: number;
178
+ breachedEmergencies: number;
179
+ met: number;
180
+ breached: number;
181
+ compliancePercent: number | null;
182
+ medianSecondsToArrival: number | null;
183
+ }
184
+ export interface IncidentSlaResponseUnitRow {
185
+ responseUnitId: number;
186
+ responseUnitName: string;
187
+ dispatches: number;
188
+ /** Acknowledged the dispatch (accepted). */
189
+ accepted: number;
190
+ declined: number;
191
+ stoodDown: number;
192
+ arrived: number;
193
+ /** Arrivals inferred from the unit's live tracking. */
194
+ arrivalsInferred: number;
195
+ /** The acceptance clock, for this unit. */
196
+ acceptanceMet: number;
197
+ acceptanceBreached: number;
198
+ acceptanceCompliancePercent: number | null;
199
+ medianSecondsToAccept: number | null;
200
+ /** Accepted to en route. */
201
+ medianSecondsToMobilize: number | null;
202
+ /** Dispatched to on scene. */
203
+ medianSecondsToArrive: number | null;
204
+ }
205
+ export interface IncidentSlaArrivalAnalytics {
206
+ arrivals: number;
207
+ /** How each first arrival is known: inferred from tracking, the responder, the control room (UNKNOWN for older ones). */
208
+ bySource: IncidentSlaAnalyticsCount[];
209
+ inferredPercent: number | null;
210
+ /** Dispatches whose live ETA turned at risk / likely late / uncertain at least once. */
211
+ etaAtRisk: number;
212
+ etaLikelyLate: number;
213
+ etaUncertain: number;
214
+ /** Emergencies a unit was predicted late for, and of those, how many breached the arrival target. */
215
+ predictedLate: number;
216
+ predictedLateAndBreached: number;
217
+ /** predictedLateAndBreached / predictedLate. */
218
+ latePredictionPrecisionPercent: number | null;
219
+ /** How far the first ETA was from the actual arrival (absolute seconds). */
220
+ firstEtaError: IncidentSlaDurationSummary;
221
+ /** Straight-line distance of the unit when dispatched, metres. */
222
+ distanceAtDispatch: IncidentSlaDurationSummary;
223
+ }
224
+ export interface IncidentSlaEscalationAnalytics {
225
+ total: number;
226
+ /** SLA_BREACHED, SLA_AT_RISK, ETA_LIKELY_BREACH, DISPATCH_REJECTED... */
227
+ byTrigger: IncidentSlaAnalyticsCount[];
228
+ /** DISPATCHER, SUPERVISOR, DUTY_MANAGER, ORGANIZATION_ADMIN. */
229
+ byLevel: IncidentSlaAnalyticsCount[];
230
+ byStage: IncidentSlaAnalyticsCount[];
231
+ /** The policy rules that fired most - the ten commonest. */
232
+ byRule: IncidentSlaAnalyticsCount[];
233
+ alternativesRecommended: number;
234
+ reassignments: number;
235
+ /** Emergencies escalated at least once. */
236
+ escalatedEmergencies: number;
237
+ }
238
+ export interface IncidentSlaPauseAnalytics {
239
+ requested: number;
240
+ approved: number;
241
+ rejected: number;
242
+ /** Waiting for a supervisor. */
243
+ pending: number;
244
+ withdrawn: number;
245
+ totalPausedSeconds: number;
246
+ pausedTime: IncidentSlaDurationSummary;
247
+ byReason: IncidentSlaAnalyticsCount[];
248
+ }
249
+ export interface IncidentSlaExceptionAnalytics {
250
+ requested: number;
251
+ approved: number;
252
+ rejected: number;
253
+ pending: number;
254
+ byReason: IncidentSlaAnalyticsCount[];
255
+ }
256
+ export interface IncidentSlaNotificationEventRow {
257
+ /** emergency-created, emergency-sla-breached... */
258
+ event: string;
259
+ requests: number;
260
+ failed: number;
261
+ }
262
+ export interface IncidentSlaNotificationChannelRow {
263
+ channel: string;
264
+ recipients: number;
265
+ sent: number;
266
+ failed: number;
267
+ successPercent: number | null;
268
+ }
269
+ export interface IncidentSlaNotificationAnalytics {
270
+ /** Requests clarion-notification answered. */
271
+ requests: number;
272
+ /** SENT, PARTIAL, FAILED, NOT_POSSIBLE. */
273
+ byStatus: IncidentSlaAnalyticsCount[];
274
+ byEvent: IncidentSlaNotificationEventRow[];
275
+ byChannel: IncidentSlaNotificationChannelRow[];
276
+ /** By audience: REPORTER, DISPATCHER, SUPERVISOR... (people reached). */
277
+ byAudience: IncidentSlaAnalyticsCount[];
278
+ }
279
+ export interface IncidentSlaClosureAnalytics {
280
+ resolved: number;
281
+ closed: number;
282
+ manual: number;
283
+ automatic: number;
284
+ /** Resolved and not closed yet. */
285
+ awaitingClosure: number;
286
+ /** Emergencies whose automatic closure waited for a unit still out. */
287
+ autoCloseDeferred: number;
288
+ resolvedToClosed: IncidentSlaDurationSummary;
289
+ }
290
+ /** One hour of one weekday (1 = Monday), in the range's zone. */
291
+ export interface IncidentSlaHeatmapCell {
292
+ weekday: number;
293
+ hour: number;
294
+ emergencies: number;
295
+ breachedEmergencies: number;
296
+ }
297
+ /** The emergencies that went most wrong - by total time over target. */
298
+ export interface IncidentSlaWorstIncident {
299
+ incidentId: number;
300
+ /** `#1234`. */
301
+ reference: string;
302
+ priority: IncidentPriority;
303
+ typeName: string | null;
304
+ controlCentreId: number | null;
305
+ createdAt: string;
306
+ breachedStages: number;
307
+ worstStage: IncidentSlaStage | null;
308
+ maxOverrunSeconds: number;
309
+ totalOverrunSeconds: number;
310
+ timeToArrivalSeconds: number | null;
311
+ }
312
+ /** A Super-Admin's platform view: one row per organization. */
313
+ export interface IncidentSlaOrganizationRow {
314
+ organizationId: number;
315
+ emergencies: number;
316
+ breachedEmergencies: number;
317
+ met: number;
318
+ breached: number;
319
+ compliancePercent: number | null;
320
+ medianSecondsToAcknowledge: number | null;
321
+ medianSecondsToArrival: number | null;
24
322
  }
25
323
  /** `GET /incident-sla/analytics`. */
26
- export interface IncidentSlaAnalyticsResult {
27
- from: string;
28
- to: string;
324
+ export interface IncidentSlaAnalytics {
325
+ range: IncidentSlaAnalyticsRange;
326
+ /** The organization the figures are for; null in a Super-Admin's platform view. */
29
327
  organizationId: number | null;
30
328
  controlCentreId: number | null;
31
- incidents: number;
32
- breachedIncidents: number;
329
+ /** A Super-Admin across every organization (`byOrganization` is filled). */
330
+ platform: boolean;
331
+ summary: IncidentSlaAnalyticsSummary;
332
+ /** The previous period of the same length; null for "forever". */
333
+ previous: IncidentSlaAnalyticsSummary | null;
33
334
  stages: IncidentSlaStageAnalytics[];
335
+ /** Critical, High, Medium, Low - in that order, zeros included. */
336
+ byPriority: IncidentSlaPriorityRow[];
337
+ timeline: IncidentSlaTimelinePoint[];
338
+ byControlCentre: IncidentSlaControlCentreRow[];
339
+ byType: IncidentSlaTypeRow[];
340
+ /** The 25 units dispatched most. */
341
+ byResponseUnit: IncidentSlaResponseUnitRow[];
342
+ arrival: IncidentSlaArrivalAnalytics;
343
+ escalations: IncidentSlaEscalationAnalytics;
344
+ pauses: IncidentSlaPauseAnalytics;
345
+ exceptions: IncidentSlaExceptionAnalytics;
346
+ notifications: IncidentSlaNotificationAnalytics;
347
+ closure: IncidentSlaClosureAnalytics;
348
+ /** emergency, panic... (the alert's own kind). */
349
+ emergencyTypes: IncidentSlaAnalyticsCount[];
350
+ heatmap: IncidentSlaHeatmapCell[];
351
+ worstIncidents: IncidentSlaWorstIncident[];
352
+ byOrganization: IncidentSlaOrganizationRow[];
34
353
  generatedAt: string;
35
354
  }
355
+ /** The name the first release used. */
356
+ export type IncidentSlaAnalyticsResult = IncidentSlaAnalytics;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grm-shared-library",
3
- "version": "1.1.238",
3
+ "version": "1.1.239",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",