The first tab defines that XML is being read and this channel will auto start.
2.2.4XML Inbound Directory
Clicking on the Source tab will show which directory is being read to find the XML content and the file name format required to process.
Note that the directory is defined as a relative path. It is relative from where Mirth was started.
On the destinations tab you can see the SQL used to insert into the PatientOS interface_messages table.
Take careful note of the URL and ensure the correct database is being accessed.
Figure 6 Destination tab
Click on the Edit Transformer link to open the Transformer. Paste your XML into the top right frame and the XML elements will be parsed and displayed in a tree below. It helps if your XML is populated with sample data.
Figure 7 Transformer incoming
However in order to see all the fields you might like to populate you can paste into the frame the RecordTransaction.xml file from http://www.patientos.org/documentation
When have finished mapping replace the contents with the original XML You may need to tailor the XML (for example we will add RecordDetailModel rows).
Figure 8 Outgoing data tab
The goal is to populate a) Enough of the PatientModel to match the patient - name and MRN (matching is a large topic) unless you have the patient_id from the patients table. b) A single FormModel to reflect the form c) As many RecordModel has you have fields on this virtual form. d) As many RecordDetailModel if you have details for a specific Record.
The concept of Record and RecordDetail is that the Record value is the significant value e.g. height, weight, lab results etc where as the RecordDetail are child details e.g. Clothing the patient had on when weighed or comments on the lab result.
2.2.7 Example Mapping
We will work with this sample XML
Figure 9 Drag patientid to be MRN
But essentially we know there are 8 records needed so we loop 8 times and within the loop duplicate the first RecordModel, map the values and where possible set common values outside each if statement. Not great but it works...
Note PatientOS dates must be formatted YYYYMMDD and mapped to the date component or YYYYMMDDHHMMSS and mapped to the date/time format. Rather than parsing we will hard code it to get started with testing
Make sure the Outgoing Data script is
After saving the transformer changes the channel is deployed
Now drop a copy of your xml file into the oru_xml_in directory identified earlier. The channel will remove the file and any errors will be written to the log.
On the dashboard we can see an error occurred.
Selecting Events will show the log, selecting the first entry and scrolling down the exception log we find the error relates to the ns1 prefix used in the XML
To resolve the issue on the Summary tab we deselected 'Strip namespace from messages' and as show above the message was transformed and sent i.e. written to the interface_messages table.
2.3 PatientOS Processing
We can find our interface message in the interface_messages table to be processed.