Announcement

Collapse

NextGen (Mirth) Connect 3.9.1 Released!

NextGen (Mirth) Connect 3.9.1 is now available as an appliance update and on our GitHub page. This release contains bug fixes and adds support for eHealth Exchange UDDI providers in the Interoperability plugin. 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

Building an HL7 message from fields of a database - Critical Error

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

  • Building an HL7 message from fields of a database - Critical Error

    Being New to Mirth am still working my way around. Please excuse me if this has been answered before. I have been trying to create an HL7 message(say ADT A08) using Mirth connecting to a database(MySql).

    I have created an outbound channel with source: Database reader (I'm using Select statement(s) to get database variables i'll need to populate the message) and Destination: file writer (where I define a transformation for each message segment PID, PV1,...).

    For the transformation how do I define which database variable is to populate the HL7 message stucture?
    For Example, I want my database variable 'pno' to be filled in ['PID']['PID.4']['CX.1']. How can I define this?
    hl7_xml['PID']['PID.4']['CX.1']=msg['pno'] ?

    Am I using the correct method to create the message or is there any other way of achieving this? I could not find any documentation on this.

    Thank you
    Anna

  • #2
    Re: Building an HL7 message from fields of a database

    Anna,
    In the File Repository there are several example channels that you can import to see how the mappings can be done. It is really quite simple. Two steps.
    1. Use the Tranformer to create steps to map each HL7 field to a variable.
    2. In the destination section, insert into your database the variables that were mapped.

    Check out the example channels. They really helped me get started.
    Good luck!

    Comment


    • #3
      Re: Building an HL7 message from fields of a database - critical error

      managed to create the hl7 message for a bit, but then the channel does not seem to be deployable. I get the following critical error while trying to:

      com.webreach.mirth.client.core.ClientException: method failed: HTTP/1.1 500 java%2Ermi%2EUnmarshalException%3A+Error+unmarshal ing+return%3B+nested+exception+is%3A+%0A%09java%2E net%2EMalformedURLException%3A+no+protocol%3A+File s%2FMirth%2F%2E%2Fmirth%2Dserver%2Ejar
      com.webreach.mirth.client.core.ServerConnection.ex ecutePostMethod(ServerConnection.java:59)
      com.webreach.mirth.client.core.Client.startChannel (Client.java:247)
      com.webreach.mirth.client.ui.Frame.doStartAll(Fram e.java:1415)
      com.webreach.mirth.client.ui.Frame$24.actionPerfor med(Frame.java:677)
      javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
      javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
      javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
      javax.swing.DefaultButtonModel.setPressed(Unknown Source)
      javax.swing.AbstractButton.doClick(Unknown Source)
      javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unk nown Source)
      javax.swing.plaf.basic.BasicMenuItemUI$Handler.mou seReleased(Unknown Source)
      java.awt.Component.processMouseEvent(Unknown Source)
      javax.swing.JComponent.processMouseEvent(Unknown Source)
      java.awt.Component.processEvent(Unknown Source)
      java.awt.Container.processEvent(Unknown Source)
      java.awt.Component.dispatchEventImpl(Unknown Source)
      java.awt.Container.dispatchEventImpl(Unknown Source)
      java.awt.Component.dispatchEvent(Unknown Source)
      java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
      java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
      java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
      java.awt.Container.dispatchEventImpl(Unknown Source)
      java.awt.Window.dispatchEventImpl(Unknown Source)
      java.awt.Component.dispatchEvent(Unknown Source)
      java.awt.EventQueue.dispatchEvent(Unknown Source)
      java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)
      java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
      java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      java.awt.EventDispatchThread.pumpEvents(Unknown Source)
      java.awt.EventDispatchThread.run(Unknown Source)

      The channel I created seems to be having this problem. Other channels when deployed don't seem to have any problems! any suggestions?

      Comment


      • #4
        Re: Building an HL7 message from fields of a database - Critical Error

        Are you using Mirth version 1.2?
        Chris Lang

        Comment


        • #5
          Re: Building an HL7 message from fields of a database - Critical Error

          Thank you Chris & Arumpke for your response,

          About Mirth Version I'm using Version 1.1.0 , Built on August 28, 2006. Do I have to update my mirth version to get the problem sorted out?

          Comment


          • #6
            Re: Building an HL7 message from fields of a database - Critical Error

            anna,

            Try updating to Mirth 1.2. It will most likely fix this problem.

            -Brendan
            Brendan Haverlock | Mirth Software Engineer | Mirth Corporation

            Comment


            • #7
              Re: Building an HL7 message from fields of a database - Critical Error

              Chris & Brendan,

              Thank you for your response.
              I have updated mirth to 1.2. There still seems to be a problem. The error i get is:

              org.mozilla.javascript.EcmaError: ReferenceError: "hl7_xml" is not defined. (a23850ac-6ea1-4d5c-8457-581add4d3af6#1)
              at org.mozilla.javascript.ScriptRuntime.constructErro r(ScriptRuntime.java:3226)
              at org.mozilla.javascript.ScriptRuntime.constructErro r(ScriptRuntime.java:3216)
              at org.mozilla.javascript.ScriptRuntime.notFoundError (ScriptRuntime.java:3289)
              at org.mozilla.javascript.ScriptRuntime.nameOrFunctio n(ScriptRuntime.java:1633)
              at org.mozilla.javascript.ScriptRuntime.name(ScriptRu ntime.java:1572)
              at org.mozilla.javascript.gen.c3._c1(a23850ac-6ea1-4d5c-8457-581add4d3af6:1)
              at org.mozilla.javascript.gen.c3.call(a23850ac-6ea1-4d5c-8457-581add4d3af6)
              at org.mozilla.javascript.optimizer.OptRuntime.callNa me0(OptRuntime.java:106)
              at org.mozilla.javascript.gen.c3._c0(a23850ac-6ea1-4d5c-8457-581add4d3af6:1)
              at org.mozilla.javascript.gen.c3.call(a23850ac-6ea1-4d5c-8457-581add4d3af6)
              at org.mozilla.javascript.ContextFactory.doTopCall(Co ntextFactory.java:337)
              at org.mozilla.javascript.ScriptRuntime.doTopCall(Scr iptRuntime.java:2755)
              at org.mozilla.javascript.gen.c3.call(a23850ac-6ea1-4d5c-8457-581add4d3af6)
              at org.mozilla.javascript.gen.c3.exec(a23850ac-6ea1-4d5c-8457-581add4d3af6)
              at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.evaluateOutboundTransformerScript( JavaScriptTransformer.java:343)
              at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.doTransform(JavaScriptTransformer. java:178)
              at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
              at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
              at org.mule.providers.file.FileMessageDispatcher.doDi spatch(FileMessageDispatcher.java:68)
              at org.mule.providers.AbstractMessageDispatcher$Worke r.run(AbstractMessageDispatcher.java:257)
              at org.mule.impl.work.WorkerContext.run(WorkerContext .java:290)
              at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:650)
              at edu.emory.mathcs.backport.java.util.concurrent.Thr eadPoolExecutor$Worker.run(ThreadPoolExecutor.java :675)
              at java.lang.Thread.run(Thread.java:595)

              Any suggesstions?
              Anna

              Comment


              • #8
                Re: Building an HL7 message from fields of a database - Critical Error

                This is a different error.

                There is a problem with the update from 1.x to 1.2 You need to re-edit all your javascript, because the carriage return are lost.

                Comment


                • #9
                  Re: Building an HL7 message from fields of a database - Critical Error

                  I uninstalled (UninstallMirth-NT.bat) and reinstalled (InstallMirth-NT.bat) the Mirth setup. Ive been successfully able to deploy inbound channel that picks up HL7 message from a text file and sends it to an external dummy system. When I try to deploy the outbound channel that picks data from a MySQL database and creates a text HL7 message, I get the following error:


                  Running Java 1.5.0_06 on Windows 2000 (5.0, x86)
                  ERROR 2006-11-28 10:19:14,046 [Thread-0] org.apache.commons.digester.Digester: E
                  nd event threw exception
                  java.lang.reflect.InvocationTargetException
                  at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
                  at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.
                  java:39)
                  at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAcces
                  sorImpl.java:25)
                  at java.lang.reflect.Method.invoke(Method.java:585)
                  at org.apache.commons.beanutils.MethodUtils.invokeMet hod(MethodUtils.jav
                  a:216)
                  at org.apache.commons.digester.SetRootRule.end(SetRoo tRule.java:209)
                  at org.apache.commons.digester.Rule.end(Rule.java:230 )
                  at org.apache.commons.digester.Digester.endElement(Di gester.java:1130)
                  at org.apache.xerces.parsers.AbstractSAXParser.endEle ment(Unknown Source
                  )
                  at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanEndElement(
                  Unknown Source)
                  at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl$FragmentContent
                  Dispatcher.dispatch(Unknown Source)
                  at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanDocument(Un
                  known Source)
                  at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
                  at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
                  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                  at org.apache.xerces.parsers.AbstractSAXParser.parse( Unknown Source)
                  at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser .parse(Unknown Sour
                  ce)
                  at org.apache.commons.digester.Digester.parse(Digeste r.java:1685)
                  at org.mule.config.builders.AbstractDigesterConfigura tion.process(Abstra
                  ctDigesterConfiguration.java:119)
                  at org.mule.config.builders.MuleXmlConfigurationBuild er.configure(MuleXm
                  lConfigurationBuilder.java:202)
                  at org.mule.config.builders.MuleXmlConfigurationBuild er.configure(MuleXm
                  lConfigurationBuilder.java:194)
                  at com.webreach.mirth.server.Mirth.startMule(Mirth.ja va:131)
                  at com.webreach.mirth.server.Mirth.restartMule(Mirth. java:117)
                  at com.webreach.mirth.server.Mirth.run(Mirth.java:98)
                  Caused by: org.mule.umo.lifecycle.InitialisationException: Initialisation Failur
                  e: syntax error (26d22426-0eaa-4118-ba2b-a58aa88328be#1)
                  at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.ini
                  tialise(JavaScriptTransformer.java:162)
                  at org.mule.MuleManager.registerTransformer(MuleManag er.java:564)
                  ... 24 more
                  Caused by: org.mozilla.javascript.EvaluatorException: syntax error (26d22426-0ea
                  a-4118-ba2b-a58aa88328be#1)
                  at org.mozilla.javascript.DefaultErrorReporter.runtim eError(DefaultError
                  Reporter.java:95)
                  at org.mozilla.javascript.DefaultErrorReporter.error( DefaultErrorReporte
                  r.java:82)
                  at org.mozilla.javascript.Parser.addError(Parser.java :122)
                  at org.mozilla.javascript.Parser.reportError(Parser.j ava:128)
                  at org.mozilla.javascript.Parser.primaryExpr(Parser.j ava:2013)
                  at org.mozilla.javascript.Parser.memberExpr(Parser.ja va:1640)
                  at org.mozilla.javascript.Parser.unaryExpr(Parser.jav a:1503)
                  at org.mozilla.javascript.Parser.mulExpr(Parser.java: 1432)
                  at org.mozilla.javascript.Parser.addExpr(Parser.java: 1413)
                  at org.mozilla.javascript.Parser.shiftExpr(Parser.jav a:1393)
                  at org.mozilla.javascript.Parser.relExpr(Parser.java: 1367)
                  at org.mozilla.javascript.Parser.eqExpr(Parser.java:1 323)
                  at org.mozilla.javascript.Parser.bitAndExpr(Parser.ja va:1312)
                  at org.mozilla.javascript.Parser.bitXorExpr(Parser.ja va:1301)
                  at org.mozilla.javascript.Parser.bitOrExpr(Parser.jav a:1290)
                  at org.mozilla.javascript.Parser.andExpr(Parser.java: 1278)
                  at org.mozilla.javascript.Parser.orExpr(Parser.java:1 266)
                  at org.mozilla.javascript.Parser.condExpr(Parser.java :1249)
                  at org.mozilla.javascript.Parser.assignExpr(Parser.ja va:1231)
                  at org.mozilla.javascript.Parser.assignExpr(Parser.ja va:1237)
                  at org.mozilla.javascript.Parser.expr(Parser.java:122 0)
                  at org.mozilla.javascript.Parser.statementHelper(Pars er.java:1107)
                  at org.mozilla.javascript.Parser.statement(Parser.jav a:619)
                  at org.mozilla.javascript.Parser.parseFunctionBody(Pa rser.java:413)
                  at org.mozilla.javascript.Parser.function(Parser.java :519)
                  at org.mozilla.javascript.Parser.parse(Parser.java:34 4)
                  at org.mozilla.javascript.Parser.parse(Parser.java:28 9)
                  at org.mozilla.javascript.Context.compileImpl(Context .java:2190)
                  at org.mozilla.javascript.Context.compileString(Conte xt.java:1284)
                  at org.mozilla.javascript.Context.compileString(Conte xt.java:1273)
                  at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.ini
                  tialise(JavaScriptTransformer.java:158)
                  ... 25 more
                  WARN 2006-11-28 10:19:14,093 [Thread-0] com.webreach.mirth.server.Mirth: Error
                  deploying channels.
                  org.mule.config.ConfigurationException: Failed to parse configuration resource "
                  C:\Program Files\Mirth\conf\mule-config.xml" (org.mule.config.ConfigurationExcep
                  tion)
                  at org.mule.config.builders.MuleXmlConfigurationBuild er.configure(MuleXm
                  lConfigurationBuilder.java:196)
                  at com.webreach.mirth.server.Mirth.startMule(Mirth.ja va:131)
                  at com.webreach.mirth.server.Mirth.restartMule(Mirth. java:117)
                  at com.webreach.mirth.server.Mirth.run(Mirth.java:98)
                  Caused by: org.mule.config.ConfigurationException: Failed to parse configuration
                  resource "C:\Program Files\Mirth\conf\mule-config.xml"
                  at org.mule.config.builders.AbstractDigesterConfigura tion.process(Abstra
                  ctDigesterConfiguration.java:121)
                  at org.mule.config.builders.MuleXmlConfigurationBuild er.configure(MuleXm
                  lConfigurationBuilder.java:202)
                  at org.mule.config.builders.MuleXmlConfigurationBuild er.configure(MuleXm
                  lConfigurationBuilder.java:194)
                  ... 3 more
                  Caused by: org.mule.umo.lifecycle.InitialisationException: Initialisation Failur
                  e: syntax error (26d22426-0eaa-4118-ba2b-a58aa88328be#1)
                  at org.apache.commons.digester.Digester.createSAXExce ption(Digester.java
                  :2919)
                  at org.apache.commons.digester.Digester.createSAXExce ption(Digester.java
                  :2945)
                  at org.apache.commons.digester.Digester.endElement(Di gester.java:1133)
                  at org.apache.xerces.parsers.AbstractSAXParser.endEle ment(Unknown Source
                  )
                  at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanEndElement(
                  Unknown Source)
                  at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl$FragmentContent
                  Dispatcher.dispatch(Unknown Source)
                  at org.apache.xerces.impl.XMLDocumentFragmentScannerI mpl.scanDocument(Un
                  known Source)
                  at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
                  at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
                  at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                  at org.apache.xerces.parsers.AbstractSAXParser.parse( Unknown Source)
                  at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser .parse(Unknown Sour
                  ce)
                  at org.apache.commons.digester.Digester.parse(Digeste r.java:1685)
                  at org.mule.config.builders.AbstractDigesterConfigura tion.process(Abstra
                  ctDigesterConfiguration.java:119)
                  ... 5 more


                  I think that it's got to do with the outbound channel's configuration. Any suggestions?

                  Comment


                  • #10
                    Re: Building an HL7 message from fields of a database - Critical Error

                    It appears that you have a syntax error in your transformer Javascript. Can you post your transformer here?

                    Thanks,
                    -Chris
                    Chris Lang

                    Comment


                    • #11
                      Re: Building an HL7 message from fields of a database - Critical Error

                      Chris,

                      I'm posting the contents of the Mirth\conf\mule-config.xml file.. I hope this is what is needed:

                      - <com.webreach.mirth.model.Transformer>
                      - <steps>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>0</sequenceNumber>
                      <name>tmp[&#039;MSH&#039;][&#039;MSH.10&#039;]</name>
                      <script>tmp[&#039;MSH&#039;][&#039;MSH.10&#039;] = var uuid = UUIDGenerator.getUUID();;</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>var uuid = UUIDGenerator.getUUID();</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;MSH&#039;][&#039;MSH.10&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>1</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.2&#039;][&#039;CX.1&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.2&#039;][&#039;CX.1&#039;] = msg[&#039;pid&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;pid&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.2&#039;][&#039;CX.1&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>2</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.5&#039;][&#039;XPN.2&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.5&#039;][&#039;XPN.2&#039;] = msg[&#039;name_first&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;name_first&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.5&#039;][&#039;XPN.2&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>3</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.5&#039;][&#039;XPN.1&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.5&#039;][&#039;XPN.1&#039;] = msg[&#039;name_last&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;name_last&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.5&#039;][&#039;XPN.1&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>4</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.7&#039;][&#039;TS.1&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.7&#039;][&#039;TS.1&#039;] = msg[&#039;date_birth&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;date_birth&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.7&#039;][&#039;TS.1&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>5</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.8&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.8&#039;] = msg[&#039;sex&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;sex&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.8&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>6</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.11&#039;][&#039;XAD.1&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.11&#039;][&#039;XAD.1&#039;] = msg[&#039;addr_str&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;addr_str&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.11&#039;][&#039;XAD.1&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>7</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.13&#039;][&#039;XTN.1&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.13&#039;][&#039;XTN.1&#039;] = msg[&#039;phone_1_nr&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;phone_1_nr&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.13&#039;][&#039;XTN.1&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>8</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.14&#039;][&#039;XTN.1&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.14&#039;][&#039;XTN.1&#039;] = msg[&#039;phone_2_nr&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;phone_2_nr&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.14&#039;][&#039;XTN.1&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>9</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.16&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.16&#039;] = msg[&#039;civil_status&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;civil_status&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.16&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      - <com.webreach.mirth.model.Step>
                      <sequenceNumber>10</sequenceNumber>
                      <name>tmp[&#039;PID&#039;][&#039;PID.19&#039;]</name>
                      <script>tmp[&#039;PID&#039;][&#039;PID.19&#039;] = msg[&#039;pid&#039;].toString();</script>
                      <type>HL7 Message Builder</type>
                      - <data class="map">
                      - <entry>
                      <string>Mapping</string>
                      <string>msg[&#039;pid&#039;].toString()</string>
                      </entry>
                      - <entry>
                      <string>Variable</string>
                      <string>tmp[&#039;PID&#039;][&#039;PID.19&#039;]</string>
                      </entry>
                      </data>
                      </com.webreach.mirth.model.Step>
                      </steps>
                      <template>MSH^~|\&^X-L^Easy B^Vista^Ml^20060602000000+0000^^ADT~A08^1199885497 8^T^2.3^ EVN^A08^20060602163030+0000^ PID^1^645749582^^^SINGH~REETA^^19700606000000+0000 ^F^^^E-18, NPL COLONY, NEW RR NAGAR^^015656549621^789456123258^^NEVER MARRIED^^^741852933^ PV1^1^^DR^^^^~JO~ANNA^~P M~SINGH^ DG1^1^</template>
                      </com.webreach.mirth.model.Transformer>

                      Is there anything else I need to post?

                      Thank you
                      Anna

                      Comment


                      • #12
                        Re: Building an HL7 message from fields of a database - Critical Error

                        In your first transformer step you have:

                        Code:
                        var uuid = UUIDGenerator.getUUID();
                        For the mapping. The mapping value can only be a expression that returns a value. Replace that with:

                        Code:
                        UUIDGenerator.getUUID()
                        (Make sure you remove the trailing semi colon)

                        If you need to use the UUID elsewhere, create a Javascript step that has:

                        Code:
                        var uuid = UUIDGenerator.getUUID();
                        Then elsewhere in the mappings you can simply put
                        Code:
                        uuid
                        Chris Lang

                        Comment


                        • #13
                          Re: Building an HL7 message from fields of a database - Critical Error

                          Chris, Albertosaez, Arumpke and Brendanh,

                          Thank you for your timely response and help. Have successfully created the text file with the HL7 message.

                          Thank you
                          Anna

                          Comment


                          • #14
                            Re: Building an HL7 message from fields of a database - Critical Error

                            Hi,

                            I am also trying the same task. I find your details very useful. I request you to send your outbound and inbound channel for more clear understanding as I have a problem

                            1. I am not able to create HL7 message from the mysql datasource.

                            Here I am attaching my xml file for your reference. Pls help me to move further

                            <com.webreach.mirth.model.Channel>
                            <id>934cce1e-7494-46a2-81e3-22b2013f42ae</id>
                            <name>Test Outbound</name>
                            <description>line1
                            line2
                            line3
                            </description>
                            <enabled>true</enabled>
                            <version>1.3.2</version>
                            <revision>34</revision>
                            <direction>OUTBOUND</direction>
                            <protocol>HL7</protocol>
                            <mode>ROUTER</mode>
                            <sourceConnector>
                            <name>sourceConnector</name>
                            <properties>
                            <property name="pollingFrequency">5000</property>
                            <property name="username">root</property>
                            <property name="DataType">Database Reader</property>
                            <property name="useAck">0</property>
                            <property name="URL">jdbc:mysql://localhost:3306/care2x</property>
                            <property name="query">select `pid`,`name_first`, `name_last`, `date_birth`,`sex`,`addr_str`,`phone_1_nr`,`phone_ 2_nr`,`civil_status`,`sss_nr` from mirth_person</property>
                            <property name="password">pixen</property>
                            <property name="host">query</property>
                            <property name="driver">com.mysql.jdbc.Driver</property>
                            <property name="ack"></property>
                            </properties>
                            <transformer>
                            <steps/>
                            </transformer>
                            <filter>
                            <rules/>
                            </filter>
                            <transportName>Database Reader</transportName>
                            </sourceConnector>
                            <destinationConnectors>
                            <com.webreach.mirth.model.Connector>
                            <name>Destination 1</name>
                            <properties>
                            <property name="charsetEncoding">DEFAULT_ENCODING</property>
                            <property name="outputAppend">1</property>
                            <property name="DataType">File Writer</property>
                            <property name="outputPattern">OUT${UUID}.txt</property>
                            <property name="template">ER7: ${HL7 ER7} &#x0D;
                            XML: ${HL7 XML}</property>
                            <property name="host">C:/temp/hl7_output</property>
                            </properties>
                            <transformer>
                            <steps>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>0</sequenceNumber>
                            <name>tmp[&apos;MSH&apos;][&apos;MSH.10&apos;]</name>
                            <script>tmp[&apos;MSH&apos;][&apos;MSH.10&apos;] = UUIDGenerator.getUUID();;</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>UUIDGenerator.getUUID();</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;MSH&apos;][&apos;MSH.10&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>1</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.2&apos;][&apos;CX.1&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.2&apos;][&apos;CX.1&apos;] = msg[&apos;pid&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;pid&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.2&apos;][&apos;CX.1&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>2</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;] = msg[&apos;name_first&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;name_first&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.2&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>3</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;] = msg[&apos;name_last&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;name_last&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.5&apos;][&apos;XPN.1&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>4</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;] = msg[&apos;date_birth&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;date_birth&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.7&apos;][&apos;TS.1&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>5</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.8&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.8&apos;] = msg[&apos;sex&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;sex&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.8&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>6</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.1&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.1&apos;] = msg[&apos;addr_str&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;addr_str&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.11&apos;][&apos;XAD.1&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>7</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.1&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.1&apos;] = msg[&apos;phone_1_nr&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;phone_1_nr&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.13&apos;][&apos;XTN.1&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>8</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.1&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.1&apos;] = msg[&apos;phone_2_nr&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;phone_2_nr&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.14&apos;][&apos;XTN.1&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>9</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.16&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.16&apos;] = msg[&apos;civil_status&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;civil_status&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.16&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            <com.webreach.mirth.model.Step>
                            <sequenceNumber>10</sequenceNumber>
                            <name>tmp[&apos;PID&apos;][&apos;PID.19&apos;]</name>
                            <script>tmp[&apos;PID&apos;][&apos;PID.19&apos;] = msg[&apos;sss_nr&apos;].toString();</script>
                            <type>HL7 Message Builder</type>
                            <data class="map">
                            <entry>
                            <string>Mapping</string>
                            <string>msg[&apos;sss_nr&apos;].toString()</string>
                            </entry>
                            <entry>
                            <string>Variable</string>
                            <string>tmp[&apos;PID&apos;][&apos;PID.19&apos;]</string>
                            </entry>
                            </data>
                            </com.webreach.mirth.model.Step>
                            </steps>
                            <template>MSH|^~\&amp;|Mirth|1|||2006044535||ADT^A 04|603340|D|2.3.1&#x0D;EVN|A04|20060404090742&#x0D ;PID|1|800888^^^Mirth^PN|999945682^^^AccMgr^MR^1|| TEST^PATIENT MF||19570414|M||W|21 PALM MANOR^^EAST SYRACUSE^NY^130570000^^M|31|||E|M||6635130^^^Mirth ^VN^1|000987655|||2|||||NOT A VETERAN|||N&#x0D;PD1||||1335^ALCOTT^KAREN^^^^^^Acc Mgr^^^^CI|||I&#x0D;NK1|1|TEST^MARGARET|W|21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||Y&#x0D;PV1|1|E|ED^^^1|1||| 1281^MARKHAM^JOSEPH^^^^^^AccMgr^^^^CI|1281^LANG^JO E^^^^^^Mirth^^^^CI||ED||||7|S|||62|6635130^^^AccMg r^VN^1|865^SP KOPP|||||||||||||||||||1||A|||20060404090500&#x0D; PV2||^NO||||||20060404090500|||||||||||||||||||||| ||||||||S&#x0D;DG1|1||^HEADACHE|HEADACHE||A||||||| ||0&#x0D;GT1|1|382582|TEST^PATIENT MF||21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||19570414|M|||000987655|||| ||||11&#x0D;IN1|1|SELF PAY NYS|734|SELF PAY NYS|||||||||||5|TEST^PATIENT MF|1|19570414|21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||||||||||||||||||||||11|M|| ||||382582&#x0D;IN1|2|SELF PAY|705|SELFPAY|||||||||||5||1&#x0D;IN2|1||0009876 55&#x0D;</template>
                            </transformer>
                            <filter>
                            <rules/>
                            <template>MSH|^~\&amp;|AccMgr|1|||20060404090746|| ADT^A04|6035910|D|2.3.1&#x0D;EVN|A04|2006040409074 2&#x0D;PID|1|800888^^^AccMgr^PN|999945682^^^AccMgr ^MR^1||TEST^PATIENT MF||19570414|M||W|21 PALM MANOR^^EAST SYRACUSE^NY^130570000^^M|31|||E|M||6635130^^^AccMg r^VN^1|000987655|||2|||||NOT A VETERAN|||N&#x0D;PD1||||1335^ALCOTT^KAREN^^^^^^Acc Mgr^^^^CI|||I&#x0D;NK1|1|TEST^MARGARET|W|21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||Y&#x0D;PV1|1|E|ED^^^1|1||| 1281^MARKHAM^JOSEPH^^^^^^AccMgr^^^^CI|1281^MARKHAM ^JOSEPH^^^^^^AccMgr^^^^CI||ED||||7|S|||62|6635130^ ^^AccMgr^VN^1|865^SP KOPP|||||||||||||||||||1||A|||20060404090500&#x0D; PV2||^NO||||||20060404090500|||||||||||||||||||||| ||||||||S&#x0D;DG1|1||^HEADACHE|HEADACHE||A||||||| ||0&#x0D;GT1|1|382582|TEST^PATIENT MF||21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||19570414|M|||000987655|||| ||||11&#x0D;IN1|1|SELF PAY NYS|734|SELF PAY NYS|||||||||||5|TEST^PATIENT MF|1|19570414|21 PALM MANOR^^EAST SYRACUSE^NY^130570000|||||||||||||||||||||||11|M|| ||||382582&#x0D;IN1|2|SELF PAY|705|SELFPAY|||||||||||5||1&#x0D;IN2|1||0009876 55</template>
                            </filter>
                            <transportName>File Writer</transportName>
                            </com.webreach.mirth.model.Connector>
                            </destinationConnectors>
                            <properties>
                            <property name="initialState">stopped</property>
                            <property name="synchronous">true</property>
                            <property name="store_messages">true</property>
                            <property name="recv_xml_encoded">false</property>
                            <property name="encryptData">false</property>
                            <property name="transactional">false</property>
                            <property name="max_message_age">-1</property>
                            <property name="error_messages_only">false</property>
                            </properties>
                            <preprocessingScript>// Modify the message variable below to pre process data&#x0D;
                            return message;</preprocessingScript>
                            </com.webreach.mirth.model.Channel>


                            Pls give me a solution.

                            From
                            kgk_007

                            Comment

                            Working...
                            X