How to Process Customized HL7 ACK Response
Â
Iguana’s to LLP can only handle standard HL7 ACK messages, and is also unable to push ACK messages to channels/databases/etc. This article covers how to handle non standard/custom ACK messages in Iguana.
Design
Below is an example of how an old channel design can be modified to handle custom ACKs. The design is flexible and the components can be modified to suit your needs.
The old channel in this example is setup as From File → To LLP. When the to LLP component sends the HL7 file to the receiving server, it receives the custom ACK. The To LLP is only designed to handle standard ACK responses, so it is unable to handle the custom ACK and produces an error.
The new channel design makes use of a translator in the filter component. This filter implements the functionality of the previous designs To LLP component, while adding the ability to process custom ACK messages. In this design the channel is setup as From File → Filter → To Channel.
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. LLP Custom Client - iNTERFACEWARE Help Center
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.