Announcement

Collapse
No announcement yet.

Mirth Newbie: OBX5 to include Patient Identifier information & HL7

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

  • Mirth Newbie: OBX5 to include Patient Identifier information & HL7

    I am trying to create a channel that will take an Outbound HL7 message and insert the following OBX segments after every 54 OBX segments.
    These segments will allow Patient Identifer information to display on each page of the document.

    According to the HPF document,the segment I need to create is the following:
    OBX||TX||\x0c|
    OBX||TX||Patient Name: XXXXX, XXXXXX Account Number: 123456789|
    OBX||TX||||


    It looks easy enough to do on the Interface, but I am having problems figuring this out.
    We are using MC 3.0.3.7171.

    I created the Channel using TCP Listener as the Connector Type. Message Templates are HL7 v2.x, both source and destination.

    Can anyone help me?

  • #2
    Are the 54 OBX segments under a single OBR segment?

    Comment


    • #3
      OBX 54 lines

      I mistyped.
      I meant to say that after 54 lines of text, a page break will happen, on the next page the patient identifier information is added to the top of the page.

      Comment


      • #4
        Still need help please.

        I'm still struggling with this. I've been reading a lot of the messages and a few might be able to help me but I'm still at a loss as to where to begin.

        Comment


        • #5
          There are many threads here already that deal with repeating segments. Basically, you can use the insertSegmentAfter method to accomplish that. It's in the Reference tab.
          Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

          Nicholas Rupley
          Work: 949-237-6069
          Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


          - How do I foo?
          - You just bar.

          Comment


          • #6
            More clarification on OBX segments

            Hello again,

            It's been a while since I last posted and have figured a few things out.
            I believe I didn't explain this very well.

            This is what I have so far.
            Connector Type: TCP Listener (Source) TCP Sender (Destination)
            Message Type: HL7 Incoming and Outgoing
            Repeating Segments: OBX

            From the Incoming Source, there is only one OBX segment which, when viewed in MC, breaks down into multiple segments.

            I need MC to loop thru the OBX segments until I get to OBX 5.1.54. At that segment, I need to 'Create a Segment After' that will create a page break ( \x0c).
            Then, beginning with OBX 5.1.55 (top of next page), I need to insert PID and PV1 segments (repeating fields?) --- In the following Format:
            OBX5.1.55 PATIENT NAME: PID.5.1, PID.5.2
            OBX5.1.56 VISIT ID: PV1.19.1
            OBX5.1.57 DATE OF VISIT: PV1.44.1
            OBX5.1.58 empty field
            OBX5.1.59 empty field
            OBX5.1.60 Continues from where it left off at OBX5.1.54

            Then I need it to continue to loop thru the next 54 segments (beginning with OBX5.1.60) and create the headers again.

            However, I need the loop to stop and not insert the above if the OBX segments do not go past 54 segments.

            I don't know which is the best way to go about this. Do I create a transformer to get this accomplished? Do I create JS code?
            I really need help with this.
            Thank you for your assistance.

            Comment


            • #7
              Obx

              In the example above, I realize I didn't figure in the page break segment.
              This is what it should look like.

              OBX5.1.55 \x0c //end of page
              OBX5.1.56 PATIENT NAME: PID.5.1, PID.5.2 //beginning of new page
              OBX5.1.57 VISIT ID: PV1.19.1
              OBX5.1.58 DATE OF VISIT: PV1.44.1
              OBX5.1.59 empty field
              OBX5.1.60 empty field
              OBX5.1.61 Continues from where it left off at OBX5.1.54

              Comment


              • #8
                Is there no one that can help me?
                Did I ask the question wrong?

                Comment


                • #9
                  Please clarify your question with some sample input message and your preferred output

                  What do you mean when you say 54 OBX?
                  msg[‘OBX’][54][‘OBX.5′][‘OBX.5.1′] (Version 1)
                  msg[‘OBX’][‘OBX.5′][54][‘OBX.5.1′] (Version 2)
                  msg[‘OBX’][‘OBX.5′][‘OBX.5.54′] (Version 3)

                  VERSION 1: (repeated OBX segments) (msg[‘OBX’][54][‘OBX.5′][‘OBX.5.1′])

                  MSH|^~\&|||
                  PID|||||
                  OBR|||
                  OBX|1||
                  OBX|2||
                  OBX|3||
                  OBX|4||
                  .
                  .
                  //
                  .
                  OBX|54||
                  OBX|55||||\x0c||||||



                  VERSION 2 (repetitive field in OBX5.1 separated by ~) (msg[‘OBX’][‘OBX.5′][54][‘OBX.5.1′] )

                  MSH|^~\&|||
                  PID|||||
                  OBR|||
                  OBX|1||||1~2~3~4~5~6~………..~53~54~\x0c~56~…||||


                  VERSION 3: (OBX5.55) (msg[‘OBX’][‘OBX.5′][‘OBX.5.54′] )

                  MSH|^~\&|||
                  PID|||||
                  OBR|||
                  OBX|1||||||||||11||||||||||21||||||||||31|||1||||| |41|||||||||51|52|53|54|\x0c|||||||||||||||||||||| ||||||||||||||||||||||||

                  Comment


                  • #10
                    We are on Version 2 with repetitive OBX segments.

                    When the HL7 is sent out, the message is in one OBX segment. Once it is received, the message is broken up into repeated OBX segments.

                    Because it is broken up into repeated segments, there is nothing in those segments that says to break and then add the patient identifiers onto the top of the next page. The receiving system does not do this and says it is our responsibility to have an interface engine to do this for us.

                    The receiving system does insert a page break, but the segments continue onto the next page at the very top. This is difficult for all concerned because there is no way to know which subsequent pages go with the first page of the document.

                    I would think this would be so easy to do.

                    I have some criteria for this OBX segment. I have to change the OBX2.1 value from a 'TX' to a 'FT'. That seems easy enough. I then need to insert a page break at the OBX 5.1.55 segment. And then follow with the patient identifiers on the next page.

                    I've looked all over MC trying to find a 'like' example, but have failed to find anything.

                    I would so appreciate some help with this. There are two of us that are working on this and we are struggling. If I can just get one going, I think I would understand what I'm doing a lot better.


                    Comes in as:

                    OBX|1|TX|||1~2~3~4~5~6~………..~53~54~55~56~57~57~.......~85 |||||

                    Would like it to go out as:

                    OBX|1|FT|||1~2~3~4~5~6~………..~53~54~55~\x0c\(page break)~56~Patient Name: (Hardcoded and then mapped fields from PID)~57~Visit ID: (mapped field)~58 (blank line)~59 (blank line)~60(begin rest of document)~61~62~(rest of document)~…||||

                    I also need it to loop through first 55 lines and then again the next 55 lines and continue to loop until the end of the document.

                    Comment


                    • #11
                      What have you try and where you stuck?

                      I don't have a detail coding yet, just throw you some ideas / brainstorming

                      var page_break= new XML("<OBX.5/>");
                      page_break['OBX.5.1'] = "\\x0c\\";
                      msg['OBX']['OBX.5'][54] += page_break;
                      var PatientName = new XML("<OBX.5/>")
                      PatientName['OBX.5.1'] = "Patient Name: " +msg['PID']['PID.5']['PID.5.1'].toString();
                      msg['OBX']['OBX.5'][55] += PatientName;

                      The above code will convert

                      MSH|^~\&|
                      PID|||||Johnny||||||
                      OBX|||||1~2~3~4~5~6~7~8~9~10~~~~~~~~~~20~~~~~~~~~~ 30~~~~~~~~~~40~~~~~~~~~~50~51~52~53~54~55~56~57~58 ~59~||||||F


                      to
                      MSH|^~\&|
                      PID|||||Johnny||||||
                      OBX|||||1~2~3~4~5~6~7~8~9~10~~~~~~~~~~20~~~~~~~~~~ 30~~~~~~~~~~40~~~~~~~~~~50~51~52~53~54~55~\x0c\~Patient Name: Johnny~56~57~58~59~||||||F




                      //Also
                      //I suppose you can use below to count the numbers of your repetitive fields
                      //when you iterate the repetitive field ,use some modular operator (%) to find which fields need adding new elements, etc...??
                      //if divisible by 55 or 56, etc

                      var obx5RepeatSegCount=msg.OBX['OBX.5'].length();
                      Last edited by [email protected]; 04-03-2015, 12:11 AM.

                      Comment


                      • #12
                        Thank you!!

                        This may work. I'm going to try it later today or Monday. I'll let you know if this works.

                        Comment


                        • #13
                          Hi again,
                          First off .... You are AWESOME!!!!
                          The script that you supplied works wonderfully so thank you so much!!! And so easy!

                          Now I only need to figure out how to add the name so it looks like the following:
                          LastName, FirstName

                          I've tried a couple of things but it isn't working yet, but I'll get it!!!

                          Thank you ... Thank you ... Thank you!!

                          Comment


                          • #14
                            I experiment a bit more
                            I don't know the best way to loop thro if there are can be few hundreds / thousands of repetitive OBX5.1

                            RAW
                            MSH|^~\&|
                            PID|||||STONE^Johnny||||||
                            PV1|||||||||||||||||||||||||||||||||||||||ABCD5678 9992234|||||||||||||||||||||
                            OBX|||||1~2~3~4~5~6~7~8~9~10~~~~~~~~~~20~~~~~~~~~~ 30~~~~~~~~~~40~~~~~~~~~~50~51~52~53~54~55~56~57~58 ~59~~~~~~~~~~~70~~~~~~~~~~80~~~~~~~~~~90~~~~~~~~~~ 100~~~~~~~~~~110~111~~~~~~~~~120~~~~||||||F

                            //The following CODE assumes that the number of repetitive OBX5.1 cannot be more than 165

                            msg['OBX']['OBX.1']['OBX.1.1'] = "FT"

                            var obx5RepeatSegCount=msg.OBX['OBX.5'].length();

                            //0 to 54 is first group of 55;
                            //55 to 109 is another group of 55

                            if (obx5RepeatSegCount >110)
                            {
                            //Page Break = \xOc ???
                            var page_break= new XML("<OBX.5/>");
                            page_break['OBX.5.1'] = "\\x0c\\";
                            msg['OBX']['OBX.5'][109] += page_break;

                            //Patient Name: Last Name, First Name
                            var PatientName = new XML("<OBX.5/>")
                            PatientName['OBX.5.1'] = "Patient Name: " +msg['PID']['PID.5']['PID.5.1'].toString()+ ", " + msg['PID']['PID.5']['PID.5.2'].toString() ;
                            msg['OBX']['OBX.5'][110] += PatientName;

                            //Visit Number, assume in PV1-39
                            var visitNum = new XML("<OBX.5/>")
                            visitNum['OBX.5.1'] = "Visit Number: " +msg['PV1']['PV1.39']['PV1.39.1'].toString();
                            msg['OBX']['OBX.5'][111] += visitNum;
                            }

                            if ( obx5RepeatSegCount >55)
                            {
                            //Page Break = \xOc ???
                            var page_break= new XML("<OBX.5/>");
                            page_break['OBX.5.1'] = "\\x0c\\";
                            msg['OBX']['OBX.5'][54] += page_break;

                            //Patient Name: Last Name, First Name
                            var PatientName = new XML("<OBX.5/>")
                            PatientName['OBX.5.1'] = "Patient Name: " +msg['PID']['PID.5']['PID.5.1'].toString()+ ", " + msg['PID']['PID.5']['PID.5.2'].toString() ;
                            msg['OBX']['OBX.5'][55] += PatientName;

                            //Visit Number, assume in PV1-39
                            var visitNum = new XML("<OBX.5/>")
                            visitNum['OBX.5.1'] = "Visit Number: " +msg['PV1']['PV1.39']['PV1.39.1'].toString();
                            msg['OBX']['OBX.5'][56] += visitNum;
                            }


                            OUTPUT
                            MSH|^~\&|
                            PID|||||STONE^Johnny||||||
                            PV1|||||||||||||||||||||||||||||||||||||||ABCD5678 9992234|||||||||||||||||||||
                            OBX|FT||||1~2~3~4~5~6~7~8~9~10~~~~~~~~~~20~~~~~~~~ ~~ 30~~~~~~~~~~40~~~~~~~~~~50~51~52~53~54~55~\x0c\~Patient Name: STONE, Johnny~Visit Number: ABCD56789992234~56~57~58 ~59~~~~~~~~~~~70~~~~~~~~~~80~~~~~~~~~~90~~~~~~~~~~ 100~~~~~~~~~~110~\x0c\~Patient Name: STONE, Johnny~Visit Number: ABCD56789992234~111~~~~~~~~~120~~~~||||||F
                            Last edited by [email protected]; 04-03-2015, 09:15 PM.

                            Comment


                            • #15
                              I experimented a bit more, a neater code is attached

                              Please see any use and please consider posting your final code installed

                              Input
                              MSH|^~\&|
                              PID|||||STONE^Johnny||||||
                              PV1|||||||||||||||||||||||||||||||||||||||ABCD5678 9992234|||||||||||||||||||||
                              OBX|||||1~2~3~4~5~6~7~8~9~10~~~~~~~~~~20~~~~~~~~~~ 30~~~~~~~~~~40~~~~~~~~~~50~51~52~53~54~55~56~57~58 ~59~~~~~~~~~~~70~~~~~~~~~~80~~~~~~~~~~90~~~~~~~~~~ 100~~~~~~~~~~110~~~~~~~~~~120~~~~~~~~~~130~~~~~~~~ ~~140~~~~~~~~~~150~151~152~153~154~155~156~157~158 ~159~~~~~~~~~~~170~~~~~~~~~~180~~~~~~~~~~190~~~~~~ ~~~~200~~~~~~~~~~210~~~~~~~~~~220~~~~~~~~~~230~~~~ ~~~~~~240~~~~~~~~~~250~~~~~~~~~~~~~~~~~~~~270~~~~~ ~~~~~280~~~~~~~~~~290~~~~~~~~~~300~~~~~~~~310~~~~~ ~~~~~320~~~~||||||F


                              Output
                              MSH|^~\&|
                              PID|||||STONE^Johnny||||||
                              PV1|||||||||||||||||||||||||||||||||||||||ABCD5678 9992234|||||||||||||||||||||
                              OBX|FT||||1~2~3~4~5~6~7~8~9~10~~~~~~~~~~20~~~~~~~~ ~~ 30~~~~~~~~~~40~~~~~~~~~~50~51~52~53~54~55~\x0c\~Patient Name: STONE, Johnny~Visit Number: ABCD56789992234~56~57~58 ~59~~~~~~~~~~~70~~~~~~~~~~80~~~~~~~~~~90~~~~~~~~~~ 100~~~~~~~~~ ~110~\x0c\~Patient Name: STONE, Johnny~Visit Number: ABCD56789992234~ ~~~~~~~~~120~~~~~~~~~~130~~~~~~~~~~140~~~~~~~~~~15 0~151~152~153~154~155~156~157~158~159~~~~~~165~\x0c\~Patient Name: STONE, Johnny~Visit Number: ABCD56789992234~
                              ~~~~170~~~~~~~~~~180~~~~~~~~~~190~~~~~~~~~~200~~~~ ~~~~~~210~~~~~~~~~~220~\x0c\~Patient Name: STONE, Johnny~Visit Number: ABCD56789992234~ ~~~~~~~~~230~~~~~~ ~~~~240~~~~~~~~~~250~~~~~~~~~~~~~~~~~~~~270~~~~~275 ~\x0c\~Patient Name: STONE, Johnny~Visit Number: ABCD56789992234~
                              ~~~~280~~~~~~~~~~290~~~~~~~~~~300~~~~~~~~310~~
                              ~~~~~~~~320~~~~||||||F

                              CODE
                              // a much neater code which can handle thousands of repetitive OBX5.1
                              // will add extra OBX5.1 segments to every 55 segments
                              //55 (index = 54); 110 (index = 109), 165 (index=164), .......etc


                              msg['OBX']['OBX.1']['OBX.1.1'] = "FT"

                              var obx5RepeatSegCount=msg.OBX['OBX.5'].length();

                              for each(seg in msg..OBX)
                              {
                              {
                              //iterating backwards to prevent adding the segment changing the indexing
                              for (var i = obx5RepeatSegCount-1; i >= 0; i--)

                              { var j = i+1
                              //modulus % operator
                              if (j % 55==0) {
                              var visitNum = new XML("<OBX.5/>")
                              visitNum['OBX.5.1'] = "Visit Number: " +msg['PV1']['PV1.39']['PV1.39.1'].toString();
                              msg['OBX']['OBX.5'][i] += visitNum;

                              var PatientName = new XML("<OBX.5/>")
                              PatientName['OBX.5.1'] = "Patient Name: " +msg['PID']['PID.5']['PID.5.1'].toString()+ ", " + msg['PID']['PID.5']['PID.5.2'].toString() ;
                              msg['OBX']['OBX.5'][i] += PatientName;

                              var page_break= new XML("<OBX.5/>");
                              page_break['OBX.5.1'] = "\\x0c\\";
                              msg['OBX']['OBX.5'][i] += page_break;
                              }
                              }
                              }
                              Last edited by [email protected]; 04-05-2015, 12:09 AM.

                              Comment

                              Working...
                              X