Skip to content

Commit 23c07d9

Browse files
authored
add additional docs (#29)
1 parent 69eac28 commit 23c07d9

File tree

3 files changed

+440
-6
lines changed

3 files changed

+440
-6
lines changed

docs/fhir-hl7v2-converter/configuration.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ flexible and reusable.
55
# Schemas
66
There are top level and child schemas. Top level schemas define an HL7 message type and HL7 message version as
77
supported by the Java HAPI HL7 v2 library. This initial version of the FHIR to HL7 v2 conversion library only
8-
supports ORU R01 (version 1.0 of this library will support any type and version supported by the HAPI HL7 v2 library). A schema
8+
supports ORU R01 (a future version of this library will support any type and version supported by the HAPI HL7 v2 library). A schema
99
also defines a list constants and one or more elements.
1010

1111
| Property Name | Required? | Description | Default |
@@ -60,11 +60,12 @@ Value elements are used to populate one or more HL7 v2 fields with a FHIR primit
6060
- '"official"'
6161
hl7Spec: [ '%{hl7NameField}-7' ]
6262
valueSet:
63-
official: L
64-
usual: D
65-
maiden: M
66-
nickname: N
67-
anonymous: S
63+
values:
64+
official: L
65+
usual: D
66+
maiden: M
67+
nickname: N
68+
anonymous: S
6869
```
6970

7071
## Schema Element Properties
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Mapping schema file structure
2+
3+
Translation between FHIR and HL7v2 requires schema files that define how data is translated from one format to another. As we have built out these mappings, we developed a file structure that aims to be self-documenting and logical so that the mappings are more maintainable and reusable.
4+
5+
Mappings were developed based on the [FHIR R4 mapping inventory](https://docs.google.com/spreadsheets/d/1PaFYPSSq4oplTvw_4OgOn6h2Bs_CMvCAU9CqC4tPBgk/edit#gid=0). This documentation is under active development so there may be differences between the current revision of the inventory and the mapping files.
6+
7+
## FHIR to HL7v2 mapping file organization
8+
9+
In order for the directory structure to be self-documenting, it should follow a defined hierarchy. The following structure would make both the source of data and the target mapping immediately apparent:
10+
11+
- hl7_mapping/_**[HL7v2 message type]**_/ ← target message types, such as ADT_A01, ORU_R01, etc.
12+
- hl7_mapping/resources/_**[FHIR path to resource]**_/_**[HL7v2 segment or datatype]**_.yml
13+
- hl7_mapping/datatypes/_**[FHIR path to datatype]**_/_**[HL7v2 segment or datatype]**_.yml
14+
15+
Each message type has a directory named after itself, with subdirectories for message specific resources or datatypes schemas.
16+
17+
- hl7_mapping/ORU_R01/ORU-R01-base.yml
18+
- hl7_mapping/ORU_R01/base.patient-result ← only if special handling is needed for this message type
19+
20+
For resources and datatypes, the basic structure is to define the FHIR path being mapped, followed by the HL7v2 segment that is being mapped using data from the given FHIR path. For example:
21+
22+
- hl7_mapping/resources/MessageHeader/SFT.yml ← elements of MessageHeader that map to SFT
23+
- hl7_mapping/resources/MessageHeader/MSH.yml ← elements of MessageHeader that map to MSH
24+
- hl7_mapping/resources/Organization/HD.yml ← elements of Organization that map to HD
25+
- hl7_mapping/resources/Organization/XON.yml ← elements of Organization that map to XON
26+
- hl7_mapping/resources/Organization/XONExtension.yml ← elements of Organization that map to XON that may not have mapped values in FHIR, used to store literal string representations of specific HL7v2 fields
27+
28+
Schemas that reference resource elements should be stored in a directory that represents the element:
29+
30+
- resources/MessageHeader/source/HD.yml ← map MessageHeader.source
31+
- resources/MessageHeader/destination/HD.yml ← map MessageHeader.destination
32+
33+
Datatypes follow the same pattern:
34+
35+
- datatypes/Coding/MSG.yml ← Coding maps to MSG
36+
- datatypes/Meta/PT.yml ← Meta maps to PT
37+
38+
### About Extensions
39+
40+
Several mapping files contain support for custom extensions that are intended to preserve the original HL7v2 string literal values when there is no lossless equivalent in the FHIR mapping inventory. Many of these extensions follow the structure of `url` being the HL7v2 location (e.g. `OBX.2`) and `value` being the string literal value to be placed at that location. If the extension is present in the input FHIR bundle, this value should override any other mappings that may exist for that location.

0 commit comments

Comments
 (0)