Create a custom ACK
Verified
Added by iNTERFACEWARE
Create a custom ACK by using a script in an LLP Listener component
Source Code
-- main() is given the original HL7 message. function main(Data) local Msg = hl7.parse{vmd='ack.vmd', data=Data} local Ack = hl7.message{vmd='ack.vmd', name='Ack'} Ack.MSH[3][1] = Msg.MSH[5][1] Ack.MSH[4][1] = Msg.MSH[6][1] Ack.MSH[5][1] = Msg.MSH[3][1] Ack.MSH[6][1] = Msg.MSH[4][1] Ack.MSH[10] = Msg.MSH[10] Ack.MSH[9][1] = 'ACK' Ack.MSH[11][1] = 'P' Ack.MSH[12][1] = '2.6.1' Ack.MSH[7][1] = os.date('%Y%m%d%H%M%S') Ack.MSA[1] = 'AA' Ack.MSA[2] = Msg.MSH[10] Ack.MSA[3] = "Everything was okay dokay!" ack.send(Ack:S()) end
Description
Create a custom ACK by using a script in an LLP Listener component
Attachments
Usage Details
This code creates a complete ACK message from scratch, mapping each of the fields using Lua.
How to use the code:
- Create a channel with an LLP Listener component
- Either load the custom_ACK_LLP_Listener.zip project file or paste in the code
- Download the ack.vmd file and add it to the project
More Information
Added by iNTERFACEWARE
This function calculates age from DOB, it returns years, months and partial years (i.e., 17, 3, 17.296272).
Added by iNTERFACEWARE
Demonstrates the use of conn:execute{} to call a stored procedure.
Added by iNTERFACEWARE
This script automatically creates a SQLite database and then generates the tables specified in a VMD.
Added by iNTERFACEWARE
Demonstrates how to use conn:merge{} with a table that has an auto-incrementing Id column.
Added by iNTERFACEWARE
How to dehydrate (serialize) raw JSON data, this can be useful for storing in a databases
Added by iNTERFACEWARE
How to dehydrate (serialize) raw XML data, this can be useful for storing in a databases
Added by iNTERFACEWARE
How to encode binary files as base 64 text, then embed them as OBX-5 segment repeats
Added by iNTERFACEWARE
How to correctly escape a SQL query string
Added by iNTERFACEWARE
How to filter out unwanted HL7 messages (similar principles apply to other message types)
Added by iNTERFACEWARE
This function formats phone numbers nicely with the area code in brackets.
Added by iNTERFACEWARE
How to format a report as a single NTE or OBX segment with repeating field or using multiple NTE segments, one for each line of the report
Added by iNTERFACEWARE
Format specified HL7 message fields in a tab delimited string and push the string to the queue for further processing
Added by iNTERFACEWARE
How to format an HL7 message without the trailing "|" at the end of each line
Added by iNTERFACEWARE
Retry an ODBC query to a MySQL DB when an error occurs, can be adapted for retrying LLP etc.
Added by iNTERFACEWARE
How to insert data from an HL7 message into a database (similar principles apply to other message types)
Added by iNTERFACEWARE
How to map all or part of an HL7 message (similar principles apply to other message types)
Added by iNTERFACEWARE
Basic example of merging data into a SQLite database (code is "plug and play" as the DB will be created if it does not exist)
Added by iNTERFACEWARE
How to normalize X12 delimiters for processing in Iguana scripts, they can be reverted after processing if needed
Added by iNTERFACEWARE
How to use transactions and conn:begin{}, conn:execute{} and conn:commit{} to insert data into a database in a specific order.