web stats
Convert XML to ER7 - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 06-21-2017, 06:51 AM
MrGesan MrGesan is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Italy
Posts: 26
MrGesan is on a distinguished road
Default Convert XML to ER7

I'm trying to convert a message from XML to ER7 format. Unfortunately the code I use removes some field values contaning spaces (for example First Name or Home Address)

The XML message I'm trying to convert is
PHP Code:

<ORM_O01>
    <
MSH>
        <
MSH.1>|</MSH.1>
        <
MSH.2>^~\&amp;</MSH.2>
        <
MSH.3>
            <
HD.1>APP1</HD.1>
        </
MSH.3>
        <
MSH.4>
            <
HD.1>COMP1</HD.1>
        </
MSH.4>
        <
MSH.5>
            <
HD.1>APP2</HD.1>
        </
MSH.5>
        <
MSH.6>
            <
HD.1>COMP2</HD.1>
        </
MSH.6>
        <
MSH.7>
            <
TS.1>
                <
DTM.1>20170621160440</DTM.1>
            </
TS.1>
        </
MSH.7>
        <
MSH.9>
            <
MSG.1>ORM</MSG.1>
            <
MSG.2>O01</MSG.2>
            <
MSG.3>ORM_O01</MSG.3>
        </
MSH.9>
        <
MSH.10>13741</MSH.10>
        <
MSH.12>
            <
VID.1>2.5</VID.1>
        </
MSH.12>
    </
MSH>
    <
ORM_O01.PATIENT>
        <
PID>
            <
PID.3>
                <
CX.1>327567</CX.1>
                <
CX.5>ID</CX.5>
            </
PID.3>
            <
PID.5>
                <
XPN.1>MARK YAH</XPN.1>
                <
XPN.2>DUMBAY</XPN.2>
            </
PID.5>
            <
PID.7>19611009</PID.7>
            <
PID.8>M</PID.8>
            <
PID.11>
                <
XAD.1>ROAD AV STREET 12</XAD.1>
                <
XAD.3>ASVILLE</XAD.3>
                <
XAD.5>25010</XAD.5>
                <
XAD.7>L</XAD.7>
                <
XAD.11>092383</XAD.11>
            </
PID.11>
        </
PID>
        <
PV1>
            <
PV1.2>U</PV1.2>
            <
PV1.3>
                <
PV1.3.1>LOC</PV1.3.1>
                <
PV1.3.4>01812</PV1.3.4>
                <
PV1.3.7>8187</PV1.3.7>
                <
PV1.3.9>BUILDING</PV1.3.9>
            </
PV1.3>
        </
PV1>
    </
ORM_O01.PATIENT>
    <
ORM_O01.ORDER/>
</
ORM_O01
Using the following code I try to convert the above message (msgXML):
PHP Code:
    var deserializationProperties SerializerFactory.getDefaultDeserializationProperties('HL7V2');
    
deserializationProperties.put('useStrictParser',true);
    
deserializationProperties.put('useStrictValidation',false);
    
deserializationProperties.put('handleRepetitions',true);
    
deserializationProperties.put('convertLineBreaks',false);
    
deserializationProperties.put('handleSubcomponents',true);
    
    var 
msgER7 SerializerFactory.getSerializer('HL7V2'
                                                 
null
                                                 
deserializationProperties).fromXML(msgXML); 
The msgER7 I gain is:
PHP Code:
MSH|^~\&|APP1|COMP1|APP2|COMP2|||ORM^O01^ORM_O01|13741||2.5
PID
|||327567^^^^ID||^DUMBAY||19611009|M|||^^ASVILLE^^25010^^L^^^^092383
PV1
||
...in the ER7 message I gain are missing many fields, seems all the ones containing space ..what's wrong?

Last edited by MrGesan; 06-21-2017 at 10:32 AM.
Reply With Quote
  #2  
Old 06-22-2017, 02:13 AM
MrGesan MrGesan is offline
OBX.1 Kenobi
 
Join Date: Jul 2011
Location: Italy
Posts: 26
MrGesan is on a distinguished road
Default

Ok, I figured out the problem.

