Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Removing part of OBR Segment

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

  • Removing part of OBR Segment

    I am sending HL7 results to Mirth but need to edit the OBR2 segment if it has two values. I was going to have two destinations. One to handle the first value in the OBR2 segment and another to handle the second value. I need to know how to delete the first value out of the OBR segment (everything from the ^ and before it).

    Example Message.
    MSH|^~\&|FUSION|WIT|MEDITECH||20080708154438||ORU^ R01|20080708154258MDEATER|P|2.2
    PID|1||M0000023||DUCK^DONALD TESTPATI|||||||||||||V000004051
    OBR|1|RAD20080708-0002^RAD20080708-0003|38|RAD|||20080708154200|20080708154200||||||| |ISGIRL^Information Systems Girl||||DI|RADS2||||D|||||||FRIST^Steven Fritsch^M.D.|||MDEATER
    OBX|1|TX|||TEST REPORT - With two orders in the same category. RAD
    OBX|2|TX
    OBX|3|TX|||The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
    OBX|4|TX|||the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
    OBX|5|TX|||fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    OBX|6|TX|||The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
    OBX|7|TX|||the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
    OBX|8|TX|||fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    OBX|9|TX|||The quick brown fox jumps over the lazy dog. The quick brown fox jumps over
    OBX|10|TX|||the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown
    OBX|11|TX|||fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
    OBX|12|TX
    OBX|13|TX
    OBX|14|TX
    OBX|15|TX
    OBX|16|TX
    OBX|17|TX
    OBX|18|TX
    OBX|19|TX

    In this example message, I want to have a transform rule to remove the 'RAD20080708-0002^' out of OBR2 segment. Does anyone know how this can be done.

    Thanks,
    Paul

  • #2
    Re:Removing part of OBR Segment

    It all depends. You are talking about to different fields. EntityIdentifier [OBR.2.1] and NamespaceID [OBR.2.2].

    So it all depends what you what to happen. In what you stated below, you want to remove OBR.2.1. Do you want to just move the text? So it would look like this?

    OBR|1|^RAD20080708- 0003|.....

    What I think you want is to replace the text in OBR.2.1 with OBR.2.2 then remove OBR.2.2 from the message. So that it would look like this:

    OBR|1|RAD20080708- 0003|38|RAD|||20080708154200|20080708154200.......

    If the last option is right, try this. I havn't tested this but I'd think it would work:

    msg['OBR'][0]['OBR.2']['OBR.2.1'] = msg['OBR'][0]['OBR.2']['OBR.2.2'].toString();
    delete msg['OBR'][0]['OBR.2']['OBR.2.2'];

    Now this assumes there is always an OBR.2.2. If this isn't the case you will have to add checks and balances to confirm it there before you try changing it. If you have more than 1 OBR in a segment you'd have to loop through and do this to all of them. Something like this:

    for each( var obr in msg.OBR )
    {
    obr['OBR.2']['OBR.2.1'] = obr['OBR.2']['OBR.2.2'].toString();
    delete obr['OBR.2']['OBR.2.2'];
    }

    Never tried the delete method this way, again I'd assume it works.

    Comment


    • #3
      Re:Removing part of OBR Segment

      Thanks a lot for your help. This code worked great.

      One other question. Is there a wildcard character in Mirth? I want to perform an if statement on just part of the OBR2.1 segment so that I can populate the OBR4.1 segement.

      Example:
      if (msg['OBR'][0]['OBR.2']['OBR.2.1'].toString() == "US*") {
      msg['OBR']['OBR.4']['OBR.4.1'] = 'US';

      The OBR2.1 segment can be different order numbers that always start with the catagory name. Example US20080707-0001. I want to look at the beginning letters and then populate the OBR4.1 segment.

      Thanks,
      Paul

      Comment

      Working...
      X