@kymoscope/sdk 0.10.0 → 0.12.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/dist/assets/{importer.worker-CLBGjz4d.js → importer.worker-C63-1oBd.js} +1 -1
- package/dist/assets/liveIngestWorker-DQYK0Xxv.js +1 -0
- package/dist/assets/offscreenLineWorker-C-_uNa_H.js +80 -0
- package/dist/importers-4CjV0qH8.js +5 -0
- package/dist/{keys-DmtCD10T.js → keys-ved5HXBj.js} +1 -1
- package/dist/kymoscope-embed.js +67 -67
- package/dist/kymoscope-sdk.js +87 -87
- package/dist/types/analysis/ai.d.ts +50 -0
- package/dist/types/analysis/aiCheck.d.ts +54 -0
- package/dist/types/analysis/alertsBefore.d.ts +7 -0
- package/dist/types/analysis/better.d.ts +6 -0
- package/dist/types/analysis/capability.d.ts +10 -0
- package/dist/types/analysis/changes.d.ts +10 -0
- package/dist/types/analysis/containment.d.ts +10 -0
- package/dist/types/analysis/context.d.ts +131 -0
- package/dist/types/analysis/control.d.ts +13 -0
- package/dist/types/analysis/energy.d.ts +4 -0
- package/dist/types/analysis/gap.d.ts +8 -0
- package/dist/types/analysis/golden.d.ts +20 -0
- package/dist/types/analysis/health.d.ts +73 -0
- package/dist/types/analysis/index.d.ts +12 -0
- package/dist/types/analysis/infer.d.ts +68 -0
- package/dist/types/analysis/lines.d.ts +6 -0
- package/dist/types/analysis/losses.d.ts +41 -0
- package/dist/types/analysis/maintenance.d.ts +8 -0
- package/dist/types/analysis/oee.d.ts +30 -0
- package/dist/types/analysis/parts.d.ts +13 -0
- package/dist/types/analysis/presets.d.ts +35 -0
- package/dist/types/analysis/reliability.d.ts +103 -0
- package/dist/types/analysis/report.d.ts +15 -0
- package/dist/types/analysis/shifts.d.ts +7 -0
- package/dist/types/analysis/sinceLast.d.ts +8 -0
- package/dist/types/analysis/stats.d.ts +110 -0
- package/dist/types/analysis/stops.d.ts +34 -0
- package/dist/types/analysis/strip.d.ts +14 -0
- package/dist/types/analysis/text.d.ts +56 -0
- package/dist/types/analysis/types.d.ts +407 -0
- package/dist/types/components/liveWindow.d.ts +6 -2
- package/dist/types/engine/createEngine.d.ts +1 -0
- package/dist/types/engine/liveController.d.ts +7 -0
- package/dist/types/engine/types.d.ts +2 -0
- package/dist/types/index.d.ts +6 -1
- package/dist/types/lib/live/chainWire.d.ts +67 -0
- package/dist/types/lib/live/liveIngest.d.ts +55 -0
- package/dist/types/lib/live/liveIngestClient.d.ts +9 -0
- package/dist/types/lib/live/liveIngestWorker.d.ts +1 -0
- package/dist/types/lib/live/publisher.d.ts +21 -1
- package/dist/types/lib/live/stream.d.ts +14 -0
- package/dist/types/lib/live/types.d.ts +17 -0
- package/dist/types/lib/live/wire.d.ts +2 -0
- package/dist/types/lib/render/frames.d.ts +10 -0
- package/dist/types/lib/render/glPoints.d.ts +18 -0
- package/dist/types/lib/render/offscreenLineRenderer.d.ts +15 -1
- package/dist/types/lib/render/sharedGl.d.ts +12 -3
- package/package.json +1 -1
- package/dist/assets/offscreenLineWorker-BQwts3O3.js +0 -80
- package/dist/importers-2iwVi4cq.js +0 -5
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type Classified, type ReportInput, type SectionOut } from './types';
|
|
2
|
+
/** Section 05 (spec 2026-11-10): sensors per stream and channel over the period's recordings (05.1), each one's drift
|
|
3
|
+
* against the golden forecast to the band's edge (05.2), and machine wear from cycle time and spread (05.3). */
|
|
4
|
+
export declare const STUCK_S = 600;
|
|
5
|
+
export declare const STUCK_JOIN_S = 3600;
|
|
6
|
+
export declare const NOISE_UP = 1.3;
|
|
7
|
+
export declare const NOISE_Z = 3;
|
|
8
|
+
export declare const SPIKE_RATE = 0.0001;
|
|
9
|
+
export declare const GAP_SHARE = 0.01;
|
|
10
|
+
export declare const RATE_DROP = 0.9;
|
|
11
|
+
export declare const HORIZON_D = 365;
|
|
12
|
+
export declare const MIN_TREND = 20;
|
|
13
|
+
export declare const MIN_POINTS = 6;
|
|
14
|
+
export declare const SPREAD_UP = 1.15;
|
|
15
|
+
export type Status = 'Replace' | 'Drifting' | 'Watch' | 'Healthy';
|
|
16
|
+
/** A sensor (a channel of one stream, `ch` its display name) and what 05.1 found; `stuck`: its joined flat runs when Replace. */
|
|
17
|
+
/** `step`: a Watch whose only reason is its offset stepping once (when, by how much). */
|
|
18
|
+
export interface Sensor {
|
|
19
|
+
ch: string;
|
|
20
|
+
sid: string;
|
|
21
|
+
key: string;
|
|
22
|
+
status: Status;
|
|
23
|
+
found: string;
|
|
24
|
+
since: number | null;
|
|
25
|
+
drift: Drift | null;
|
|
26
|
+
stuck: Span[];
|
|
27
|
+
step?: {
|
|
28
|
+
t: number;
|
|
29
|
+
d: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
type Span = {
|
|
33
|
+
t0: number;
|
|
34
|
+
t1: number;
|
|
35
|
+
};
|
|
36
|
+
type Basis = 'day' | 'recording' | 'hour';
|
|
37
|
+
export interface Drift {
|
|
38
|
+
ch: string;
|
|
39
|
+
key: string;
|
|
40
|
+
b: number;
|
|
41
|
+
p: number;
|
|
42
|
+
days: number;
|
|
43
|
+
n: number;
|
|
44
|
+
per: Basis;
|
|
45
|
+
edge: number;
|
|
46
|
+
cross: number;
|
|
47
|
+
lo: number;
|
|
48
|
+
hi: number | null;
|
|
49
|
+
past: boolean;
|
|
50
|
+
vNow: number;
|
|
51
|
+
points: Array<{
|
|
52
|
+
t: number;
|
|
53
|
+
v: number;
|
|
54
|
+
}>;
|
|
55
|
+
line: {
|
|
56
|
+
t0: number;
|
|
57
|
+
v0: number;
|
|
58
|
+
t1: number;
|
|
59
|
+
v1: number;
|
|
60
|
+
};
|
|
61
|
+
/** 05.5's work for it when it stands for several channels of one stream drifting together (the process, not a sensor). */
|
|
62
|
+
work?: string;
|
|
63
|
+
}
|
|
64
|
+
/** A trend that is really one step: the values sit at one level, then at another (a setting changed, a part was
|
|
65
|
+
* replaced). Two levels must fit the means clearly better than the line does (under half its squared error), so a
|
|
66
|
+
* steady climb with noise is never taken for a step. Returns when it stepped and by how much. */
|
|
67
|
+
export declare const STEP_BETTER = 0.5;
|
|
68
|
+
export declare function stepOf(means: Array<{
|
|
69
|
+
t: number;
|
|
70
|
+
v: number;
|
|
71
|
+
}>, fit: {
|
|
72
|
+
s: number;
|
|
73
|
+
n: number;
|
|
74
|
+
}): {
|
|
75
|
+
t: number;
|
|
76
|
+
d: number;
|
|
77
|
+
} | null;
|
|
78
|
+
/** Wear: cycle time trending up (its daily means, % of its median per week, p < α), and/or the value's spread up (MAD
|
|
79
|
+
* of the last third over the first third ≥ SPREAD_UP, both thirds resampled, one-sided bootstrap p < α). Per stream (a
|
|
80
|
+
* machine wears on its own; pooled, one machine running at another level reads as spread): the clearest one, named
|
|
81
|
+
* when the report has several streams. */
|
|
82
|
+
export interface Wear {
|
|
83
|
+
text: string;
|
|
84
|
+
p: number | null;
|
|
85
|
+
grow: number | null;
|
|
86
|
+
spread: number | null;
|
|
87
|
+
}
|
|
88
|
+
/** Channels that are clocks in any recording (a time column read as a channel): never sensors. */
|
|
89
|
+
export declare const clockKeys: (input: ReportInput) => Set<string>;
|
|
90
|
+
/** Channels that are counters (an energy meter, a part count): they never fall in any recording they move in. Never
|
|
91
|
+
* compared with a golden nor checked as sensors: a meter's offset only says how long it has been counting. */
|
|
92
|
+
export declare function counterKeys(input: ReportInput): Set<string>;
|
|
93
|
+
/** 05.1's sensors, sorted as its table: Replace, Drifting (soonest crossing first), Watch, Healthy. */
|
|
94
|
+
export declare function sensorsOf(input: ReportInput, pop: Classified[]): Sensor[];
|
|
95
|
+
export declare const reliability: (input: ReportInput, pop: Classified[]) => SectionOut;
|
|
96
|
+
/** Section 05 with what 05.5 plans from: the sensors, the drifting ones' drifts and the wear. */
|
|
97
|
+
export declare function reliabilityOf(input: ReportInput, pop: Classified[]): {
|
|
98
|
+
out: SectionOut;
|
|
99
|
+
sensors: Sensor[];
|
|
100
|
+
drifts: Drift[];
|
|
101
|
+
wear: Wear | null;
|
|
102
|
+
};
|
|
103
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Finding, type ReportDoc, type ReportInput, type ReportRole, type ReportSection } from './types';
|
|
2
|
+
/** Actions section 12 shows in full; 00 names the first 3. */
|
|
3
|
+
export declare const SHOWN_ACTIONS = 5;
|
|
4
|
+
/** The production report (spec 2026-11-10, delivery D revised 2026-11-11): sections 00–14, each from the data and the
|
|
5
|
+
* one-time Process context (those with their inputs), worded from fixed templates. Pure: the same input gives the same
|
|
6
|
+
* document. */
|
|
7
|
+
export declare function buildReport(given: ReportInput): ReportDoc;
|
|
8
|
+
/** The sections a role's view shows (the Full report: all). */
|
|
9
|
+
/** The findings a section lists: those a table row already states are left out (the row carries their evidence); of
|
|
10
|
+
* the rest, the ones among the engine's first `shown` in full, the others folded. */
|
|
11
|
+
export declare function listedFindings(s: ReportSection): {
|
|
12
|
+
full: Finding[];
|
|
13
|
+
rest: Finding[];
|
|
14
|
+
};
|
|
15
|
+
export declare function viewSections(doc: ReportDoc, view: ReportRole | 'full'): ReportSection[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Stop } from './stops';
|
|
2
|
+
import { type Classified, type Finding, type Missing, type ReportInput, type SectionOut } from './types';
|
|
3
|
+
/** Section 11 (delivery D revised 2026-11-11): one row per shift from the data (batches, the share at golden level or
|
|
4
|
+
* better, stopped time, alerts), and the weakest shift by that share, named when it differs from the rest by a
|
|
5
|
+
* two-proportion test at ALPHA or 02.4 named it (its finding then referenced). */
|
|
6
|
+
export declare const SHIFT_GAP = 0.05;
|
|
7
|
+
export declare function shiftsSection(input: ReportInput, pop: Classified[], stops: Stop[], s02?: Finding[]): SectionOut | Missing;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Sensor } from './reliability';
|
|
2
|
+
import { type Stop } from './stops';
|
|
3
|
+
import { type Classified, type Finding, type Missing, type ReportInput, type SectionOut } from './types';
|
|
4
|
+
/** Section 01 (delivery D revised 2026-11-11): this period against the one before it, on the current goldens. The share
|
|
5
|
+
* at golden level or better (two proportions) and the value to compare (Mann–Whitney), Benjamini–Hochberg at ALPHA
|
|
6
|
+
* across the two; stopped time and the sensors to replace or drifting shown alongside. `s08`: 08's findings, the first place to
|
|
7
|
+
* look when the period is worse; `sensors`: 05.1's and `stops`: 05.4's for this period, when the report already has them. */
|
|
8
|
+
export declare function sinceLast(input: ReportInput, pop: Classified[], s08?: Finding[], sensors?: Sensor[], stops?: Stop[]): SectionOut | Missing;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/** Statistics of the production report (spec 2026-11-10-production-reports-design, delivery A). Classic, named
|
|
2
|
+
* methods only, so every number in a report can be explained and checked by hand: quantiles, the MAD, least squares,
|
|
3
|
+
* Mann–Whitney, a two-proportion test (Fisher's exact with small counts), Student's t, Benjamini–Hochberg, the
|
|
4
|
+
* percentile bootstrap. Inputs are finite unless a function says otherwise. */
|
|
5
|
+
/** Items grouped by key, in order (pushed in place: linear). */
|
|
6
|
+
export declare function groupBy<T, K>(xs: Iterable<T>, key: (x: T) => K): Map<K, T[]>;
|
|
7
|
+
/** Daily means of timed points (t in seconds; days counted from t0), each at its day's mean time. */
|
|
8
|
+
export declare const dailyMeans: (pts: Array<{
|
|
9
|
+
t: number;
|
|
10
|
+
v: number;
|
|
11
|
+
}>, t0: number) => Array<{
|
|
12
|
+
t: number;
|
|
13
|
+
v: number;
|
|
14
|
+
}>;
|
|
15
|
+
/** Means of timed points per group, each at its group's mean time. */
|
|
16
|
+
export declare const groupMeans: <P extends {
|
|
17
|
+
t: number;
|
|
18
|
+
v: number;
|
|
19
|
+
}>(pts: P[], key: (p: P) => unknown) => Array<{
|
|
20
|
+
t: number;
|
|
21
|
+
v: number;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const isNum: (x: number | null | undefined) => x is number;
|
|
24
|
+
export declare function mean(xs: ArrayLike<number>): number;
|
|
25
|
+
/** Sample standard deviation (n − 1); 0 for fewer than 2 values. */
|
|
26
|
+
export declare function sd(xs: ArrayLike<number>): number;
|
|
27
|
+
/** The q-quantile of the finite values, linear between order statistics (type 7: R's and numpy's default); NaN when
|
|
28
|
+
* there are none. */
|
|
29
|
+
export declare function quantile(xs: ArrayLike<number>, q: number): number;
|
|
30
|
+
export declare const median: (xs: ArrayLike<number>) => number;
|
|
31
|
+
/** Median absolute deviation × 1.4826: the σ of normal data, unmoved by outliers. */
|
|
32
|
+
export declare function mad(xs: ArrayLike<number>): number;
|
|
33
|
+
/** How many robust σ (MAD) `x` lies from the median of `xs`. */
|
|
34
|
+
export declare function robustZ(x: number, xs: ArrayLike<number>): number;
|
|
35
|
+
/** Standard normal CDF through erf (Abramowitz–Stegun 7.1.26, error < 1.5e-7). */
|
|
36
|
+
export declare function normCdf(z: number): number;
|
|
37
|
+
/** Two-sided p of a standard normal statistic. */
|
|
38
|
+
export declare const pTwo: (z: number) => number;
|
|
39
|
+
/** Mann–Whitney U of `a` against `b`: normal approximation with the tie correction, no continuity correction.
|
|
40
|
+
* `effect` = P(a > b) + ½ P(a = b) (0.5: no difference). Fewer than 2 values in a group: p 1. */
|
|
41
|
+
export declare function mannWhitney(a: number[], b: number[]): {
|
|
42
|
+
u: number;
|
|
43
|
+
p: number;
|
|
44
|
+
effect: number;
|
|
45
|
+
};
|
|
46
|
+
/** ln Γ(x) (Lanczos, g = 7). */
|
|
47
|
+
export declare function lgamma(x: number): number;
|
|
48
|
+
/** The regularized incomplete beta I_x(a, b). */
|
|
49
|
+
export declare function betaInc(x: number, a: number, b: number): number;
|
|
50
|
+
/** Student's t CDF with `df` degrees of freedom. */
|
|
51
|
+
export declare function tCdf(t: number, df: number): number;
|
|
52
|
+
/** Two-sided p of a t statistic (no cancellation for tiny p). */
|
|
53
|
+
export declare const pTwoT: (t: number, df: number) => number;
|
|
54
|
+
/** The q-quantile of Student's t (bisection). */
|
|
55
|
+
export declare function tQuantile(q: number, df: number): number;
|
|
56
|
+
/** Fisher's exact test of x1 of n1 against x2 of n2, two-sided (the tables no likelier than the one seen). */
|
|
57
|
+
export declare function fisherExact(x1: number, n1: number, x2: number, n2: number): number;
|
|
58
|
+
/** Two proportions, x1 of n1 against x2 of n2: the pooled z-test, or Fisher's exact test when an expected count is
|
|
59
|
+
* under 5. Either group empty: p 1. */
|
|
60
|
+
export declare function twoProportions(x1: number, n1: number, x2: number, n2: number): {
|
|
61
|
+
p1: number;
|
|
62
|
+
p2: number;
|
|
63
|
+
p: number;
|
|
64
|
+
};
|
|
65
|
+
/** Benjamini–Hochberg at false-discovery rate q: which of the tests to keep. */
|
|
66
|
+
export declare function benjaminiHochberg(ps: number[], q: number): boolean[];
|
|
67
|
+
/** Pearson's correlation; 0 when either side is constant. */
|
|
68
|
+
export declare function pearson(x: number[], y: number[]): number;
|
|
69
|
+
/** Least squares y = a + b·x: the slope's standard error and two-sided p (Student's t, n − 2 df), the residual σ `s`,
|
|
70
|
+
* x's mean and Σ(x − x̄)² (for prediction intervals); null with < 3 points or a constant x. */
|
|
71
|
+
export declare function linearFit(x: number[], y: number[]): {
|
|
72
|
+
a: number;
|
|
73
|
+
b: number;
|
|
74
|
+
se: number;
|
|
75
|
+
p: number;
|
|
76
|
+
r2: number;
|
|
77
|
+
n: number;
|
|
78
|
+
s: number;
|
|
79
|
+
mx: number;
|
|
80
|
+
sxx: number;
|
|
81
|
+
} | null;
|
|
82
|
+
/** Ordinary least squares of y on the columns of X (rows = observations) plus an intercept, by the normal equations of
|
|
83
|
+
* the centred columns (Gauss–Jordan, partial pivoting). `std`: standardized coefficients β·sd(x)/sd(y). Null when
|
|
84
|
+
* singular or n ≤ k + 1. */
|
|
85
|
+
export declare function ols(X: number[][], y: number[]): {
|
|
86
|
+
beta: number[];
|
|
87
|
+
std: number[];
|
|
88
|
+
r2: number;
|
|
89
|
+
} | null;
|
|
90
|
+
/** Pratt's measure: each predictor's share of R² (its standardized coefficient × its correlation with y); the shares
|
|
91
|
+
* sum to R². */
|
|
92
|
+
export declare function pratt(X: number[][], y: number[]): {
|
|
93
|
+
shares: number[];
|
|
94
|
+
r2: number;
|
|
95
|
+
} | null;
|
|
96
|
+
/** mulberry32: a small seeded generator, so every report (and test) gives the same intervals. */
|
|
97
|
+
export declare function rng(seed: number): () => number;
|
|
98
|
+
/** Rows a bootstrap resample draws at most; past it, an m-out-of-n bootstrap. */
|
|
99
|
+
export declare const BOOT_ROWS = 2000;
|
|
100
|
+
/** Percentile bootstrap: `stat` over B resamples (with replacement) of the indices 0..n−1; the α/2 and 1 − α/2
|
|
101
|
+
* quantiles of the finite results. Over BOOT_ROWS rows, resamples of BOOT_ROWS rows whose spread around the full
|
|
102
|
+
* estimate is scaled by √(m/n) (m-out-of-n bootstrap), so a long period costs no more than 2,000 batches. */
|
|
103
|
+
export declare function bootstrap(n: number, stat: (idx: number[]) => number, { B, seed, alpha }?: {
|
|
104
|
+
B?: number | undefined;
|
|
105
|
+
seed?: number | undefined;
|
|
106
|
+
alpha?: number | undefined;
|
|
107
|
+
}): {
|
|
108
|
+
lo: number;
|
|
109
|
+
hi: number;
|
|
110
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Part } from './parts';
|
|
2
|
+
import type { ReportInput } from './types';
|
|
3
|
+
/** Stops from the data alone (spec 2026-11-10, delivery D revised 2026-11-11): no data between a stream's recordings,
|
|
4
|
+
* or no batch inside one for much longer than usual. Planned stops and time outside the shifts are left out. */
|
|
5
|
+
export declare const STOP_MIN_S = 300;
|
|
6
|
+
export declare const IDLE_FACTOR = 5;
|
|
7
|
+
export declare const ATTRIB_S = 60;
|
|
8
|
+
export declare const STOP_CRIT = 0.2;
|
|
9
|
+
export declare const OFF_GAP_S = 7200;
|
|
10
|
+
/** `part`: a later piece of a stop a break or the time between shifts cut (1, 2…): its time counts, it is not one more stop. */
|
|
11
|
+
export interface Stop {
|
|
12
|
+
streamId: string;
|
|
13
|
+
t0: number;
|
|
14
|
+
t1: number;
|
|
15
|
+
kind: 'no_data' | 'no_batches';
|
|
16
|
+
unit: string | null;
|
|
17
|
+
part?: number;
|
|
18
|
+
}
|
|
19
|
+
/** How long with no batch is a stop for a stream: STOP_MIN_S, or IDLE_FACTOR × the usual wait from one batch's end to
|
|
20
|
+
* the next one's start when that is longer. The wait, not the time from start to start: a reactor whose batches last
|
|
21
|
+
* four hours waits half an hour between them, and five hours with none is a stop (five times the start-to-start time
|
|
22
|
+
* would only call a day without batches one). A press that waits seconds keeps the 5 minutes. */
|
|
23
|
+
export declare function idleS(cycles: Array<{
|
|
24
|
+
tstart: number;
|
|
25
|
+
tend: number | null;
|
|
26
|
+
}>): number;
|
|
27
|
+
export declare function detectStops(input: ReportInput): Stop[];
|
|
28
|
+
/** The stops, and how many gaps with no data were left out as time off (no shifts set, longer than OFF_GAP_S). */
|
|
29
|
+
export declare function stopsOf(input: ReportInput): {
|
|
30
|
+
stops: Stop[];
|
|
31
|
+
offGaps: number;
|
|
32
|
+
};
|
|
33
|
+
/** 05.4: stops, MTBF and MTTR per stream, or per machine unit when stops could be given one. */
|
|
34
|
+
export declare function stopsPart(input: ReportInput, stops: Stop[], offGaps?: number): Part | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Stop } from './stops';
|
|
2
|
+
import type { Classified, ReportChart, ReportInput } from './types';
|
|
3
|
+
/** Days a strip shows at most (a year's report: 366). */
|
|
4
|
+
export declare const STRIP_MAX_DAYS = 400;
|
|
5
|
+
/** 00.3: the period day by day in one strip, each day coloured by its share of batches off the golden, with the time
|
|
6
|
+
* stopped and a stuck sensor marked: the whole period at a glance. `stuck`: when 05.1's sensors to replace were stuck
|
|
7
|
+
* (the report passes them: a setting that holds, or a ram at rest, is flat and not stuck); without it, every flat run
|
|
8
|
+
* of a recorded channel. */
|
|
9
|
+
export declare function periodStrip(input: ReportInput, pop: Classified[], stops: Stop[], stuck?: Array<{
|
|
10
|
+
t0: number;
|
|
11
|
+
t1: number;
|
|
12
|
+
}>): Extract<ReportChart, {
|
|
13
|
+
kind: 'strip';
|
|
14
|
+
}> | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type Finding } from './types';
|
|
2
|
+
/** Fixed wording of the report: numbers, durations, dates and lists, always the same way. */
|
|
3
|
+
export declare const pct: (x: number) => string;
|
|
4
|
+
/** A percentage already in %: whole from 10 up, one decimal under it (4.13 → "4.1%", 20.4 → "20%"). */
|
|
5
|
+
export declare const pct1: (p: number) => string;
|
|
6
|
+
/** An amount in the Process context's currency: cents under 100, whole units above. */
|
|
7
|
+
export declare function money(x: number, currency: string): string;
|
|
8
|
+
/** Numbers as a manager reads them, the report's one formatter: at most 3 significant figures (2 under 1: "0.37",
|
|
9
|
+
* "0.012"), whole with thousands separators from 1,000 up ("33,392"). */
|
|
10
|
+
export declare const num: (x: number) => string;
|
|
11
|
+
/** A value that must read as it was set or measured (a specification limit, the value a sensor stuck at): 4 significant figures. */
|
|
12
|
+
export declare const exact: (x: number) => string;
|
|
13
|
+
/** Numbers shown together (a value against another): as `num` (3 significant figures, 2 under 1), or as
|
|
14
|
+
* many more as keep different values different, so a range never reads "150 to 150". `numsExact`: from 4 (limits). */
|
|
15
|
+
export declare const nums: (...xs: number[]) => string[];
|
|
16
|
+
export declare const numsExact: (...xs: number[]) => string[];
|
|
17
|
+
export declare const signed: (x: number) => string;
|
|
18
|
+
export declare function dur(s: number): string;
|
|
19
|
+
/** The unit of the value batches are compared by: seconds for the cycle time, else its channel's ("thickness:mean" → mm);
|
|
20
|
+
* none for a measure whose unit is not the channel's (a count, a slope). */
|
|
21
|
+
export declare function valueUnit(input: {
|
|
22
|
+
value: {
|
|
23
|
+
key: string;
|
|
24
|
+
};
|
|
25
|
+
units: Record<string, string>;
|
|
26
|
+
}): string;
|
|
27
|
+
export declare const times: (n: number) => string;
|
|
28
|
+
export declare const plural: (n: number, one: string, many?: string) => string;
|
|
29
|
+
export declare const listText: (xs: string[]) => string;
|
|
30
|
+
export declare const cap: (s: string) => string;
|
|
31
|
+
export declare const lower: (s: string) => string;
|
|
32
|
+
/** Whether `tz` is a time zone this runtime knows. */
|
|
33
|
+
export declare function validTz(tz: string): boolean;
|
|
34
|
+
/** "3 Oct" */
|
|
35
|
+
export declare const dateText: (t: number, tz: string) => string;
|
|
36
|
+
/** "21 Oct, 14:05" */
|
|
37
|
+
export declare const dateTimeText: (t: number, tz: string) => string;
|
|
38
|
+
/** "14:05" */
|
|
39
|
+
export declare const timeText: (t: number, tz: string) => string;
|
|
40
|
+
/** "21 Oct, 14:05–15:10", the second date only when it is another day; `sep` " to " for running text. */
|
|
41
|
+
export declare const spanText: (t0: number, t1: number, tz: string, sep?: string) => string;
|
|
42
|
+
export declare const DAY_NAMES: string[];
|
|
43
|
+
/** The local weekday (Monday 0) and hour of `t` in `tz`. */
|
|
44
|
+
export declare function localDayHour(t: number, tz: string): {
|
|
45
|
+
day: number;
|
|
46
|
+
hour: number;
|
|
47
|
+
};
|
|
48
|
+
/** "Sun 6 Dec, 06:00" */
|
|
49
|
+
export declare const weekdayTimeText: (t: number, tz: string) => string;
|
|
50
|
+
/** A cycle KPI key ("channel:stat", as kpiKey) in words; 'duration' is the cycle's. */
|
|
51
|
+
export declare function kpiLabel(key: string): string;
|
|
52
|
+
/** A p-value as the report shows it: "p < 0.01" or "p = 0.03". */
|
|
53
|
+
export declare const pText: (p: number) => string;
|
|
54
|
+
/** A finding's evidence as the viewer and the PDF show it: "Statistical · p < 0.01", "Correlation · r = 0.71",
|
|
55
|
+
* "Measured". */
|
|
56
|
+
export declare function evidenceLabel(f: Pick<Finding, 'evidence' | 'p' | 'numbers'>): string;
|