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

preprocessor stops processing?

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

  • preprocessor stops processing?

    I'm trying to get mirth to process files that look like this:

    Code:
    Hospital_Name|Date_of_Visit|Time_of_Visit|Sex|Age|Zip_Code|Chief_Complaint|Medical_Record_Number
    St. Marys Reg|02/07/2007|08:02:00|F|6|12345|FEVER,WEAKNESS|M0XXXXXX
    St. Marys Reg|02/07/2007|08:11:00|M|71|12346|WEAKNESS|M00XXXXXX
    using the following script:
    Code:
    var lines=message.split("\n"«»);
    if(lines.length>0){
      var head=lines[0];
      var fields=head.split("|"«»);
      var record=null;
      var new_rec_str=null;
      var new_message="<!-- Generated by Mirth PreProcessor --><HL7Batch>\n";
      for(i=1;i<lines.length;i++,new_rec_str=""«»){
        record=lines[i].split("|"«»);
        new_rec_str="<HL7Message>";
        for(j=0;j<fields.length;j++){
          new_rec_str+="<"+fields[j]+">"+record[j]+"</"+fields[j]+">\n";
        }
        new_message+=new_rec_str+"</HL7Message>";
      }
      new_message+="</HL7Batch>";
    }
    return new_message;
    My problem is that it seems like processing dies somewhere in there, but I can't see where because there's no error being thrown. processing just stops. Mirth moves the file, but the dashboard shows no new message receipt, error or otherwise.

    I'm really new to mirth, so apologies if there's an elementary error somewhere in my understanding of this. If someone could point me toward the answer I'll go dig it up myself...

  • #2
    Rereprocessor stops processing?

    I don't see any problem with your code. I acctually had no problem running the code. Make sure you set the incoming data type as XML. You might want to change:

    var new_message="<!-- Generated by Mirth PreProcessor --><HL7Batch>n";
    to
    var new_message="<!-- Generated by Mirth PreProcessor --><HL7Batch>\n";

    and

    new_rec_str+="<"+fields[j]+">"+record[j]+"</"+fields[j]+">n";
    to
    new_rec_str+="<"+fields[j]+">"+record[j]+"</"+fields[j]+">\n";

    to get the line endings right.
    Daniel Svanstedt
    Software Engineer
    Mirth Corporation

    Want professional services, support, and enterprise or virtual appliances? It's all available from the Mirth Corporation:
    Mirth Support | Mirth Training | Mirth Appliances | Online Training | Developer Q&A

    Don't forget, Mirth Support gives you access to all of our online training videos, and silver support gives you access to developer Q&As!

    Comment


    • #3
      Rereprocessor stops processing?

      I think he had the right line endings - the board just stripped the backslash.
      Chris Lang

      Comment

      Working...
      X