This topic contains 2 replies, has 3 voices, and was last updated by Eliot Muir 8 years, 10 months ago.
Mapping HL7 to JSON (with template)
You must be logged in to reply to this topic.
This topic contains 2 replies, has 3 voices, and was last updated by Eliot Muir 8 years, 10 months ago.
Hello All,
I wathced this video (https://www.youtube.com/watch?v=T6AEvELf9G8&noredirect=1) demonstrating how to map HL7 to HL7, Hl7 to DB or HL7 to XML and started to wonder that is it possible to create JSON template in a same way as in XML part and map data from HL7 to it?
local Outbound = json.parse{data=template} should work as with XML, but in what form should that template be.
I tried to search knowledge base for information, but couldn’t find anything about mapping, only parsing and serializing.
It is possible in a way by using tables. Here is example template that has also group in it…try it out.
require ‘node’
Jtemplate = {[“Key1”]=’value1′, [“key2”]=’value2′,[“Group”]={[“Key3″]=”, [“Key4″]=”}}
function main(Data)
local hl7message ,Name = hl7.parse{vmd=vmd,data=Data}
local mapHL7toJTemplate = Jtemplate
mapHL7toJTemplate.Key1 = hl7message.MSH[6][1]:S()
mapHL7toJTemplate.key2 = hl7message.MSH[12]:S()
mapHL7toJTemplate.Group.Key3 = hl7message.MSH[9][1]:S()
mapHL7toJTemplate.Group.Key4 = hl7message.MSH[9][2]:S()
json.serialize{data=mapHL7toJTemplate, compact=true}
end
You could do it programmatically in a loop also if you leverage the # operator to give the count of nodes, nodeValue() and nodeName() and nodeType() to get the values, names and type of each HL7 node.
You must be logged in to reply to this topic.