Handling a long data string

10 views
Skip to first unread message

OMEGA_OPP

unread,
Feb 2, 2012, 9:13:56 PM2/2/12
to InterSystems: Ensemble in Healthcare
Hello Everyone,
I am having an issue with handling a long data string. A remote
system is sending an HL7 record in one string with no delimiters
between messages. I need to parse the string and load individual
segments. The code should be breaking up the string and loading the
file to be handled and but the process is locking up the HL7 business
service.

Example of Long String
MSH|^~\&|XXX_LOAD|200|XXX-ICN|200|20120202152847-0600||VQQ^Q02|
1328218127012206000||2.3175VTQ|666601105|T|VTQ_PID_ICN_NO_LOAD|SCN|
@00108.1^EQ^CHDRRKMADCund^AND~@00108.2^EQ^RKMPATFIVENB^AND~@00122^EQ^666601105^AND~@00110^EQ^19120120^AND~@00108.3^EQ^v^AND~@00111^EQ^F125RDF|
9|
@00108.1^ST^30~@00108.2^ST^30~@00122^ST^9~@00110^ST^8~@00108.3^ST^16~@00111^ST^1~@00105^ST^19~@00756^ST^5~@00169^ST^999003

Here is the example of the code

Method OnProcessInput(pInput As Ens.StringContainer, pOutput As
Ens.StringContainer) As %Status
{
#Dim tResponse As EnsLib.HL7.Message

Set tInput=$e(pInput.StringValue,1,4)
If tInput = "HELO" {
Set ..HL7Msg=##class(%GlobalCharacterStream).%New()
Set pOutput = ##class(Ens.StringContainer).%New(..HELOACK)
$$$TRACE("ACK: "_..HELOACK)
}
ElseIf tInput = "QUIT" {
Set:..QUITACK pOutput = ##class(Ens.StringContainer).%New(..QUITACK)
$$$TRACE("ACK: "_..QUITACK)
}
ElseIf tInput = "RDF|" {
Do:
$IsObject(..HL7Msg) ..SendRequestSync("HL7Out",##class(EnsLib.HL7.Message).ImportFromLibraryStream(..HL7Msg),.tResponse)
Set tAck=tResponse.OutputToString()
Set pOutput = ##class(Ens.StringContainer).%New(tAck)
$$$TRACE("ACK: "_tAck)
}
Else {
Do:$IsObject(..HL7Msg)..HL7Msg.WriteLine("MSH"_
$p($p(pInput.stringvalue,"MSH",2),"VTQ"))
Do:$IsObject(..HL7Msg) ..HL7Msg.WriteLine("VTQ"_
$p($p(pInput.stringvalue,"VTQ",2),"RDF"))
Do:$IsObject(..HL7Msg) ..HL7Msg.WriteLine("RDF"_
$p(pinput.stringvalue,"RDF",2))
Do:
$IsObject(..HL7Msg) ..SendRequestSync("HL7Out",##class(EnsLib.HL7.Message).ImportFromLibraryStream(..HL7Msg),.tResponse)
Set tAck=tResponse.OutputToString()
Set pOutput = ##class(Ens.StringContainer).%New(tAck)
$$$TRACE("ACK: "_tAck)
//Do:$IsObject(..HL7Msg) ..HL7Msg.WriteLine(pInput.StringValue)
}
Quit $$$OK
}

Ted Peck

unread,
Feb 3, 2012, 11:30:48 AM2/3/12
to ensemble-in...@googlegroups.com, OMEGA_OPP
You know, Ensemble comes with an HL7 parser already. It does not require
a delimiter between messages; it supports Framing=None.
Reply all
Reply to author
Forward
0 new messages