The XML message doesn't respect the standard xsd, so some field values do not appear in the ER7 because they are not correctly wrapped in the XML tag elements
Reply With Quote
  #3  
Old 06-25-2018, 06:07 AM
cldparisi cldparisi is offline
What's HL7?
 
Join Date: Oct 2017
Posts: 4
cldparisi is on a distinguished road
Default

Thanks for your suggest.

I solved my problems in two ways.

By code:
Code:
var msgXML = msg;
channelMap.put('_msgXML',msgXML);
var deserializationProperties = SerializerFactory.getDefaultDeserializationProperties('HL7V2');
    deserializationProperties.put('useStrictParser',true);
    deserializationProperties.put('useStrictValidation',false);
    deserializationProperties.put('handleRepetitions',true);
    deserializationProperties.put('convertLineBreaks',false);
    deserializationProperties.put('handleSubcomponents',true);
   
    var msgER7 = SerializerFactory.getSerializer('HL7V2', 
                                                 null, 
                                                 deserializationProperties).fromXML(msgXML);  
msg = msgER7;
channelMap.put('_msgER7',msgER7);

or by configuration:
• Source
o Inbound: HL7 v2.x - Serialization Use Strict Parser
o Outbound: HL7 v2.x - Deserialization Use Strict Parser
• Destination
o Inbound: HL7 v2.x - Serialization (Use Strict Parser = false)
o Outbound: HL7 v2.x - Serialization (Use Strict Parser = false)

Both solutions work right …for my HL7 Xml message example in the first post

Is It possible choose xsd to use for conversion?
http://www.hl7.org/documentcenter/pu...fts/v2xml.html

BUT I have another problem because Mirth don't use xsd standard, if I use different message xml

