edfcore 0.3.48 → 0.3.50
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 +40 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/header/identification.d.ts.map +1 -1
- package/dist/header/identification.js +13 -2
- package/dist/header/identification.js.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +1 -1
- package/src/header/identification.ts +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,46 @@ 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.3.50
|
|
10
|
+
|
|
11
|
+
- **Fixed** the "Renamed in 0.3.0" note in `api-helpers.md`, which was attached to the wrong family
|
|
12
|
+
of functions and so told a reader migrating from 0.2 to call a function that answers a different
|
|
13
|
+
question.
|
|
14
|
+
- The note sat at the end of **The recording-aware form**, saying that `sampleAt`,
|
|
15
|
+
`sampleStartTicksOf` and `sampleStartSecondsOf` "were `sampleIndexAt`, `sampleStartTicks` and
|
|
16
|
+
`sampleStartSeconds`" and that "the behaviour did not change". The rename table in
|
|
17
|
+
`migrating-to-0-3.md` and the 0.3.0 CHANGELOG entry both say those became **`gridSampleIndexAt`,
|
|
18
|
+
`gridSampleStartTicks` and `gridSampleStartSeconds`** — the family documented in the section
|
|
19
|
+
above.
|
|
20
|
+
- The two families are exactly the distinction the rename existed to make. On a six-record file
|
|
21
|
+
with a seven-second hole, `gridSampleStartSeconds(signal, 12, d)` is `3` and
|
|
22
|
+
`sampleStartSecondsOf(recording, i, 12)` is `10`. A reader who followed the note moved every
|
|
23
|
+
answer by the gaps, under a sentence promising nothing had changed. On a file with gaps and a
|
|
24
|
+
probed index, `sampleStartTicksOf` throws instead.
|
|
25
|
+
- The note now sits under the grid functions, and says out loud that the recording-aware family
|
|
26
|
+
below is a different one.
|
|
27
|
+
- `tests/integration/rename-note.test.ts` derives the rename from the migration table, checks the
|
|
28
|
+
CHANGELOG spells it the same way, and requires the code block the note is attached to to import
|
|
29
|
+
the names the table produces. A note that drifts onto the wrong family is a test failure.
|
|
30
|
+
|
|
31
|
+
## 0.3.49
|
|
32
|
+
|
|
33
|
+
- **Fixed** `splitSubfields` splitting the EDF+ identification fields on JavaScript's `\s` instead
|
|
34
|
+
of on the ASCII space the spec names, so a NO-BREAK SPACE inside a subfield silently cut it in
|
|
35
|
+
two.
|
|
36
|
+
- EDF+ tells a writer to replace a space inside a subfield with another character and mandates
|
|
37
|
+
neither the character nor a way back. NBSP is one of the choices that leaves, and it is header
|
|
38
|
+
byte 0xA0 — which `decodeHeaderLatin1` turns into U+00A0, which `\s` matches. `Mac<NBSP>Donald`
|
|
39
|
+
parsed as `name: 'Mac'` with `'Donald'` demoted to `extraSubfields`.
|
|
40
|
+
- Nothing warned. The split **adds** a subfield rather than removing one, trailing extras are
|
|
41
|
+
legal under EDF+, so the count check passed and `conformant` stayed `true`.
|
|
42
|
+
- In `parseRecordingId` it was worse than a truncation: every code after the NBSP shifted one
|
|
43
|
+
position left, so `investigationCode`, `technicianCode` and `equipmentCode` each held the
|
|
44
|
+
previous field's value and all three looked plausible.
|
|
45
|
+
- The module docblock says `raw` and the subfields "both keep what the file wrote". That was true
|
|
46
|
+
of `raw` only. A tab or a CR in the field now also stays inside its subfield, where
|
|
47
|
+
`NON_ASCII_HEADER_FIELD` reports it, rather than acting as a separator the spec never named.
|
|
48
|
+
|
|
9
49
|
## 0.3.48
|
|
10
50
|
|
|
11
51
|
- **Fixed** the identification lines in `formatHeader` and in `edfcore json --patient` using
|
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.3.
|
|
112
|
+
export declare const VERSION = "0.3.50";
|
|
113
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identification.d.ts","sourceRoot":"","sources":["../../src/header/identification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAmB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAejF,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;
|
|
1
|
+
{"version":3,"file":"identification.d.ts","sourceRoot":"","sources":["../../src/header/identification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAmB,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAejF,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AA+CD;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,cAAc,GACnB,YAAY,CA0Cd;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,cAAc,GACnB,cAAc,CA+ChB"}
|
|
@@ -30,12 +30,23 @@ const PATIENT_SUBFIELD_COUNT = 4;
|
|
|
30
30
|
const RECORDING_SUBFIELD_COUNT = 5;
|
|
31
31
|
const PATIENT_GRAMMAR = 'code sex(F|M) birthdate(dd-MMM-yyyy) name';
|
|
32
32
|
const RECORDING_GRAMMAR = 'Startdate startdate(dd-MMM-yyyy) investigationCode technicianCode equipmentCode';
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Subfields are separated by spaces and may not contain one. Runs are tolerated.
|
|
35
|
+
*
|
|
36
|
+
* The ASCII space the spec names, not `/\s+/`. JavaScript's `\s` also matches U+00A0, which is
|
|
37
|
+
* what header byte 0xA0 decodes to — and NO-BREAK SPACE is one of the characters a writer may
|
|
38
|
+
* legitimately pick when EDF+ tells it to replace a space inside a subfield. Splitting on it cut
|
|
39
|
+
* `Mac Donald` into two subfields, so `name` held only `Mac`; and because the split ADDS a
|
|
40
|
+
* subfield rather than removing one, the count check still passed and `conformant` stayed true
|
|
41
|
+
* with no diagnostic. In `parseRecordingId` it shifted every code after it by one position. The
|
|
42
|
+
* docblock's "`raw` and the subfields both keep what the file wrote" was not true of the
|
|
43
|
+
* subfields (fixed in 0.3.49).
|
|
44
|
+
*/
|
|
34
45
|
function splitSubfields(raw) {
|
|
35
46
|
const text = trimEdfField(raw);
|
|
36
47
|
if (text.length === 0)
|
|
37
48
|
return [];
|
|
38
|
-
return text.split(
|
|
49
|
+
return text.split(' ').filter((part) => part.length > 0);
|
|
39
50
|
}
|
|
40
51
|
/** `'X'` is the spec's "unknown", and an absent subfield is unknown too. */
|
|
41
52
|
function subfieldValue(subfields, index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identification.js","sourceRoot":"","sources":["../../src/header/identification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,uEAAuE;AACvE,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAExC,MAAM,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ions {
|
|
|
47
47
|
readonly edfPlus: boolean;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Subfields are separated by spaces and may not contain one. Runs are tolerated.
|
|
52
|
+
*
|
|
53
|
+
* The ASCII space the spec names, not `/\s+/`. JavaScript's `\s` also matches U+00A0, which is
|
|
54
|
+
* what header byte 0xA0 decodes to — and NO-BREAK SPACE is one of the characters a writer may
|
|
55
|
+
* legitimately pick when EDF+ tells it to replace a space inside a subfield. Splitting on it cut
|
|
56
|
+
* `Mac Donald` into two subfields, so `name` held only `Mac`; and because the split ADDS a
|
|
57
|
+
* subfield rather than removing one, the count check still passed and `conformant` stayed true
|
|
58
|
+
* with no diagnostic. In `parseRecordingId` it shifted every code after it by one position. The
|
|
59
|
+
* docblock's "`raw` and the subfields both keep what the file wrote" was not true of the
|
|
60
|
+
* subfields (fixed in 0.3.49).
|
|
61
|
+
*/
|
|
51
62
|
function splitSubfields(raw: string): readonly string[] {
|
|
52
63
|
const text = trimEdfField(raw);
|
|
53
64
|
if (text.length === 0) return [];
|
|
54
|
-
return text.split(
|
|
65
|
+
return text.split(' ').filter((part) => part.length > 0);
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
/** `'X'` is the spec's "unknown", and an absent subfield is unknown too. */
|