Creating a Mirth Channel for the DHIS Connector Module

Channel Overview

The channel configuration that we used for OpenMRS to DHIS integration is as follows:

  • Source:
    • The source is a SOAP listener as the Mirth Messaging Module that I wrote uses web services and SOAP messages to communicate with Mirth.
  • Destination:
    • The destination is set to be a file writer, it has a transformer attached to it that can take in an HL7 message and convert it into files that DHIS can understand. The files that this transformer generates are then written to a "working directory".
  • Post Processing script:
    • The post processing script runs after each message has been processed. It takes the relevant files in the working directory and zips them up into the 7zip archiving format as DHIS imports files using this format. The archive file is then written to an output directory.

For this channel to work automatically Mirth should be installed on the same system that DHIS 1.4 is running on. If this isn't feasible, this channel could still be used to generate the DHIS import file and the file could then be sent to the DHIS using conventional methods (ie. email, secondary storage).

If automation is required and Mirth cannot be installed on the DHIS system, Mirth could be setup to sent the 7zip file over ftp (or similar) to DHIS.

Channel Configuration

First off, you will need to download the channel template. You can get it here OpenMRS-DHISchannel.zip.

Then you will need to download this library. It performs the transformation of the HL7 message into a files that DHIS 1.4 can understand.

  • Double click on the Mirth server manager in the task bar
  • Click stop to stop the server, click ok
  • Copy the jar file of the library you downloaded to "$/Mirth/lib/" folder (where $ is the directory that Mirth is installed)
  • Double click on the Mirth server manager in the task bar
  • Click start to restart the server, click ok

Setting up the Channel:

  • Double click on the Mirth server manager in the task bar
  • Click "Administrator"
  • Enter your username and password (Default is "admin" pass: "admin")
  • This should bring you to the Mirth dashboard, now click on the "Channels" link
  • Click "Import Channel"
  • This brings up a dialog box, choose the xml file that you downloaded above
  • Click Open and the Channel is imported
  • Double click on the newly imported channel to edit it
  • Click on the "Destination" tab
    • Change the "Directory:" field to the working directory that you want the Mirth Channel to use (make sure this directory exists)
    • Click on "Edit Transfomer"
    • In the javascript set the "dataFileDir" variable to the working directory used above
  • Click "Back to Channel" link
  • Click on the "Scripts" tab
    • Choose "Postprocessor" from the drop down box
    • Change the "inputDir" variable to the working directory used above
    • Change the "outputDir" to the directory that you want the output files to be written (usually "C:/Dhis14/Transfer/")
    • Change the "zipDir" to the directory that contains the 7zip stand alone console program (it comes standard when DHIS is installed, usually in "C:/Dhis14/". If you don't have this tool you can get it from http://mesh.dl.sourceforge.net/sourceforge/sevenzip/7za457.zip)
  • Click "Save Changes"
  • Click on "Channels"
  • And click "Deploy All"

The channel is now deployed and ready for use!