edfcore 0.2.14 → 0.2.16
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 +13 -1
- package/dist/record-index.d.ts.map +1 -1
- package/dist/record-index.js +37 -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 +9 -1
- package/src/record-index.ts +38 -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.16
|
|
10
|
+
|
|
11
|
+
- **Added** `gapAt(index, seconds)`, the complement of `segmentAt`. `segmentAt` returning
|
|
12
|
+
`undefined` tells a viewer there is no data under the cursor and nothing else; how long the hole
|
|
13
|
+
is and when the recording resumes are on the `EdfGap`. Exactly one of the two returns a value
|
|
14
|
+
for any instant strictly inside the recording, and a test checks that at every tenth of a second
|
|
15
|
+
across a file with a real gap.
|
|
16
|
+
|
|
17
|
+
## 0.2.15
|
|
18
|
+
|
|
19
|
+
- **Added** `summarizeDiagnostics(diagnostics)` — counts by severity and by code, plus `worst`.
|
|
20
|
+
`formatDiagnostics` produces text for a person; there was nothing that produced numbers for a
|
|
21
|
+
program, and `validateRecording`'s `report.ok` needs a full scan. `worst` is `undefined` for an
|
|
22
|
+
empty list rather than `'info'`, so `worst !== undefined` means "anything to report at all".
|
|
23
|
+
Documented with the warning that `errors > 0` does NOT mean the file failed to read: a deferred
|
|
24
|
+
code carries `error` severity while every signal but one decodes perfectly.
|
|
25
|
+
- **Changed** `formatValidationReport` to print severity counts in a fixed error-warning-info
|
|
26
|
+
order rather than in whichever order they first appeared, and to share one counting
|
|
27
|
+
implementation with `summarizeDiagnostics` instead of keeping a second copy.
|
|
28
|
+
|
|
9
29
|
## 0.2.14
|
|
10
30
|
|
|
11
31
|
- **Added** `segmentAt(index, seconds)` — the pure, synchronous form of `index.locate()`. A viewer
|
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.16";
|
|
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"],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AC,sBAAsB,GAAG,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, segmentAt } from './record-index.js';
|
|
45
|
+
export { buildRecordIndex, buildTimeline, contiguityOf, gapAt, 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,EAC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,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, segmentAt } from './record-index.js';
|
|
54
|
+
export { buildRecordIndex, buildTimeline, contiguityOf, gapAt, 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":"index.js","sourceRoot":"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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,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,KAAK,EACL,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,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, EdfSegment, EdfTimeline, OpenOptions } from './types.js';
|
|
28
|
+
import type { BuildIndexOptions, ByteSource, EdfGap, 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
|
/**
|
|
@@ -84,4 +84,16 @@ export declare function contiguityOf(index: EdfRecordIndex): 'contiguous' | 'dis
|
|
|
84
84
|
* `segment.startSeconds`, `readWindow` and `readEnvelope`.
|
|
85
85
|
*/
|
|
86
86
|
export declare function segmentAt(index: EdfRecordIndex, seconds: number): EdfSegment | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The gap covering an instant, or `undefined` when a record covers it.
|
|
89
|
+
*
|
|
90
|
+
* The complement of `segmentAt`, and the reason it exists separately: `segmentAt` returning
|
|
91
|
+
* `undefined` tells a viewer there is no data under the cursor and nothing else. What a viewer
|
|
92
|
+
* then wants — how long the hole is, and when the recording resumes — is on the `EdfGap`.
|
|
93
|
+
*
|
|
94
|
+
* Exactly one of the two returns a value for any instant strictly inside the recording, and
|
|
95
|
+
* neither does for a time before the first record or after the last. Refuses a probed index and a
|
|
96
|
+
* non-finite time for the same reasons `segmentAt` does.
|
|
97
|
+
*/
|
|
98
|
+
export declare function gapAt(index: EdfRecordIndex, seconds: number): EdfGap | undefined;
|
|
87
99
|
//# 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,
|
|
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,EAGV,MAAM,EACN,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;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAyBhF"}
|
package/dist/record-index.js
CHANGED
|
@@ -367,4 +367,41 @@ export function segmentAt(index, seconds) {
|
|
|
367
367
|
}
|
|
368
368
|
return undefined;
|
|
369
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* The gap covering an instant, or `undefined` when a record covers it.
|
|
372
|
+
*
|
|
373
|
+
* The complement of `segmentAt`, and the reason it exists separately: `segmentAt` returning
|
|
374
|
+
* `undefined` tells a viewer there is no data under the cursor and nothing else. What a viewer
|
|
375
|
+
* then wants — how long the hole is, and when the recording resumes — is on the `EdfGap`.
|
|
376
|
+
*
|
|
377
|
+
* Exactly one of the two returns a value for any instant strictly inside the recording, and
|
|
378
|
+
* neither does for a time before the first record or after the last. Refuses a probed index and a
|
|
379
|
+
* non-finite time for the same reasons `segmentAt` does.
|
|
380
|
+
*/
|
|
381
|
+
export function gapAt(index, seconds) {
|
|
382
|
+
const gaps = index.gaps;
|
|
383
|
+
if (index.coverage !== 'complete' || gaps === undefined) {
|
|
384
|
+
throw new RangeError('gapAt() needs a complete index: this one is probed, so it has read record 0 and the last ' +
|
|
385
|
+
'record and nothing between, and has not looked for gaps at all. ' +
|
|
386
|
+
'Next: await buildRecordIndex(recording) and pass the index it returns.');
|
|
387
|
+
}
|
|
388
|
+
if (!Number.isFinite(seconds)) {
|
|
389
|
+
throw new RangeError(`gapAt() needs a finite time in seconds, received ${seconds}.`);
|
|
390
|
+
}
|
|
391
|
+
let low = 0;
|
|
392
|
+
let high = gaps.length - 1;
|
|
393
|
+
while (low <= high) {
|
|
394
|
+
const middle = (low + high) >> 1;
|
|
395
|
+
const gap = gaps[middle];
|
|
396
|
+
// Half-open, matching `segmentAt`: `gap.endSeconds` is the first instant with data again, so
|
|
397
|
+
// it belongs to the segment after the gap and not to the gap.
|
|
398
|
+
if (seconds < gap.startSeconds)
|
|
399
|
+
high = middle - 1;
|
|
400
|
+
else if (seconds >= gap.endSeconds)
|
|
401
|
+
low = middle + 1;
|
|
402
|
+
else
|
|
403
|
+
return gap;
|
|
404
|
+
}
|
|
405
|
+
return undefined;
|
|
406
|
+
}
|
|
370
407
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;GA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KAAK,SAAS,EAAE,CAAC;QACxD,MAAM,IAAI,UAAU,CAClB,2FAA2F;YACzF,kEAAkE;YAClE,wEAAwE,CAC3E,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,UAAU,CAAC,oDAAoD,OAAO,GAAG,CAAC,CAAC;IACvF,CAAC;IAED,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAC3B,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QACnB,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAW,CAAC;QACnC,6FAA6F;QAC7F,8DAA8D;QAC9D,IAAI,OAAO,GAAG,GAAG,CAAC,YAAY;YAAE,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC;aAC7C,IAAI,OAAO,IAAI,GAAG,CAAC,UAAU;YAAE,GAAG,GAAG,MAAM,GAAG,CAAC,CAAC;;YAChD,OAAO,GAAG,CAAC;IAClB,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,13 @@ export { httpSource } from './io/http.js';
|
|
|
158
160
|
// ===========================================================================
|
|
159
161
|
|
|
160
162
|
export { readHeader, readRecordBytes } from './io/read.js';
|
|
161
|
-
export {
|
|
163
|
+
export {
|
|
164
|
+
buildRecordIndex,
|
|
165
|
+
buildTimeline,
|
|
166
|
+
contiguityOf,
|
|
167
|
+
gapAt,
|
|
168
|
+
segmentAt,
|
|
169
|
+
} from './record-index.js';
|
|
162
170
|
|
|
163
171
|
// ===========================================================================
|
|
164
172
|
// Convenience layer
|
package/src/record-index.ts
CHANGED
|
@@ -473,3 +473,41 @@ export function segmentAt(index: EdfRecordIndex, seconds: number): EdfSegment |
|
|
|
473
473
|
}
|
|
474
474
|
return undefined;
|
|
475
475
|
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* The gap covering an instant, or `undefined` when a record covers it.
|
|
479
|
+
*
|
|
480
|
+
* The complement of `segmentAt`, and the reason it exists separately: `segmentAt` returning
|
|
481
|
+
* `undefined` tells a viewer there is no data under the cursor and nothing else. What a viewer
|
|
482
|
+
* then wants — how long the hole is, and when the recording resumes — is on the `EdfGap`.
|
|
483
|
+
*
|
|
484
|
+
* Exactly one of the two returns a value for any instant strictly inside the recording, and
|
|
485
|
+
* neither does for a time before the first record or after the last. Refuses a probed index and a
|
|
486
|
+
* non-finite time for the same reasons `segmentAt` does.
|
|
487
|
+
*/
|
|
488
|
+
export function gapAt(index: EdfRecordIndex, seconds: number): EdfGap | undefined {
|
|
489
|
+
const gaps = index.gaps;
|
|
490
|
+
if (index.coverage !== 'complete' || gaps === undefined) {
|
|
491
|
+
throw new RangeError(
|
|
492
|
+
'gapAt() needs a complete index: this one is probed, so it has read record 0 and the last ' +
|
|
493
|
+
'record and nothing between, and has not looked for gaps at all. ' +
|
|
494
|
+
'Next: await buildRecordIndex(recording) and pass the index it returns.',
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
if (!Number.isFinite(seconds)) {
|
|
498
|
+
throw new RangeError(`gapAt() needs a finite time in seconds, received ${seconds}.`);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
let low = 0;
|
|
502
|
+
let high = gaps.length - 1;
|
|
503
|
+
while (low <= high) {
|
|
504
|
+
const middle = (low + high) >> 1;
|
|
505
|
+
const gap = gaps[middle] as EdfGap;
|
|
506
|
+
// Half-open, matching `segmentAt`: `gap.endSeconds` is the first instant with data again, so
|
|
507
|
+
// it belongs to the segment after the gap and not to the gap.
|
|
508
|
+
if (seconds < gap.startSeconds) high = middle - 1;
|
|
509
|
+
else if (seconds >= gap.endSeconds) low = middle + 1;
|
|
510
|
+
else return gap;
|
|
511
|
+
}
|
|
512
|
+
return undefined;
|
|
513
|
+
}
|