The standard HL7 response to a QRY message is an ADR message response, instead of an ACK. This article covers how to send HL7 QRY messages and process the ADR response within the Iguana translator.
Prerequisite
This implementation makes use of iNTERFACEWARE’s llp.lua shared module. Import the LLP custom client channel from the built in Iguana tools repository to add this module to your Iguana. https://help.interfaceware.com/v6/llp-client-custom
Implementation
Instead of using a from/to LLP component, this implementation makes use of the translator environment, and the ability to make LLP calls within the translator (or filter).
This code below is an example of how the llp.lua module can be leveraged in the translator. The important aspects are:
Setting the proper host and port (line 7)
Sending the QRY (line 8)
Receiving the ADR response (line 10)
local llp = {} llp.connect = require 'llp' function main(Data) -- use llp.connect to the LLP connection -- Connect to server and send QRY local s = llp.connect{host='localhost',port=8087, live=true} s:send(Data) -- Receive ADR and push to queue local ADR = s:recv() s:close() queue.push{data=ADR} util.sleep(50) end
In this example the ADR response is pushed to the queue, however the ADR response can be handled in many different ways such as writing to a file or saving to a database.
Testing Your Implementation
Creating a channel that sends a pre defined ADR response as the ACK for the purpose of testing can be beneficial to ensure your code works as expected.
This can be done by creating a channel with a from LLP component and modifying a few settings:
Change the port to be listening to the same port where the QRY is being sent.
Change the ACKnowledgement settings to have ACK set to translator.
Within the translator ack.send() can be used to send a specified ACK message by passing the function your custom ACK. The example below reads a pre defined ADR message from a file, and sends it as an ACK:
local FILE_PATH = 'C:\\Program Files\\iNTERFACEWARE\\Iguana\\SampleMessages\\sample_ADR.txt' function main(Data) local ACK = readFile() ack.send(ACK) end function readFile() local file = io.open(FILE_PATH,'r') local content = file:read("*all") return content end
Limitations
Using the translator to send and receive data over LLP, the is no option to include the following SSL files:
Certificate file
Private key file
Certificate authority file
This differers from using a from/to LLP component, as the option to include these files is available.