–Below is main.lua

local JSON_TEMPLATE = [[
{
‘patients’:
{
‘patient-id’:”,
‘first-name’:”,
‘last-name’:”,
‘social-security-no’:”
}
}]]

function main(Data)

local Msg = hl7.parse{vmd = ‘example/demo.vmd’, data = Data}
local Out = json.parse(JSON_TEMPLATE)

Out.patients[“patient-id”] = Msg.PID[3][1][1]:nodeValue()
Out.patients[“first-name”] = Msg.PID[5][1][2]:nodeValue()
Out.patients[“last-name”] = Msg.PID[5][1][1][1]:nodeValue()
Out.patients[“social-security-no”] = Msg.PID[19]:nodeValue()

queue.push{data=Out}

response=json.serialize{data=Out}
trace(response)
–net.http.respond{body=response}
net.http.respond{
body=response,
entity_type=’application/json’
}
return

end

When I run the above piece of code, I could see the error as :- ‘The channel encountered an error’.

Also, please let me know how to get the Access codes for the Iguana training series.