Code:
<ORM_O01 xmlns="urn:hl7-org:v2xml">
	<MSH>
		<MSH.1>|</MSH.1>
		<MSH.2>^~\&amp;</MSH.2>
		<MSH.3>
			<HD.1>OE</HD.1>
		</MSH.3>
		<MSH.4>
			<HD.1>ENG</HD.1>
		</MSH.4>
		<MSH.5>
			<HD.1>ESTRAD</HD.1>
		</MSH.5>
		<MSH.6>
			<HD.1>ESTRAD</HD.1>
		</MSH.6>
		<MSH.7>
			<TS.1>20150428101603</TS.1>
		</MSH.7>
		<MSH.9>
			<MSG.1>ORM</MSG.1>
			<MSG.2>O01</MSG.2>
			<MSG.3>ORM_O01</MSG.3>
		</MSH.9>
		<MSH.10>2015000000801603580</MSH.10>
		<MSH.11>
			<PT.1>P</PT.1>
		</MSH.11>
		<MSH.12>
			<VID.1>2.5</VID.1>
		</MSH.12>
	</MSH>
	<ORM_O01.PATIENT>
		<PID>
			<PID.3>
				<CX.1>PRNPRN14C07G337F</CX.1>
				<CX.4>
					<HD.1>Ministero Finanze</HD.1>
				</CX.4>
				<CX.5>NNITA</CX.5>
			</PID.3>
			<PID.3>
				<CX.1>1015228</CX.1>
				<CX.4>
					<HD.1>XMPI</HD.1>
				</CX.4>
				<CX.5>XMPI</CX.5>
			</PID.3>
			<PID.3>
				<CX.1>ADTENGI001015228</CX.1>
				<CX.4>
					<HD.1>APC</HD.1>
				</CX.4>
				<CX.5>PI</CX.5>
			</PID.3>
			<PID.5>
				<XPN.1>
					<FN.1>PRONEO2004</FN.1>
				</XPN.1>
				<XPN.2>PRONEO2004</XPN.2>
			</PID.5>
			<PID.7>
				<TS.1>20140307</TS.1>
			</PID.7>
			<PID.8>M</PID.8>
			<PID.11>
				<XAD.3>PARMA</XAD.3>
				<XAD.6>34027</XAD.6>
				<XAD.7>BR</XAD.7>
			</PID.11>
			<PID.11>
				<XAD.1>
					<SAD.1>VIA MILANO 109 COGOZZO</SAD.1>
				</XAD.1>
				<XAD.3>PARMA</XAD.3>
				<XAD.5>43126</XAD.5>
				<XAD.7>L</XAD.7>
				<XAD.9>34027</XAD.9>
			</PID.11>
			<PID.11>
				<XAD.1>
					<SAD.1>VIA MILANO 109 COGOZZO</SAD.1>
				</XAD.1>
				<XAD.3>VIADANA</XAD.3>
				<XAD.5>46019</XAD.5>
				<XAD.7>H</XAD.7>
				<XAD.9>20066</XAD.9>
			</PID.11>
			<PID.13>
				<XTN.3>PH</XTN.3>
				<XTN.12>0522680611MADRE</XTN.12>
			</PID.13>
			<PID.13>
				<XTN.3>CP</XTN.3>
				<XTN.12/>
			</PID.13>
			<PID.26>
				<CE.4>100</CE.4>
				<CE.5>ITALIA</CE.5>
				<CE.6>ISTAT</CE.6>
			</PID.26>
		</PID>
		<ORM_O01.PATIENT_VISIT>
			<PV1>
				<PV1.2>I</PV1.2>
				<PV1.3>
					<PL.1>260</PL.1>
					<PL.4>
						<HD.1>1</HD.1>
					</PL.4>
				</PV1.3>
				<PV1.4>1</PV1.4>
				<PV1.8>
					<XCN.1>CUP2000ME08L378X</XCN.1>
					<XCN.2>
						<FN.1>MEOTTO</FN.1>
					</XCN.2>
					<XCN.3>CUPDUEMILA</XCN.3>
				</PV1.8>
				<PV1.19>
					<CX.1>2014550012</CX.1>
				</PV1.19>
				<PV1.44>
					<TS.1>20140307152901</TS.1>
				</PV1.44>
			</PV1>
		</ORM_O01.PATIENT_VISIT>
	</ORM_O01.PATIENT>
	<ORM_O01.ORDER>
		<ORC>
			<ORC.1>NW</ORC.1>
			<ORC.2>
				<EI.1>201500000159</EI.1>
				<EI.2>ENG</EI.2>
			</ORC.2>
			<ORC.4>
				<EI.1>201500000080</EI.1>
				<EI.2>ENG</EI.2>
			</ORC.4>
			<ORC.5>IP</ORC.5>
			<ORC.7>
				<TQ.4>
					<TS.1>20150418000000</TS.1>
				</TQ.4>
				<TQ.6>90000001508</TQ.6>
			</ORC.7>
			<ORC.9>
				<TS.1>20150417153409</TS.1>
			</ORC.9>
			<ORC.10>
				<XCN.1>GPAGLIARELLO</XCN.1>
			</ORC.10>
			<ORC.12>
				<XCN.1>CUP2000ME08L378X</XCN.1>
				<XCN.2>
					<FN.1>MEOTTO</FN.1>
				</XCN.2>
				<XCN.3>CUPDUEMILA</XCN.3>
			</ORC.12>
			<ORC.17>
				<CE.1>260</CE.1>
				<CE.2>PEDIATRIA OSPEDALE DEL BAMBINO</CE.2>
			</ORC.17>
			<ORC.21>
				<XON.1>PEDIATRIA OSPEDALE DEL BAMBINO</XON.1>
				<XON.10>260</XON.10>
			</ORC.21>
		</ORC>
		<ORM_O01.ORDER_DETAIL>
			<ORM_O01.OBRRQDRQ1RXOODSODT_SUPPGRP>
				<OBR>
					<OBR.2>
						<EI.1>201500000159</EI.1>
						<EI.2>ENG</EI.2>
					</OBR.2>
					<OBR.4>
						<CE.1>A3111</CE.1>
						<CE.2>TAC MASSICCIO FACCIALE (senza MDC)</CE.2>
						<CE.4>87.03.2</CE.4>
						<CE.5>TAC MASSICCIO FACCIALE (senza MDC)</CE.5>
					</OBR.4>
					<OBR.13/>
					<OBR.16>
						<XCN.1>CUP2000ME08L378X</XCN.1>
						<XCN.2>
							<FN.1>MEOTTO</FN.1>
						</XCN.2>
						<XCN.3>CUPDUEMILA</XCN.3>
					</OBR.16>
					<OBR.18>7153</OBR.18>
					<OBR.19/>
					<OBR.30/>
					<OBR.31>
						<CE.2>sss</CE.2>
					</OBR.31>
					<OBR.47>
						<CE.1>7153</CE.1>
						<CE.2>NEURORADIOLOGIA</CE.2>
					</OBR.47>
				</OBR>
			</ORM_O01.OBRRQDRQ1RXOODSODT_SUPPGRP>
		</ORM_O01.ORDER_DETAIL>
	</ORM_O01.ORDER>
