Announcement

Collapse
No announcement yet.

Use multiple Text files to create HL7 messages

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

  • Use multiple Text files to create HL7 messages

    I have a facility that is sending multiple flat text files (each for Patient Data, Insurance Information, Transactions, Notes etc) with multiple patient records in them. Now I need to create HL7 messages by combining the information contained in these files for each patient.

    Is there a way to consume these files directly using a javascript and gather the data from these multiple files for generation of HL7 messages or will it be easier to dump these files into a DB and create the messages from there using the DB reader?

    Thanks
    Last edited by softengg; 06-23-2016, 02:10 PM.

  • #2
    I had a similar situation and thought using a DB was overkill for what we needed.

    We did something similar by using one channel to combine the two files into one and another channel to parse the combined file.

    A better solution would be to use a file reader in Javascript to read the contents of both files at the same time.

    If you search the forum, I think I've seen posts on how to do this.
    Best,

    Kirby

    Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

    Appliance Version 3.11.4
    Mirth Connect Version 3.8.0
    Java Version 1.6.0_45-b06
    Java (64 bit) Version 1.6.0_45-b06
    Java 7 (64 bit) Version 1.7.0_151-b15
    Java 8 (64 bit) Version 1.8.0_181-b13
    PostgreSQL Version 9.6.8

    Comment


    • #3
      That's our thought too that using DB would be overkill.

      Would you mind sharing your channel you used for combining and parsing multiple files and/or can you point me to the posts you are referring to?

      Thanks

      Comment


      • #4
        I can't post the channel because of a lot of embedded stuff (users, passwords, server information, etc.)

        I can tell you
        1. We had two files in a folder.
        2. We had source file reader pickup the files and move them to and archive directory after reading.
        3. We had two transformer steps, one for each file (if($('originalFilename') == "nodeDataArray.txt")). This steps look for the data we need and puts it in an array. You could just as easily pass the whole contents into a variable.

        channel 1 channelMap.put('nodeArray',nodeArrayString);
        Channel 2 channelMap.put('linkArray',linkArray);
        4. On the destination in the template section we write both arrays to the same file.

        ${nodeArray}

        ${linkArray}
        Best,

        Kirby

        Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

        Appliance Version 3.11.4
        Mirth Connect Version 3.8.0
        Java Version 1.6.0_45-b06
        Java (64 bit) Version 1.6.0_45-b06
        Java 7 (64 bit) Version 1.7.0_151-b15
        Java 8 (64 bit) Version 1.8.0_181-b13
        PostgreSQL Version 9.6.8

        Comment


        • #5
          Thanks for a quick reply Kirby.

          This is really helpful but how do you recommend combining the arrays or the data from 2 files based upon certain fields?
          For example:

          File 1 contains:

          PatLastName, PatFirstName, dob, SSN, MRN, Inv#

          File 2 contains

          Inv#, MRN, Type, InsuranceCo, Address

          Comment


          • #6
            Its easy. You can use below code.
            I would suggest creating JSON objects as an additional step and then map JSON to HL7

            Code:
            var patient = new Object();
            var filePath = * absolutePathOfFile * ;
            var fileOps = org.apache.commons.io.FileUtils();
            var thisFile = new File(filePath);
            var fileContents = fileOps.readFileToString(thisFile);
            var fileContentsLines = fileContents.split("\n"); //This will put every row in the CSV as an array element.
            for (i = 0; i < fileContentsLines.length; i++) { // This works as a lineIterator and moves to next line/row in the CSV
              var fileContentsColumn = fileContentsLines[i].split(","); //Now we split using comma and put inside an array
            
              patient.patLastName = fileContentsColumn[0];
              patient.patFirstName = fileContentsColumn[1];
              patient.dob = fileContentsColumn[2]; // and so on
            }
            Similarly, read the insurance file, and create insurance object.
            Last edited by siddharth; 06-27-2016, 03:49 AM. Reason: Additional
            HL7v2.7 Certified Control Specialist!

            Comment

            Working...
            X