Maping for ORC, OBR and OBX segment through coding

144 views
Skip to first unread message

Mady

unread,
May 17, 2011, 4:20:06 AM5/17/11
to InterSystems: Ensemble in Healthcare
Hi,

I want to mapping multiple ORC, OBR and OBX segments for ORU messages
by manual coding not through transformation. Is there any feasible way
to doing this?
Thanks in advance.

Regards
Andy

Simpson, Matt

unread,
May 17, 2011, 11:07:02 AM5/17/11
to ensemble-in...@googlegroups.com
Hi Andy,

I'm not sure exactly what you need, but if you need to loop on a repeating segment in code and take an action, you can do this:

for i = 1:1:source.GetValueAt("OBR(*)") {
d target.SetValueAt(source.GetValueAt("OBR("_i_"):4.1"),"OBR("_i_"):4.1")
}

Thanks!

Matt Simpson
Information Systems | Inland Imaging Business Associates
Tel: 509.363.7759 | Cell: 509.370.7141 | Fax: 509.363.7082

Hi,

Regards
Andy

--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en

This electronic transmission and any documents accompanying this electronic transmission may contain information that is confidential and/or legally privileged. The information is intended only for the use of the individual or entity named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or the taking of any action in reliance on or regarding the contents of this electronically transmitted information is strictly prohibited. If you have received this e-mail in error, please notify the sender and delete this message immediately.

Nigel Timothy Bloom-Salm

unread,
May 17, 2011, 11:29:29 AM5/17/11
to ensemble-in...@googlegroups.com
Hi

And if you have many nested structures something like this

Hi

In Caché ObjectScript syntax you would use nested loops along the lines of:

for i=1:1 {
if pRequest.GetSegmentAt("PIDgrp(i).PID")=""
quit
for j=1:1 {
if
pRequest.GetSegmentAt("PIDgrp(i).ORCgrp("_j_").ORC")="" quit
for k=1:1 {
if
pRequest.GetSegmentAt("PIDgrp("_i_").ORCgrp("_j_").OBXgrp(“_k_")")="" quit
if
pRequest.GetValueAt("PIDgrp("_i_").ORCgrp("_j_").OBXgrp("_k_”).
OBX:ObservResultStatus ")=”F” {
; Do code
}
}
}
}

To navigate

And of course the similar logic to create segments

Here is a snippet of code from one of my productions where I have looping
structures

