@kquika-inc/s-system 1.0.8 → 2.0.0

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/README.md CHANGED
@@ -26,6 +26,10 @@ record before acting on it.
26
26
  | `live_feed` | Observed from the live provider feed. |
27
27
  | `database` | Observed on an earlier read and persisted. |
28
28
 
29
+ Every record this API returns is an observation. `live_feed` is the current
30
+ reading from the provider; `database` is the same reading persisted from an
31
+ earlier call, so it may lag the feed. Neither is an estimate.
32
+
29
33
  Fields are left null where the source carries no value. A null
30
34
  `delay_minutes` means no time was reported.
31
35
 
@@ -35,6 +39,20 @@ Fields are left null where the source carries no value. A null
35
39
  are in the response. Flights that reported no time are excluded from that
36
40
  denominator, so other ratios can be derived from the same payload.
37
41
 
42
+ `on_time` counts departures within `on_time_threshold_minutes`, which is
43
+ returned on the response and defaults to 15. Read it rather than assuming it.
44
+
45
+ `on_time_percentage` is null when the figure cannot be measured, and
46
+ `ontime_unavailable_reason` says why. Three cases:
47
+
48
+ - Nothing was measured.
49
+ - Coverage was too thin to describe the operation.
50
+ - The sample was censored: every flight carrying a time was late, and none
51
+ departed early or on schedule. This happens when the upstream feed publishes
52
+ a delay only when there is one, so "on time" and "unknown" collapse into the
53
+ same absence. A rate over only late flights reads near zero whatever the
54
+ real punctuality is, so no rate is returned at all.
55
+
38
56
  `gate_conflicts` is keyed on airport and gate together, so gate labels are
39
57
  only compared within a single station.
40
58
 
