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

UUDecode GE Muse

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

  • UUDecode GE Muse

    Ver: Mirth 1.7.1.3422

    I need to decode a UUDecode TIF from GE Muse. I have been able to replace all of the characters in the ZPD3.3 segment to create a proper UUEncoded text string. I can write that string to a file and UUDecode using another utility and get by TIF image. My issue is doing the decode from within Mirth.

    Here is the code I am using:
    Code:
    var ZPD = msg['ZPD']['ZPD.3']['ZPD.3.3'].toString();
    
    ZPD = ZPD.replace(/\\F\\/g,'|');
    ZPD = ZPD.replace(/\\S\\/g,'^');
    ZPD = ZPD.replace(/\\T\\/g,'&');
    ZPD = ZPD.replace(/\\R\\/g,'~');
    ZPD = ZPD.replace(/\\E\\/g,'\');
    ZPD = ZPD.replace(/\\X0D\\/g,'\r');
    ZPD = ZPD.replace(/\\X0A\\/g,'\n');
    
    var tifDecode = FileUtil.decode(ZPD);
    As you can see, I tried using Mirth's Base64 decode. But UUEncode and Base64 are two differnt methods. The resulting file is garbage.

    Has anyone been able to UUDecode from within Mirth?

  • #2
    Re:UUDecode GE Muse

    You can use java funcions from Mirth.

    To use SUn decode, try:
    Code:
    var ud=package.sun.misc. SunUUEncode;
    
    var tf=ud.decode(msg['ZPD']['ZPD.3']['ZPD.3.3'].toString());

    Comment


    • #3
      Re:UUDecode GE Muse

      You can use java funcions from Mirth.

      To use SUn decode, try:
      Code:
      var ud=package.sun.misc. SunUUEncode;
      
      var tf=ud.decode(msg['ZPD']['ZPD.3']['ZPD.3.3'].toString());

      Comment


      • #4
        Re:UUDecode GE Muse

        I tried the code and received the following error:

        Code:
        ERROR-300: Transformer error
        ERROR MESSAGE:	Error evaluating transformer
        com.webreach.mirth.server.MirthJavascriptTransformerException: 
        CHANNEL:	TIF via HL7
        CONNECTOR:	Destination 1
        SCRIPT SOURCE:	
        LINE NUMBER:	31
        DETAILS:	TypeError: decode is not a function, it is org.mozilla.javascript.NativeJavaPackage.
        	at com.webreach.mirth.server.mule.transformers.JavaScriptTransformer.evaluateScript(JavaScriptTransformer.java:439)
        	at com.webreach.mirth.server.mule.transformers.JavaScriptTransformer.transform(JavaScriptTransformer.java:346)
        I have attached a copy of my channel for reference. TIF_via_HL7.xml (160951 bytes)

        Post edited by: wseay, at: 07/25/2008 14:10

        Comment


        • #5
          Re:UUDecode GE Muse

          Hi.

          I was showing an example of how o use a java function in Mirth. You can find the right syntax for UUEncode at google, or you could use your own function.

          Code:
            var ud=package.sun.misc. SunUUEncode;
            var tf=ud.encode(msg['ZPD']['ZPD.3']['ZPD.3.3'].toString().getBytes("UTF-8"«»);
          Post edited by: albertosaez, at: 07/29/2008 05:58

          Comment


          • #6
            Re:UUDecode GE Muse

            I have the syntax I need. But I still get errors when calling the Java class.

            In your code sample I see you create 'decodeBuffer,' but that never gets called.

            I'm sorry if I appear dense. Do you have a working Mirth code sample that would call decode?

            The sample channel in the previous post contains a UUEncoded tif.

            Post edited by: wseay, at: 07/28/2008 15:22

            Comment


            • #7
              Re:UUDecode GE Muse

              wseay wrote:
              I have the syntax I need. But I still get errors when calling the Java class.
              Can you post the code you're using to call the Java UUDecode?
              Jon Bartels

              Zen is hiring!!!!
              http://consultzen.com/careers/
              Talented healthcare IT professionals wanted. Engineers to sales to management.
              Good benefits, great working environment, genuinely interesting work.

              Comment


              • #8
                Re:UUDecode GE Muse

                I haven't tried it from Mirth yet, I did this awhile ago with a java class in relation to GE ( http://www.clubpacswestmi.net/articl...ion-with-mirth )... but what I did find, is that you will have to iterate over it char by char, then replace it...

                my java code in the blog post above shows this iteration to remove the HL7 escape chars BEFORE decoding.

                Comment


                • #9
                  Re:UUDecode GE Muse

                  Hopefully I am down to the wire on this issue.

                  Using Mirth, I am able to un-escape the codes in my UUEncoded message. Now I am trying to get Mirth to UUDecode and write the file.

                  For this example, the following code is the only reference to the Java class.
                  Whenever I try calling a Java class:
                  Code:
                  // Thanks to sween for his code and samples
                  var ud = new Packages.sweeney.StripDecode();
                  I receive the following:
                  CHANNEL: TIF via HL7
                  CONNECTOR: Destination 1
                  SCRIPT SOURCE:
                  LINE NUMBER: 20
                  DETAILS: TypeError: [JavaPackage sweeney.StripDecode] is not a function, it is org.mozilla.javascript.NativeJavaPackage.
                  I get this '...NativeJavaPackage' message for every class I try to call. The 'StripDecode.class' is in 'lib\custom'.

                  Comment


                  • #10
                    Re:UUDecode GE Muse

                    ok, I have to start with asking if you restarted mirth after the .jar upload. It only reads in this directory on restart, not dynamically.

                    Comment


                    • #11
                      Re:UUDecode GE Muse

                      Mirth was restarted.

                      When compiling the decode code, I only created a .class file and moved that to \lib\custom. Would that be a newbie mistake?

                      Comment


                      • #12
                        Re:UUDecode GE Muse

                        try the .jar...

                        wget http://www.clubpacswestmi.net/mirth/StripDecode.jar should do the trick...

                        this assumes you didnt modify anything... give it a shot and let me know....

                        Comment


                        • #13
                          Re:UUDecode GE Muse

                          WOW!!

                          Using the jar with the following code, I have what I need.

                          Code:
                          var a = new Packages.sweeney.StripDecode();
                          var b = a.strip($('zPD'),"c:\\\\EMCData\\\\Hl7PDF\\\\uue.tmp"«»);
                          var c = a.decode("c:\\\\EMCData\\\\Hl7PDF\\\\uue.tmp", "c:\\\\EMCData\\\\Hl7PDF\\\\uue.tif"«»);
                          Thank you so much for your help!

                          Walter Seay

                          Post edited by: wseay, at: 07/29/2008 15:35

                          Comment


                          • #14
                            Sorry for the bump ... but I'm really interested in that StripDecode.jar file.
                            Anyone can help me out with this please?
                            I also need to UUdecode ...
                            Thanks!

                            Comment


                            • #15
                              You can try this (replace the part highlighted in red):

                              Code:
                              var inputStream = org.apache.commons.io.IOUtils.toInputStream([B][COLOR="Red"]uuencodedString[/COLOR][/B], 'US-ASCII');
                              inputStream = javax.mail.internet.MimeUtility.decode(inputStream, 'uuencode');
                              var byteArray = org.apache.commons.io.IOUtils.toByteArray(inputStream);
                              From there you have the raw byte array and can do whatever you want with it. For example if you want to convert it to Base64, you can do that easily with FileUtil.
                              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

                              Working...
                              X