@dcmjs-org/fhir 1.0.0-beta.3 → 1.0.0-beta.5

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/License.txt ADDED
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2017 Steve Pieper
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # @dcmjs-org/fhir
2
2
 
3
- > **Status: preliminary.** The API of this package, and the FHIR methods of
4
- > `DicomEventStream` (`fromFhir`, `toFhir`), can change in a minor release
5
- > while this notice is here. Such a change is not a breaking change for
3
+ > **Status: preliminary.** The API of this package can change in a minor
4
+ > release while this notice is here. Such a change is not a breaking change for
6
5
  > semantic versioning; the release notes name it. Pin an exact version if you
7
6
  > depend on the current shape.
8
7
 
@@ -19,25 +18,24 @@ mapping of patient demographics.
19
18
  - `patientToDataset(patient)` — a FHIR Patient to the DICOM patient-module
20
19
  attributes (`PatientName`, `PatientID`, `PatientBirthDate`, `PatientSex`).
21
20
 
22
- The event-stream source `DicomEventStream.fromFhir(resource, options)` (in
23
- `src/eventStream/fromFhir.js`) turns a DocumentReference or Media with inline
24
- data, or a Bundle that holds one, into a DICOM instance.
21
+ The wrapper `@dcmjs-org/dcmjs` does not depend on this package. An
22
+ event stream gives the naturalized dataset for `toFhir`:
25
23
 
26
24
  ```js
27
- const { patient, imagingStudy } = toFhir(naturalizedDataset);
25
+ import { toFhir } from "@dcmjs-org/fhir";
28
26
 
29
- const part10 = await DicomEventStream.fromFhir(documentReference, {
30
- patient,
31
- instance: priorStudyInstance,
32
- overrides: { SeriesDescription: "Scanned reports" }
33
- }).toPart10();
27
+ const { patient, imagingStudy } = toFhir(await events.toNaturalized());
34
28
  ```
35
29
 
36
30
  ## Scope and change rule
37
31
 
38
- This README holds the requirements of `@dcmjs-org/fhir` and of
39
- `DicomEventStream.fromFhir` and `toFhir`. The options of `fromFhir` follow
40
- the `createInstance` requirements (CORE-USR-n) in `packages/core/README.md`.
32
+ This README holds the requirements of `@dcmjs-org/fhir`.
33
+
34
+ An earlier beta had `DicomEventStream.fromFhir()` and `toFhir()` in the
35
+ wrapper. The 1.0 wrapper removed them, because the FHIR mapping is
36
+ preliminary. FHIR-USR-7, FHIR-USR-8, FHIR-USR-9, FHIR-IMP-3, and FHIR-IMP-4
37
+ held the requirements of `fromFhir`. These identifiers are withdrawn, and
38
+ the git history keeps the old text and the old code.
41
39
 
42
40
  While the status is preliminary, a user requirement (FHIR-USR-n) can change
43
41
  in a minor release. After that, change a user requirement only when it
@@ -83,33 +81,8 @@ freely. Do not renumber an identifier.
83
81
  empty string for an absent value. A text-only HumanName becomes a
84
82
  single-component PN. A partial FHIR `birthDate` becomes empty, and never
85
83
  a fabricated day.
86
- - **FHIR-USR-7** `fromFhir` makes an Encapsulated PDF instance from an
87
- inline PDF, and an image instance that carries an inline JPEG verbatim,
88
- with DICOM-valid geometry and photometric interpretation (IMG-USR-11).
89
- A lossy JPEG (baseline or extended) gets `LossyImageCompression` "01"
90
- and `LossyImageCompressionMethod` "ISO_10918_1". A Patient
91
- alone, an attachment with only a `url`, and an unsupported content type
92
- give a corrective error. The error comes from the sink call, not from
93
- the `fromFhir` factory.
94
- - **FHIR-USR-8** The `fromFhir` options are `patient` plus the
95
- `createInstance` options. The caller `overrides` win over the values from
96
- FHIR (demographics, DocumentTitle), and those win over the inherited and
97
- base values. With no FHIR title, the base or inherited `DocumentTitle`
98
- stays.
99
- - A FHIR Patient replaces the whole patient module: the four attributes
100
- of FHIR-USR-6, and no other patient-level attribute of `instance`
101
- (for example `IssuerOfPatientID` or `OtherPatientIDs`) stays.
102
- - An `instance` with a non-empty PatientID that is not the PatientID of
103
- the FHIR Patient throws an error, because the new instance would
104
- join the study of another patient.
105
- - **FHIR-USR-9** A Bundle for `fromFhir` must hold exactly one
106
- DocumentReference or Media. Its Patient is `options.patient`, else the
107
- Patient that the `subject` reference names, else the only Patient. A
108
- reference matches the `fullUrl` of an entry exactly; only a relative
109
- reference (`Patient/<id>`, with an optional `/_history/<n>`) also matches
110
- by `id`. A `subject` that matches no Patient or more than one, or more
111
- than one Patient with no `subject`, throws an error, so the demographics
112
- never go to the wrong patient.
84
+ - **FHIR-USR-7**, **FHIR-USR-8**, **FHIR-USR-9** Withdrawn (see the
85
+ scope section).
113
86
  - **FHIR-USR-10** The output links its resources without server ids.
114
87
  Without `options.subject`, `toFhir` gives the ImagingStudy or the
115
88
  DocumentReference `subject: { reference: "./patient" }`, a path relative
@@ -128,9 +101,4 @@ freely. Do not renumber an identifier.
128
101
  `@dcmjs-org/encapsulated`. The value readers (`toStringFirst`,
129
102
  `toFloatFirst`), `encodeBase64`, and `MODALITY_DISPLAY` come from
130
103
  `@dcmjs-org/core`.
131
- - **FHIR-IMP-3** `fromFhir` builds the instance with `encapsulatePdf` or
132
- `buildImageDataset` (both on `createInstance`), and reads the JPEG frame
133
- header with `parseJpegInfo` of `@dcmjs-org/imaging`.
134
- - **FHIR-IMP-4** `fromFhir.js` lives at `src/eventStream/`, beside `api.js`,
135
- because it composes several packages. It moves into the wrapper package
136
- with the facade.
104
+ - **FHIR-IMP-3**, **FHIR-IMP-4** Withdrawn (see the scope section).