Archive for category Mirth

Mirth Connect Part 4 – Creating A Simple HL7 Interface

In this post I will go over how to create a simple HL7 interface that just accepts a HL7 message on a TCP port and then writes the message to a file. This will be a very simple interface, but it will get you familar with working with channels, sources, and destinations.

To begin, launch the Mirth Connect Administrator program, and go to the ‘Channels’ area.

Mirth Administrator Channels

A channel in Mirth is what I normally call a interface.  It contains the sources, destinations, and all of the transformations and filters that make up a interface.  So in order to create a new interface, we want to create a new Channel.  To create a new Channel, click on ‘New Channel’ under the ‘Channel Tasks’ section.  This will take you to the ‘Edit Channel’ window, and you will be on the summary tab.

Mirth Edit Channel

If you click on ‘Help on this topic’ under the ‘Other’ section you will be taken to the Mirth help page, which gives a good explanation of all the options on the summary tab.  I am going to name my channel ‘Simple Interface’, I am going to have it enabled, the incoming data is going to be HL7 2.x, I am going to synchronize the channel, and I am going to store the message data indefinitely.

Next click on the ‘Source’ tab to define the source for this interface.  The source is how the data goes into the interface.

Mirth Channel Source

Again, you can click on ‘Help on this topic’ under the ‘Other’ section to get a good description of all the options on this screen.  At the top of this window you select what type of connector you want to use.  You will see that Mirth offers a large number of options for contecting to data.  For this example we want to get HL7 information on a TCP socket.  Almost all HL7 interfaces that go over TCP use LLP as their protocal, so I will select the LLP Listener.

Since I am receiving the data, I want to configure the LLP Mode to Server, and I can just enter 127.0.0.1 to let it know that I want to listen on the local address.  You can pick whatever port you would like to listen to, for my example I will be listening on port 6661.  I am going to accept the default for the rest of the settings.  You can also specify filters and transformers on the source in order to filter out messages and make changes to the message, but I am not going to cover that in this post.

Next we need to create our destination.  The destination species where the data is sent to.  In Mirth you can have multiple destinations.  You can either always send the data to all destinations, or apply filters to determine what destination the data is sent to.  To create destinations you go to the ‘Destinations’ tab in the Edit Channel window.

Mirth File Destination

There will already be one destination created for you.  Just like the source, you select a Connector Type.  We want to write the HL7 message to a file, so select the ‘File Writer’ message type.  For the method select file, enter the directory that you want to write the file to.  For the file name, drag ‘Message ID’ over from the Destination Mappings area to the file name field to have it use the message id as the file name.  The template section determines what is written to the file, drag ‘Encoded Data’ from the Destination Mappings section to the Template filed to have it write the contents of the HL7 message to the file.

We now have the channel completed, click on ‘Save Changes’ under the Channel Tasks section in order to save the channel.  We now need to deploy the channel in order to make it active so we can use it.  Under the ‘Mirth Connect’ section click on ‘Channels’ to get back to the Channels window.  You will now see you channel listed.

Mirth Channel

To deploy your channel click on ‘Deploy All’ under the ‘Channel Tasks’ section.  Mirth will deploy your channel and switch to the Dashboard window.  We are now ready to test the interface.

There are multiple tools that are available that you can use to test the interface by sending a HL7 message to the interface.  I used HL7 Browser.  Open a HL7 message in HL7 Browser and send it to your local computer to port 6661.  You will see the dashboard in Mirth update to show that it sent the message, and you will see the HL7 message written out to a file.

Tags: ,

Mirth Connect Part 3 – Using SQL Server As The Mirth Database



When you install Mirth Connect it will b7 default use Derby as its database.  I am not real familar with Derby, and everything else I work with is in SQL Server so I wanted the Mirth database to be on SQL Server also.  This is pretty easy to accomplish with Mirth Connect.  You just need to create a blank database for Mirth to use along with a SQL login for it to use, and then point Mirth to this database.  I will show how to perform these steps.

Create A Blank SQL Server Database

  • Open SQL Server Management Studio and connect to the SQL Server that you want to use for the Mirth Connect database.
  • In the Object Explorer section, right click on the ‘Databases’ node and select ‘New Database’.

SQL Server Management Studio New Database

  • In the ‘New Database’ window give your database a name and clikc ‘OK’.

New Database Window

Create A SQL Login For Mirth

  • In SQL Management Studio, in the Object Explorer section, expand the Security node, and then right click on the Logins node and select ‘New Login…’Management Studio New Login
  • In the new login window, enter a user name, select ‘SQL Server authentication’ and enter a password for the user.  Uncheck the checkbox that says ‘User must change password at next login’, and set the default database to the database you just created for Mirth and select OK.

New Login Windows

  • In the Object Explorer section of Management Studio, expand the Databases node, then expand the node for the database you just created, and then expand the Security node.  Right click on the Users node and select ‘New User…’

Management Studio New User

  • In the Database User window, enter in the name of the user you just created in the ‘User name’ and ‘Login name’ fields.  Give the user the ‘db_owner’ role, and then click OK.

Connect Mirth To The SQL Server Database

  • Log onto the server where Mirth Connect is installed.
  • Open Mirth Connect Server Manager, and go to the database tab.
  • Change the ‘Type’ dropdown to sqlserver 2005.
  • In the URL field, change localhost to the name of your database server, and change mirthdb to the name of the database you created.  For example, if you database server is sqlserver01 and the database is MirthDatabase, then the value in the URL field should be jdbc:jtds:sqlserver://sqlserver01:1433/MirthDatabase.
  • In the Username field enter the username of the SQL account you created.
  • Enter the password for the SQL account in the password field.

  • Click the ‘OK’ button.
  • Mirth Connect is now using SQL Server as its database.

Tags: , ,