Set HL7 fields in reverse/random order leads to wrong output #4917
-
I tested in Mirth v3.5.1 and 3.12.0 In the source transformer, I have an outbound message template defined:
In the source transformer script, I set 3 fields in reverse/random order as follows: tmp['OBR']['OBR.16']['OBR.16.7'] = "Dr.";
tmp['OBR']['OBR.16']['OBR.16.3'] = "John";
tmp['OBR']['OBR.16']['OBR.16.2'] = "Doe"; The ER7/XML semantically looks fine (extract of <OBR.16.7>Dr.</OBR.16.7><OBR.16.3>John</OBR.16.3><OBR.16.2>Doe</OBR.16.2> The rendered
Why is that and is this intended? Please find sample channel attached (created in Mirth v3.12.0). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It has to do with the way that the mirth serializer works going from xml to hl7. It expects them to appear in the correct order in the xml. If you unable to ensure that elements will be added in the correct order, you can use this code template to fix them https://github.com/nextgenhealthcare/connect-examples/tree/master/Code%20Templates/Fix%20HL7%20Node%20Order To elaborate a little bit more on why they are getting created out of order, from your template If your template had at least 6 All of the examples below do not depend on this as they would replace any components created by the template if they existed. |
Beta Was this translation helpful? Give feedback.
It has to do with the way that the mirth serializer works going from xml to hl7. It expects them to appear in the correct order in the xml. If you unable to ensure that elements will be added in the correct order, you can use this code template to fix them https://github.com/nextgenhealthcare/connect-examples/tree/master/Code%20Templates/Fix%20HL7%20Node%20Order
To elaborate a little bit more on why they are getting created out of order, from your template
tmp['OBR']['OBR.16']
will exist, but it will have no children. When you assign totmp['OBR']['OBR.16']['OBR.16.7']
, since it doesn't already exist, it will be appended to thetmp['OBR']['OBR.16']
child list (as the first and only child.…