Announcement

Collapse
No announcement yet.

removing a segment before relaying to another destination

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

  • removing a segment before relaying to another destination

    Hello community. I am very new to the Mirth application, this was an application that was already in place in the organization when I was hired and it has fallen to me to maintain the application and to make adjustments when they are needed. I have never used Mirth before and am learning so please be patient with me.

    I have spent the last two weeks searching the interwebs for an article that would help me but most of them assume many things are already known or completed so I have not been able to find a real walk through on this particular subject.

    Let me lay it out for everyone.
    This is a Radiology environment.
    1. We are receiving ORM Orders from the EMR. These orders are ORM^O01
    2. We receive these in a single Mirth TCP Listener Channel
    3. This channel has 4 destinations configured.
    4. This single message is relayed to all 4 destinations via TCP Sender
    Okay simple enough I was able to build this with zero issues. All messages get routed to all destinations successfully.

    But her is where the issue is.

    These Orders will sometimes contain a base64 attachment (jpeg, PDF, etc...) These attachments are things like pre-screening forms or insurance card or some type of government ID.

    These base 64 segments are broken up in to multiple OBX segments labeled OBX1, OBX2 and so on.
    I have attached a sample message for review. This is all test data fyi.

    The issue is that 2 of the destinations do not want the Base 64 to be sent to them, they only want the basic part of the order. (Basically everything but the OBX Segment)

    I have attempted multiple different suggestions but I am not sure if it would be beneficial to lay out all the things I have tried. I am fairly confident they were not done correctly anyways since I am really fumbling my way through this application anyways. I am sure this is something that is a common practice but I just don't even know where to start.

    If I have left out some vital piece of information for the community to help please let me know, I will provide anything you need to help me with this.
    Attached Files

  • #2
    Just modify the "msg" and delete the unwanted segments for those clients that don't need them. What have you tried?


    Diridium Technologies, Inc.
    https://diridium.com

    Comment


    • #3
      Originally posted by pacmano View Post
      Just modify the "msg" and delete the unwanted segments for those clients that don't need them. What have you tried?

      Thank you so much for your reply, and please be aware I know that what is about to be discussed is probably more than what may be supported in the community.

      Right, but this is the problem, I have no idea where to start with modifying the message. How is that done? I have no idea. Now I am not wanting the community to do my job for me, I am really just needing some guidance, where are some good articles to help accomplish what I am trying to do. Like I said before, I have come across several articles but all of them assume knowledge of how Mirth works and the terminology used in Mirth, which I am not familiar with yet. HL7 in general is a very new concept to me, so I am learning through trial by fire unfortunately. Eventually I will be going through the NextGen Connect Virtual Courses.

      The Mirth tutorial articles found here
      These are really great so far but I am under the gun and need to try and get this particular task completed asap. Working my way through and understanding how it all works is my end goal but the client does not have time for me to spend a couple months going through all this and learning how to use the application. It's not a good situation unfortunately.


      I will try to explain what I have attempted but I will probably generate more questions than answers. Only because I do not know if what I have attempted was even then correct path to take for this task.

      This article Is the main article I tried to follow and attempt but there are discussion points that are just "known or understood" that a newcomer to Mirth just is not aware of what they are talking about.
      1. This article caused me to look up outbound message templates, which I quickly got lost in and came across lots of other articles around message templates and then I lost confidence that this path was the correct way to go to get this task done.
      2. there is discussion of "delete segment command from the message template screen" but no indication of where it was found or how to use it. Things like this are what I am finding, which is totally fine, I am not upset about that, it is just not helpful to someone as green as I am in this environment.

      these are just a couple examples, but again, I realize that I am so new to this and in an unknown that what I am needing may not be possible in this environment. I get that I am kind of on my last ditch effort to try and get this done.

      Comment


      • #4
        To selectively delete from a group of OBX segments, maybe something like:
        Code:
        for each (obx in msg.OBX)
          if (obx['OBX.1']['OBX.1.1'] == 3)
            delete msg.children()[obx.childIndex()]
        If you get to ORU messages, it becomes a bit more involved w/multiple groups.
        Last edited by jkrebs; 02-17-2021, 08:49 PM.

        Comment


        • #5
          to delete all OBX segments from a message, it's as simple as
          Code:
          delete msg.OBX;

          Comment


          • #6
            Originally posted by jkrebs View Post
            To selectively delete from a group of OBX segments, maybe something like:
            Code:
            for each (obx in msg.OBX)
            if (obx['OBX.1']['OBX.1.1'] == 3)
            delete msg.children()[obx.childIndex()]
            If you get to ORU messages, it becomes a bit more involved w/multiple groups.
            Thank you for being willing to help with this. So you mention to use this code. Where is this code put in?

            Comment


            • #7
              Thank you for being willing to help with this. So you mention to use this code. Where is this code put in?
              Most welcome! You noted 2 destinations that don't want the OBXs, so highlight one to work w/first and Edit Transformer. Then you can either import the attached deleteOBX.xml or add a new JavaScript step and type in the code seen in the attached screen shot. Curly brackets were added to original posted format make room for additional code, if you want to play around w/it.

              When executed, you should see the 3rd iteration of OBX removed from the group of OBX segments. To delete all of the OBX segments at once, simply remove the loop code completely and then uncomment the code agermano recommended.
              Code:
              delete msg.OBX
              screenShot.png


              Welcome to Mirth!!
              Attached Files
              Last edited by jkrebs; 02-19-2021, 05:56 AM.

              Comment


              • #8
                Originally posted by jkrebs View Post
                Most welcome! You noted 2 destinations that don't want the OBXs, so highlight one to work w/first and Edit Transformer. Then you can either import the attached deleteOBX.xml or add a new JavaScript step and type in the code seen in the attached screen shot. Curly brackets were added to original posted format make room for additional code, if you want to play around w/it.

                When executed, you should see the 3rd iteration of OBX removed from the group of OBX segments. To delete all of the OBX segments at once, simply remove the loop code completely and then uncomment the code agermano recommended.
                Code:
                delete msg.OBX
                screenShot.png


                Welcome to Mirth!!
                WOW, Thank you so much. Okay so I did some testing. Both with the full code and with just the
                Code:
                delete msg.OBX
                I got an error both times. Example of the ORM and the error are attached.

                Good news, the other two destinations still got the original message the error only happened on the two destinations where I have the code configured.
                Attached Files

                Comment


                • #9
                  The error relates to parsing the encoded segments, nothing to do with the code to remove them. You must be passing the message to the working destinations as raw data.

                  Instead of using the delete code, set the data types to raw data and use something like below in the transformer to strip the OBXs:

                  Code:
                  msg = msg.substring(0,msg.indexOf('OBX'))
                  Last edited by jkrebs; 02-19-2021, 08:44 PM. Reason: verbiage

                  Comment


                  • #10
                    See attached for cleaned up source HL7 message. The OBX segments were truncated to meet upload size limit. If the upstream system sends the corrected format, w/o the extra CRLF in the OBX segments, you can set the data types to HL7v2.x and use the delete code originally provided.
                    Attached Files
                    Last edited by jkrebs; 02-20-2021, 08:30 PM. Reason: file uploaded to meet size limits

                    Comment


                    • #11
                      I would recommend you download and read the manual. There is a lot of good information in the manual

                      https://www.nextgen.com/products-and...gine-downloads
                      Best,

                      Kirby

                      Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

                      Appliance Version 3.11.4
                      Mirth Connect Version 3.8.0
                      Java Version 1.6.0_45-b06
                      Java (64 bit) Version 1.6.0_45-b06
                      Java 7 (64 bit) Version 1.7.0_151-b15
                      Java 8 (64 bit) Version 1.8.0_181-b13
                      PostgreSQL Version 9.6.8

                      Comment


                      • #12
                        Originally posted by kirbykn2 View Post
                        I would recommend you download and read the manual. There is a lot of good information in the manual

                        https://www.nextgen.com/products-and...gine-downloads
                        Thank you I have been making my way through this already. It is very helpful.

                        Comment


                        • #13
                          Originally posted by jkrebs View Post
                          See attached for cleaned up source HL7 message. The OBX segments were truncated to meet upload size limit. If the upstream system sends the corrected format, w/o the extra CRLF in the OBX segments, you can set the data types to HL7v2.x and use the delete code originally provided.
                          I will be doing some more testing this evening so hopefully I will have some good news tomorrow. Also the source has made it very clear that they will not be adjusting the MSG at all, so it all falls on me to adjust as I need to.

                          Comment


                          • #14
                            Also the source has made it very clear that they will not be adjusting the MSG at all
                            In that case placing the below in the preprocessor script should cleanup HL7 messages like the one you shared. The inbound data type should be set to HL7v2.
                            Code:
                            var obxGrp = message.substr(message.indexOf('OBX\|'))
                            obxGrp = obxGrp.replace(/[\r\n]/g,'')
                            obxGrp = obxGrp.replace(/OBX\|/g,'\r\nOBX\|').slice(2)
                            message = message.substring(0,message.indexOf('OBX\|'))
                            message += obxGrp
                            return message
                            Don't expect it to solve all your troubles w/a system that passes bad data. If you spend some time w/the manual and searching the forum, you should find all the answers you need. Good Luck!

                            Comment


                            • #15
                              Originally posted by jkrebs View Post
                              In that case placing the below in the preprocessor script should cleanup HL7 messages like the one you shared. The inbound data type should be set to HL7v2.
                              Code:
                              var obxGrp = message.substr(message.indexOf('OBX\|'))
                              obxGrp = obxGrp.replace(/[\r\n]/g,'')
                              obxGrp = obxGrp.replace(/OBX\|/g,'\r\nOBX\|').slice(2)
                              message = message.substring(0,message.indexOf('OBX\|'))
                              message += obxGrp
                              return message
                              Don't expect it to solve all your troubles w/a system that passes bad data. If you spend some time w/the manual and searching the forum, you should find all the answers you need. Good Luck!
                              I was able to get this configured in the pre-processor and messages are coming over correctly now. So at least that is working I don't feel like a total failure. However, I am still unable to get the delete code to work. I am just using
                              Code:
                              delete msg.OBX
                              but nothing is happening. The entire message is still being sent to the destination(s).

                              I will play around some more tomorrow morning with the delete code and read through the manual a little more. I will report back tomorrow. Thanks again for all your help, this community rocks!

                              Comment

                              Working...
                              X