if orderobj.MicroType'="C" {
set result="",resultcounter=1
for {
set
resultobj=orderobj.Results.GetNext(.result) quit:result=""
set interpretive="",general="" if
$d(^LabTrak.CulturesD(orderobj.TestID))#10 set
interpretive=$lg(^(orderobj.TestID),5),general=$lg(^(orderobj.TestID),6)
// If the test item is not a general
comment then it is going to be handled as an OBX
// with a Result Type of "I" if it
is an interpretive result and "RP" if it is a stain result
if
general'[resultobj.ObservationIdentifier {
set
resulttype=$s(interpretive[resultobj.ObservationIdentifier:"I",1:"RP")
set
tSC=tRequest.SetValueAt(resultcounter,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obrco
unt_").OBXgrp("_resultcounter_").OBX:SetIDOBX","set","") if 'tSC goto End
set
tSC=tRequest.SetValueAt(resultobj.ValueType,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("
_obrcount_").OBXgrp("_resultcounter_").OBX:ValueType","set","") if 'tSC goto
End
set
tSC=tRequest.SetValueAt(orderobj.TestID,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obr
count_").OBXgrp("_resultcounter_").OBX:ObservationIdentifier.identifier","se
t","") if 'tSC goto End
set
tSC=tRequest.SetValueAt(orderobj.TestIDName,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("
_obrcount_").OBXgrp("_resultcounter_").OBX:ObservationIdentifier.text","set"
,"") if 'tSC goto End
set
tSC=tRequest.SetValueAt(resulttype,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obrcount
_").OBXgrp("_resultcounter_").OBX:ObservationIdentifier.nameofcodingsystem",
"set","") if 'tSC goto End
set
tSC=tRequest.SetValueAt(resultcounter,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obrco
unt_").OBXgrp("_resultcounter_").OBX:ObservationSubID","set","") if 'tSC
goto End
if resulttype'="I" {
set
tSC=tRequest.SetValueAt(resultobj.ObservationIdentifier,"PIDgrpgrp(1).ORCgrp
(1).OBRgrp("_obrcount_").OBXgrp("_resultcounter_").OBX:ObservationValue(1)",
"set","") if 'tSC goto End
// If there is an
Observation Value and an Observation text then we write both
// to the messge.
Otherwise we only write the Observation Value and we put it
// into the 'Text'
field in the segment. This is the only way that Meditech can
// handle results
with a value that are not standard comments such as PH or Semen count
if
resultobj.ObservationText'="" {
set
tSC=tRequest.SetValueAt(resultobj.ObservationValue,"PIDgrpgrp(1).ORCgrp(1).O
BRgrp("_obrcount_").OBXgrp("_resultcounter_").OBX:Units","set","") if 'tSC
goto End
set
tSC=tRequest.SetValueAt($e(resultobj.ObservationText,1,60),"PIDgrpgrp(1).ORC
grp(1).OBRgrp("_obrcount_").OBXgrp("_resultcounter_").OBX:ReferencesRange","
set","") if 'tSC goto End
}
else {
set
tSC=tRequest.SetValueAt(resultobj.ObservationValue,"PIDgrpgrp(1).ORCgrp(1).O
BRgrp("_obrcount_").OBXgrp("_resultcounter_").OBX:ReferencesRange","set","")
if 'tSC goto End
}
}
else {
set
tSC=tRequest.SetValueAt(resultobj.ObservationText,"PIDgrpgrp(1).ORCgrp(1).OB
Rgrp("_obrcount_").OBXgrp("_resultcounter_").OBX:ObservationValue(1)","set",
"") if 'tSC goto End
}
set
tSC=tRequest.SetValueAt(resultobj.Units,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obr
count_").OBXgrp("_resultcounter_").OBX:Probability","set","") if 'tSC goto
End
set
tSC=tRequest.SetValueAt(orderobj.ObservationResultStatus,"PIDgrpgrp(1).ORCgr
p(1).OBRgrp("_obrcount_").OBXgrp("_resultcounter_").OBX:ObservResultStatus",
"set","") if 'tSC goto End
for
comment=1:1:resultobj.Comments.Count() {
set
text=resultobj.Comments.GetAt(comment)
set
tSC=tRequest.SetValueAt(comment,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obrcount_")
.OBXgrp("_resultcounter_").NTE("_comment_"):SetIDNotesandComments","set","")
if 'tSC goto End
set
tSC=tRequest.SetValueAt("L","PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obrcount_").OBX
grp("_resultcounter_").NTE("_comment_"):SourceofComment","set","") if 'tSC
goto End
set
tSC=tRequest.SetValueAt(text,"PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obrcount_").OB
Xgrp("_resultcounter_").NTE("_comment_"):Comment(1)","set","") if 'tSC goto
End
do
tRequest.commitSegmentByPath("PIDgrpgrp(1).ORCgrp(1).OBRgrp("_obrcount_").OB
Xgrp("_resultcounter_").NTE("_comment_")")
kill text
}
}

Sorry about the formatting

Can send an xml export of the whole class if you need

Nigel Timothy Bloom-Salm

Nigel Timothy Bloom-Salm

Technical Specialist

Mady

unread,
May 19, 2011, 7:48:26 AM5/19/11
to InterSystems: Ensemble in Healthcare
Hi,

Thanks for your reply

Now my problem is as below.

I create a method getORUBeanDao(pMsg As EnsLib.HL7.Message) which fill
the property of ORC, OBR and OBX from HL7 message segment elements.
the structure of my property class is
ORC -> OBR -> OBX -> NTE

Now in method i have create for loop as below

For i=1:1:pMsg.SegCount
{
if (obrSegType = "ORC")
{
s objORC = ##Class(OmniMD.HL7WSClient.ns3.ORCBean).%New()
s objORC.enterby = "test"
}
if (obrSegType = "OBR")
{
s objOBR = ##Class(OmniMD.HL7WSClient.ns3.OBRBean).%New()
s objOBR.dangerCode = "test"
}
if (obrSegType = "OBX")
{
s objOBX = ##class(OmniMD.HL7WSClient.ns3.OBXBean).%New()
s objOBX.observationValue = "test"
}
if (obrSegType = "NTE")
{
s objNTE = ##class(OmniMD.HL7WSClient.ns3.NTEBean).%New()
s objNTE.sourceofComment = "test"
}

}

I have to insert object as below.

d objOBX.noteBeanDao.Insert(objNTE)
d objOBR.obxBean.Insert(objOBX)
d objORC.obrBeanDao.Insert(objOBR)
d objORU.orcBeanDao.Insert(objORC)

but my problem is that I have to insert it as per class hierarchy as i
have earlier mention.

message structure may be as follows :

MSH|
PID|
ORC|

OBR|1|
OBX|1|
OBX|2|
OBX|3|
OBX|4|
OBX|5|
OBX|6|

OBR|2|
OBX|1|
NTE|1|
NTE|2|
NTE|3|
NTE|4|
NTE|5|
NTE|6|
NTE|7|
NTE|8|


On May 17, 8:29 pm, "Nigel Timothy Bloom-Salm" <nigel.s...@gmail.com>
wrote:
> For more options, visit this group athttp://groups.google.com/group/Ensemble-in-Healthcare?hl=en

Nigel Timothy Bloom-Salm

unread,
May 19, 2011, 8:04:37 AM5/19/11
to ensemble-in...@googlegroups.com
Hi Mady

I'm not sure I get what the problem is. Do your methods create HL7 segments
or a collection of normal hierarchical Caché classes representing each type
of segment?

Maybe you could send me your classes so I can see the contents more clearly.
You can send them privately to nigel...@intersystems.com

Thanks

Reply all
Reply to author
Forward
0 new messages