edfcore 0.2.13 → 0.2.15
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/CHANGELOG.md +20 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/diagnostics/summary.d.ts +43 -0
- package/dist/diagnostics/summary.d.ts.map +1 -0
- package/dist/diagnostics/summary.js +61 -0
- package/dist/diagnostics/summary.js.map +1 -0
- package/dist/format-report.d.ts.map +1 -1
- package/dist/format-report.js +15 -11
- package/dist/format-report.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/record-index.d.ts +19 -1
- package/dist/record-index.d.ts.map +1 -1
- package/dist/record-index.js +44 -0
- package/dist/record-index.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/diagnostics/summary.ts +82 -0
- package/src/format-report.ts +17 -11
- package/src/index.ts +3 -1
- package/src/record-index.ts +45 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,26 @@ alone does not tell you whether you were affected.
|
|
|
6
6
|
edfcore is pre-1.0. Patch releases have carried behaviour changes where the old behaviour was a
|
|
7
7
|
defect; those are called out below.
|
|
8
8
|
|
|
9
|
+
## 0.2.15
|
|
10
|
+
|
|
11
|
+
- **Added** `summarizeDiagnostics(diagnostics)` — counts by severity and by code, plus `worst`.
|
|
12
|
+
`formatDiagnostics` produces text for a person; there was nothing that produced numbers for a
|
|
13
|
+
program, and `validateRecording`'s `report.ok` needs a full scan. `worst` is `undefined` for an
|
|
14
|
+
empty list rather than `'info'`, so `worst !== undefined` means "anything to report at all".
|
|
15
|
+
Documented with the warning that `errors > 0` does NOT mean the file failed to read: a deferred
|
|
16
|
+
code carries `error` severity while every signal but one decodes perfectly.
|
|
17
|
+
- **Changed** `formatValidationReport` to print severity counts in a fixed error-warning-info
|
|
18
|
+
order rather than in whichever order they first appeared, and to share one counting
|
|
19
|
+
implementation with `summarizeDiagnostics` instead of keeping a second copy.
|
|
20
|
+
|
|
21
|
+
## 0.2.14
|
|
22
|
+
|
|
23
|
+
- **Added** `segmentAt(index, seconds)` — the pure, synchronous form of `index.locate()`. A viewer
|
|
24
|
+
asks which segment covers the cursor on every mouse move and should not issue a read to find
|
|
25
|
+
out; a completed index already holds the segments. Throws on a probed index rather than
|
|
26
|
+
returning `undefined`, because `undefined` means "no records cover this instant" and a probed
|
|
27
|
+
index cannot say that about anything in the middle of the file.
|
|
28
|
+
|
|
9
29
|
## 0.2.13
|
|
10
30
|
|
|
11
31
|
- **Added** `edfcore events <file> --list`: one tab-separated event per line instead of counts by
|
package/dist/constants.d.ts
CHANGED
|
@@ -109,5 +109,5 @@ export declare const SIGNAL_FIELD_BLOCK_OFFSETS: {
|
|
|
109
109
|
readonly reserved: 224;
|
|
110
110
|
};
|
|
111
111
|
/** Published package version. Kept in sync with package.json by a test. */
|
|
112
|
-
export declare const VERSION = "0.2.
|
|
112
|
+
export declare const VERSION = "0.2.15";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagnostics, counted.
|
|
3
|
+
*
|
|
4
|
+
* `formatDiagnostics` turns a list into text for a human. This turns the same list into numbers
|
|
5
|
+
* for a program: the question "is anything wrong with this header, and how wrong" has no answer
|
|
6
|
+
* on `EdfHeader` — `validateRecording` produces a `report.ok`, but that needs a full scan, and a
|
|
7
|
+
* caller who has only just parsed the header has nothing to test but `diagnostics.length`.
|
|
8
|
+
*
|
|
9
|
+
* The one thing worth knowing before acting on `errors > 0`: an `error` here does not mean the
|
|
10
|
+
* file failed to read. It means at least one diagnostic has `error` severity, and the `deferred`
|
|
11
|
+
* codes — a signal whose gain cannot be computed — carry that severity while the file parses,
|
|
12
|
+
* reads and decodes perfectly. `signal.scale` is `undefined` for that one signal and every other
|
|
13
|
+
* signal is fine. Refusing the whole recording on that count throws away good data.
|
|
14
|
+
*/
|
|
15
|
+
import type { EdfDiagnostic, EdfDiagnosticCode, EdfSeverity } from '../types.js';
|
|
16
|
+
export interface EdfCodeCount {
|
|
17
|
+
readonly code: EdfDiagnosticCode;
|
|
18
|
+
readonly severity: EdfSeverity;
|
|
19
|
+
readonly count: number;
|
|
20
|
+
}
|
|
21
|
+
export interface EdfDiagnosticSummary {
|
|
22
|
+
readonly total: number;
|
|
23
|
+
readonly errors: number;
|
|
24
|
+
readonly warnings: number;
|
|
25
|
+
readonly infos: number;
|
|
26
|
+
/** The highest severity present, or `undefined` when there are no diagnostics at all. */
|
|
27
|
+
readonly worst: EdfSeverity | undefined;
|
|
28
|
+
/** Distinct codes, most frequent first. Ties keep first-seen order. */
|
|
29
|
+
readonly byCode: readonly EdfCodeCount[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Counts by severity and by code.
|
|
33
|
+
*
|
|
34
|
+
* `worst` is by severity rank, not by insertion order and not alphabetical — `error` beats
|
|
35
|
+
* `warning` beats `info`. It is `undefined` for an empty list rather than `'info'`, which would
|
|
36
|
+
* claim a note exists when none does.
|
|
37
|
+
*
|
|
38
|
+
* `byCode` is ordered by count, descending: on a damaged file one code usually accounts for most
|
|
39
|
+
* of the list — `TIMEKEEPING_TAL_MISSING` is reported per record — and that is the one to look at
|
|
40
|
+
* first. `Array.prototype.sort` is stable, so equal counts keep the order they were first seen.
|
|
41
|
+
*/
|
|
42
|
+
export declare function summarizeDiagnostics(diagnostics: readonly EdfDiagnostic[]): EdfDiagnosticSummary;
|
|
43
|
+
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/diagnostics/summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEjF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yFAAyF;IACzF,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,CAAC;IACxC,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C;AAKD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,SAAS,aAAa,EAAE,GAAG,oBAAoB,CAiChG"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagnostics, counted.
|
|
3
|
+
*
|
|
4
|
+
* `formatDiagnostics` turns a list into text for a human. This turns the same list into numbers
|
|
5
|
+
* for a program: the question "is anything wrong with this header, and how wrong" has no answer
|
|
6
|
+
* on `EdfHeader` — `validateRecording` produces a `report.ok`, but that needs a full scan, and a
|
|
7
|
+
* caller who has only just parsed the header has nothing to test but `diagnostics.length`.
|
|
8
|
+
*
|
|
9
|
+
* The one thing worth knowing before acting on `errors > 0`: an `error` here does not mean the
|
|
10
|
+
* file failed to read. It means at least one diagnostic has `error` severity, and the `deferred`
|
|
11
|
+
* codes — a signal whose gain cannot be computed — carry that severity while the file parses,
|
|
12
|
+
* reads and decodes perfectly. `signal.scale` is `undefined` for that one signal and every other
|
|
13
|
+
* signal is fine. Refusing the whole recording on that count throws away good data.
|
|
14
|
+
*/
|
|
15
|
+
/** Descending, so the first entry is the worst thing in the list. */
|
|
16
|
+
const SEVERITY_RANK = { error: 3, warning: 2, info: 1 };
|
|
17
|
+
/**
|
|
18
|
+
* Counts by severity and by code.
|
|
19
|
+
*
|
|
20
|
+
* `worst` is by severity rank, not by insertion order and not alphabetical — `error` beats
|
|
21
|
+
* `warning` beats `info`. It is `undefined` for an empty list rather than `'info'`, which would
|
|
22
|
+
* claim a note exists when none does.
|
|
23
|
+
*
|
|
24
|
+
* `byCode` is ordered by count, descending: on a damaged file one code usually accounts for most
|
|
25
|
+
* of the list — `TIMEKEEPING_TAL_MISSING` is reported per record — and that is the one to look at
|
|
26
|
+
* first. `Array.prototype.sort` is stable, so equal counts keep the order they were first seen.
|
|
27
|
+
*/
|
|
28
|
+
export function summarizeDiagnostics(diagnostics) {
|
|
29
|
+
let errors = 0;
|
|
30
|
+
let warnings = 0;
|
|
31
|
+
let infos = 0;
|
|
32
|
+
let worst;
|
|
33
|
+
const counts = new Map();
|
|
34
|
+
for (const diagnostic of diagnostics) {
|
|
35
|
+
if (diagnostic.severity === 'error')
|
|
36
|
+
errors += 1;
|
|
37
|
+
else if (diagnostic.severity === 'warning')
|
|
38
|
+
warnings += 1;
|
|
39
|
+
else
|
|
40
|
+
infos += 1;
|
|
41
|
+
if (worst === undefined || SEVERITY_RANK[diagnostic.severity] > SEVERITY_RANK[worst]) {
|
|
42
|
+
worst = diagnostic.severity;
|
|
43
|
+
}
|
|
44
|
+
const existing = counts.get(diagnostic.code);
|
|
45
|
+
counts.set(diagnostic.code, {
|
|
46
|
+
code: diagnostic.code,
|
|
47
|
+
// The severity of a code is fixed by `severityOf`, so the first one seen is the one.
|
|
48
|
+
severity: existing?.severity ?? diagnostic.severity,
|
|
49
|
+
count: (existing?.count ?? 0) + 1,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
total: diagnostics.length,
|
|
54
|
+
errors,
|
|
55
|
+
warnings,
|
|
56
|
+
infos,
|
|
57
|
+
worst,
|
|
58
|
+
byCode: Object.freeze([...counts.values()].sort((a, b) => b.count - a.count)),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/diagnostics/summary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAqBH,qEAAqE;AACrE,MAAM,aAAa,GAAgC,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAErF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,WAAqC;IACxE,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAA8B,CAAC;IAEnC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAmC,CAAC;IAC1D,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,IAAI,UAAU,CAAC,QAAQ,KAAK,OAAO;YAAE,MAAM,IAAI,CAAC,CAAC;aAC5C,IAAI,UAAU,CAAC,QAAQ,KAAK,SAAS;YAAE,QAAQ,IAAI,CAAC,CAAC;;YACrD,KAAK,IAAI,CAAC,CAAC;QAEhB,IAAI,KAAK,KAAK,SAAS,IAAI,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACrF,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC;QAC9B,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE;YAC1B,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,qFAAqF;YACrF,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAI,UAAU,CAAC,QAAQ;YACnD,KAAK,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC;SAClC,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,MAAM;QACzB,MAAM;QACN,QAAQ;QACR,KAAK;QACL,KAAK;QACL,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;KAC9E,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-report.d.ts","sourceRoot":"","sources":["../src/format-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"format-report.d.ts","sourceRoot":"","sources":["../src/format-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASnF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,gBAAgB,EACxB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,CA4DR;AAED,qFAAqF;AACrF,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/format-report.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* thing are wrong and how much of the file is affected.
|
|
12
12
|
*/
|
|
13
13
|
import { formatDiagnostics } from './diagnostics/format.js';
|
|
14
|
+
import { summarizeDiagnostics } from './diagnostics/summary.js';
|
|
14
15
|
/** Enough to see the pattern, few enough to read. Override with `maxItems`. */
|
|
15
16
|
const DEFAULT_MAX_ITEMS = 20;
|
|
16
17
|
function pluralise(count, noun) {
|
|
@@ -25,24 +26,27 @@ function pluralise(count, noun) {
|
|
|
25
26
|
export function formatValidationReport(report, options) {
|
|
26
27
|
const lines = [];
|
|
27
28
|
const header = options?.header;
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
for (const diagnostic of report.diagnostics) {
|
|
31
|
-
bySeverity.set(diagnostic.severity, (bySeverity.get(diagnostic.severity) ?? 0) + 1);
|
|
32
|
-
byCode.set(diagnostic.code, (byCode.get(diagnostic.code) ?? 0) + 1);
|
|
33
|
-
}
|
|
29
|
+
// One counting implementation, shared with the public `summarizeDiagnostics`.
|
|
30
|
+
const summary = summarizeDiagnostics(report.diagnostics);
|
|
34
31
|
const verdict = report.ok ? 'PASS' : 'FAIL';
|
|
35
|
-
const severities =
|
|
32
|
+
const severities = summary.total === 0
|
|
36
33
|
? 'no diagnostics'
|
|
37
|
-
: [
|
|
34
|
+
: [
|
|
35
|
+
[summary.errors, 'error'],
|
|
36
|
+
[summary.warnings, 'warning'],
|
|
37
|
+
[summary.infos, 'info'],
|
|
38
|
+
]
|
|
39
|
+
.filter(([count]) => count > 0)
|
|
40
|
+
.map(([count, severity]) => `${count} ${severity}`)
|
|
41
|
+
.join(', ');
|
|
38
42
|
lines.push(`${verdict} — ${severities}`);
|
|
39
43
|
lines.push(`scanned ${pluralise(report.recordsScanned, 'record')}, ` +
|
|
40
44
|
`read ${report.bytesRead.toLocaleString('en-US')} bytes`);
|
|
41
|
-
if (byCode.
|
|
45
|
+
if (summary.byCode.length > 0) {
|
|
42
46
|
lines.push('');
|
|
43
47
|
lines.push('by code:');
|
|
44
|
-
//
|
|
45
|
-
for (const
|
|
48
|
+
// Already descending by count: the code affecting most of the file comes first.
|
|
49
|
+
for (const { code, count } of summary.byCode) {
|
|
46
50
|
lines.push(` ${String(count).padStart(7)} ${code}`);
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-report.js","sourceRoot":"","sources":["../src/format-report.ts"],"names":[],"mappings":"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AAG,CAAC;gBAC9B,CAAC,CAAC,KAAK,KAAK,CAAC,sBAAsB,6BAA6B;gBAChE,CAAC,CAAC,EAAE,CAAC;YACT,KAAK,CAAC,IAAI,CACR,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,kBAAkB,KAAK,KAAK,CAAC,kBAAkB,EAAE;gBACzF,SAAS,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,QAAQ,EAAE,CAC1E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,iBAAiB,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
/** The trailing `options` argument shared by every primitive that can allocate. */
|
|
23
23
|
export type { MaterializeOptions } from './decode/digital.js';
|
|
24
24
|
export type { FormatDiagnosticsOptions } from './diagnostics/format.js';
|
|
25
|
+
export type { EdfCodeCount, EdfDiagnosticSummary } from './diagnostics/summary.js';
|
|
25
26
|
export type { AbortSignalLike, BlobLike, BuildIndexOptions, ByteSource, CacheOptions, DecodeAnnotationsOptions, EdfAnnotation, EdfAnnotationsResult, EdfAnnotationWindow, EdfCalendarDate, EdfChunk, EdfChunkSignal, EdfClockTime, EdfDiagnostic, EdfDiagnosticCode, EdfEnvelopeChunk, EdfEnvelopeSignal, EdfGap, EdfHeader, EdfInspection, EdfKnownDiagnosticCode, EdfLocation, EdfPatientId, EdfPhysicalEnvelope, EdfRawHeaderFields, EdfRawSignalFields, EdfRecordIndex, EdfRecording, EdfRecordingId, EdfSampleLocation, EdfScale, EdfSegment, EdfSeverity, EdfSignal, EdfStartTime, EdfStatusWord, EdfTimeline, EdfTriggerEvent, EdfVariant, EnvelopeSelection, FetchLike, FormatHeaderOptions, HttpResponseLike, HttpSourceOptions, OpenOptions, ParseOptions, ReadOptions, RecordRange, RecordSelection, StreamSelection, TriggerSelection, WindowSelection, } from './types.js';
|
|
26
27
|
export type { AnyEdfError, EdfErrorKind, EdfFormatErrorInit } from './errors.js';
|
|
27
28
|
export { EdfAmbiguousChannelError, EdfBudgetError, EdfChannelNotFoundError, EdfError, EdfFormatError, EdfRangeError, EdfScalingError, EdfSourceError, isEdfError, } from './errors.js';
|
|
@@ -30,6 +31,7 @@ export { decodeHeaderLatin1 } from './bytes/latin1.js';
|
|
|
30
31
|
export { decodeDigital } from './decode/digital.js';
|
|
31
32
|
export { clampToDigitalRange, physicalRangeOf, toPhysical } from './decode/physical.js';
|
|
32
33
|
export { formatDiagnostics } from './diagnostics/format.js';
|
|
34
|
+
export { summarizeDiagnostics } from './diagnostics/summary.js';
|
|
33
35
|
export { formatStartTimeNaive } from './header/dates.js';
|
|
34
36
|
export { declaredDurationSeconds, findSignals, getSignal, isAnnotationLabel, matchSignals, } from './header/lookup.js';
|
|
35
37
|
export { parseHeader } from './header/parse.js';
|
|
@@ -40,7 +42,7 @@ export { byteSource } from './io/bytes.js';
|
|
|
40
42
|
export { cachedSource } from './io/cached.js';
|
|
41
43
|
export { httpSource } from './io/http.js';
|
|
42
44
|
export { readHeader, readRecordBytes } from './io/read.js';
|
|
43
|
-
export { buildRecordIndex, buildTimeline, contiguityOf } from './record-index.js';
|
|
45
|
+
export { buildRecordIndex, buildTimeline, contiguityOf, segmentAt } from './record-index.js';
|
|
44
46
|
export { annotationsAt, countAnnotationsByText, filterAnnotationsByText, filterAnnotationsByTime, } from './annotations-query.js';
|
|
45
47
|
export { decodeStatusWord, getStatusSignal, readTriggers } from './biosemi.js';
|
|
46
48
|
export { mergeChunks } from './chunks.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,mFAAmF;AACnF,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,YAAY,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACxE,YAAY,EACV,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,MAAM,EACN,SAAS,EACT,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,SAAS,EACT,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EACX,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AAUpB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,uBAAuB,EACvB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,eAAe,EACf,cAA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,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export { decodeHeaderLatin1 } from './bytes/latin1.js';
|
|
|
32
32
|
export { decodeDigital } from './decode/digital.js';
|
|
33
33
|
export { clampToDigitalRange, physicalRangeOf, toPhysical } from './decode/physical.js';
|
|
34
34
|
export { formatDiagnostics } from './diagnostics/format.js';
|
|
35
|
+
export { summarizeDiagnostics } from './diagnostics/summary.js';
|
|
35
36
|
export { formatStartTimeNaive } from './header/dates.js';
|
|
36
37
|
export { declaredDurationSeconds, findSignals, getSignal, isAnnotationLabel, matchSignals, } from './header/lookup.js';
|
|
37
38
|
export { parseHeader } from './header/parse.js';
|
|
@@ -50,7 +51,7 @@ export { httpSource } from './io/http.js';
|
|
|
50
51
|
// I/O layer — thin, async, no caching.
|
|
51
52
|
// ===========================================================================
|
|
52
53
|
export { readHeader, readRecordBytes } from './io/read.js';
|
|
53
|
-
export { buildRecordIndex, buildTimeline, contiguityOf } from './record-index.js';
|
|
54
|
+
export { buildRecordIndex, buildTimeline, contiguityOf, segmentAt } from './record-index.js';
|
|
54
55
|
// ===========================================================================
|
|
55
56
|
// Convenience layer
|
|
56
57
|
// ===========================================================================
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;
|
|
1
|
+
{"version":3,"file":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1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E;AAE9E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE7F,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACnF,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/record-index.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* it is also what lets `decodeAnnotations` own the timekeeping rule: it requires the record's
|
|
26
26
|
* full bytes, and reading less would mean reimplementing that rule here.
|
|
27
27
|
*/
|
|
28
|
-
import type { BuildIndexOptions, ByteSource, EdfHeader, EdfRecordIndex, EdfRecording, EdfTimeline, OpenOptions } from './types.js';
|
|
28
|
+
import type { BuildIndexOptions, ByteSource, EdfHeader, EdfRecordIndex, EdfRecording, EdfSegment, EdfTimeline, OpenOptions } from './types.js';
|
|
29
29
|
/** Records per chunk of a full traversal: bounded memory, and never fewer than one record. */
|
|
30
30
|
export declare function scanChunkRecords(header: EdfHeader, maxMaterializeBytes?: number): number;
|
|
31
31
|
/**
|
|
@@ -66,4 +66,22 @@ export declare function buildRecordIndex(recording: EdfRecording, options?: Buil
|
|
|
66
66
|
* `buildRecordIndex()` is what turns `'unknown'` into a real answer.
|
|
67
67
|
*/
|
|
68
68
|
export declare function contiguityOf(index: EdfRecordIndex): 'contiguous' | 'discontinuous' | 'unknown';
|
|
69
|
+
/**
|
|
70
|
+
* The segment covering an instant, or `undefined` when the instant falls in a gap or outside the
|
|
71
|
+
* recording.
|
|
72
|
+
*
|
|
73
|
+
* Pure and synchronous, which is the point: `index.locate()` answers the same question by probing
|
|
74
|
+
* the file, and a viewer that asks on every mouse move should not be issuing reads. A completed
|
|
75
|
+
* index already holds the segments, so this is a binary search over them.
|
|
76
|
+
*
|
|
77
|
+
* THROWS on a probed index rather than returning `undefined`. `undefined` here means "no records
|
|
78
|
+
* cover this time", and a probed index has read record 0 and the last record and nothing between —
|
|
79
|
+
* it does not know where the segments are, so it cannot say that about any instant in the middle.
|
|
80
|
+
* Returning `undefined` would merge "there is a gap here" with "nobody looked", which are the two
|
|
81
|
+
* answers a caller most needs to keep apart.
|
|
82
|
+
*
|
|
83
|
+
* `seconds` is on the recording's own axis: `t = 0` is the start of record 0, matching
|
|
84
|
+
* `segment.startSeconds`, `readWindow` and `readEnvelope`.
|
|
85
|
+
*/
|
|
86
|
+
export declare function segmentAt(index: EdfRecordIndex, seconds: number): EdfSegment | undefined;
|
|
69
87
|
//# sourceMappingURL=record-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-index.d.ts","sourceRoot":"","sources":["../src/record-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAeH,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EAIV,SAAS,EAET,cAAc,EACd,YAAY,
|
|
1
|
+
{"version":3,"file":"record-index.d.ts","sourceRoot":"","sources":["../src/record-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAeH,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EAIV,SAAS,EAET,cAAc,EACd,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EAGZ,MAAM,YAAY,CAAC;AAWpB,8FAA8F;AAC9F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAOxF;AAwKD;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC;IAAE,QAAQ,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAC,CAkE3D;AAmDD;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,YAAY,EACvB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,cAAc,CAAC,CAyBzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,YAAY,GAAG,eAAe,GAAG,SAAS,CAG9F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CA0BxF"}
|
package/dist/record-index.js
CHANGED
|
@@ -323,4 +323,48 @@ export function contiguityOf(index) {
|
|
|
323
323
|
return 'unknown';
|
|
324
324
|
return index.gaps.length === 0 ? 'contiguous' : 'discontinuous';
|
|
325
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* The segment covering an instant, or `undefined` when the instant falls in a gap or outside the
|
|
328
|
+
* recording.
|
|
329
|
+
*
|
|
330
|
+
* Pure and synchronous, which is the point: `index.locate()` answers the same question by probing
|
|
331
|
+
* the file, and a viewer that asks on every mouse move should not be issuing reads. A completed
|
|
332
|
+
* index already holds the segments, so this is a binary search over them.
|
|
333
|
+
*
|
|
334
|
+
* THROWS on a probed index rather than returning `undefined`. `undefined` here means "no records
|
|
335
|
+
* cover this time", and a probed index has read record 0 and the last record and nothing between —
|
|
336
|
+
* it does not know where the segments are, so it cannot say that about any instant in the middle.
|
|
337
|
+
* Returning `undefined` would merge "there is a gap here" with "nobody looked", which are the two
|
|
338
|
+
* answers a caller most needs to keep apart.
|
|
339
|
+
*
|
|
340
|
+
* `seconds` is on the recording's own axis: `t = 0` is the start of record 0, matching
|
|
341
|
+
* `segment.startSeconds`, `readWindow` and `readEnvelope`.
|
|
342
|
+
*/
|
|
343
|
+
export function segmentAt(index, seconds) {
|
|
344
|
+
const segments = index.segments;
|
|
345
|
+
if (index.coverage !== 'complete' || segments === undefined) {
|
|
346
|
+
throw new RangeError('segmentAt() needs a complete index: this one is probed, so it knows record 0 and the last ' +
|
|
347
|
+
'record and nothing between, and cannot say which segment covers a time in the middle. ' +
|
|
348
|
+
'Next: await buildRecordIndex(recording) and pass the index it returns.');
|
|
349
|
+
}
|
|
350
|
+
// NaN fails every comparison below, so the binary search would walk to an arbitrary segment and
|
|
351
|
+
// return it. Refusing is the only honest answer for a time that is not a time.
|
|
352
|
+
if (!Number.isFinite(seconds)) {
|
|
353
|
+
throw new RangeError(`segmentAt() needs a finite time in seconds, received ${seconds}.`);
|
|
354
|
+
}
|
|
355
|
+
let low = 0;
|
|
356
|
+
let high = segments.length - 1;
|
|
357
|
+
while (low <= high) {
|
|
358
|
+
const middle = (low + high) >> 1;
|
|
359
|
+
const segment = segments[middle];
|
|
360
|
+
// Half-open, so a segment that ends exactly where the next begins is not both.
|
|
361
|
+
if (seconds < segment.startSeconds)
|
|
362
|
+
high = middle - 1;
|
|
363
|
+
else if (seconds >= segment.endSeconds)
|
|
364
|
+
low = middle + 1;
|
|
365
|
+
else
|
|
366
|
+
return segment;
|
|
367
|
+
}
|
|
368
|
+
return undefined;
|
|
369
|
+
}
|
|
326
370
|
//# sourceMappingURL=record-index.js.map
|
package/dist/record-index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-index.js","sourceRoot":"","sources":["../src/record-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,GAExB,MAAM,oBAAoB,CAAC;AAkB5B;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEhD,8FAA8F;AAC9F,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,mBAA4B;IAC9E,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CACrB,uBAAuB,EACvB,mBAAmB,IAAI,6BAA6B,CACrD,CAAC;IACF,IAAI,MAAM,CAAC,gBAAgB,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,GAAG,C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Q,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/B,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAe,CAAC;QAC/C,+EAA+E;QAC/E,IAAI,OAAO,GAAG,OAAO,CAAC,YAAY;YAAE,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC;aACjD,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU;YAAE,GAAG,GAAG,MAAM,GAAG,CAAC,CAAC;;YACpD,OAAO,OAAO,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diagnostics, counted.
|
|
3
|
+
*
|
|
4
|
+
* `formatDiagnostics` turns a list into text for a human. This turns the same list into numbers
|
|
5
|
+
* for a program: the question "is anything wrong with this header, and how wrong" has no answer
|
|
6
|
+
* on `EdfHeader` — `validateRecording` produces a `report.ok`, but that needs a full scan, and a
|
|
7
|
+
* caller who has only just parsed the header has nothing to test but `diagnostics.length`.
|
|
8
|
+
*
|
|
9
|
+
* The one thing worth knowing before acting on `errors > 0`: an `error` here does not mean the
|
|
10
|
+
* file failed to read. It means at least one diagnostic has `error` severity, and the `deferred`
|
|
11
|
+
* codes — a signal whose gain cannot be computed — carry that severity while the file parses,
|
|
12
|
+
* reads and decodes perfectly. `signal.scale` is `undefined` for that one signal and every other
|
|
13
|
+
* signal is fine. Refusing the whole recording on that count throws away good data.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { EdfDiagnostic, EdfDiagnosticCode, EdfSeverity } from '../types.js';
|
|
17
|
+
|
|
18
|
+
export interface EdfCodeCount {
|
|
19
|
+
readonly code: EdfDiagnosticCode;
|
|
20
|
+
readonly severity: EdfSeverity;
|
|
21
|
+
readonly count: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface EdfDiagnosticSummary {
|
|
25
|
+
readonly total: number;
|
|
26
|
+
readonly errors: number;
|
|
27
|
+
readonly warnings: number;
|
|
28
|
+
readonly infos: number;
|
|
29
|
+
/** The highest severity present, or `undefined` when there are no diagnostics at all. */
|
|
30
|
+
readonly worst: EdfSeverity | undefined;
|
|
31
|
+
/** Distinct codes, most frequent first. Ties keep first-seen order. */
|
|
32
|
+
readonly byCode: readonly EdfCodeCount[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Descending, so the first entry is the worst thing in the list. */
|
|
36
|
+
const SEVERITY_RANK: Record<EdfSeverity, number> = { error: 3, warning: 2, info: 1 };
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Counts by severity and by code.
|
|
40
|
+
*
|
|
41
|
+
* `worst` is by severity rank, not by insertion order and not alphabetical — `error` beats
|
|
42
|
+
* `warning` beats `info`. It is `undefined` for an empty list rather than `'info'`, which would
|
|
43
|
+
* claim a note exists when none does.
|
|
44
|
+
*
|
|
45
|
+
* `byCode` is ordered by count, descending: on a damaged file one code usually accounts for most
|
|
46
|
+
* of the list — `TIMEKEEPING_TAL_MISSING` is reported per record — and that is the one to look at
|
|
47
|
+
* first. `Array.prototype.sort` is stable, so equal counts keep the order they were first seen.
|
|
48
|
+
*/
|
|
49
|
+
export function summarizeDiagnostics(diagnostics: readonly EdfDiagnostic[]): EdfDiagnosticSummary {
|
|
50
|
+
let errors = 0;
|
|
51
|
+
let warnings = 0;
|
|
52
|
+
let infos = 0;
|
|
53
|
+
let worst: EdfSeverity | undefined;
|
|
54
|
+
|
|
55
|
+
const counts = new Map<EdfDiagnosticCode, EdfCodeCount>();
|
|
56
|
+
for (const diagnostic of diagnostics) {
|
|
57
|
+
if (diagnostic.severity === 'error') errors += 1;
|
|
58
|
+
else if (diagnostic.severity === 'warning') warnings += 1;
|
|
59
|
+
else infos += 1;
|
|
60
|
+
|
|
61
|
+
if (worst === undefined || SEVERITY_RANK[diagnostic.severity] > SEVERITY_RANK[worst]) {
|
|
62
|
+
worst = diagnostic.severity;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const existing = counts.get(diagnostic.code);
|
|
66
|
+
counts.set(diagnostic.code, {
|
|
67
|
+
code: diagnostic.code,
|
|
68
|
+
// The severity of a code is fixed by `severityOf`, so the first one seen is the one.
|
|
69
|
+
severity: existing?.severity ?? diagnostic.severity,
|
|
70
|
+
count: (existing?.count ?? 0) + 1,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
total: diagnostics.length,
|
|
76
|
+
errors,
|
|
77
|
+
warnings,
|
|
78
|
+
infos,
|
|
79
|
+
worst,
|
|
80
|
+
byCode: Object.freeze([...counts.values()].sort((a, b) => b.count - a.count)),
|
|
81
|
+
};
|
|
82
|
+
}
|
package/src/format-report.ts
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { formatDiagnostics } from './diagnostics/format.js';
|
|
15
|
+
import { summarizeDiagnostics } from './diagnostics/summary.js';
|
|
15
16
|
import type { EdfHeader, FormatReportOptions, ValidationReport } from './types.js';
|
|
16
17
|
|
|
17
18
|
/** Enough to see the pattern, few enough to read. Override with `maxItems`. */
|
|
@@ -34,29 +35,34 @@ export function formatValidationReport(
|
|
|
34
35
|
const lines: string[] = [];
|
|
35
36
|
const header = options?.header;
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
for (const diagnostic of report.diagnostics) {
|
|
40
|
-
bySeverity.set(diagnostic.severity, (bySeverity.get(diagnostic.severity) ?? 0) + 1);
|
|
41
|
-
byCode.set(diagnostic.code, (byCode.get(diagnostic.code) ?? 0) + 1);
|
|
42
|
-
}
|
|
38
|
+
// One counting implementation, shared with the public `summarizeDiagnostics`.
|
|
39
|
+
const summary = summarizeDiagnostics(report.diagnostics);
|
|
43
40
|
|
|
44
41
|
const verdict = report.ok ? 'PASS' : 'FAIL';
|
|
45
42
|
const severities =
|
|
46
|
-
|
|
43
|
+
summary.total === 0
|
|
47
44
|
? 'no diagnostics'
|
|
48
|
-
:
|
|
45
|
+
: (
|
|
46
|
+
[
|
|
47
|
+
[summary.errors, 'error'],
|
|
48
|
+
[summary.warnings, 'warning'],
|
|
49
|
+
[summary.infos, 'info'],
|
|
50
|
+
] as const
|
|
51
|
+
)
|
|
52
|
+
.filter(([count]) => count > 0)
|
|
53
|
+
.map(([count, severity]) => `${count} ${severity}`)
|
|
54
|
+
.join(', ');
|
|
49
55
|
lines.push(`${verdict} — ${severities}`);
|
|
50
56
|
lines.push(
|
|
51
57
|
`scanned ${pluralise(report.recordsScanned, 'record')}, ` +
|
|
52
58
|
`read ${report.bytesRead.toLocaleString('en-US')} bytes`,
|
|
53
59
|
);
|
|
54
60
|
|
|
55
|
-
if (byCode.
|
|
61
|
+
if (summary.byCode.length > 0) {
|
|
56
62
|
lines.push('');
|
|
57
63
|
lines.push('by code:');
|
|
58
|
-
//
|
|
59
|
-
for (const
|
|
64
|
+
// Already descending by count: the code affecting most of the file comes first.
|
|
65
|
+
for (const { code, count } of summary.byCode) {
|
|
60
66
|
lines.push(` ${String(count).padStart(7)} ${code}`);
|
|
61
67
|
}
|
|
62
68
|
}
|
package/src/index.ts
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
/** The trailing `options` argument shared by every primitive that can allocate. */
|
|
29
29
|
export type { MaterializeOptions } from './decode/digital.js';
|
|
30
30
|
export type { FormatDiagnosticsOptions } from './diagnostics/format.js';
|
|
31
|
+
export type { EdfCodeCount, EdfDiagnosticSummary } from './diagnostics/summary.js';
|
|
31
32
|
export type {
|
|
32
33
|
AbortSignalLike,
|
|
33
34
|
BlobLike,
|
|
@@ -130,6 +131,7 @@ export { decodeHeaderLatin1 } from './bytes/latin1.js';
|
|
|
130
131
|
export { decodeDigital } from './decode/digital.js';
|
|
131
132
|
export { clampToDigitalRange, physicalRangeOf, toPhysical } from './decode/physical.js';
|
|
132
133
|
export { formatDiagnostics } from './diagnostics/format.js';
|
|
134
|
+
export { summarizeDiagnostics } from './diagnostics/summary.js';
|
|
133
135
|
export { formatStartTimeNaive } from './header/dates.js';
|
|
134
136
|
export {
|
|
135
137
|
declaredDurationSeconds,
|
|
@@ -158,7 +160,7 @@ export { httpSource } from './io/http.js';
|
|
|
158
160
|
// ===========================================================================
|
|
159
161
|
|
|
160
162
|
export { readHeader, readRecordBytes } from './io/read.js';
|
|
161
|
-
export { buildRecordIndex, buildTimeline, contiguityOf } from './record-index.js';
|
|
163
|
+
export { buildRecordIndex, buildTimeline, contiguityOf, segmentAt } from './record-index.js';
|
|
162
164
|
|
|
163
165
|
// ===========================================================================
|
|
164
166
|
// Convenience layer
|
package/src/record-index.ts
CHANGED
|
@@ -428,3 +428,48 @@ export function contiguityOf(index: EdfRecordIndex): 'contiguous' | 'discontinuo
|
|
|
428
428
|
if (index.coverage !== 'complete' || index.gaps === undefined) return 'unknown';
|
|
429
429
|
return index.gaps.length === 0 ? 'contiguous' : 'discontinuous';
|
|
430
430
|
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* The segment covering an instant, or `undefined` when the instant falls in a gap or outside the
|
|
434
|
+
* recording.
|
|
435
|
+
*
|
|
436
|
+
* Pure and synchronous, which is the point: `index.locate()` answers the same question by probing
|
|
437
|
+
* the file, and a viewer that asks on every mouse move should not be issuing reads. A completed
|
|
438
|
+
* index already holds the segments, so this is a binary search over them.
|
|
439
|
+
*
|
|
440
|
+
* THROWS on a probed index rather than returning `undefined`. `undefined` here means "no records
|
|
441
|
+
* cover this time", and a probed index has read record 0 and the last record and nothing between —
|
|
442
|
+
* it does not know where the segments are, so it cannot say that about any instant in the middle.
|
|
443
|
+
* Returning `undefined` would merge "there is a gap here" with "nobody looked", which are the two
|
|
444
|
+
* answers a caller most needs to keep apart.
|
|
445
|
+
*
|
|
446
|
+
* `seconds` is on the recording's own axis: `t = 0` is the start of record 0, matching
|
|
447
|
+
* `segment.startSeconds`, `readWindow` and `readEnvelope`.
|
|
448
|
+
*/
|
|
449
|
+
export function segmentAt(index: EdfRecordIndex, seconds: number): EdfSegment | undefined {
|
|
450
|
+
const segments = index.segments;
|
|
451
|
+
if (index.coverage !== 'complete' || segments === undefined) {
|
|
452
|
+
throw new RangeError(
|
|
453
|
+
'segmentAt() needs a complete index: this one is probed, so it knows record 0 and the last ' +
|
|
454
|
+
'record and nothing between, and cannot say which segment covers a time in the middle. ' +
|
|
455
|
+
'Next: await buildRecordIndex(recording) and pass the index it returns.',
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
// NaN fails every comparison below, so the binary search would walk to an arbitrary segment and
|
|
459
|
+
// return it. Refusing is the only honest answer for a time that is not a time.
|
|
460
|
+
if (!Number.isFinite(seconds)) {
|
|
461
|
+
throw new RangeError(`segmentAt() needs a finite time in seconds, received ${seconds}.`);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
let low = 0;
|
|
465
|
+
let high = segments.length - 1;
|
|
466
|
+
while (low <= high) {
|
|
467
|
+
const middle = (low + high) >> 1;
|
|
468
|
+
const segment = segments[middle] as EdfSegment;
|
|
469
|
+
// Half-open, so a segment that ends exactly where the next begins is not both.
|
|
470
|
+
if (seconds < segment.startSeconds) high = middle - 1;
|
|
471
|
+
else if (seconds >= segment.endSeconds) low = middle + 1;
|
|
472
|
+
else return segment;
|
|
473
|
+
}
|
|
474
|
+
return undefined;
|
|
475
|
+
}
|