You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Current »
Here’s an example of mapping HL7 messages to a database table using best practices. Iguana X also provides a pre-built HL7 to Database component to help get you started.
STEP 1: Add in Sample Data
See Sample Data for more information
Here’s a sample ADT message to test with:
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|
STEP 2: Parse the HL7 message
Using a VMD file, parse the incoming HL7 messages.
STEP 3: Create a VDB file
A VDB file is used to create a staging table mirroring the database.
STEP 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.
Create functions to map out patient and kin tables
STEP 5: Map the HL7 data into the schema
In the main.lua, pass through the parsed HL7 message (P) and the database schema (T):
Sample mapping:
STEP 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.