Announcement

Collapse
No announcement yet.

ERROR MESSAGE: Error evaluating transformer

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

  • ERROR MESSAGE: Error evaluating transformer

    I'm going through the book "Unofficial Mirth Connect 3.1 Developer's Guide" and I'm at chapter 5 "Query Sender Channel".

    I've created the Query Sender channel, inbound and outbound datatypes are HL7 v2.x. Source Connector Type is Channel Reader, destination Connector Type is File writer. I test write and successfully connect to my path.

    When I deploy the channel and send an HL7 message it successfully writes to the file. The problem is when I use the destination transformer and add the steps that the book says to add. I get an error when I try to send a message.

    I add 4 steps and they are:

    Name: MSH Segment
    Type: JavaScript
    Script:
    Code:
    tmp = msg;
    tmp['MSH']['MSH.7']['MSH.7.1'] = Now("yyyyMMddhhmmss"); tmp['MSH']['MSH.10']['MSH.10.1'] = UUIDGenerator.getUUID();
    Name: Patient ID
    Type: JavaScript
    Script:
    Code:
    tmp['QPD']['QPD.3']['QPD.3.1'] = getPatientID();
    function getPatientID() { var patientId = '';
    for ( var i = 0; i <= 9; i++ ) {
    patientId += Math.floor( (Math.random() * 10) );
    }
    return patientId; };
    Name: Query Tag
    Type: Message Builder
    Script:
    Message Segment: tmp['QPD']['QPD.2']['QPD.2.1']
    Mapping: tmp['MSH']['MSH.10']['MSH.10.1'].substring(10)

    Name: TEST ONLY
    Type: JavaScript
    Script:
    Code:
    if ( 'ERR2' == msg['MSH']['MSH.9']['MSH.9.2'].toString().toUpperCase() ) {
    if ( Math.floor((Math.random()*10)+1) > 5 ) tmp['MSH']['MSH.9']['MSH.9.1'] = 'QQQ';
    if ( Math.floor((Math.random()*10)+1) > 5 )
    tmp['MSH']['MSH.9']['MSH.9.2'] = 'E99'; if ( Math.floor((Math.random()*10)+1) > 5 )
    tmp['MSH']['MSH.12']['MSH.12.1'] = '9.9';
    }

    From Destination Mappings I drag and drop Encoded Data into the box. I save changes and deploy channel. I try to send this sample HL7 as a message:

    MSH|^~\&|ADM|Sending Organization|ALL|Receiving Organization|||QBP^E22^QBP_E22||D|2.7|||AL|AL QPD|E22^Authorization
    Request^CIHI0003||^^^ISO^PHN|Everywoman^Mary^Patri ck^^^^L^|19680120|MSP^|EXT RCP|I

    I get the following error even though I followed the book exactly:

    Code:
    Transformer error
    ERROR MESSAGE: Error evaluating transformer
    com.mirth.connect.server.MirthJavascriptTransformerException: 
    CHANNEL:	Query Sender
    CONNECTOR:	Destination 1
    SCRIPT SOURCE:	
    SOURCE CODE:	
    26:         }
    27:         eval('importPackage(' + Packages.java.lang.Class.forName(className).getPackage().getName() + ')');
    28:     }
    29: }
    30: function doScript() {
    31: msg = new XML(connectorMessage.getTransformedData());
    32: if (msg.namespace('') != undefined) { default xml namespace = msg.namespace(''); } else { default xml namespace = ''; }
    33: function doFilter() { phase[0] = 'filter'; return true; }function doTransform() { phase[0] = 'transformer'; logger = Packages.org.apache.log4j.Logger.getLogger(phase[0]);
    34: 
    35: 
    LINE NUMBER:	31
    DETAILS:	TypeError: Element type "Request" must be followed by either attribute specifications, ">" or "/>".
    	at 114d3ec0-02a6-4fbf-ba92-7a688f279e4c:31 (doScript)
    	at 114d3ec0-02a6-4fbf-ba92-7a688f279e4c:43
    	at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.call(JavaScriptFilterTransformer.java:134)
    	at com.mirth.connect.server.transformers.JavaScriptFilterTransformer$FilterTransformerTask.call(JavaScriptFilterTransformer.java:100)
    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    	at java.lang.Thread.run(Thread.java:695)

    Does anyone have any idea why this is happening or how to troubleshoot?

  • #2
    Figured out my problem!!

    Just in case anyone else is having the same problem I realized that the book's sample HL7 message had spaces where it shouldn't therefore the transformer couldn't parse the message properly. Below is the correct HL7 message without the spaces. (Do not include quotes)

    "MSH|^~\&|ADM|Sending Organization|ALL|Receiving Organization|||QBP^E22^QBP_E22||D|2.7|||AL|ALQPD|E 22^AuthorizationRequest^CIHI0003||^^^ISO^PHN|Every woman^Mary^Patrick^^^^L^|19680120|MSP^|EXT RCP|I"

    Comment


    • #3
      DICOM To XML convert error

      DICOMSerializer error
      ERROR MESSAGE: Error converting DICOM to XML
      java.lang.NullPointerException
      at com.mirth.connect.plugins.datatypes.dicom.DICOMSer ializer.fromXML(DICOMSerializer.java:97)
      at com.mirth.connect.donkey.server.channel.FilterTran sformerExecutor.processConnectorMessage(FilterTran sformerExecutor.java:123)
      at com.mirth.connect.donkey.server.channel.Destinatio nConnector.transform(DestinationConnector.java:360 )
      at com.mirth.connect.donkey.server.channel.Destinatio nChain.doCall(DestinationChain.java:114)
      at com.mirth.connect.donkey.server.channel.Destinatio nChain.call(DestinationChain.java:63)
      at com.mirth.connect.donkey.server.channel.Channel.pr ocess(Channel.java:1716)
      at com.mirth.connect.donkey.server.channel.Channel.di spatchRawMessage(Channel.java:1191)
      at com.mirth.connect.donkey.server.channel.SourceConn ector.dispatchRawMessage(SourceConnector.java:192)
      at com.mirth.connect.server.controllers.DonkeyEngineC ontroller.dispatchRawMessage(DonkeyEngineControlle r.java:1067)
      at com.mirth.connect.server.api.servlets.MessageServl et$2.run(MessageServlet.java:107)
      at java.lang.Thread.run(Unknown Source)

      If any one solved this problem So please tell me!!!!

      Comment

      Working...
      X