Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Here’s an example of mapping HL7 messages to a database table using best practices. Iguana X IguanaX also provides a pre-built HL7 to Database component to help get you started.

Expand
titleSTEP 1: Add in Sample Data

See Sample Data for more information on adding and how to use it in the Translator.

Here’s a sample ADT message to test with:

Code Block
MSH|^~\&|AcmeMed|E\T\R|Main HIS|St. Micheals|20110213145956||ADT^A07|9B38584DCB03B0577D55CF66983BA79B39022ABD61F9E0188DD9BD03B2C99446|P|2.6|{{IFWTOKEN}}0D{{IFWTOKEN}}
EVN||20110213144818||||20110213144552|{{IFWTOKEN}}0D{{IFWTOKEN}}
PID|||2495499^^^ADT1||Meade^Sabrina||20001005|F||Martian|207 Miller Lane^^Toronto^ON^16200|||||||7-264-942|365-5-488|{{IFWTOKEN}}0D{{IFWTOKEN}}
NK1|1|Garland^Sabrina|Second Cousin|{{IFWTOKEN}}0D{{IFWTOKEN}}
NK1|2|Smith^Fred|Grandchild|{{IFWTOKEN}}0D{{IFWTOKEN}}
NK1|3|WHITE^Tracy|Grandchild|{{IFWTOKEN}}0D{{IFWTOKEN}}
NK1|4|Fitzgerald^John|Grandchild|{{IFWTOKEN}}0D{{IFWTOKEN}}
NK1|5|Adams^Mary|Parent|{{IFWTOKEN}}0D{{IFWTOKEN}}
PV1||E||||||5101^WHITE^Tracy^F^^DR|||||||||||602131^^^ADT1|||||||||||||||||||||||||20110213150128|{{IFWTOKEN}}0D{{IFWTOKEN}}
OBX|||WT^WEIGHT||82|pounds|{{IFWTOKEN}}0D{{IFWTOKEN}}
OBX|||HT^HEIGHT||103|cm|
Expand
titleSTEP 2: Parse the HL7 message

Using a VMD file, parse the incoming HL7 messages.

Screen Shot 2024-09-30 at 12.32.04 PM.png
Expand
titleSTEP 3: Create a VDB file

A VDB file is used to create a staging table mirroring the database.

Screen Shot 2024-09-30 at 12.34.09 PM.png
Expand
titleSTEP 4: Create a mapping module

Add in a separate mapping.lua file to map the HL7 data into the schema. See Structuring Component Translators for more info.

Screen Shot 2024-09-30 at 12.37.25 PM.png

Create functions to map out patient and kin tables

Screen Shot 2024-09-30 at 2.03.14 PM.png
Expand
titleSTEP 5: Map the HL7 data into the schema

In the main.lua, call your mapping functions and pass through the parsed HL7 message (P) and the database schema (T):

Screen Shot 2024-09-30 at 2.21.45 PM.png

Sample Map the HL7 data to your VDB generated tables. Take a look at the following sample mapping:

Screen Shot 2024-09-30 at 2.24.41 PM.png
Expand
titleSTEP 6: Connect to the database

Iguana connects to the database and the staging table is merged with the database table to insert a new row of HL7 data.

Screen Shot 2024-09-30 at 2.28.57 PM.png