@cosyte/hl7 0.0.2 → 0.0.3
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 +123 -0
- package/README.md +1 -1
- package/dist/index.cjs +41 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +243 -256
- package/dist/index.d.ts +243 -256
- package/dist/index.mjs +41 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,129 @@ per the cosyte version ladder (`0.0.x` until first alpha).
|
|
|
15
15
|
|
|
16
16
|
### Added
|
|
17
17
|
|
|
18
|
+
- **The published JSDoc is swept, and `src/` doc comments are gated
|
|
19
|
+
(`pnpm check:no-internal-refs` third pass; `PUBLIC-SURFACE-HYGIENE`).** Doc comments compile
|
|
20
|
+
into `dist/index.d.ts` and `dist/index.d.cts`, `dist` is the first entry in `files`, and every
|
|
21
|
+
`npm i @cosyte/hl7` receives them, so what a consumer's editor renders on hover is public
|
|
22
|
+
surface and the founder directive of 2026-07-27 applies to it. Re-measured with the shipped
|
|
23
|
+
rules before the change: **293 distinct lines** across tracked `src/*.ts` (253 phase-rule, 39
|
|
24
|
+
identifier-rule, 5 ADR, 1 jargon, 1 traceability marker), of which a local build carried
|
|
25
|
+
**164 distinct lines into `dist/index.d.ts`** (137 phase-rule, 22 identifier-rule, 5 ADR,
|
|
26
|
+
1 jargon, 1 traceability). After: **0 on every rule, in `src/` doc comments and in both built
|
|
27
|
+
declaration files.** A consumer hovering `parseHL7`, `defineProfile`, `Medication` or
|
|
28
|
+
`buildMessage` no longer reads which internal phase built it. Every `Plan N` build-order
|
|
29
|
+
reference was swept in the same pass, by hand, and **the built declaration file now carries
|
|
30
|
+
none**: no rule catches them, and they contradicted the `CLAUDE.md` sentence this change adds.
|
|
31
|
+
For scale, the base commit's build carried 28 such lines, from 61 doc-comment lines in `src/`.
|
|
32
|
+
|
|
33
|
+
**Identifiers were translated, never deleted, and no public export lost its documentation.**
|
|
34
|
+
That is measured, not asserted: the built `dist/index.d.ts` carries **691 doc-comment blocks,
|
|
35
|
+
633 documented declarations and 237 `@example` blocks before and after, and the sorted list of
|
|
36
|
+
documented declaration names is byte-identical.** Heads left behind by a front-of-line strip
|
|
37
|
+
were repaired: nine composite parsers wrapped `HL7-VALUE-REDECODE)` onto a continuation line,
|
|
38
|
+
where a naive strip leaves `). Absent / empty components are OMITTED`.
|
|
39
|
+
|
|
40
|
+
**Stripping the framing exposed a false claim on a published API, which is the argument for
|
|
41
|
+
doing this at all.** `defineProfile`'s doc block in `dist/index.d.ts` told consumers that
|
|
42
|
+
`opts.extends` was "ACCEPTED but IGNORED, resulting in `lineage === [opts.name]` regardless".
|
|
43
|
+
The implementation merges parents (lineage, `dateFormats`, `customSegments`, `description`,
|
|
44
|
+
composed `onWarning`) and re-validates the merged result. The text now describes what the
|
|
45
|
+
function does. Four sibling claims of the same kind were also stale and are gone: `emitMessage`,
|
|
46
|
+
`emitPrettyPrint`, `emitJson` and `buildMessage` were each documented as an unimplemented stub
|
|
47
|
+
("Stub throws", "Implementation lives in..."), and all four have been implemented for some time.
|
|
48
|
+
Internal framing is where stale claims hide, which is why this is a correctness change and not
|
|
49
|
+
a tidying one.
|
|
50
|
+
|
|
51
|
+
**The gate now has a third pass** with its own rule array, its own extractor and its own
|
|
52
|
+
positive/negative self-tests written in the language of source rather than markdown. It scans
|
|
53
|
+
`/** */` text only, line by line and again over the block reflowed the way a hover tooltip
|
|
54
|
+
reflows it, because multi-token rules are blind to a violation that straddles a wrap and this
|
|
55
|
+
package wraps its doc comments. `//` and `/* */` comments are deliberately **not** covered and
|
|
56
|
+
keep their identifiers: they do not reach `dist` (checked both directions), and the convention
|
|
57
|
+
names source comments as a place identifiers belong. 61 such lines remain in `src/` by choice.
|
|
58
|
+
|
|
59
|
+
Every claim above was checked RED against a seeded violation rather than assumed: a single-line
|
|
60
|
+
violation in an exported function's JSDoc; a violation split across a wrap that a line-only
|
|
61
|
+
grep scores 0 on; the same bookkeeping in a `//` comment staying green; widening the source
|
|
62
|
+
identifier rule to the `WORD-N` shape failing its own negative self-test naming `MSH-2`; an
|
|
63
|
+
extractor that strips the comment leader before testing the terminator reporting 66 false hits
|
|
64
|
+
on a clean tree; and an extractor that yields nothing refusing to report green.
|
|
65
|
+
|
|
66
|
+
**The ceiling is stated rather than implied shut, and "0 on all six rules" is a statement about
|
|
67
|
+
these rules, not about the founder's rule.** Measured on the built `dist/index.d.ts`, what still
|
|
68
|
+
ships is **144 lines carrying `D-NN` internal decision numbers** and **51 lines carrying item
|
|
69
|
+
identifiers from nine prefixes the list does not hold** (`HELPERS` 14, `BIP` 15, `PROF` 8,
|
|
70
|
+
`SER` 6, `MODEL` 4, `PARSE`, `WR`, `TOL`, `TYPES` 1 each). `D-NN` is the deliberate
|
|
71
|
+
non-catch it has always been, because legacy SNOMED RT codes are axis-prefixed in exactly that
|
|
72
|
+
shape (`D-13000`, `T-32000`, `M-80003`). The item identifiers need new prefixes added to the
|
|
73
|
+
list, which is a **rule** change needing its own negative self-tests (`SER`, `WR`, `TOL` and
|
|
74
|
+
`BIP` are exactly the short generic tokens that made `PKG` unsafe), so it is not smuggled in on
|
|
75
|
+
the back of a prose sweep. Separately, `dist/` is untracked build output, so no checked-in gate
|
|
76
|
+
can read it: this gates dist's _source_, which holds only because the dts build copies doc text
|
|
77
|
+
verbatim, and the `164` figure is a hand-taken snapshot. Two "the per-X slice of Y" false
|
|
78
|
+
positives, where `slice` means portion, were fixed by rewording rather than by narrowing the
|
|
79
|
+
rule.
|
|
80
|
+
|
|
81
|
+
Documentation, tooling and CI only. No change to the published package surface, parser
|
|
82
|
+
behavior, or warning codes.
|
|
83
|
+
|
|
84
|
+
- **Public-surface hygiene gate in CI (`scripts/check-no-internal-refs.sh`,
|
|
85
|
+
`pnpm check:no-internal-refs`, `.github/workflows/no-internal-refs.yml`;
|
|
86
|
+
`PUBLIC-SURFACE-HYGIENE`).** Founder directive of 2026-07-27: no internal project bookkeeping on
|
|
87
|
+
any surface a consumer reads. The remediation half of that directive was a sweep of 149 references
|
|
88
|
+
across 11 repos, and a sweep regresses the first time someone writes `(CCDA-P8)` into a README, so
|
|
89
|
+
the deliverable here is the gate; the sweep rides along. **50 violating lines across 15
|
|
90
|
+
`docs-content/` pages were cleared** (re-measured with the shipped rules against the previous tree;
|
|
91
|
+
the backlog's count of 44 was markdown-only and predates two of the rules): phase identifiers in
|
|
92
|
+
page titles and headings, `HL7-N` / `HL7-J` / `HL7-ESC` / `HL7-R` / `VERIFY-AT-BUILD` item
|
|
93
|
+
identifiers, a citation of `operations/roadmaps/hl7.md`, bracketed spec-trace tags (`[S-NTE]`,
|
|
94
|
+
`[S-DTM-IMPL]`), an "Open-question #12", and review-process commentary ("All confirmed 3-0
|
|
95
|
+
(pass 5)", "all verified 3-0 in the research pass", "Assumption logged"). One more, in `README.md`,
|
|
96
|
+
was fixed by hand and is caught by no rule: a pointer to "the roadmap's known-limitations", a file
|
|
97
|
+
the reader does not have. Identifiers were translated at the boundary, not merely deleted, and
|
|
98
|
+
every head left behind by a front-of-line strip was repaired: a heading cut to `: datetime
|
|
99
|
+
precision` reads worse than the text it replaced. The datetime page needed more than a strip: with
|
|
100
|
+
its phase framing gone it read as documentation of shipped behaviour while still describing, in the
|
|
101
|
+
present tense, a `parseHl7TsDtm` zero-fill defect that no longer exists in the library (the API it
|
|
102
|
+
planned has shipped). It is now written as what the package does, its unexecuted plan and test
|
|
103
|
+
bookkeeping are gone, and a provenance claim that survived the strip in a stronger form than the
|
|
104
|
+
original ("all verified against primary Ch. 2A") is removed rather than reworded. The detection
|
|
105
|
+
rules are lifted
|
|
106
|
+
from `cosyte/.github` `scripts/release-notes.mjs`, which is already tested byte-for-byte against
|
|
107
|
+
the 14 published release bodies, and they are **keyed on known project prefixes, never on the
|
|
108
|
+
`WORD-N` shape**: `MSH-2`, `PID-3`, `OBX-5`, `TQ1-7`, `NM1-03`, `PKG-4`, `ICD-10-CM`, `HL7-V2`,
|
|
109
|
+
`FHIR-R4`, `DICOM-SR`, `NCPDP-SCRIPT`, `FHIR-bridge`, `HL7-defined` and the four `CSP`
|
|
110
|
+
Clinical Study **Phase** field names are the reference material an HL7 parser's docs exist to
|
|
111
|
+
provide, and a shape rule deletes them. That is asserted, not assumed: the script carries a
|
|
112
|
+
**negative** self-test per rule, built from that material, alongside the positive one, so widening
|
|
113
|
+
a rule into the `WORD-N` shape reds the gate instead of silently corrupting a segment reference on
|
|
114
|
+
the next sweep. Where a rule could not be guarded it was **cut** instead: `phase` after a
|
|
115
|
+
determiner ("the non-goals of this phase") is not detected at all, because catching it also caught
|
|
116
|
+
"the phase of the clinical study" and "the phase of illness", and when the collision is
|
|
117
|
+
with clinical reference material the reference material wins. The scan harness is the em-dash gate's,
|
|
118
|
+
in mllp's variant: scan list built and `./`-prefixed in one loop so the scan stays a single command
|
|
119
|
+
with stderr bound to all of it, no `sed -z`, no `-d skip`, no `-I`, `-e`/`--`, `-0 -r`, and a
|
|
120
|
+
refusal to print OK from an empty list, an unreadable input, a non-regular-file entry, or any
|
|
121
|
+
scanner stderr. Every one of those routes was checked RED against a seeded violation rather than
|
|
122
|
+
inherited. **Every rule is also applied a second time to paragraph-joined text**, because the rules
|
|
123
|
+
are multi-token and this repo hard-wraps markdown: a violation straddling a wrap was invisible to a
|
|
124
|
+
line scan and one was live (`A future phase` / `may add opt-in decode`, with the gate printing OK).
|
|
125
|
+
The join squeezes whitespace the way markdown does, which is load-bearing rather than cosmetic: a
|
|
126
|
+
verbatim join leaves the continuation line's indentation in place, and about 600 lines of
|
|
127
|
+
`docs-content/` start indented, so the pass would have missed the dominant wrap shape while
|
|
128
|
+
reporting that it ran.
|
|
129
|
+
It scans the public surface only (`README.md`, `TRADEMARKS.md`, `LICENSE`, `docs-content/`, and the
|
|
130
|
+
npm `description` and `keywords`) because the same identifier is required on the inside:
|
|
131
|
+
`CHANGELOG.md`, `.changeset/`, commits and PRs are where it belongs. A tripwire refuses the run if
|
|
132
|
+
`package.json`'s `files` starts shipping anything the gate does not cover. **Three holes are measured and disclosed rather than implied
|
|
133
|
+
shut:** `dist/` ships the compiled JSDoc, and the tracked `src/*.ts` files carry 253 phase-rule and
|
|
134
|
+
39 identifier-rule lines, of which a local build puts 137 and 22 into `dist/index.d.ts` for every
|
|
135
|
+
consumer's editor to render, unswept and ungated here because remediating ~290 source doc comments
|
|
136
|
+
is its own reviewable change (**that change is the entry above, which swept them and added the
|
|
137
|
+
third pass**; `dist/` is untracked, so no checked-in gate can re-derive that figure without
|
|
138
|
+
building first, and that part is still true); determiner-plus-`phase` is not detected, by choice;
|
|
139
|
+
and the rules catch identifiers, not English sentences about our process. Documentation and CI only: no change to the
|
|
140
|
+
published package surface, parser behavior, or warning codes.
|
|
18
141
|
- **Em-dash brand gate in CI (`scripts/check-no-emdash.sh`, `pnpm check:no-emdash`,
|
|
19
142
|
`.github/workflows/no-emdash.yml`; `EMDASH-CONFORMANCE` part 1).** The founder directive of
|
|
20
143
|
2026-07-24 (`knowledgebase/06-brand/voice-and-tone.md`) bans `U+2014` outright across every cosyte
|
package/README.md
CHANGED
|
@@ -251,7 +251,7 @@ for (const charge of parseHL7(raw).charges()) {
|
|
|
251
251
|
}
|
|
252
252
|
```
|
|
253
253
|
|
|
254
|
-
These are **breadth** helpers: they surface the common trigger events' core fields, not a scheduling-workflow state machine, signature verification, or a claims/pricing engine (see the
|
|
254
|
+
These are **breadth** helpers: they surface the common trigger events' core fields, not a scheduling-workflow state machine, signature verification, or a claims/pricing engine (see the known limitations in the docs).
|
|
255
255
|
|
|
256
256
|
### Order & medication timing
|
|
257
257
|
|
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ var ProfileDefinitionError = class extends Error {
|
|
|
38
38
|
profileName;
|
|
39
39
|
/**
|
|
40
40
|
* Construct a new `ProfileDefinitionError`. `profileName` is optional so
|
|
41
|
-
*
|
|
41
|
+
* callers may omit it when the offending profile cannot be named
|
|
42
42
|
* (e.g. during initial validation before a name is parsed).
|
|
43
43
|
*
|
|
44
44
|
* @internal
|
|
@@ -1863,11 +1863,11 @@ var Field = class {
|
|
|
1863
1863
|
isNull;
|
|
1864
1864
|
/** Reference to the underlying `RawField.repetitions` (no defensive copy). */
|
|
1865
1865
|
repetitions;
|
|
1866
|
-
/** The 5 encoding characters for this message. Exposed for composite parsers
|
|
1866
|
+
/** The 5 encoding characters for this message. Exposed for composite parsers. @internal */
|
|
1867
1867
|
enc;
|
|
1868
1868
|
/** Position of this field in the parent message: used for position-aware error messages. @internal */
|
|
1869
1869
|
position;
|
|
1870
|
-
/** The full `RawField` this wrapper wraps. Exposed for composite parsers
|
|
1870
|
+
/** The full `RawField` this wrapper wraps. Exposed for composite parsers. @internal */
|
|
1871
1871
|
raw;
|
|
1872
1872
|
/**
|
|
1873
1873
|
* Construct a new `Field`. Called internally by `Segment.field(n)`; user
|
|
@@ -1884,7 +1884,7 @@ var Field = class {
|
|
|
1884
1884
|
/**
|
|
1885
1885
|
* First-repetition, first-component, first-subcomponent value as a decoded
|
|
1886
1886
|
* string: unescaped ONCE by the tokenizer on parse, returned verbatim here
|
|
1887
|
-
* (never re-unescaped
|
|
1887
|
+
* (never re-unescaped). Returns `""` when the field is
|
|
1888
1888
|
* empty or HL7 null. Equivalent to `msg.get('SEG.N')` for a top-level access.
|
|
1889
1889
|
*
|
|
1890
1890
|
* @example
|
|
@@ -1915,7 +1915,7 @@ var Field = class {
|
|
|
1915
1915
|
* vendor-quirk control id containing an unescaped delimiter (`ID^X`) must
|
|
1916
1916
|
* not be truncated to its first component.
|
|
1917
1917
|
*
|
|
1918
|
-
* **Byte-verbatim for parsed content
|
|
1918
|
+
* **Byte-verbatim for parsed content.** The parse pipeline stores
|
|
1919
1919
|
* *decoded* content, but also records the original wire bytes of any escape
|
|
1920
1920
|
* whose decode is not byte-faithful (`RawComponent.rawSubcomponents`), so
|
|
1921
1921
|
* re-serialization preserves the sender's exact escape bytes: hex escapes
|
|
@@ -2169,7 +2169,7 @@ var Segment = class {
|
|
|
2169
2169
|
enc;
|
|
2170
2170
|
/** Absolute index of this segment in `Hl7Message.rawSegments[]`. Used for position tracking. @internal */
|
|
2171
2171
|
absoluteIndex;
|
|
2172
|
-
/** The full `RawSegment` this wrapper wraps. Exposed for mutation methods
|
|
2172
|
+
/** The full `RawSegment` this wrapper wraps. Exposed for mutation methods. @internal */
|
|
2173
2173
|
raw;
|
|
2174
2174
|
/**
|
|
2175
2175
|
* Lookup map from profile-declared field name → 1-indexed HL7 position.
|
|
@@ -2186,7 +2186,7 @@ var Segment = class {
|
|
|
2186
2186
|
* should obtain `Segment` instances via `msg.segments(type)` or
|
|
2187
2187
|
* `msg.allSegments()`.
|
|
2188
2188
|
*
|
|
2189
|
-
* The optional `customFields` parameter is the per-segment
|
|
2189
|
+
* The optional `customFields` parameter is the per-segment portion of the
|
|
2190
2190
|
* applied profile's merged `customSegments` map (PROF-07 / D-16). When
|
|
2191
2191
|
* supplied, `get(name)` resolves names against it; otherwise `get(name)`
|
|
2192
2192
|
* always returns `undefined`.
|
|
@@ -3881,8 +3881,7 @@ var Hl7Message = class {
|
|
|
3881
3881
|
* Raw positional tree produced by the parser. 1-indexed per HL7 convention
|
|
3882
3882
|
* (`fields[0]` is the segment-name / MSH separator placeholder slot). Use
|
|
3883
3883
|
* `segments(type)` / `allSegments()` for typed wrapper access: this field
|
|
3884
|
-
* is exposed for advanced callers that need the raw tree directly
|
|
3885
|
-
* future serialization phase 5).
|
|
3884
|
+
* is exposed for advanced callers that need the raw tree directly.
|
|
3886
3885
|
*/
|
|
3887
3886
|
rawSegments;
|
|
3888
3887
|
encodingCharacters;
|
|
@@ -3898,7 +3897,7 @@ var Hl7Message = class {
|
|
|
3898
3897
|
dateFormats;
|
|
3899
3898
|
/**
|
|
3900
3899
|
* Merged `customSegments` map from the applied profile, stored so
|
|
3901
|
-
* `allSegments()` can hand per-segment
|
|
3900
|
+
* `allSegments()` can hand per-segment portions to `Segment` constructors
|
|
3902
3901
|
* (D-16). Undefined when no profile was applied.
|
|
3903
3902
|
* @internal
|
|
3904
3903
|
*/
|
|
@@ -3907,40 +3906,40 @@ var Hl7Message = class {
|
|
|
3907
3906
|
* Lazily built cache of Segment wrappers keyed by segment type. Built on
|
|
3908
3907
|
* first `segments(type)` call and filtered from `_allSegments` so
|
|
3909
3908
|
* individual Segment instances are identical across both caches (D-11).
|
|
3910
|
-
*
|
|
3909
|
+
* The mutation methods drop this cache wholesale.
|
|
3911
3910
|
* @internal
|
|
3912
3911
|
*/
|
|
3913
3912
|
_segmentsByType;
|
|
3914
3913
|
/**
|
|
3915
3914
|
* Lazily built cache of every Segment wrapper in document order. Built on
|
|
3916
|
-
* first `segments(type)` / `allSegments()` call.
|
|
3915
|
+
* first `segments(type)` / `allSegments()` call. The mutation methods
|
|
3917
3916
|
* drop this cache wholesale.
|
|
3918
3917
|
* @internal
|
|
3919
3918
|
*/
|
|
3920
3919
|
_allSegments;
|
|
3921
3920
|
/**
|
|
3922
|
-
* Lazily built `Meta` view (
|
|
3921
|
+
* Lazily built `Meta` view (memoized). Dropped wholesale
|
|
3923
3922
|
* by `invalidateCaches`. `Meta` is always defined (D-03: MSH absence
|
|
3924
3923
|
* throws `NO_MSH_SEGMENT` at parse time) so no null-sentinel is needed.
|
|
3925
3924
|
* @internal
|
|
3926
3925
|
*/
|
|
3927
3926
|
_meta;
|
|
3928
3927
|
/**
|
|
3929
|
-
* Lazily built `MessageStructure` view
|
|
3928
|
+
* Lazily built `MessageStructure` view. Dropped wholesale by
|
|
3930
3929
|
* `invalidateCaches`. Always defined: `analyzeMessageStructure` returns an
|
|
3931
3930
|
* `recognized: false` summary for unmodelled types rather than absence.
|
|
3932
3931
|
* @internal
|
|
3933
3932
|
*/
|
|
3934
3933
|
_structure;
|
|
3935
3934
|
/**
|
|
3936
|
-
* Lazily built `Patient | undefined` view (
|
|
3935
|
+
* Lazily built `Patient | undefined` view (memoized). Uses
|
|
3937
3936
|
* a null-sentinel cache because `undefined` means "not yet computed" while
|
|
3938
3937
|
* `null` means "computed, absent". D-04: no PID → public value `undefined`.
|
|
3939
3938
|
* @internal
|
|
3940
3939
|
*/
|
|
3941
3940
|
_patient;
|
|
3942
3941
|
/**
|
|
3943
|
-
* Lazily built `Visit | undefined` view (
|
|
3942
|
+
* Lazily built `Visit | undefined` view (memoized). Same
|
|
3944
3943
|
* null-sentinel convention as `_patient`. HELPERS-03: no PV1 → public
|
|
3945
3944
|
* value `undefined`.
|
|
3946
3945
|
* @internal
|
|
@@ -3964,8 +3963,8 @@ var Hl7Message = class {
|
|
|
3964
3963
|
}
|
|
3965
3964
|
/**
|
|
3966
3965
|
* Resolve a dot-path (e.g. `PID.5.1`, `OBX[2].5`, `PID.3[0].1`) to its
|
|
3967
|
-
* decoded leaf string (unescaped once at parse: never re-unescaped on
|
|
3968
|
-
*
|
|
3966
|
+
* decoded leaf string (unescaped once at parse: never re-unescaped on
|
|
3967
|
+
* read). Returns `undefined` when the path doesn't
|
|
3969
3968
|
* resolve: never throws on missing path (MODEL-05). Throws `TypeError`
|
|
3970
3969
|
* on malformed path syntax (e.g. `"pid.5"`, empty string).
|
|
3971
3970
|
*
|
|
@@ -4000,7 +3999,7 @@ var Hl7Message = class {
|
|
|
4000
3999
|
* Return the cached array of `Segment` wrappers for `segmentType` in
|
|
4001
4000
|
* document order. The returned array identity and the individual Segment
|
|
4002
4001
|
* instances are both stable across calls (D-11). Invalidated wholesale
|
|
4003
|
-
* by
|
|
4002
|
+
* by the mutation methods.
|
|
4004
4003
|
*
|
|
4005
4004
|
* @example
|
|
4006
4005
|
* ```ts
|
|
@@ -4023,7 +4022,7 @@ var Hl7Message = class {
|
|
|
4023
4022
|
* Iterate every `Segment` in document order (MSH first, then every
|
|
4024
4023
|
* subsequent segment). Cached per-message; same array reference and same
|
|
4025
4024
|
* Segment instances on repeat calls (D-11). Invalidated wholesale by
|
|
4026
|
-
*
|
|
4025
|
+
* the mutation methods.
|
|
4027
4026
|
*
|
|
4028
4027
|
* @example
|
|
4029
4028
|
* ```ts
|
|
@@ -4057,7 +4056,7 @@ var Hl7Message = class {
|
|
|
4057
4056
|
* @example
|
|
4058
4057
|
* ```ts
|
|
4059
4058
|
* console.log(msg.meta.type); // "ADT^A01"
|
|
4060
|
-
* console.log(msg.meta.timestamp?.raw); // fidelity TS
|
|
4059
|
+
* console.log(msg.meta.timestamp?.raw); // fidelity TS
|
|
4061
4060
|
* console.log(msg.meta.controlId); // "MSG001"
|
|
4062
4061
|
* ```
|
|
4063
4062
|
*/
|
|
@@ -4065,8 +4064,8 @@ var Hl7Message = class {
|
|
|
4065
4064
|
return this._meta ??= buildMeta(this);
|
|
4066
4065
|
}
|
|
4067
4066
|
/**
|
|
4068
|
-
* Structural-conformance summary for the common message types
|
|
4069
|
-
*
|
|
4067
|
+
* Structural-conformance summary for the common message types: a
|
|
4068
|
+
* misroute/truncation safety net, NOT a conformance validator.
|
|
4070
4069
|
* Reports, per the message's recognized (MSH-9.1, MSH-9.2) type, which
|
|
4071
4070
|
* Required segment groups are present and which are entirely absent
|
|
4072
4071
|
* (`missingGroups`: the same set the parser flags as
|
|
@@ -4134,7 +4133,7 @@ var Hl7Message = class {
|
|
|
4134
4133
|
}
|
|
4135
4134
|
/**
|
|
4136
4135
|
* Every OBR as an Order with its OBX children grouped positionally (D-12) and
|
|
4137
|
-
* its TQ1 / legacy embedded-TQ (ORC-7) `timings` (
|
|
4136
|
+
* its TQ1 / legacy embedded-TQ (ORC-7) `timings` (the repeat pattern is
|
|
4138
4137
|
* surfaced verbatim, never resolved to a schedule). D-05: returns `[]` when no
|
|
4139
4138
|
* OBR present. D-06: not memoized.
|
|
4140
4139
|
*
|
|
@@ -4150,7 +4149,7 @@ var Hl7Message = class {
|
|
|
4150
4149
|
return orders(this);
|
|
4151
4150
|
}
|
|
4152
4151
|
/**
|
|
4153
|
-
* Message-level NTE notes
|
|
4152
|
+
* Message-level NTE notes: every NTE segment with no recognized
|
|
4154
4153
|
* preceding parent (not immediately following a `PID`, `ORC`, `OBR`, or
|
|
4155
4154
|
* `OBX`), surfaced verbatim in document order so nothing is dropped. Notes
|
|
4156
4155
|
* that DO attach to a specific patient / order / result are exposed on those
|
|
@@ -4167,7 +4166,7 @@ var Hl7Message = class {
|
|
|
4167
4166
|
}
|
|
4168
4167
|
/**
|
|
4169
4168
|
* Every recognized ADT patient-identity event (merge / move / link /
|
|
4170
|
-
* unlink / person add/update
|
|
4169
|
+
* unlink / person add/update), with the MRG-sourced
|
|
4171
4170
|
* `prior` and PID/PV1-sourced `surviving` parties labelled by role and the
|
|
4172
4171
|
* spec-constant `direction: "MRG_TO_PID"` on merge/move events. Returns
|
|
4173
4172
|
* `[]` when the trigger event is not in the identity family. D-06: not
|
|
@@ -4188,13 +4187,13 @@ var Hl7Message = class {
|
|
|
4188
4187
|
}
|
|
4189
4188
|
/**
|
|
4190
4189
|
* Every RXO/RXE/RXD/RXA as a typed `Medication`, with RXR (route) and RXC
|
|
4191
|
-
* (component) segments grouped positionally under their parent
|
|
4192
|
-
*
|
|
4193
|
-
*
|
|
4194
|
-
*
|
|
4190
|
+
* (component) segments grouped positionally under their parent. D-05:
|
|
4191
|
+
* returns `[]` when no RX* parent present. D-06: not memoized. The give
|
|
4192
|
+
* *amount* and give *strength* are surfaced separately and never
|
|
4193
|
+
* reconciled.
|
|
4195
4194
|
*
|
|
4196
4195
|
* Each medication also carries its TQ1 / legacy embedded-TQ (RXE-1) `timings`
|
|
4197
|
-
* (
|
|
4196
|
+
* (repeat pattern verbatim, never resolved to a schedule).
|
|
4198
4197
|
*
|
|
4199
4198
|
* @example
|
|
4200
4199
|
* ```ts
|
|
@@ -4211,7 +4210,7 @@ var Hl7Message = class {
|
|
|
4211
4210
|
/**
|
|
4212
4211
|
* Every RXA of a VXU^V04 as a typed `Immunization`, with RXR (route/site)
|
|
4213
4212
|
* and OBX children grouped positionally under the RXA and `orderControl`
|
|
4214
|
-
* from the preceding ORC of the VXU order group
|
|
4213
|
+
* from the preceding ORC of the VXU order group. D-05:
|
|
4215
4214
|
* returns `[]` when no RXA present. D-06: not memoized. The vaccine code
|
|
4216
4215
|
* carries its own provenance; the action code (RXA-21) is surfaced verbatim
|
|
4217
4216
|
* and `recordOrigin` (administered vs historical) is derived only from the
|
|
@@ -4279,7 +4278,7 @@ var Hl7Message = class {
|
|
|
4279
4278
|
return insurance(this);
|
|
4280
4279
|
}
|
|
4281
4280
|
/**
|
|
4282
|
-
* Every SCH of an SIU message as a typed `Appointment
|
|
4281
|
+
* Every SCH of an SIU message as a typed `Appointment`, with
|
|
4283
4282
|
* the AIS/AIG/AIL/AIP resource segments that follow it grouped positionally
|
|
4284
4283
|
* under that SCH. Surfaces the placer/filler appointment ids, SCH-25 filler
|
|
4285
4284
|
* status (Table 0278), SCH-11 start/end timing, and the resource groups
|
|
@@ -4299,7 +4298,7 @@ var Hl7Message = class {
|
|
|
4299
4298
|
return appointments(this);
|
|
4300
4299
|
}
|
|
4301
4300
|
/**
|
|
4302
|
-
* Every TXA of an MDM message as a typed `ClinicalDocument
|
|
4301
|
+
* Every TXA of an MDM message as a typed `ClinicalDocument`,
|
|
4303
4302
|
* with the OBX narrative body grouped positionally under that TXA. The
|
|
4304
4303
|
* completion status (TXA-17) and availability status (TXA-19) are surfaced as
|
|
4305
4304
|
* **distinct** fields and never conflated: a document can be available before
|
|
@@ -4319,7 +4318,7 @@ var Hl7Message = class {
|
|
|
4319
4318
|
return documents(this);
|
|
4320
4319
|
}
|
|
4321
4320
|
/**
|
|
4322
|
-
* Every FT1 of a DFT message as a typed `Charge
|
|
4321
|
+
* Every FT1 of a DFT message as a typed `Charge`, one per
|
|
4323
4322
|
* FT1 in document order. Surfaces billing-critical fields (FT1-6 transaction
|
|
4324
4323
|
* type, FT1-7 code, FT1-11/12 extended/unit amount, FT1-19 diagnosis linkage)
|
|
4325
4324
|
* with **no billing logic and no money-as-float**: amounts are the verbatim
|
|
@@ -4413,7 +4412,7 @@ var Hl7Message = class {
|
|
|
4413
4412
|
* `TypeError` with an actionable message otherwise).
|
|
4414
4413
|
*
|
|
4415
4414
|
* The value is accepted verbatim: unescaped delimiter characters are NOT
|
|
4416
|
-
* rejected on input (D-18). Re-escaping
|
|
4415
|
+
* rejected on input (D-18). Re-escaping is the serializer's concern.
|
|
4417
4416
|
*
|
|
4418
4417
|
* MSH-1 / MSH-2 follow the user-facing HL7 convention: `setField("MSH.3", ...)`
|
|
4419
4418
|
* targets MSH-3 (sending application), matching `msg.get("MSH.3")`.
|
|
@@ -4499,11 +4498,11 @@ var Hl7Message = class {
|
|
|
4499
4498
|
return this;
|
|
4500
4499
|
}
|
|
4501
4500
|
/**
|
|
4502
|
-
* Set a **typed composite** at a field (or field-repetition) dot-path
|
|
4503
|
-
*
|
|
4501
|
+
* Set a **typed composite** at a field (or field-repetition) dot-path:
|
|
4502
|
+
* the conservative-emit mirror of the typed read accessors
|
|
4504
4503
|
* (`asXpn`/`asCx`/…). The caller passes a structured value (an XPN name, a CX
|
|
4505
4504
|
* identifier, a TS timestamp, …) by its {@link CompositeKind}, and the setter
|
|
4506
|
-
* encodes it into a spec-clean field using the
|
|
4505
|
+
* encodes it into a spec-clean field using the encode-safe path: any
|
|
4507
4506
|
* delimiter embedded in a component value is **escaped, never injected**, so
|
|
4508
4507
|
* a `familyName` of `"Smith^Jr"` re-parses to exactly that string rather than
|
|
4509
4508
|
* forging a component boundary. No hand-assembly of `^`/`&`/`~`.
|
|
@@ -4694,8 +4693,8 @@ var Hl7Message = class {
|
|
|
4694
4693
|
return this;
|
|
4695
4694
|
}
|
|
4696
4695
|
/**
|
|
4697
|
-
* Drop every wrapper AND helper cache wholesale (
|
|
4698
|
-
*
|
|
4696
|
+
* Drop every wrapper AND helper cache wholesale (D-17 + D-02). Called by
|
|
4697
|
+
* every mutation method so subsequent `segments(type)` /
|
|
4699
4698
|
* `allSegments()` / `meta` / `patient` / `visit` reads rebuild from the
|
|
4700
4699
|
* mutated `rawSegments` tree.
|
|
4701
4700
|
* @internal
|
|
@@ -6809,7 +6808,7 @@ async function* parseStream(source, optionsOrProfile) {
|
|
|
6809
6808
|
}
|
|
6810
6809
|
|
|
6811
6810
|
// src/index.ts
|
|
6812
|
-
var VERSION = "0.0.
|
|
6811
|
+
var VERSION = "0.0.3";
|
|
6813
6812
|
|
|
6814
6813
|
exports.ACK_CODES = ACK_CODES;
|
|
6815
6814
|
exports.ACK_CONDITIONS = ACK_CONDITIONS;
|