</ORM_O01>
Convertion ignore OBR and transform:

Code:
MSH|^~\&|OE|ENG|ESTRAD|ESTRAD|20150428101603||ORM^O01^ORM_O01|2015000000801603580|P|2.5
PID|||PRNPRN14C07G337F^^^Ministero Finanze^NNITA~1015228^^^XMPI^XMPI~ADTENGI001015228^^^APC^PI||PRONEO2004^PRONEO2004||20140307|M|||^^PARMA^^^34027^BR~VIA MILANO 109 COGOZZO^^PARMA^^43126^^L^^34027~VIA MILANO 109 COGOZZO^^VIADANA^^46019^^H^^20066||^^PH^^^^^^^^^0522680611MADRE~^^CP|||||||||||||^^^100^ITALIA^ISTAT
PV1||I|260^^^1|1||||CUP2000ME08L378X^MEOTTO^CUPDUEMILA|||||||||||2014550012|||||||||||||||||||||||||20140307152901
ORC|NW|201500000159^ENG||201500000080^ENG|IP||^^^20150418000000^^90000001508||20150417153409|GPAGLIARELLO||CUP2000ME08L378X^MEOTTO^CUPDUEMILA|||||260^PEDIATRIA OSPEDALE DEL BAMBINO||||PEDIATRIA OSPEDALE DEL BAMBINO^^^^^^^^^260
BUT If I remove <ORM_O01.OBRRQDRQ1RXOODSODT_SUPPGRP> my channel create OBR too

Code:
MSH|^~\&|OE|ENG|ESTRAD|ESTRAD|20150428101603||ORM^O01^ORM_O01|2015000000801603580|P|2.5
PID|||PRNPRN14C07G337F^^^Ministero Finanze^NNITA~1015228^^^XMPI^XMPI~ADTENGI001015228^^^APC^PI||PRONEO2004^PRONEO2004||20140307|M|||^^PARMA^^^34027^BR~VIA MILANO 109 COGOZZO^^PARMA^^43126^^L^^34027~VIA MILANO 109 COGOZZO^^VIADANA^^46019^^H^^20066||^^PH^^^^^^^^^0522680611MADRE~^^CP^^^^^^^^^|||||||||||||^^^100^ITALIA^ISTAT
PV1||I|260^^^1|1||||CUP2000ME08L378X^MEOTTO^CUPDUEMILA|||||||||||2014550012|||||||||||||||||||||||||20140307152901
ORC|NW|201500000159^ENG||201500000080^ENG|IP||^^^20150418000000^^90000001508||20150417153409|GPAGLIARELLO||CUP2000ME08L378X^MEOTTO^CUPDUEMILA|||||260^PEDIATRIA OSPEDALE DEL BAMBINO||||PEDIATRIA OSPEDALE DEL BAMBINO^^^^^^^^^260
OBR||201500000159^ENG||A3111^TAC MASSICCIO FACCIALE (senza MDC)^^87.03.2^TAC MASSICCIO FACCIALE (senza MDC)||||||||||||CUP2000ME08L378X^MEOTTO^CUPDUEMILA||7153|||||||||||||^sss||||||||||||||||7153^NEURORADIOLOGIA
But in http://www.hl7.org/documentcenter/pu...fts/v2xml.html
Standard xds need <ORM_O01.OBRRQDRQ1RXOODSODT_SUPPGRP>
Attached Files
File Type: xml ORM_O01.xsd.xml (5.1 KB, 2 views)
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 05:29 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation