No announcement yet.

postgres source -> file destination

  • Filter
  • Time
  • Show
Clear All
new posts

  • postgres source -> file destination


    I'm having trouble getting started. Being new to this, I'm just going to describe in as much detail as I can what I've done, what I need, and hopefully one of you can give me a hint.

    A little background: I'm the lead programmer for my company's in-house practice management software. It's a JEE app, using JBoss and a Postgres backend. We are in the process of rolling out a software suite (Allscripts) that includes a prescription writing component and an EMR package. I need to send patient demographics to Allscripts via HL7 (file or TCP), and make my app capable of receiving HL7 messages so we can bill when meds are dispensed.

    I've downloaded the mirth.sar package for JBoss, configured it, created the mirthdb (postgres) database, and launched JBoss. I was able to get into the Mirth Administrator. I set up a "test channel" as follows:

    - source is "database reader".
    driver is postgresql.
    URL is jdbcostgresql://x.x.x.x:5432/MEDPLUS. (no "test connectivity" option?)
    polling interval 5000 ms
    use javascript=yes:

    var dbConn = DatabaseConnectionFactory.createDatabaseConnection('org.postgresql.Driver','jdbc:«»postgresql://x.x.x.x:5432/MEDPLUS','postgres','*******');
    var result = dbConn.executeCachedQuery("expression"«»);
    var Query = "SELECT patientid FROM patients where allscripts_processed=FALSE";
    var result = dbConn.executeCachedQuery(Query);
    while ( {
       var patientID = result.getInt("patientid"«»);
       msg['PID']['PID.3']['PID.3.1'] = patientID;
    // You may access this result with $('column_name')
    return result;

    Run on update statement=yes:

    // This update script will be executed once for ever result returned from the above query.
    var dbConn = DatabaseConnectionFactory.createDatabaseConnection('org.postgresql.Driver','jdbc:«»postgresql://x.x.x.x:5432/MEDPLUS','postgres','****');
    var result = dbConn.executeUpdate("update patients set allscripts_processed=TRUE where patientid=70756"«»);
    (The 70756 above is just for testing, I wasn't sure of the syntax to use, probably $('patientid') ).

    For destination, I've tried both Email sender and File Writer. I've neither received an email nor seen a file. My transformer on the destination side looks like:

    Message segment: tmp['PID']['PID.3']['PID.3.1']
    Mapping: msg['patientid'].toString()


    I'm pretty sure my database is never getting polled. If it were, I should see the "allscripts_processed" field set to TRUE for patientid=70756, but I'm not.

    I've also tried running the mirth server outside of JBoss, but it doesn't help.

    I don't see any useful errors / log entries. I'm probably missing a step, but documentation seems kind of lacking (for what otherwise appears to be a great product).

    I'm hoping someone here can give me a nudge in the right direction.



  • #2
    Reostgres source -> file destination

    To me, your script looks about right. Are you sure you don't see any error in the log? There has to be something that indicates something's wrong.

    or you can log it yourself using logger.error();

    logger.error("** result = " + result); and see if the DB is actually polled.
    Chris Ro
    Sr. Software Engineer | Mirth Corporation


    • #3
      Reostgres source -> file destination

      I figured it out. I just didn't deploy the channels... they were enabled, but not deployed.

      But now I get:

      ERROR 2008-04-25 22:33:27,844 [3decd9d9-341d-4fdb-baf3-67974fe48945_source_connector._jdbcEndpoint#157986 6383.receiver.1] com.webreach.mirth.connectors.jdbc.JdbcMessageRece iver: Got a result of: [email protected]