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

Processing Mirth's output files

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

  • Processing Mirth's output files

    I'm fairly new to Mirth. I'm coding an app that will 'listen' for Mirth to deliver a file. When the app detects that a new file is available from Mirth I'm going to process the contents of that file into a DB.
    Currently the design assumes that the name of the file delivered by Mirth will be fixed.
    For example, mirthdata.xml.
    My question is this.
    In the event, presumably common, that Mirth delivers a new file while my app is processing the previous file what options does Mirth have for waiting until that processing finishes to avoid conflicts?
    For background, my 'listening' code is based on Apache Commons VFS. I create a thread that uses this API to detect timestamp changes on a file, and when a change is detected, it calls the DB access code.
    Any ideas appreciated, even better ones. :>)

  • #2
    Re:Processing Mirth's output files

    if the file contains HL7 data, why don't you use Mirth to place the data in the DB?
    Reid Hospital and Healthcare

    Comment


    • #3
      Re:Processing Mirth's output files

      Thanks for your interesting response. I was unaware that Mirth could directly access a DB. I have written lots of code to handle the DB loading from an XML file that's generated by Mirth. ie; AS400 app exports file to Mirth. Mirth transforms this file into an XML file which I use as input to the DB loading code.
      I know that I can setup Mirth to fire my DB loading code but that code still has to be written - Mirth doesn't know what my DB looks like, or does it?
      Looking forward to reading your response.

      Comment


      • #4
        Re:Processing Mirth's output files

        There is a sample channel called "Workaround to call a stored procedure from Mirth" that can be found at: http://www.mirthproject.org/index.ph...d=19&Itemid=43

        Mirth doesn't need to know what your database looks like. You control that in the javascript code itself.

        I went off this same sample channel. I have a SQL Server 2005 database that has a stored procedure that will process all my transactions. I have variables that hold the various information, an example below:
        Code:
           // Patient gender
           if (msg['PID']['PID.8']['PID.8.1'].toString() != null) {   
              tempGender = "'" + msg['PID']['PID.8']['PID.8.1'].toString() + "'";
           }
        Then I take all the variables and send them to the stored procedure:
        Code:
        //DatabaseConnection 
        var dbConn = DatabaseConnectionFactory.createDatabaseConnection('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:«»sqlserver://localhost:1433/Openlink;','java','java1');
        //Get parameters for the stored proc separated by , 
           
        var spParams = tempMRN  + ', ' + tempPID     + ', ' + 
        	       tempLastName  + ', ' + tempFirstName + ', ' + 
        	       tempMiddleName   + ', ' + tempBirthDate     + ', ' + 
        	       tempGender   + ', ' + tempModifiedSSN + ', ' + 
        	       tempAttendID + ', ' + tempAttendPhy + ', ' + 
                       tempNurseStat     + ', ' + tempRoomNum + ', ' + 
                       tempDischargeDate + ', ' + tempAddress1 + ', ' + 
        	       tempCity       + ', ' + tempState      + ', ' + 
        	       tempZipCode    + ', ' + tempPhone1 + ', ' + 
        	       tempADTCode + ', ' + tempAdmitDate + ', ' + 
        	       tempPatType;
        
        var expression = "EXEC process_adt " + spParams;   
        
        // Print the SQL statement for debugging purpose
        //logger.info('SQL: ' + expression);
        
        //Execute SQL statement.
        var result = dbConn.executeQuery(expression); 
        
        //logger.info(result); 
        
        //cleanup 
        result.close(); 
        dbConn.close();
        You can also change the expression variable to say "insert into (....) values(...)" rather than send information to a stored procedure.
        Reid Hospital and Healthcare

        Comment


        • #5
          Re:Processing Mirth's output files

          You can also use the DB Writer connector, however you might need to install the AS400 driver into Mirth.
          Chris Lang

          Comment

          Working...
          X