HL7 to Database

Mapping: ADT Messages

In this script, ProcessADT() is the function that handles the processing of incoming ADT messages.

It looks like this:

ProcessADT() is passed two variables:

  • Out, which is an empty record table node tree that will be used to store the message data
  • Msg, which contains the message data to be mapped into the Out variable

ProcessADT() calls three functions, each of which handles a specific mapping task:

  • MapPatient(), which maps patient data from the incoming message’s PID segment
  • MapWeight(), which maps the patient’s weight from the incoming message’s OBX segment
  • MapNextOfKin(), which maps the patient’s next of kin information from the incoming message’s NK1 segments

The details of these functions are described in the next three pages.

Note: The for statement ensures that each of the next of kin is mapped:

Note: #Msg.NK1 is the number of NK1 segments defined in the incoming message.

For more information on how for statements work in Lua, see Conditional Statements and Loops.

Next Step?

Now you understand the structure of the ProcessADT() function. Next we will look at how MapPatient() is used to map the patient data.