Announcement

Collapse
No announcement yet.

Copy part of OBX text to another segment.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Copy part of OBX text to another segment.

    I found threads similar to this but not really what I am looking for. I am a novice when it comes to javascript so please bear with me.

    I am trying to copy BiRADS out of a block of text. These are single OBX messages so that's why I was having a hard time searching for threads. This is an example message I have. Sometimes it can be BiRADS: 2 or even BiRADS: 2A for example and it will not always be at the end of the report. It can be at the beginning or even in the middle. How do I account for this? I'd like to put it somewhere like OBR 4.1.

    Thank you!

    MSH|^~\&|RIS|Facility|Mirth|Facility|2015090218350 3.0000+02:00||ORU^R01|e6A4KAxgVjLSlzBfSc7W|P|2.3
    PID|1||123456||LASTNAME^FIRSTNAME||19000101000000. 0000+01:00|M||||||||||1
    PV1|1|O|||||1^test^TEST||||||||||||||||||||||||||| ||||||||||20150902183024.0000+02:00
    ORC|RE|2015227909|1||||^^30^20150816235300.0000+02 :00^20150817002300.0000+02:00||20150902183306.0000 +02:00|4^ACCOUNT^SYSTEM
    OBR|1|2015227909|1||||20150902183333.0000+02:00||| ||||||||2015227909||||||CR|F||^^30^20150816235300. 0000+02:00^20150817002300.0000+02:00|||||1^test^TE ST||||||||||||70501^BREAST^^^BREAST TEST
    OBX|1|TX|||TEST TEST TEST TEST TEST TEST TEST~TEST TEST TEST TEST TEST TEST TEST. ~TEST TEST TEST TEST TEST TEST TEST ~TEST TEST TEST.~TEST TEST TEST TESTTEST TEST TEST TEST ~TEST TEST TEST TEST TEST TEST TEST~TEST TEST TEST TEST TEST TEST TEST ~TEST TEST ~ITEST TEST TEST TEST TEST TEST TEST~TEST TEST TEST TEST TEST TEST TEST.~TEST TEST TEST TEST TEST TEST TEST.~~TEST TEST TEST TEST TEST TEST TEST.~~FIRSTNAME LASTNAME M.D.~ ~~~Imaging Technologist: FIRSTNAME
    LASTNAME RT(R)(M), XX Medical Center~BiRADS: 2~||

  • #2
    For this you need to use the special ~ character.
    In your channel, Go to HL7 v2.x Props-> Parse Field Repetitions and check it.

    This will parse all ~ to serve the purpose of repeating field. Eg.

    OBX|1|TX|||TEST1~TEST2~TEST3|

    This means that OBX.5.1 can have 3 values TEST1,TEST2, and TEST3.

    Now, you can use this small script below.
    Code:
    noOfOBX5=msg['OBX']['OBX.5'].length();
    i=0;
    while(i < noOfOBX5)
    {
    if(msg['OBX']['OBX.5'][i]['OBX.5.1'].toString() == "BiRADS: 2") {
    	capture=msg['OBX']['OBX.5'][i]['OBX.5.1'].toString();
    }
    
    
    //map capture to OBR-4
    msg['OBR']['OBR.4']['OBR.4.1']= capture;
    HL7v2.7 Certified Control Specialist!

    Comment


    • #3
      Using JS search function

      You can also use js search function something like this -

      var obvalue = msg['OBX']['OBX.5']['OBX.5.1'].toString();

      if(obvalue.search("BiRADS: 2")!=-1){
      msg['OBR']['OBR.4']['OBR.4.1'] = "BiRADS: 2";
      }
      if(obvalue.search("BiRADS: 2A")!=-1){
      msg['OBR']['OBR.4']['OBR.4.1'] = "BiRADS: 2A";
      }

      Comment


      • #4
        I have doubts that search function will work, now that msg is not a string but in E4x/XML format. But give it a try.
        HL7v2.7 Certified Control Specialist!

        Comment


        • #5
          Copy part of OBX text to another segment.

          I am able to achieve desired result. Did you try and experience any issue?

          Comment

          Working...
          X