How to create a new OBX segment

198 views
Skip to first unread message

L Granato

unread,
Aug 4, 2010, 9:15:46 AM8/4/10
to InterSystems: Ensemble in Healthcare
Hello,

I have an application that is sending data in one OBX segment with OBX:
5 containing \.br\'s. I need to break this OBX into multiple OBX's
based on this. Thanks to a previous post, I know how to get pieces of
OBX:5, but how does one create a new OBX segment within DTL to assign
these values to? HL7 schema is 2.4

Here's what I've got so far:

<code>
<![CDATA[
set inputtext =
target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:ObservationValue()")
for i = 1:1:$l(inputtext,"\.br\"){
set newline = $p(inputtext,"\.br\",i)
}
]]>
</code>
<assign property='target.{ORCgrp(1).OBXgrp(1).OBX:5()}'
value='$g(newline)' action='set'/>

Any assistance would be greatly appreaciated!

Regards,
Laura

Atkinson, Gary

unread,
Aug 4, 2010, 9:25:01 AM8/4/10
to ensemble-in...@googlegroups.com
You can replace the "\br\" with "~".
<assign
property='target.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:ObservationValue(
1)}'
value='..ReplaceStr(source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:Observa
tionValue(1)},"\.br\","~")' action='set'/>


Then you can iterate as would normally off the field5, but place your
key in the segment iteration.

<foreach
property='source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:ObservationValue(
)}' key='k1'>
<assign property='target.{OBX(k1):ObservationValue(1)}'
value='source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:ObservationValue(k1)
}' action='set'/>
<assign property='target.{OBX(k1):ValueType}'
value='source.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:ValueType}'
action='set'/>

Thanks,
Gary

Hello,

Regards,
Laura

--
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

L Granato

unread,
Aug 4, 2010, 10:09:00 AM8/4/10
to InterSystems: Ensemble in Healthcare
Thanks Gary. This looks to replace the existing OBX line? I need to
break a single OBX into multiple OBX lines.

For example:
OBX|1^1|ST|REPORTTEXT||Report Summary:\.br\Overall impression: This is
a test of the results system.\.br\More text\.br\Some more text||||||
F|||

would like to be:
OBX|1|ST|REPORTTEXT||Report Summary:||||||F|||
OBX|2|ST|REPORTTEXT||Overall impression: This is a test of the results
system||||||F|||
OBX|3|ST|REPORTTEXT||More text||||||F|||
OBX|4|ST|REPORTTEXT||Some more text||||||F|||

Thanks,
Laura
> For more options, visit this group athttp://groups.google.com/group/Ensemble-in-Healthcare?hl=en- Hide quoted text -
>
> - Show quoted text -

Atkinson, Gary

unread,
Aug 4, 2010, 10:13:12 AM8/4/10
to ensemble-in...@googlegroups.com
Right. If you change the \br\ to ~, then you can iterate over OBX:5, but use key to create OBX segment foreach OBX:5. Make sense?

Graham, Ben

unread,
Aug 4, 2010, 10:18:38 AM8/4/10
to ensemble-in...@googlegroups.com
Use the SetValueAt Method - see below
You will need to do this for each of the OBX fields...

