Sure, I can post the channels I created (sanitized a bit). I’ll also give a bit of background and explanation.
Disclaimer: This post assumes basic knowledge of the structure of an HL7 ORM and ORU message. Also, keep in mind that these channels and configs were built for a dev environment, not a production environment. Be sure to thoroughly test anything you plan to put into production.
Again, these channels were designed specifically to interface with an EEG system, but they should be adaptable to your needs. The EEG system does not send back discrete data, but that should work fine simply by having multiple OBX segments with your discrete results.
My basic configuration:
- OpenEMR 5.0.1 running on Ubuntu 16.04
- Mirth 3.5.2 (important for if you try to import the channels) installed and running on the OpenEMR server
- EEG system receiving orders and sending results (PDF report), running its own instance of Mirth
- EEG system only accepts ORM O01 messages
When an order is placed in OpenEMR, a file is written to the path configured in the procedure provider, and is formatted as an ORM O01 HL7 message. This is native OpenEMR functionality.
“OpenEMR Orders - EEG” Channel
Source: Uses connector type “File Reader”. Checks “/opt/hl7orders/eeg” every 10 seconds for new files and ignores files that do not have “ORM” in MSH.9.1 and “O01” in MSH.9.2. If successfully processed, it moves the file to “/opt/hl7orders/eeg/processed”. Otherwise the file is moved to “/opt/hl7orders/eeg/error”. Because Mirth is installed on the same server as OpenEMR both software suites can read and write to the folders without using SFTP or some other remote file transfer protocol.
Destinations: “Send to EEG system” uses connector type “TCP Sender”. Takes the HL7 message passed to it by the Source and sends it on to a system called “eegserver” that is listening on port 12345.
“EEG Results Channel”
Requires that the ORU have the PDF report embedded in OBX.5.5 as encoded Base64 text.
Source: Uses connector type “TCP Listener”. Listens on port 5000. When an ORU is received the “Generate pdfName variable” transformer parses various pieces of the message to generate a filename for the PDF report, stores it as the variable “filename” and makes “filename” available to the channel as variable “pdfName”. It also pulls the Base64 PDF data from OBX.5.5 and makes it available to the channel as variable “pdfData”.
Destinations: “Write ORU to Folder” uses connector type “File Writer”. Takes the HL7 message passed to it by the Source and passes it through two transformers: “Create the filename” and “Put PDF in ORU”. Transformer “Create the filename” takes the Message Control ID from MSH.10.1 and uses that as a unique filename for the ORU file written to the server and makes it available to the channel as variable “filename”. Transformer “Put PDF in ORU” sets OBX.2 = “ED”, OBX.5.1 = “pdf”, OBX.5.2 = “TEXT”, OBX.5.4 = “Base64” and OBX.5.5 = pdfData variable. This transformer is important for getting OpenEMR to create a PDF file directly in the electronic results. It then writes the ORU to “/opt/hl7results/eeg” using the ${filename}.txt as the filename where ${filename} is the variable defined in transformer “Create the filename”.
Notes
Some of these steps are probably not necessary such as reading OBX.5.5 to pdfData and putting pdfData back in OBX.5.5, and creating the pdfName variable. However, it took some trial and error to get the process to work as desired, so there are a few artifacts that need to be cleaned up.
Viewing Results in OpenEMR
In order to get the results to show in OpenEMR, you must go to the “Procedures” menu → “Electronic Reports”. This triggers OpenEMR to check all configured results folders in your various procedure providers configs and read in all files it finds. It will only process messages with a proper MSH segment. You will see the results listed in tabular form, as well as any file read errors. From there you can click on the date to see the specific results, or you can click on the patient and view “Lab Results” in the “Documents” section of the patient record.
Finally, here is a screenshot of the procedure provider configuration used to make this work.
OpenEMR Procedure Provider Configuration
Clear as mud, I’m sure. I hope this helps.
EEG Results Channel.xml (24.7 KB)
OpenEMR Orders - EEG.xml (25.2 KB)