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

xml to hl7 transformer error ! plz help me stuck!!

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

  • xml to hl7 transformer error ! plz help me stuck!!

    I want to extract a hl7 message from database and transform it to get mapped data,from which different segments will be extracted and stored in different tables in the database.
    I used this,as told by chris:
    msg = SerializerFactory.getHL7Serializer(useStrictParser ,
    useStrictValidation,
    handleRepetitions).
    fromXML(msg['msg_text'].toXMLString());

    Now it gives this error:
    ERROR-300: Transformer error
    ERROR MESSAGE: Error evaluating transformer
    com.webreach.mirth.server.MirthJavascriptTransform erException:
    CHANNEL: example
    CONNECTOR: Destination 1
    SCRIPT SOURCE: Transformer
    LINE NUMBER: 9
    DETAILS: TypeError: Cannot call method "toString" of undefined
    at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.evaluateTransformerScript(JavaScri ptTransformer.java:414)
    at com.webreach.mirth.server.mule.transformers.JavaSc riptTransformer.transform(JavaScriptTransformer.ja va:286)
    at org.mule.transformers.AbstractEventAwareTransforme r.doTransform(AbstractEventAwareTransformer.java:4 8)
    at org.mule.transformers.AbstractTransformer.transfor m(AbstractTransformer.java:197)
    at org.mule.impl.MuleEvent.getTransformedMessage(Mule Event.java:251)
    at com.webreach.mirth.server.controllers.MessageObjec tController.getMessageObjectFromEvent(MessageObjec tController.java:482)
    at com.webreach.mirth.connectors.file.FileMessageDisp atcher.doDispatch(FileMessageDispatcher.java:79)
    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(Unknown Source

    my channel is:


    - <com.webreach.mirth.model.Channel>
    <id>b4d73bd1-3d31-46f5-8044-98bc6d934633</id>
    <name>example2</name>
    <description />
    <enabled>true</enabled>
    <version>1.6.1.2750</version>
    <revision>21</revision>
    - <sourceConnector>
    <name>sourceConnector</name>
    - <properties>
    <property name="ack">UPDATE msg_info SET msg_status = '1' WHERE msg_sr_no = ${msg_sr_no}</property>
    <property name="password">sql</property>
    <property name="URL">jdbcdbc:mirth</property>
    <property name="pollingTime">12:00 AM</property>
    <property name="username">dba</property>
    <property name="ackScript" />
    <property name="host">query</property>
    <property name="useScript">0</property>
    <property name="pollingType">interval</property>
    <property name="driver">sun.jdbc.odbc.JdbcOdbcDriver</property>
    <property name="useAck">1</property>
    <property name="pollingFrequency">5000</property>
    <property name="script" />
    <property name="query">SELECT msg_text, msg_sr_no from msg_info where msg_status = '2'</property>
    <property name="DataType">Database Reader</property>
    </properties>
    - <transformer>
    <steps />
    <inboundTemplate><?xml version="1.0" encoding="UTF-8"?> <result> <msg_text>value</msg_text> <msg_sr_no>value</msg_sr_no> </result></inboundTemplate>
    <outboundTemplate />
    <inboundProtocol>XML</inboundProtocol>
    <outboundProtocol>XML</outboundProtocol>
    <inboundProperties />
    <outboundProperties />
    </transformer>
    - <filter>
    <rules />
    </filter>
    <transportName>Database Reader</transportName>
    <mode>SOURCE</mode>
    <enabled>true</enabled>
    </sourceConnector>
    - <destinationConnectors>
    - <com.webreach.mirth.model.Connector>
    <name>Destination 1</name>
    - <properties>
    <property name="binary">0</property>
    <property name="charsetEncoding">DEFAULT_ENCODING</property>
    <property name="host">C:/destiny</property>
    <property name="outputPattern">abcd.txt</property>
    <property name="DataType">File Writer</property>
    <property name="template">${hl7message} ${message.encodedData}</property>
    <property name="outputAppend">1</property>
    </properties>
    - <transformer>
    - <steps>
    - <com.webreach.mirth.model.Step>
    <sequenceNumber>0</sequenceNumber>
    <name>New Step</name>
    <script>var useStrictParser = false; var useStrictValidation = false; var handleRepetitions = false; //var tempmsg; //tempmsg = new XML(msg['msg_text'].toString()); //SerializerFactory.getHL7Serializer(useStrictParser , useStrictValidation, handleRepetitions).fromXML(messageObject.getRawDat a()); //SerializerFactory.getHL7Serializer(useStrictParser , useStrictValidation, handleRepetitions).fromXML(msg); msg=SerializerFactory.getHL7Serializer(useStrictPa rser, useStrictValidation ,handleRepetitions).fromXML(msg['msg_text'].toXMLString());</script>
    <type>JavaScript</type>
    - <data class="map">
    - <entry>
    <string>Script</string>
    <string>var useStrictParser = false; var useStrictValidation = false; var handleRepetitions = false; //var tempmsg; //tempmsg = new XML(msg['msg_text'].toString()); //SerializerFactory.getHL7Serializer(useStrictParser , useStrictValidation, handleRepetitions).fromXML(messageObject.getRawDat a()); //SerializerFactory.getHL7Serializer(useStrictParser , useStrictValidation, handleRepetitions).fromXML(msg); msg=SerializerFactory.getHL7Serializer(useStrictPa rser, useStrictValidation ,handleRepetitions).fromXML(msg['msg_text'].toXMLString());</string>
    </entry>
    </data>
    </com.webreach.mirth.model.Step>
    - <com.webreach.mirth.model.Step>
    <sequenceNumber>1</sequenceNumber>
    <name>hl7message</name>
    <script>connectorMap.put('hl7message', validate(msg['msg_text'].toXMLString(), '', new Array()));</script>
    <type>Mapper</type>
    - <data class="map">
    - <entry>
    <string>Mapping</string>
    <string>msg['msg_text'].toXMLString()</string>
    </entry>
    - <entry>
    <string>Variable</string>
    <string>hl7message</string>
    </entry>
    - <entry>
    <string>RegularExpressions</string>
    <list />
    </entry>
    - <entry>
    <string>isGlobal</string>
    <string>connector</string>
    </entry>
    - <entry>
    <string>DefaultValue</string>
    <string />
    </entry>
    </data>
    </com.webreach.mirth.model.Step>
    </steps>
    <inboundTemplate><?xml version="1.0" encoding="UTF-8"?> <result> <msg_text>value</msg_text> <msg_sr_no>value</msg_sr_no> </result></inboundTemplate>
    <outboundTemplate />
    <inboundProtocol>XML</inboundProtocol>
    <outboundProtocol>HL7V2</outboundProtocol>
    - <inboundProperties>
    <property name="useStrictValidation">false</property>
    <property name="useStrictParser">true</property>
    </inboundProperties>
    - <outboundProperties>
    <property name="useStrictParser">false</property>
    <property name="encodeEntities">true</property>
    <property name="handleRepetitions">false</property>
    <property name="useStrictValidation">false</property>
    </outboundProperties>
    </transformer>
    - <filter>
    - <rules>
    - <com.webreach.mirth.model.Rule>
    <sequenceNumber>0</sequenceNumber>
    <name>New Rule</name>
    <script>return true;</script>
    <operator>NONE</operator>
    </com.webreach.mirth.model.Rule>
    </rules>
    </filter>
    <transportName>File Writer</transportName>
    <mode>DESTINATION</mode>
    <enabled>true</enabled>
    </com.webreach.mirth.model.Connector>
    </destinationConnectors>
    - <properties>
    <property name="synchronous">true</property>
    <property name="removeNamespace">true</property>
    <property name="encryptData">false</property>
    <property name="store_messages">true</property>
    <property name="dont_store_filtered">false</property>
    <property name="initialState">started</property>
    <property name="max_message_age">-1</property>
    <property name="transactional">false</property>
    <property name="error_messages_only">false</property>
    </properties>
    <preprocessingScript>// Modify the message variable below to pre process data return message;</preprocessingScript>
    <postprocessingScript>// This script executes once after a message has been processed return;</postprocessingScript>
    <deployScript>// This script executes once when the mule engine is started // You only have access to the globalMap here to persist data return;</deployScript>
    <shutdownScript>// This script executes once when the mule engine is stopped // You only have access to the globalMap here to persist data return;</shutdownScript>
    </com.webreach.mirth.model.Channel>

  • #2
    Re:xml to hl7 transformer error ! plz help me stuck!!

    it seems than msg['msg_text'] doesn't exist. Which is your source endoint ?

    And please, next time attach the XML file, don't pastle it.

    Comment


    • #3
      Re:xml to hl7 transformer error ! plz help me stuck!!

      appology for pasting the channel,wont do it again!

      and msg_txt do exists, it comes in the right hand corner textbox in the source,and it also comes in the incoming data
      in the transformer, from which i paste in in the "mapping" textbox for hl7message variable,
      also, the error ceases to exist if i use :
      SerializerFactory.getHL7Serializer(useStrictParser ,
      useStrictValidation
      ,handleRepetitions).fromXML(msg['msg_text'].toXMLString());

      instead of :
      msg= SerializerFactory.getHL7Serializer(useStrictParser ,
      useStrictValidation
      ,handleRepetitions).fromXML(msg['msg_text'].toXMLString());

      but the problem is that in my text file i get this:

      <msg_text>MSH|^~\&amp;|IDXTEND|CLINIC|""|""|</msg_text>
      msg_textMSH|^~\&|IDXTEND|CLINIC|""|""|
      msg_sr_noADT0000291
      <msg_text>MSH|^~\&amp;||.|||177708180016||AD</msg_text>
      msg_textMSH|^~\&||.|||177708180016||AD
      msg_sr_noADT0000442
      <msg_text>MSH|^~\&amp;|IDXTEND|CLINIC|""|""|200702 060948||ADT^A01|60667_21848_RE|P|2.3||||
      EVN|A01|200702060948|""||SCR9411
      PID|1|700184435|700184444|2453634|AGUIRRE^MAXIMILL IAN^""^""^""^""|""|19511216|male||n|529 RIDGEWAY CT^""^SPRING VALLEY^CA^91977|""|(619)472-8124|(858)277-6460|""|d|Jew|""|552822125|""^""||1|""|||usac|vv|g fgfgfe|""
      NK1|1|AGUIRRE^MARIA^R^""^""^""|SP|429 RIDGEWAY CT^""^SPRING VALLEY^CA^91977|(619)472-8124|(619)228-5873|CP|||""||||||||||||||||||||||||""|||""
      NK1|2|AGUIRRE^KRISTIE^""^""^""^""|DAU|1503 REPUBLIC ST^""^SAN DIEGO^CA^92114|(619)264-1839|(619)962-3418|CP|||""||||||||||||||||||||||||""|||""
      GT1|1|700184435|AGUIRRE^MAXIMILLIAN^""^""^""^""||4 29 RIDGEWAY CT^""^SPRING VALLEY^CA^91977|(619)472-8124|(858)277-6460||""||SE|552-82-2125||||PLEASANT CARE CONV HOSP|2828 MEADOW LARK DR^""^SAN DIEGO^CA^92123|(858)277-6460|""|""
      IN1|1|732|CHFS|CIGNA HEALTHCARE/FFS|PO BOX 182223^""^CHATTANOOGA^ TN^37422-7223||(800)244-6224||3311808|||20051101|""|||AGUIRRE^MAXIMILLIAN^ ""^""^""^""|SE|19511216|""^""^""^""^""||""|||||||| ||||||""|U0532853901|||||||M
      </msg_text>
      msg_textMSH|^~\&|IDXTEND|CLINIC|""|""|200702060948 ||ADT^A01|60667_21848_RE|P|2.3||||
      EVN|A01|200702060948|""||SCR9411
      PID|1|700184435|700184444|2453634|AGUIRRE^MAXIMILL IAN^""^""^""^""|""|19511216|male||n|529 RIDGEWAY CT^""^SPRING VALLEY^CA^91977|""|(619)472-8124|(858)277-6460|""|d|Jew|""|552822125|""^""||1|""|||usac|vv|g fgfgfe|""
      NK1|1|AGUIRRE^MARIA^R^""^""^""|SP|429 RIDGEWAY CT^""^SPRING VALLEY^CA^91977|(619)472-8124|(619)228-5873|CP|||""||||||||||||||||||||||||""|||""
      NK1|2|AGUIRRE^KRISTIE^""^""^""^""|DAU|1503 REPUBLIC ST^""^SAN DIEGO^CA^92114|(619)264-1839|(619)962-3418|CP|||""||||||||||||||||||||||||""|||""
      GT1|1|700184435|AGUIRRE^MAXIMILLIAN^""^""^""^""||4 29 RIDGEWAY CT^""^SPRING VALLEY^CA^91977|(619)472-8124|(858)277-6460||""||SE|552-82-2125||||PLEASANT CARE CONV HOSP|2828 MEADOW LARK DR^""^SAN DIEGO^CA^92123|(858)277-6460|""|""
      IN1|1|732|CHFS|CIGNA HEALTHCARE/FFS|PO BOX 182223^""^CHATTANOOGA^ TN^37422-7223||(800)244-6224||3311808|||20051101|""|||AGUIRRE^MAXIMILLIAN^ ""^""^""^""|SE|19511216|""^""^""^""^""||""|||||||| ||||||""|U0532853901|||||||M
      msg_sr_noADT0000292

      wherein i dont want the message to be preceeded with msg_text and msg_sr_no ,which hampers the proper mapping..

      Comment


      • #4
        Re:xml to hl7 transformer error ! plz help me stuc

        It seems than the error is launched at your second step, as in this new step you don't have the msg_txt field (you have a normal HTML message).

        You can use the next expression at source transformer

        Code:
        tmp=SerializerFactory.getHL7Serializer(useStrictParser,useStrictValidation,handleRepetitions).fromXML(msg['msg_text'].toXMLString());
        Set the output as HL7, and then, at the destination transformer, you can manipulate this message

        Comment

        Working...
        X