<code>
<![CDATA[
set inputtext =
target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:ObservationValue()")
for i = 1:1:$l(inputtext,"\.br\"){
set newline = $p(inputtext,"\.br\",i)

//Build the OBX
S tSC=target.SetValueAt(newline,"ORCgrp(1).OBXgrp("_i_").OBX:ObservationValue(1)","set")

}
]]>
</code>


-Ben

Thanks,
Laura

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.

L Granato

unread,
Aug 4, 2010, 10:46:33 AM8/4/10
to InterSystems: Ensemble in Healthcare
Thank you both!

Gary, When I test the transformation , the \.br\ does not get replaced
with ~ and the repeating segment is not recognized. I've tried a
couple changes, but can't seem to get it to work. But yes, it does
make sense.

Ben, to use the SetValueAt for each of the OBX fields, would I just
add new lines within the loop? (This is first time I'm getting into
coding within the DTL... so my apologies for question that is probably
straightforward to most)

//Build the OBX
S
tSC=target.SetValueAt(newline,"ORCgrp(1).OBXgrp("_i_").OBX:ObservationValue­
(1)","set")
S
tSC=target.SetValueAt(i,"ORCgrp(1).OBXgrp("_i_").OBX:SetIDOBX","set")
S
tSC=target.SetValueAt(source.ORCgrp(1).OBXgrp(1).OBX:ValueType,"ORCgrp(1).OBXgrp("_i_").OBX:ValueType","set")
S tSC=target.SetValueAt("","ORCgrp(1).OBXgrp("_i_").OBX:3","set")
... and so on


Thanks so much!

Laura


On Aug 4, 10:18 am, "Graham, Ben" <BGra...@inlandimaging.com> wrote:
> Use the SetValueAt Method - see below
> You will need to do this for each of the OBX fields...
>
> <code>
> <![CDATA[
>   set inputtext =
>  target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:ObservationValue()")
>          for i = 1:1:$l(inputtext,"\.br\"){
>                  set newline = $p(inputtext,"\.br\",i)
>                         //Build the OBX
>                         S tSC=target.SetValueAt(newline,"ORCgrp(1).OBXgrp("_i_").OBX:ObservationValue­(1)","set")
> > For more options, visit this group athttp://groups.google.com/group/Ensemble-in-Healthcare?hl=en-Hide quoted text -
>
> > - Show quoted text -
>
> --
> 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 athttp://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.- Hide quoted text -

Graham, Ben

unread,
Aug 4, 2010, 10:53:05 AM8/4/10
to ensemble-in...@googlegroups.com
The SetValueAt will create the OBX and put a value in the specified field.
It is the equivalent of the '<ASSIGN' in the DTL.

In the tSC=target.SetValueAt(i,"ORCgrp(1).OBXgrp("_i_").OBX:SetIDOBX","set")
'i' is the instance of the OBX that you are creating.

You only need to populate the fields that have data. The remaining field will be empty.
What you have below should work.
Although for OBX field 1, I would use 'i' as the value, rather than copying from the source. This way you will get an incrementing set id.

L Granato

unread,
Aug 4, 2010, 11:06:48 AM8/4/10
to InterSystems: Ensemble in Healthcare
Thanks so much! This was exactly what I needed.

I couldn't get the SetValueAt to recognize source. Here's what I
ended up with, for anyone else who's looking for this solution:

<![CDATA[
set inputtext =
target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:ObservationValue()")
for i = 1:1:$l(inputtext,"\.br\"){
set newline = $p(inputtext,"\.br\",i)
set OBX2= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:2")
set OBX3= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:3")
set OBX6= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:6")
set OBX7= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:7")
set OBX8= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:8")
set OBX11= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:11")
set OBX14= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:14")
set OBX15= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:15")
set OBX16= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:16")
set OBX17= target.GetValueAt("ORCgrp(1).OBXgrp(1).OBX:17")

set tsc =
target.SetValueAt(newline,"ORCgrp(1).OBXgrp("_i_").OBX:ObservationValue(1)")
set tsc = target.SetValueAt(i,"ORCgrp(1).OBXgrp("_i_").OBX:1")
set tsc = target.SetValueAt(OBX2,"ORCgrp(1).OBXgrp("_i_").OBX:2")
set tsc = target.SetValueAt(OBX3,"ORCgrp(1).OBXgrp("_i_").OBX:3")
set tsc = target.SetValueAt(OBX6,"ORCgrp(1).OBXgrp("_i_").OBX:6")
set tsc = target.SetValueAt(OBX7,"ORCgrp(1).OBXgrp("_i_").OBX:7")
set tsc = target.SetValueAt(OBX8,"ORCgrp(1).OBXgrp("_i_").OBX:8")
set tsc = target.SetValueAt(OBX11,"ORCgrp(1).OBXgrp("_i_").OBX:11")
set tsc = target.SetValueAt(OBX14,"ORCgrp(1).OBXgrp("_i_").OBX:14")
set tsc = target.SetValueAt(OBX15,"ORCgrp(1).OBXgrp("_i_").OBX:15")
set tsc = target.SetValueAt(OBX16,"ORCgrp(1).OBXgrp("_i_").OBX:16")
set tsc = target.SetValueAt(OBX17,"ORCgrp(1).OBXgrp("_i_").OBX:17")

}
]]>
</code>

Thanks again!

Regards,
Laura
> tSC=target.SetValueAt(source.ORCgrp(1).OBXgrp(1).OBX:ValueType,"ORCgrp(1).O­BXgrp("_i_").OBX:ValueType","set")
> > > For more options, visit this group athttp://groups.google.com/group/Ensemble-in-Healthcare?hl=en-Hidequoted text -
>
> > > - Show quoted text -
>
> > --
> > 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 athttp://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.- Hide quoted text -
>
> > - Show quoted text -
>
> --
> 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 athttp://groups.google.com/group/Ensemble-in-Healthcare?hl=en- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages