Dehydrate (serialize) as XML
Verified
Added by iNTERFACEWARE
How to dehydrate (serialize) raw XML data, this can be useful for storing in a databases
Source Code
local Vmd = 'example/demo.vmd' function main(Data) local H = hl7.parse{vmd=Vmd,data=Data} local D = MyTemplate() D.data.ssn = H.PID[19] D.data.dob = H.PID[7][1] D.data.ascension_num = H.PID[3][1][1] local SerializedXml = D:S() D = DehydrateXml(SerializedXml) trace(D.data.ssn:nodeValue()) end function MyTemplate() return xml.parse{data="<data ssn='' dob='' ascension_num=''/>"} end function DehydrateXml(Xml) return xml.parse{data=Xml} end
Description
How to dehydrate (serialize) raw XML data, this can be useful for storing in a databases
Usage Details
Demonstrates how to serialize HL7 message data as XML, by using xml.parse{}
. This can be very useful for storing raw data in a database, as opposed than breaking it out and saving it in various tables.
How to use the snippet:
- Paste the code into your script
- Inspect the annotations to see how it works
More Information
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 insert data from an HL7 message into a database (similar principles apply to other message types)
Added by iNTERFACEWARE
How to update a database using data from an HL7 message (similar principles apply to other message types)
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
A very simple way to run all your code in protected mode with pcall() and log errors instead of stopping
Added by iNTERFACEWARE
Demonstrates the use of conn:execute{} to call a stored procedure.
Added by iNTERFACEWARE
How to encode binary files as base 64 text, then embed them as OBX-5 segment repeats
Added by iNTERFACEWARE
Shows the correct way to add and update TEXT (and other) fields, as well as what not to do
Added by iNTERFACEWARE
Demonstrates how to use conn:merge{} with a table that has an auto-incrementing Id column.
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
How to correctly escape a SQL query string
Added by iNTERFACEWARE
This script automatically creates a SQLite database and then generates the tables specified in a VMD.
Added by iNTERFACEWARE
This code checks EDI (XML) data for some common errors, you can use this approach for pre-processing messages to clean them up
Added by iNTERFACEWARE
How to handle inserts and updates for a table using an autoincrementing ID
Added by iNTERFACEWARE
Create a custom ACK by using a script in an LLP Listener component
Added by iNTERFACEWARE
How to use an external command program to zip up a folder containing multiple files
Added by iNTERFACEWARE
How to dehydrate (serialize) raw JSON data, this can be useful for storing in a databases
Added by iNTERFACEWARE
Retries a a custom ACK using the retry.lua module