@@ -106,15 +124,20 @@ if (error || !data?.success) {
106
124
 
107
125
  ```ts
108
126
  for (const flight of data.data) {
109
- if (flight.data_confidence === 'live_feed') schedule(flight);
127
+ // Both values are observations, so both are safe to schedule against.
128
+ // Branch on freshness only when it matters to you: `database` may lag the
129
+ // live feed by a sync interval.
130
+ if (flight.data_confidence === 'live_feed') scheduleNow(flight);
131
+ else queueForRefresh(flight);
110
132
  }
111
133
  ```
112
134
 
113
135
  `live_feed` is the current reading from the provider. `database` is the same
114
- reading persisted from an earlier call, so it may lag the feed.
136
+ reading persisted from an earlier call, so it may lag the feed by up to one
137
+ sync interval.
115
138
 
116
- TypeScript narrows that union, so a typo fails to compile instead of
117
- silently never matching.
139
+ TypeScript narrows the union, so a typo fails to compile instead of silently
140
+ never matching.
118
141
 
119
142
  ## Nulls
120
143
 
@@ -158,6 +181,13 @@ if (!heat.data?.data?.lidar_available) {
158
181
  `avg_wait_minutes` covers queueing zones only: security, check-in,
159
182
  immigration and customs. Gates and lounges are out of scope.
160
183
 
184
+ Check `data_source` on the heatmap response before acting on occupancy or wait
185
+ times. `measured` means a sensor, gate read or throughput count is behind the
186
+ figure. `modelled` means it is derived from terminal layout and time of day
187
+ with no sensor behind it, in which case two calls seconds apart can return
188
+ different values with no underlying event. Do not diff them to infer movement.
189
+
190
+
161
191
  Heatmap and congestion require Professional. Overview is Standard.
162
192
 
163
193
  ## Flight metrics and route analytics
@@ -204,16 +234,23 @@ Every schema is exported.
204
234
  ```ts
205
235
  import type {
206
236
  Flight,
207
- DisruptionPrediction,
208
- Exposure,
209
- Meta,
237
+ MetricsResponse,
238
+ HeatmapResponse,
239
+ ErrorResponse,
210
240
  } from '@kquika-inc/s-system';
211
241
 
212
- function isActionable(p: DisruptionPrediction): boolean {
213
- return p.risk_level === 'critical' || p.risk_level === 'elevated';
242
+ function isActionable(flight: Flight): boolean {
243
+ // delay_minutes must be null-checked first. `?? 0` here would treat an
244
+ // unreported flight as departing exactly on schedule.
245
+ return flight.delay_minutes !== null && flight.delay_minutes > 15;
214
246
  }
215
247
  ```
216
248
 
249
+ Disruption prediction and passenger-rights exposure are not on the public API
250
+ and have no exported types. They are delivered through the application and
251
+ through scheduled data delivery; talk to your account manager about direct
252
+ access.
253
+
217
254
  ## Support
218
255
 
219
256
  An API key, a plan change, or a capability you need that your plan does not
package/dist/sdk.gen.d.ts CHANGED
@@ -19,8 +19,9 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
19
19
  *
20
20
  * **Requires Standard.**
21
21
  *
22
- * Each flight carries a `data_confidence` value. Confirm it before using the
23
- * flight for operational planning.
22
+ * Every record returned is an observation. Records generated to fill a gap in the live
23
+ * feed are excluded rather than labelled, so no provenance check is required before using
24
+ * a flight for operational planning. `excluded_generated` reports how many were removed.
24
25
  */
25
26
  export declare const listFlights: <ThrowOnError extends boolean = false>(options?: Options<ListFlightsData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").FlightListResponse, import("./types.gen").ErrorResponse, ThrowOnError>;
26
27
  /**
package/dist/sdk.gen.js CHANGED
@@ -6,8 +6,9 @@ import { client as _heyApiClient } from './client.gen';
6
6
  *
7
7
  * **Requires Standard.**
8
8
  *
9
- * Each flight carries a `data_confidence` value. Confirm it before using the
10
- * flight for operational planning.
9
+ * Every record returned is an observation. Records generated to fill a gap in the live
10
+ * feed are excluded rather than labelled, so no provenance check is required before using
11
+ * a flight for operational planning. `excluded_generated` reports how many were removed.
11
12
  */
12
13
  export const listFlights = (options) => {
13
14
  return (options?.client ?? _heyApiClient).get({
@@ -59,11 +59,11 @@ export type Flight = {
59
59
  */
60
60
  status?: 'scheduled' | 'active' | 'landed' | 'delayed' | 'cancelled' | 'diverted' | 'unknown';
61
61
  /**
62
- * Provenance of this record. `live_feed` and `database` are observed records.
63
- * `generated` is synthetic sample data and is not suitable for operational
64
- * planning.
62
+ * Provenance of this record. Both values are observations: `live_feed` is the current reading from the provider, `database` is the same reading persisted from an earlier call and may lag the feed by up to one sync interval.
63
+ *
64
+ * There is no value for generated data. Records produced to fill a gap in the feed are excluded from this API entirely rather than labelled, so every record you receive is an observation and no client-side check is required before acting on one.
65
65
  */
66
- data_confidence: 'live_feed' | 'database' | 'generated';
66
+ data_confidence: 'live_feed' | 'database';
67
67
  };
68
68
  export type FlightListResponse = Envelope & {
69
69
  data?: {
@@ -72,11 +72,13 @@ export type FlightListResponse = Envelope & {
72
72
  /**
73
73
  * Provenance of the returned records. `generated` appears only when it was requested explicitly, since the default excludes it.
74
74
  */
75
- source?: 'live_feed' | 'database' | 'generated' | 'mixed';
75
+ source?: 'live_feed' | 'database' | 'mixed';
76
76
  /**
77
- * Records matching the other filters but removed by `confidence`. With no filter this counts the generated rows the default excluded, so a non-zero value here on a default query means the feed is carrying synthetic data.
77
+ * Records matching your filters that were produced to fill a gap in the live feed, and therefore excluded. Always excluded; this is the count, not a choice.
78
+ *
79
+ * A non-zero value means the feed was thin enough for the platform to generate rows, so a short result can be told apart from a short schedule. It is a signal about the feed, not about your query.
78
80
  */
79
- excluded_by_confidence?: number | null;
81
+ excluded_generated?: number | null;
80
82
  };
81
83
  };
82
84
  export type FlightResponse = Envelope & {
@@ -93,13 +95,29 @@ export type MetricsResponse = Envelope & {
93
95
  */
94
96
  measured_flights?: number;
95
97
  /**
96
- * Departures within 15 minutes of schedule.
98
+ * Departures within `on_time_threshold_minutes` of schedule, which defaults to 15. Read the threshold from the response rather than assuming it.
97
99
  */
98
100
  on_time?: number;
99
101
  /**
100
- * `on_time` divided by `measured_flights`. Null when `measured_flights` is 0.
102
+ * `on_time` divided by `measured_flights`.
103
+ *
104
+ * Null in three cases, which `ontime_unavailable_reason` distinguishes: nothing was measured; coverage was too thin for the figure to describe the operation; or the sample was censored, meaning every flight carrying a time was late and none departed early or on schedule. The third is the one to watch, because a rate computed over only late flights reads near zero whatever the real punctuality is.
105
+ *
106
+ * Null is not zero. Treating it as zero reports perfect lateness on a day nothing was measured.
101
107
  */
102
108
  on_time_percentage?: number | null;
109
+ /**
110
+ * False when the sample cannot support an on-time rate. `on_time_percentage` is null whenever this is false.
111
+ */
112
+ ontime_measurable?: boolean;
113
+ /**
114
+ * Plain sentence naming why the rate could not be computed. Null when it could.
115
+ */
116
+ ontime_unavailable_reason?: string | null;
117
+ /**
118
+ * Minutes of delay still counted as on time. Configurable per deployment, so read it rather than assuming 15.
119
+ */
120
+ on_time_threshold_minutes?: number;
103
121
  /**
104
122
  * Mean delay across delayed departures only. The denominator excludes on time
105
123
  * departures.
@@ -155,8 +173,22 @@ export type HeatmapResponse = Envelope & {
155
173
  /**
156
174
  * Whether LiDAR coverage exists at this station. `points` is empty when false,
157
175
  * which carries no information about occupancy.
176
+ *
177
+ * **Read `data_source` before acting on any figure here.** Where it is `modelled`, occupancy and wait times are derived from terminal layout and time of day rather than measured from sensors, regardless of what this flag says.
158
178
  */
159
179
  lidar_available?: boolean;
180
+ /**
181
+ * How the figures in `points` were produced. `measured` means a sensor, gate read or throughput count. `modelled` means derived from terminal layout and time of day, with no sensor behind it. Two calls seconds apart can return different modelled values with no underlying event, so do not diff them to infer movement.
182
+ */
183
+ data_source?: 'measured' | 'modelled';
184
+ /**
185
+ * False when the figures are modelled. Present as a boolean as well as in `data_source` so a client can branch without string comparison.
186
+ */
187
+ is_measured?: boolean;
188
+ /**
189
+ * Plain sentence describing how these figures were produced, safe to display.
190
+ */
191
+ provenance_note?: string | null;
160
192
  points?: Array<{
161
193
  zone?: string;
162
194
  zone_type?: string;
@@ -222,14 +254,6 @@ export type UsageResponse = Envelope & {
222
254
  * IATA code, three letters. Case insensitive.
223
255
  */
224
256
  export type AirportCode = string;
225
- /**
226
- * Restrict to records of this provenance. Repeat the parameter for more than one value.
227
- *
228
- * **Defaults to `live_feed` and `database`.** Generated records must be asked for by name. A generated row filled a gap in the feed and carries a real carrier code on a route that carrier may not fly, so it does not reach a planner who did not ask for it.
229
- *
230
- * `count` reflects what was returned. `excluded_by_confidence` reports what the filter removed, so a small result can be told apart from a thin feed.
231
- */
232
- export type Confidence = Array<'live_feed' | 'database' | 'generated'>;
233
257
  export type ListFlightsData = {
234
258
  body?: never;
235
259
  path?: never;
@@ -244,14 +268,6 @@ export type ListFlightsData = {
244
268
  */
245
269
  date?: string;
246
270
  limit?: number;
247
- /**
248
- * Restrict to records of this provenance. Repeat the parameter for more than one value.
249
- *
250
- * **Defaults to `live_feed` and `database`.** Generated records must be asked for by name. A generated row filled a gap in the feed and carries a real carrier code on a route that carrier may not fly, so it does not reach a planner who did not ask for it.
251
- *
252
- * `count` reflects what was returned. `excluded_by_confidence` reports what the filter removed, so a small result can be told apart from a thin feed.
253
- */
254
- confidence?: Array<'live_feed' | 'database' | 'generated'>;
255
271
  };
256
272
  url: '/api/v1/flights';
257
273
  };
@@ -365,14 +381,6 @@ export type SearchFlightsData = {
365
381
  */
366
382
  q: string;
367
383
  limit?: number;
368
- /**
369
- * Restrict to records of this provenance. Repeat the parameter for more than one value.
370
- *
371
- * **Defaults to `live_feed` and `database`.** Generated records must be asked for by name. A generated row filled a gap in the feed and carries a real carrier code on a route that carrier may not fly, so it does not reach a planner who did not ask for it.
372
- *
373
- * `count` reflects what was returned. `excluded_by_confidence` reports what the filter removed, so a small result can be told apart from a thin feed.
374
- */
375
- confidence?: Array<'live_feed' | 'database' | 'generated'>;
376
384
  };
377
385
  url: '/api/v1/flights/search';
378
386
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kquika-inc/s-system",
3
- "version": "1.0.8",
3
+ "version": "2.0.0",
4
4
  "description": "Predict flight disruption, price the passenger-rights exposure it carries, and rebook before it costs you.",
5
5
  "author": { "name": "Kquika, Inc.", "email": "support@kquika.com" },
6
6
  "homepage": "https://www.s-system.cloud/document",