Announcement

Collapse
No announcement yet.

XML to HL7 Transformation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML to HL7 Transformation

    Is there a way to transform a NON-hl7 XML into a proper HL7 file in the preprocessing stage either through XLST or other mechanism?

  • #2
    Re: XML to HL7 Transformation

    You can try with regexp in the preprocessor.

    If you have a non-XML input you can't use XSLT anyway.

    Comment


    • #3
      Re: XML to HL7 Transformation

      Files are XML, just not HL7 encoded XML.

      Comment


      • #4
        Re: XML to HL7 Transformation

        It might make sense to wait for 1.3 and use an outbound channel. You can read in any data (XML is required - this can either be the source or transformed in the pre-proc) and use an HL7 template to generate a new ER7 encoded file.

        -Chris
        Chris Lang

        Comment


        • #5
          Re: XML to HL7 Transformation

          And when will 1.3 be released?

          Comment


          • #6
            Re: XML to HL7 Transformation

            This week.
            Chris Lang

            Comment


            • #7
              Re: XML to HL7 Transformation

              Chris,

              Could you give me a sample code to manipulate XML doc in pre-proc?

              Thanks,

              Charles

              Comment


              • #8
                Re: XML to HL7 Transformation

                Chris,

                I need to extract the value for element <MSH.10_MessageControlId> from the incoming message.

                Here is the same xml.

                Thanks,

                <xmlDoc>
                <ns0:MSH_24_GLO_DEF xmlns:ns0="http://microsoft.com/HealthCare/HL7/2X">
                <MSH xmlns="">
                <MSH.2_EncodingCharacters>^~\&amp;</MSH.2_EncodingCharacters>
                <MSH.3_SendingApplication>
                <HD.0_NamespaceId>OADD</HD.0_NamespaceId>
                </MSH.3_SendingApplication>
                <MSH.4_SendingFacility>
                <HD.0_NamespaceId/>
                </MSH.4_SendingFacility>
                <MSH.5_ReceivingApplication>
                <HD.0_NamespaceId>CAIS</HD.0_NamespaceId>
                </MSH.5_ReceivingApplication>
                <MSH.6_ReceivingFacility>
                <HD.0_NamespaceId/>
                </MSH.6_ReceivingFacility>
                <MSH.7_DateTimeOfMessage>
                <TS.1>20061213155729</TS.1>
                </MSH.7_DateTimeOfMessage>
                <MSH.8_Security/>
                <MSH.9_MessageType>
                <CM_MSG.0_MessageType>ORM</CM_MSG.0_MessageType>
                <CM_MSG.1_TriggerEvent>O01</CM_MSG.1_TriggerEvent>
                </MSH.9_MessageType>
                <MSH.10_MessageControlId>20063470000048</MSH.10_MessageControlId>
                <MSH.11_ProcessingId>
                <PT.0_ProcessingId>T</PT.0_ProcessingId>
                </MSH.11_ProcessingId>
                <MSH.12_VersionId>
                <VID.0_VersionId>2.3</VID.0_VersionId>
                </MSH.12_VersionId>
                </MSH>
                </ns0:MSH_24_GLO_DEF>
                <ns1:ORM_O01_23_GLO_DEF xmlns:ns1="http://phsa.ca/hl7/generic/v23" xmlns:ns0="http://microsoft.com/HealthCare/HL7/2X/2.3/Segments" xmlns:ns2="http://microsoft.com/HealthCare/HL7/2X/2.3/Tables" xmlns:ns3="http://microsoft.com/HealthCare/HL7/2X/2.3/DataTypes">
                <PID_PatientIdentification xmlns="">
                <PID.1_SetIdPatientId/>
                <PID.2_PatientIdExternalId>
                <CX.0_Id>123456789</CX.0_Id>
                <CX.3_AssigningAuthority/>
                </PID.2_PatientIdExternalId>
                <PID.3_PatientIdInternalId>
                <CX.0_Id>123456789</CX.0_Id>
                <CX.1_CheckDigit/>
                <CX.2_CodeIdentifyingTheCheckDigitSchemeEmployed/>
                <CX.3_AssigningAuthority>
                <CX.3.0_NamespaceId/>
                </CX.3_AssigningAuthority>
                <CX.4_IdentifierTypeCode>1</CX.4_IdentifierTypeCode>
                </PID.3_PatientIdInternalId>
                <PID.4_AlternatePatientId/>
                <PID.5_PatientName>
                <XPN.0_FamilyName>MISYS</XPN.0_FamilyName>
                <XPN.1_GivenName>MINNIE</XPN.1_GivenName>
                </PID.5_PatientName>
                <PID.6_MotherSMaidenName/>
                <PID.7_DateOfBirth>19941201</PID.7_DateOfBirth>
                <PID.8_Sex>F</PID.8_Sex>
                <PID.15_PrimaryLanguage/>
                <PID.27_VeteransMilitaryStatus/>
                </PID_PatientIdentification>
                <PV1_PatientVisit xmlns="">
                <PV1.1_SetIdPatientVisit/>
                <PV1.2_PatientClass>OP</PV1.2_PatientClass>
                <PV1.3_AssignedPatientLocation>
                <PL.0_PointOfCareId>BCCA</PL.0_PointOfCareId>
                <PL.3_FacilityHd/>
                </PV1.3_AssignedPatientLocation>
                <PV1.4_AdmissionType/>
                <PV1.5_PreadmitNumber/>
                <PV1.6_PriorPatientLocation>
                <PL.0_PointOfCareId/>
                <PL.3_FacilityHd/>
                </PV1.6_PriorPatientLocation>
                <PV1.7_AttendingDoctor>
                <XCN.0_IdNumberSt>27442</XCN.0_IdNumberSt>
                <XCN.1_FamilyName>Miller</XCN.1_FamilyName>
                <XCN.2_GivenName>Andreas</XCN.2_GivenName>
                <XCN.3_MiddleInitialOrName>Martin</XCN.3_MiddleInitialOrName>
                </PV1.7_AttendingDoctor>
                <PV1.8_ReferringDoctor>
                <XCN.0_IdNumberSt/>
                </PV1.8_ReferringDoctor>
                <PV1.9_ConsultingDoctor>
                <XCN.0_IdNumberSt/>
                </PV1.9_ConsultingDoctor>
                <PV1.10_HospitalService/>
                <PV1.11_TemporaryLocation>
                <PL.0_PointOfCareId/>
                <PL.3_FacilityHd/>
                </PV1.11_TemporaryLocation>
                <PV1.12_PreadmitTestIndicator/>
                <PV1.13_ReadmissionIndicator/>
                <PV1.14_AdmitSource/>
                <PV1.15_AmbulatoryStatus/>
                <PV1.16_VipIndicator/>
                <PV1.17_AdmittingDoctor>
                <XCN.0_IdNumberSt/>
                </PV1.17_AdmittingDoctor>
                <PV1.18_PatientType>OS</PV1.18_PatientType>
                <PV1.19_VisitNumber>
                <CX.0_Id/>
                <CX.3_AssigningAuthority/>
                </PV1.19_VisitNumber>
                <PV1.20_FinancialClass>
                <FC.0_FinancialClass/>
                </PV1.20_FinancialClass>
                <PV1.21_ChargePriceIndicator/>
                <PV1.22_CourtesyCode/>
                <PV1.23_CreditRating/>
                <PV1.24_ContractCode/>
                <PV1.25_ContractEffectiveDate/>
                <PV1.26_ContractAmount/>
                <PV1.27_ContractPeriod/>
                <PV1.28_InterestCode/>
                <PV1.29_TransferToBadDebtCode/>
                <PV1.30_TransferToBadDebtDate/>
                <PV1.31_BadDebtAgencyCode/>
                <PV1.32_BadDebtTransferAmount/>
                <PV1.33_BadDebtRecoveryAmount/>
                <PV1.34_DeleteAccountIndicator/>
                <PV1.35_DeleteAccountDate/>
                <PV1.36_DischargeDisposition/>
                <PV1.37_DischargedToLocation>
                <CM_DLD.0_DischargeLocation/>
                </PV1.37_DischargedToLocation>
                <PV1.38_DietType/>
                <PV1.39_ServicingFacility/>
                <PV1.40_BedStatus/>
                <PV1.41_AccountStatus/>
                <PV1.42_PendingLocation>
                <PL.0_PointOfCareId/>
                <PL.3_FacilityHd/>
                </PV1.42_PendingLocation>
                <PV1.43_PriorTemporaryLocation>
                <PL.0_PointOfCareId/>
                <PL.3_FacilityHd/>
                </PV1.43_PriorTemporaryLocation>
                <PV1.44_AdmitDateTime>200605240000</PV1.44_AdmitDateTime>
                </PV1_PatientVisit>
                <ORC_CommonOrderSegment xmlns="">
                <ORC.1_OrderControl>SC</ORC.1_OrderControl>
                <ORC.2_PlacerOrderNumber>
                <EI.0_EntityIdentifier/>
                </ORC.2_PlacerOrderNumber>
                <ORC.3_FillerOrderNumber>
                <EI.0_EntityIdentifier>168L93W3289CHMISC</EI.0_EntityIdentifier>
                </ORC.3_FillerOrderNumber>
                <ORC.4_PlacerGroupNumber>
                <EI.0_EntityIdentifier/>
                </ORC.4_PlacerGroupNumber>
                <ORC.5_OrderStatus/>
                <ORC.6_ResponseFlag/>
                <ORC.7_QuantityTiming>
                <TQ.0_Quantity>
                <TQ.0.0_Quantity/>
                </TQ.0_Quantity>
                </ORC.7_QuantityTiming>
                <ORC.8_Parent>
                <CM_EIP.0_ParentSPlacerOrderNumber>
                <CM_EIP.0.0_EntityIdentifier/>
                </CM_EIP.0_ParentSPlacerOrderNumber>
                <CM_EIP.1_ParentSFillerOrderNumber/>
                </ORC.8_Parent>
                <ORC.9_DateTimeOfTransaction/>
                <ORC.10_EnteredBy>
                <XCN.0_IdNumberSt/>
                </ORC.10_EnteredBy>
                <ORC.11_VerifiedBy>
                <XCN.0_IdNumberSt/>
                </ORC.11_VerifiedBy>
                <ORC.12_OrderingProvider>
                <XCN.0_IdNumberSt>27442</XCN.0_IdNumberSt>
                <XCN.1_FamilyName>Miller</XCN.1_FamilyName>
                <XCN.2_GivenName>Andreas</XCN.2_GivenName>
                <XCN.3_MiddleInitialOrName>Marti</XCN.3_MiddleInitialOrName>
                </ORC.12_OrderingProvider>
                <ORC.13_EntererSLocation/>
                </ORC_CommonOrderSegment>
                <OBR_ObservationRequestSegment xmlns="">
                <OBR.1_SetIdObservationRequest/>
                <OBR.2_PlacerOrderNumber>
                <EI.0_EntityIdentifier/>
                </OBR.2_PlacerOrderNumber>
                <OBR.3_FillerOrderNumber>
                <EI.0_EntityIdentifier>168L93W3289CHMISC</EI.0_EntityIdentifier>
                </OBR.3_FillerOrderNumber>
                <OBR.4_UniversalServiceIdentifier>
                <CE.0_Identifier>CHMISC</CE.0_Identifier>
                <CE.1_Text>Miscellaneous Test</CE.1_Text>
                </OBR.4_UniversalServiceIdentifier>
                <OBR.5_Priority/>
                <OBR.6_RequestedDateTime/>
                <OBR.7_ObservationDateTime>20061213115100</OBR.7_ObservationDateTime>
                <OBR.8_ObservationEndDateTime/>
                <OBR.9_CollectionVolume>
                <CQ.0_Quantity/>
                <CQ.1_Units/>
                </OBR.9_CollectionVolume>
                <OBR.10_CollectorIdentifier>
                <XCN.0_IdNumberSt/>
                </OBR.10_CollectorIdentifier>
                <OBR.11_SpecimenActionCode/>
                <OBR.12_DangerCode>
                <CE.0_Identifier/>
                </OBR.12_DangerCode>
                <OBR.13_RelevantClinicalInformation/>
                <OBR.14_SpecimenReceivedDateTime>20061213115200</OBR.14_SpecimenReceivedDateTime>
                <OBR.15_SpecimenSource>
                <CM_SPS.0_SpecimenSourceNameOrCode>
                <CM_SPS.0.0_Identifier/>
                </CM_SPS.0_SpecimenSourceNameOrCode>
                </OBR.15_SpecimenSource>
                <OBR.16_OrderingProvider>
                <XCN.0_IdNumberSt>27442</XCN.0_IdNumberSt>
                <XCN.1_FamilyName>Miller</XCN.1_FamilyName>
                <XCN.2_GivenName>Andreas</XCN.2_GivenName>
                <XCN.3_MiddleInitialOrName>Martin</XCN.3_MiddleInitialOrName>
                </OBR.16_OrderingProvider>
                <OBR.17_OrderCallbackPhoneNumber>
                <XTN.0_9999999999X99999CAnyText/>
                </OBR.17_OrderCallbackPhoneNumber>
                <OBR.18_PlacerField1/>
                <OBR.19_PlacerField2/>
                <OBR.20_FillerField1>W3289</OBR.20_FillerField1>
                <OBR.21_FillerField2/>
                <OBR.22_ResultsRptStatusChngDateTime/>
                <OBR.23_ChargeToPractice>
                <CM_MOC.0_DollarAmount>
                <CM_MOC.0.0_Quantity/>
                </CM_MOC.0_DollarAmount>
                <CM_MOC.1_ChargeCode/>
                </OBR.23_ChargeToPractice>
                <OBR.24_DiagnosticServiceSectionId>B020</OBR.24_DiagnosticServiceSectionId>
                <OBR.25_ResultStatus>I</OBR.25_ResultStatus>
                <OBR.26_ParentResult>
                <CM_PRL.0_Obx3ObservationIdentifierOfParentResul t>
                <CM_PRL.0.0_Identifier/>
                </CM_PRL.0_Obx3ObservationIdentifierOfParentResult>
                </OBR.26_ParentResult>
                <OBR.27_QuantityTiming>
                <TQ.0_Quantity>
                <TQ.0.0_Quantity/>
                </TQ.0_Quantity>
                <TQ.1_Interval>
                <TQ.1.0_RepeatPattern/>
                </TQ.1_Interval>
                <TQ.2_Duration/>
                <TQ.3_StartDateTime/>
                <TQ.4_EndDateTime/>
                <TQ.5_Priority>R</TQ.5_Priority>
                </OBR.27_QuantityTiming>
                </OBR_ObservationRequestSegment>
                <Z02_PHSA xmlns="">
                <MSHSendingApplication>OADD</MSHSendingApplication>
                <MSHReceivingApplication>EXC</MSHReceivingApplication>
                <MSHMessageType>ORM</MSHMessageType>
                <MessageStatus>Send</MessageStatus>
                </Z02_PHSA>
                </ns1:ORM_O01_23_GLO_DEF>
                </xmlDoc>

                Comment


                • #9
                  Re: XML to HL7 Transformation

                  Do you need to extract it in the preproc or in a transformer?
                  Chris Lang

                  Comment


                  • #10
                    Re: XML to HL7 Transformation

                    I prefer doing it in transformer.

                    Thanks,

                    Charles

                    Comment


                    • #11
                      Re: XML to HL7 Transformation

                      Hello Chris,

                      Wish you have good holiday.

                      Wondering if you have the sample code to extract any element in an well-formed XML document in either pre-proc or transformer?

                      Thanks,

                      Charles

                      Comment


                      • #12
                        Re: XML to HL7 Transformation

                        Hi,

                        One additional question: does it make sense to support XPath expression instead of the current apprach such as msg[&#039;MSH&#039;][&#039;MSH.1&#039;]?

                        If so, how do you precisely express the second repetition of PID-3 or data in the second OBX segments for example?

                        Thanks,

                        Charles

                        Comment


                        • #13
                          Re: XML to HL7 Transformation

                          Charles,

                          Sorry for the delay. To answer your first question, I believe E4X includes filtering (XPATH/XQUERY) like support, however I do not know for sure. Check out the E4X links in the sticky.

                          For your first question, try:

                          Code:
                          msg[&#039;MSH_24_GLO_DEF&#039;][&#039;MSH&#039;][&#039;MSH.10_MessageControlId&#039;]
                          What do you get with that?

                          -Chris
                          Chris Lang

                          Comment


                          • #14
                            Re: XML to HL7 Transformation

                            Chris,

                            I had tried the following and got null back:

                            var controlid = msg[&#039;MSH_24_GLO_DEF&#039;][&#039;MSH&#039;][&#039;MSH.10_MessageControlId&#039;];
                            logger.error("verifyMsg: controlid == " + controlid);

                            and

                            var controlid = msg[&#039;ns0:MSH_24_GLO_DEF&#039;][&#039;MSH&#039;][&#039;MSH.10_MessageControlId&#039;];
                            logger.error("verifyMsg: controlid == " + controlid);

                            Thanks,

                            Charles

                            Comment


                            • #15
                              Re: XML to HL7 Transformation

                              Try logger.error(msg), logger.error(msg[&#039;MSH&#039;]), logger.error(msg[&#039;xmlDoc&#039;]) and paste what you get.

                              -Chris
                              Chris Lang

                              Comment

                              Working...
                              X