@cosyte/transform 0.0.6 → 0.0.8
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 +91 -16
- package/README.md +25 -23
- package/dist/index.cjs +14 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +130 -130
- package/dist/index.d.ts +130 -130
- package/dist/index.mjs +14 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,99 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 0.0.8
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
Versions and publishing are managed with [Changesets](https://github.com/changesets/changesets);
|
|
8
|
-
this file is maintained by hand (Changesets handles the version bump and publish only).
|
|
5
|
+
### Patch Changes
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
- 9fdde50: No runtime impact: punctuation only, plus a new repository-internal check that keeps it that way.
|
|
11
8
|
|
|
12
|
-
The
|
|
13
|
-
its
|
|
9
|
+
The Cosyte brand voice does not use the em dash (U+2014). This package carried 659 of them across
|
|
10
|
+
75 of its 98 tracked files, including the README, every documentation page that publishes to the
|
|
11
|
+
documentation site, and the source doc comments that compile into the shipped type declarations and
|
|
12
|
+
render in an editor on hover. All 609 that were in scope are rewritten with a period, a colon, a
|
|
13
|
+
comma or parentheses, chosen by what each sentence meant rather than by one blanket substitution.
|
|
14
|
+
|
|
15
|
+
No exported name, type, issue code, fatal code or documented behaviour changed. Two strings changed
|
|
16
|
+
punctuation and nothing else, and both belong to developer tooling rather than to the published
|
|
17
|
+
package: the PHI scanner's clean-run line, and one diagnostic from the check that verifies this
|
|
18
|
+
repository's own contributor instructions.
|
|
19
|
+
|
|
20
|
+
Two files still carry the character and each is an exemption with a written reason. The changelog's
|
|
21
|
+
dated archive below its "Released before this file was generated" heading is a frozen record whose
|
|
22
|
+
entries are byte identical to the tarballs they shipped in, and rewriting it would destroy the
|
|
23
|
+
evidence a changelog exists to hold. The vendored third-party tarball under `vendor/` holds the
|
|
24
|
+
character's bytes by coincidence inside a compressed stream, which no edit can remove.
|
|
25
|
+
|
|
26
|
+
The check that enforces the rule lands in the same change as the sweep, on purpose: a check arriving
|
|
27
|
+
before its sweep turns the build red on arrival, and a sweep arriving before its check lets the
|
|
28
|
+
character grow back. It reads bytes directly rather than shelling out, refuses to report a clean
|
|
29
|
+
result whenever it cannot prove it read its subject, and holds its own source to the same rule by
|
|
30
|
+
assembling every banned spelling at runtime instead of writing one down.
|
|
31
|
+
|
|
32
|
+
## 0.0.7
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- a9c522a: No runtime impact: a repository-internal CI check now verifies this repository's own contributor instructions, which are not part of the published package.
|
|
37
|
+
|
|
38
|
+
The instructions live in two files, one always read and one read on demand, and until now nothing checked that the second one existed, that the sections it declares had any content, or that the cross-references between the two resolved. A new check refuses all three, refuses a cross-reference pointing at a file or path the repository does not carry, and refuses a relocated section that nothing points at any more.
|
|
39
|
+
|
|
40
|
+
It also refuses to report a clean run over a corpus it did not actually open: the files it read are reconciled against the list of files tracked by version control, and an empty or unreadable list is treated as a failure to run rather than as nothing to check.
|
|
41
|
+
|
|
42
|
+
- 9fd8f24: The npm `description` no longer carries an em dash (`EMDASH-CONFORMANCE`).
|
|
43
|
+
|
|
44
|
+
The brand rule bans U+2014 on every cosyte surface, and this string is the most visible one the
|
|
45
|
+
package has: it is the subtitle on the npm package page and the one line shown in every npm search
|
|
46
|
+
result. It now reads with a colon, which is what the rule's own remedy list names first.
|
|
47
|
+
|
|
48
|
+
The `→` in the same string is U+2192, not an em dash, and it is load-bearing: it names the direction
|
|
49
|
+
of the transformation. It stays.
|
|
50
|
+
|
|
51
|
+
Scoped deliberately to the description alone. The full tree sweep for this repo is a separate unit,
|
|
52
|
+
still queued, and lands with the CI gate that keeps it swept.
|
|
53
|
+
|
|
54
|
+
- 9fb82e8: The README lockup now links to cosyte.com (`ASSETS`).
|
|
55
|
+
|
|
56
|
+
The `<picture>` block above the H1 is wrapped in an anchor to https://cosyte.com, per the founder
|
|
57
|
+
requirement of 2026-08-06. Nothing inside the block moved: the `<source>`, the `<img>`, the alt text
|
|
58
|
+
and both tile URLs are byte-identical.
|
|
59
|
+
|
|
60
|
+
What the anchor does was measured on both surfaces by `fhir`, not assumed, because fourteen READMEs
|
|
61
|
+
carry this shape. On GitHub the anchor works and the colour-scheme switch keeps working, because the
|
|
62
|
+
`<img>` stays a direct child of `<picture>`, which is the condition the HTML spec puts on `<source>`
|
|
63
|
+
applying at all. On an npm package page the anchor is lost: npm wraps a README image in its own
|
|
64
|
+
anchor to the image file, a nested anchor is not representable, so the parser closes ours early and
|
|
65
|
+
the image ends up linked to the image file rather than to cosyte.com. Shipped anyway by founder
|
|
66
|
+
decision of 2026-08-07: on npm that is no worse than the unlinked lockup it replaces, and GitHub is
|
|
67
|
+
where these READMEs are read.
|
|
68
|
+
|
|
69
|
+
- 7f4d59b: The published changelog no longer describes its own contents as unreleased: a release now writes its own version heading and its own entry into `CHANGELOG.md`.
|
|
70
|
+
|
|
71
|
+
`CHANGELOG.md` ships inside the npm tarball, and for the whole of this package's public history it carried no version heading at all. A single `[Unreleased]` heading spanned everything, and the preamble above it said the first pre-alpha release "will ship" the API surface listed below it, in a tarball that had already shipped that surface several versions earlier. Changesets now generates the changelog, so a release writes the version heading and the entry, and there is no hand-maintained section left to go stale.
|
|
72
|
+
|
|
73
|
+
The hand-written history is kept verbatim beneath a `Released before this file was generated` divider, with generated release sections above it, newest first. No entry was reworded, re-sorted or removed. What was dropped was scaffolding for the old hand-written workflow: the file's former header, the `[Unreleased]` heading and its link definition, the note beneath that heading promising a first release which had in fact already shipped, and the empty section stubs that existed to receive the next hand-written entry.
|
|
74
|
+
|
|
75
|
+
## Released before this file was generated
|
|
76
|
+
|
|
77
|
+
Every release section above this heading is written by
|
|
78
|
+
[Changesets](https://github.com/changesets/changesets) from the changesets in `.changeset/`, newest
|
|
79
|
+
release first. The release writes its own version heading, so nothing above this line is maintained
|
|
80
|
+
by hand: a change is recorded by adding a changeset, and that changeset's summary is the entry a
|
|
81
|
+
reader sees here.
|
|
82
|
+
|
|
83
|
+
Everything below this heading was maintained by hand. It sat under a single `[Unreleased]` heading
|
|
84
|
+
that no release ever rolled over, so it went on describing already-published code as unreleased,
|
|
85
|
+
inside the published tarball, for the whole of this package's public history. It is left as it was
|
|
86
|
+
written rather than re-sorted into version sections: the file never recorded which release each
|
|
87
|
+
entry went out in, and this is the text that installed copies already carry on disk. No entry was
|
|
88
|
+
reworded, re-sorted or removed. What was dropped was scaffolding for the hand-written workflow that
|
|
89
|
+
no longer runs: the file's former header, the `[Unreleased]` heading and its link definition at the
|
|
90
|
+
foot of the file, the note beneath that heading promising a first release which had in fact already
|
|
91
|
+
shipped, and the empty section stubs that existed to receive the next hand-written entry.
|
|
92
|
+
|
|
93
|
+
The entries below follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); the generated
|
|
94
|
+
sections above use the format Changesets writes, which is a version heading and a list of the
|
|
95
|
+
changes that release consumed. Versions follow the cosyte pre-alpha ladder, `0.0.x` until first
|
|
96
|
+
alpha, rather than [Semantic Versioning](https://semver.org/spec/v2.0.0.html) alone.
|
|
14
97
|
|
|
15
98
|
### Fixed
|
|
16
99
|
|
|
@@ -532,10 +615,6 @@ dependency: peer @cosyte/fhir@">=0.0.0" from @cosyte/transform@0.0.4`.
|
|
|
532
615
|
`parseTransform` / `WARNING_CODES` / `FATAL_CODES` parser stubs and the round-trip property test;
|
|
533
616
|
rewrote `docs-content/`, `README`, and this repo's `CLAUDE.md` for the transformation library.
|
|
534
617
|
|
|
535
|
-
### Deprecated
|
|
536
|
-
|
|
537
|
-
### Removed
|
|
538
|
-
|
|
539
618
|
### Fixed
|
|
540
619
|
|
|
541
620
|
- **The README no longer says this package is unpublished.** It is on npm, and the sentence sat a
|
|
@@ -544,7 +623,3 @@ dependency: peer @cosyte/fhir@">=0.0.0" from @cosyte/transform@0.0.4`.
|
|
|
544
623
|
rendered directly beneath npm's own header, which shows the version being served. The replacement
|
|
545
624
|
names no version deliberately. A version written into prose is the part that goes stale, and the
|
|
546
625
|
registry is the only thing that knows which one is current.
|
|
547
|
-
|
|
548
|
-
### Security
|
|
549
|
-
|
|
550
|
-
[Unreleased]: https://github.com/cosyte/transform/commits/main
|
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
<
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<a href="https://cosyte.com">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://cosyte.com/tile/cosyte-lockup-tile-on-dark-1200x300.png">
|
|
4
|
+
<img alt="Cosyte: a plus mark set in two overlapping rounded squares, one solid and one outlined, beside the Cosyte wordmark" src="https://cosyte.com/tile/cosyte-lockup-tile-on-light-1200x300.png">
|
|
5
|
+
</picture>
|
|
6
|
+
</a>
|
|
5
7
|
|
|
6
8
|
# @cosyte/transform
|
|
7
9
|
|
|
8
|
-
> HL7 v2 → FHIR R4 transformation for Node.js and TypeScript
|
|
10
|
+
> HL7 v2 → FHIR R4 transformation for Node.js and TypeScript: **IG-grounded, fail-safe, value-free
|
|
9
11
|
> diagnostics; never a confident wrong FHIR value**.
|
|
10
12
|
|
|
11
13
|
`@cosyte/transform` is the healthcare **transformation** layer of the cosyte suite. Unlike the
|
|
@@ -16,9 +18,9 @@ grounded on the official **HL7 Version 2 to FHIR** Implementation Guide (`hl7.fh
|
|
|
16
18
|
> **Status:** pre-alpha (`0.0.x`), published to npm. This release ships the
|
|
17
19
|
> six safety-critical datatype converters and the value-free diagnostic channel, the
|
|
18
20
|
> message-level assembly, HL7 v2 **ADT → FHIR Patient + Encounter**, the **ORU^R01 → FHIR
|
|
19
|
-
> DiagnosticReport + Observation** results graph, the order-entry graph
|
|
20
|
-
> OML_O21 → ServiceRequest** and **RXO → MedicationRequest**
|
|
21
|
-
> **VXU_V04 → Immunization**, **SIU_S12 → Appointment**, **MDM_T02 → DocumentReference**
|
|
21
|
+
> DiagnosticReport + Observation** results graph, the order-entry graph (**ORM_O01 /
|
|
22
|
+
> OML_O21 → ServiceRequest** and **RXO → MedicationRequest**), the thin IG singles
|
|
23
|
+
> (**VXU_V04 → Immunization**, **SIU_S12 → Appointment**, **MDM_T02 → DocumentReference**), all
|
|
22
24
|
> via `toFhir(msg)`, and **terminology value translation** of coded fields: route/site,
|
|
23
25
|
> appointment type, order priority, and substitution are now value-translated through their IG
|
|
24
26
|
> `mappedVia` ConceptMaps via `toFhirCodeableConceptVia`, fail-safe on any code the IG leaves unmapped.
|
|
@@ -31,7 +33,7 @@ grounded on the official **HL7 Version 2 to FHIR** Implementation Guide (`hl7.fh
|
|
|
31
33
|
npm install @cosyte/transform @cosyte/hl7 @cosyte/fhir
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
`@cosyte/hl7` and `@cosyte/fhir` are **peer dependencies
|
|
36
|
+
`@cosyte/hl7` and `@cosyte/fhir` are **peer dependencies**: the transform maps between the models
|
|
35
37
|
they own. Its own third-party runtime dependencies are **zero**.
|
|
36
38
|
|
|
37
39
|
**That command does not work yet.** This package is published, but `@cosyte/fhir` is not on the
|
|
@@ -51,21 +53,21 @@ const { value, issues } = toFhirHumanName({
|
|
|
51
53
|
// value: a FHIR HumanName node; issues: [] (clean, fully mapped)
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
Each converter returns `{ value, issues }
|
|
56
|
+
Each converter returns `{ value, issues }`: the FHIR datatype node it could faithfully produce, plus
|
|
55
57
|
the value-free diagnostics it raised.
|
|
56
58
|
|
|
57
59
|
## The fail-safe rule
|
|
58
60
|
|
|
59
|
-
Every conversion is grounded on the IG and **refuses to guess**. On any
|
|
61
|
+
Every conversion is grounded on the IG and **refuses to guess**. On any of these ambiguities:
|
|
60
62
|
|
|
61
63
|
- a v2 timestamp with a time-of-day but **no timezone** (FHIR forbids time without a zone),
|
|
62
64
|
- an assigning authority that can't be **resolved to a system URI** (never synthesized from a bare
|
|
63
|
-
namespace
|
|
65
|
+
namespace, which would merge two patients),
|
|
64
66
|
- a code with an **unrecognized or absent coding system**,
|
|
65
67
|
- a unit that isn't valid **UCUM** (magnitudes are never converted),
|
|
66
68
|
|
|
67
|
-
|
|
68
|
-
`TransformIssue`**: a stable code, the v2 location, and the FHIR path
|
|
69
|
+
the converter produces what it _can_ (often reduced in precision) and raises a **typed, value-free
|
|
70
|
+
`TransformIssue`**: a stable code, the v2 location, and the FHIR path, never a value. Render a list
|
|
69
71
|
of issues as a FHIR `OperationOutcome` with `toOperationOutcome(issues)`.
|
|
70
72
|
|
|
71
73
|
## The six datatype converters
|
|
@@ -81,8 +83,8 @@ of issues as a FHIR `OperationOutcome` with `toOperationOutcome(issues)`.
|
|
|
81
83
|
|
|
82
84
|
## Assemble a message
|
|
83
85
|
|
|
84
|
-
`toFhir(msg)` takes a parsed `@cosyte/hl7` **ADT** message and returns a FHIR R4 **message `Bundle
|
|
85
|
-
a `MessageHeader`, then the `Patient` and `Encounter` (and `RelatedPerson`) it describes
|
|
86
|
+
`toFhir(msg)` takes a parsed `@cosyte/hl7` **ADT** message and returns a FHIR R4 **message `Bundle`**:
|
|
87
|
+
a `MessageHeader`, then the `Patient` and `Encounter` (and `RelatedPerson`) it describes, plus the
|
|
86
88
|
value-free issues, each map grounded firsthand on the IG's segment/table ConceptMaps.
|
|
87
89
|
|
|
88
90
|
```ts
|
|
@@ -103,19 +105,19 @@ const { bundle, issues } = toFhir(parseHL7(raw), {
|
|
|
103
105
|
| NK1 | `RelatedPerson` | NK1-2/3/4 → `name`/`relationship`/`address` |
|
|
104
106
|
|
|
105
107
|
The fail-safe rule holds at the message level: an unmapped patient class, a naked timestamp, or an
|
|
106
|
-
unresolvable authority becomes a typed issue
|
|
108
|
+
unresolvable authority becomes a typed issue, never a fabricated value. A trigger the IG has no
|
|
107
109
|
**message** map for is assembled from the segment maps and flagged, never invented; every emitted
|
|
108
110
|
resource is validated against `@cosyte/fhir` before it ships.
|
|
109
111
|
|
|
110
112
|
The same `toFhir(msg)` handles the other message families: **ORU^R01** → `DiagnosticReport` (OBR) +
|
|
111
|
-
`Observation` (OBX), and the order-entry graph
|
|
112
|
-
`ServiceRequest
|
|
113
|
+
`Observation` (OBX), and the order-entry graph, **ORM_O01 / OML_O21** ORC/OBR →
|
|
114
|
+
`ServiceRequest` and **RXO** (+ RXR route) → `MedicationRequest`, with `ServiceRequest.status`
|
|
113
115
|
grounded on the HL70119 → request-status ConceptMap and withheld when it cannot be grounded, and a
|
|
114
116
|
`MedicationRequest` whose IG-ungrounded status is the honest `unknown` rather than a guess. `RXE` has no
|
|
115
117
|
STU1 IG map and is flagged, never assembled.
|
|
116
118
|
|
|
117
119
|
The thin single-trigger families complete the IG-covered message set: **VXU_V04** RXA (+
|
|
118
|
-
RXR route, ORC) → `Immunization` (status via the IG's three conditioned rows
|
|
120
|
+
RXR route, ORC) → `Immunization` (status via the IG's three conditioned rows: a delete action →
|
|
119
121
|
`entered-in-error`, an unvalued RXA-20 → `completed`, else the HL70322 → event-status ConceptMap, with a
|
|
120
122
|
valued-but-unmapped code withheld), **SIU_S12** SCH/AIS/PID → `Appointment` (status via the
|
|
121
123
|
HL70278 → appointmentstatus ConceptMap, the Patient wired as the required participant, its IG-unsourced
|
|
@@ -124,12 +126,12 @@ grounded only for TXA-19 `AV` → `current`, the document body base64-encoded ve
|
|
|
124
126
|
interpreted). Timezone-naked instants are dropped and flagged, never assigned a fabricated UTC offset.
|
|
125
127
|
|
|
126
128
|
`toFhirCodeableConceptVia(cwe, map)` applies a license-clean IG value ConceptMap
|
|
127
|
-
(transcribed and verified firsthand against the raw published IG JSON)
|
|
129
|
+
(transcribed and verified firsthand against the raw published IG JSON): **RXR** route/site
|
|
128
130
|
(HL70162/HL70550), **SCH-8** appointment type (HL70277), **RXO-9** substitution (HL70161), and **OBR-5**
|
|
129
|
-
priority (HL70485)
|
|
131
|
+
priority (HL70485), translating the source table code to its FHIR target coding, additively (the raw
|
|
130
132
|
coding is preserved alongside the derived one). It is fail-safe by refusal: a code the IG map leaves in
|
|
131
133
|
its `(unmapped)` group is flagged, never coerced to a neighbour. Fields whose IG target is **SNOMED CT**
|
|
132
|
-
(RXR-4 method, SCH-7 reason) stay structural
|
|
134
|
+
(RXR-4 method, SCH-7 reason) stay structural, because SNOMED is not bundled (BYO ConceptMap), and fields the
|
|
133
135
|
IG ships no value map for (TXA-2 document type, RXA-5 vaccine code) are carried as-is, never invented.
|
|
134
136
|
|
|
135
137
|
## License
|
package/dist/index.cjs
CHANGED
|
@@ -7,16 +7,16 @@ var crypto = require('crypto');
|
|
|
7
7
|
// src/diagnostics/codes.ts
|
|
8
8
|
var ISSUE_CODES = {
|
|
9
9
|
/** A v2 DTM/TS carried a time-of-day but no timezone offset. FHIR forbids time-without-zone, so
|
|
10
|
-
* the value was reduced to date precision (or an explicit sender offset applied via options)
|
|
10
|
+
* the value was reduced to date precision (or an explicit sender offset applied via options),
|
|
11
11
|
* **never** a guessed UTC. */
|
|
12
12
|
TRANSFORM_TIMESTAMP_NO_TIMEZONE: "TRANSFORM_TIMESTAMP_NO_TIMEZONE",
|
|
13
13
|
/** A v2 DTM/TS could not be parsed into a valid FHIR date/time; no value was emitted. */
|
|
14
14
|
TRANSFORM_TIMESTAMP_INVALID: "TRANSFORM_TIMESTAMP_INVALID",
|
|
15
15
|
/** The assigning authority (HD) could not be resolved to a FHIR `Identifier.system` URI via the
|
|
16
|
-
* NamingSystem registry. The identifier is emitted with its value and **no** system
|
|
16
|
+
* NamingSystem registry. The identifier is emitted with its value and **no** system: a system URI
|
|
17
17
|
* is **never** synthesized from HD.1 alone. */
|
|
18
18
|
TRANSFORM_IDENTIFIER_SYSTEM_UNRESOLVED: "TRANSFORM_IDENTIFIER_SYSTEM_UNRESOLVED",
|
|
19
|
-
/** A coded value could not be mapped to a FHIR concept
|
|
19
|
+
/** A coded value could not be mapped to a FHIR concept: either it carried no coding-system context
|
|
20
20
|
* (CWE.3 absent), or it is a table code the IG ConceptMap has **no target** for (e.g. an OBX-11/
|
|
21
21
|
* OBR-25 result status the HL70085/HL70123 map does not carry, or an OBX-8 abnormal flag absent from
|
|
22
22
|
* HL70078). The original code is preserved / the FHIR value left absent; **never** coerced to a
|
|
@@ -26,14 +26,14 @@ var ISSUE_CODES = {
|
|
|
26
26
|
* be emitted. The code is preserved; a URI is **never** invented. */
|
|
27
27
|
TRANSFORM_CODE_SYSTEM_UNRESOLVED: "TRANSFORM_CODE_SYSTEM_UNRESOLVED",
|
|
28
28
|
/** A unit was not a valid UCUM code (or was not declared UCUM). It is preserved verbatim in
|
|
29
|
-
* `Quantity.unit`; `Quantity.code`/`.system` are left absent
|
|
29
|
+
* `Quantity.unit`; `Quantity.code`/`.system` are left absent: a UCUM code is **never** fabricated
|
|
30
30
|
* and a magnitude is **never** converted. */
|
|
31
31
|
TRANSFORM_UNIT_NOT_UCUM: "TRANSFORM_UNIT_NOT_UCUM",
|
|
32
|
-
/** A v2 numeric value (NM) could not be represented as a FHIR `decimal` without altering it
|
|
32
|
+
/** A v2 numeric value (NM) could not be represented as a FHIR `decimal` without altering it, e.g.
|
|
33
33
|
* a leading `+`, a leading zero, or a trailing dot, which FHIR's `decimal` lexical form forbids. No
|
|
34
34
|
* `Quantity` value is emitted rather than a canonicalized (and therefore altered) magnitude. */
|
|
35
35
|
TRANSFORM_QUANTITY_VALUE_INVALID: "TRANSFORM_QUANTITY_VALUE_INVALID",
|
|
36
|
-
/** A populated source element was not carried to its FHIR target and was dropped
|
|
36
|
+
/** A populated source element was not carried to its FHIR target and was dropped, either because
|
|
37
37
|
* the IG map defines no target, or because that target's conversion is **not implemented**
|
|
38
38
|
* (e.g. XTN→ContactPoint telecom, PV1 participants). Surfaced here rather than silently discarded,
|
|
39
39
|
* never a fabricated value. */
|
|
@@ -46,13 +46,13 @@ var ISSUE_CODES = {
|
|
|
46
46
|
TRANSFORM_ADDRESS_USE_UNMAPPED: "TRANSFORM_ADDRESS_USE_UNMAPPED",
|
|
47
47
|
/** The message's trigger event has no IG *message* map, so its resource graph was assembled from
|
|
48
48
|
* the reusable IG *segment* maps rather than a message map. The graph is best-effort and flagged
|
|
49
|
-
* as such
|
|
49
|
+
* as such, never a fabricated message map. */
|
|
50
50
|
TRANSFORM_SEGMENT_ASSEMBLED: "TRANSFORM_SEGMENT_ASSEMBLED",
|
|
51
51
|
/** A produced FHIR resource failed `@cosyte/fhir` R4 structural validation and was **withheld**
|
|
52
|
-
* from the bundle rather than emitted as a silently-invalid resource
|
|
52
|
+
* from the bundle rather than emitted as a silently-invalid resource: the conservative-emit gate. */
|
|
53
53
|
TRANSFORM_RESOURCE_INVALID: "TRANSFORM_RESOURCE_INVALID",
|
|
54
54
|
/** A FHIR-required element's value could not be faithfully derived from the source, so it was
|
|
55
|
-
* emitted with a `data-absent-reason` extension (value `unknown`) rather than fabricated
|
|
55
|
+
* emitted with a `data-absent-reason` extension (value `unknown`) rather than fabricated, e.g.
|
|
56
56
|
* `MessageHeader.source.endpoint` from an MSH-3 application namespace that is not a URL. */
|
|
57
57
|
TRANSFORM_REQUIRED_ELEMENT_UNKNOWN: "TRANSFORM_REQUIRED_ELEMENT_UNKNOWN"
|
|
58
58
|
};
|
|
@@ -165,7 +165,7 @@ function renderIssue(i) {
|
|
|
165
165
|
prop("severity", fhir.primitive(i.severity)),
|
|
166
166
|
prop("code", fhir.primitive(fhirIssueTypeFor(i.code))),
|
|
167
167
|
prop("details", details),
|
|
168
|
-
// `diagnostics` carries the v2 source location
|
|
168
|
+
// `diagnostics` carries the v2 source location: positional metadata, never a value.
|
|
169
169
|
prop("diagnostics", fhir.primitive(i.v2Location))
|
|
170
170
|
];
|
|
171
171
|
if (i.fhirPath !== void 0) {
|
|
@@ -1609,7 +1609,7 @@ var EMIT_SCHEMAS = Object.freeze([
|
|
|
1609
1609
|
},
|
|
1610
1610
|
{
|
|
1611
1611
|
// Immunization: status (1..1 code), vaccineCode (1..1 CodeableConcept), patient (1..1 Reference), and
|
|
1612
|
-
// occurrence[x] (1..1) are all required
|
|
1612
|
+
// occurrence[x] (1..1) are all required, and the assembler only ever emits the occurrenceDateTime form, so
|
|
1613
1613
|
// it is required here. An RXA with no groundable status/vaccine/occurrence, or no bundle Patient, is
|
|
1614
1614
|
// withheld rather than emitted incomplete.
|
|
1615
1615
|
type: "Immunization",
|
|
@@ -1621,7 +1621,7 @@ var EMIT_SCHEMAS = Object.freeze([
|
|
|
1621
1621
|
}
|
|
1622
1622
|
},
|
|
1623
1623
|
{
|
|
1624
|
-
// Appointment: status (1..1 code) and participant (1..* BackboneElement) are both required
|
|
1624
|
+
// Appointment: status (1..1 code) and participant (1..* BackboneElement) are both required, so an
|
|
1625
1625
|
// Appointment whose SCH-25 status could not be grounded via HL70278, or that has no resolvable Patient
|
|
1626
1626
|
// participant, is withheld rather than emitted with a guessed status or no participant.
|
|
1627
1627
|
type: "Appointment",
|
|
@@ -1631,7 +1631,7 @@ var EMIT_SCHEMAS = Object.freeze([
|
|
|
1631
1631
|
}
|
|
1632
1632
|
},
|
|
1633
1633
|
{
|
|
1634
|
-
// DocumentReference: status (1..1 code) and content (1..* BackboneElement) are both required
|
|
1634
|
+
// DocumentReference: status (1..1 code) and content (1..* BackboneElement) are both required, so a
|
|
1635
1635
|
// reference whose TXA-19 is not "AV" (no groundable status), or that carries no document body from its
|
|
1636
1636
|
// OBX segments, is withheld rather than emitted with a guessed status or referencing nothing.
|
|
1637
1637
|
type: "DocumentReference",
|
|
@@ -2647,7 +2647,7 @@ function toFhir(msg, opts = {}) {
|
|
|
2647
2647
|
}
|
|
2648
2648
|
|
|
2649
2649
|
// src/index.ts
|
|
2650
|
-
var VERSION = "0.0.
|
|
2650
|
+
var VERSION = "0.0.8";
|
|
2651
2651
|
|
|
2652
2652
|
exports.ADDRESS_TYPE_MAP = ADDRESS_TYPE_MAP;
|
|
2653
2653
|
exports.ADDRESS_USE_MAP = ADDRESS_USE_MAP;
|