Procedure Order Results only import HL7

I am trying to find documentation on how to import HL7 files.

I have found in the code where the list_reports.php file calls the In the file, there is a reference to results_path from the procedure_provider_edit.php.

Hi @juggernautsei, you’re looking to enter the results electronically instead of manually?

if so you can try to do it by setting up an hl7 provider under Procedures->Providers after adding a lab service to the address book. Choose results only, specify filesystem or sftp, and then import with Procedures->Electronic reports if one of the users has an NPI that matches the hl7 ordering provider.

Yes, we are trying to set up the electronic import of hl7 files to parse the results into the patients chart. We have setup to receive the files from the lab via them pushing the files to our server.

So, does it have to be a provider that clicks on the Process Results button?

Nope, wow, you’re running dev :grimacing: :slight_smile:

Nope, why do you think we are running dev?


The process results button in blue only appears on dev.

The reason that it is blue is that this installation started before 6.0 was released. I pulled the dev before the release of 6.0 but then added the patches after the release. So, my install could be broken?

I was able to verify that the system does read the files in the given file location. They get read in and then stored in the procedure results folder. This all happens. I can see that it is supposed to delete the files from the folder. It is not currently doing that. I changed the folder owner to www-data.

It still does not delete the file from the local file system.

It seems there should be an unlink after the log entry. Is that right? @adunsulag

            if ($fh) {
                fwrite($fh, $hl7);
                $log .= "Retrieved and Saved File #$filecount: $file\n";

In the log file I find these entries.

Retrieved and Saved File #1: 80947f6a-8612-40b1-8f26-b5971273bea5.hl7
No Lab Match File #1: Account:  
Retrieved and Saved File #2: FFC_{80947f6a-8612-40b1-8f26-b5971273bea5}.txt
No Lab Match File #2: Account: 
Retrieved and Saved File #3: FFC_{de40a244-9873-42b6-8b65-898707e303da}.txt
No Lab Match File #3: Account: 
Retrieved and Saved File #4: de40a244-9873-42b6-8b65-898707e303da.hl7
No Lab Match File #4: Account:

So I’m not familiar with the hl7 import. However, looking at the code, the files are only removed on lines 1727-1740 with the unlink happening on L1738.

From the messagings you are seeing it looks like the lab_match() is returning false which is then skipping over you file. I’d look into that function and see what’s going on. From a basic reading it would seem something is wrong in your HL7 file format which is why the whole process is erroring out. Take what I say with a grain of salt though as I’m not familiar with this file.

Thanks, @adunsulag. If no matching orders are found the file should be deleted (unlinked). I placed the unlink after line 1703. Otherwise, it keeps processing the same files over and over.