Could not load file or assembly 'file://Microsoft.Solutions.BTAHL7.HL72fDasm.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Reason: Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft BizTalk Server 2009\Pipeline Components\Microsoft.Solutions.BTAHL7.HL72fDasm.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Make sure that your host is running under 32bit mode, if it is running in 64 bit mode, you will get this error.

Import MSI and getting a Pending/Active Batches error

I was importing an MSI into one of our regions, and I received the following error:

“Import/Copy failed as there are active/pending batches. Stop active/pending batches and try importing/copying. (Microsoft.BizTalk.Edi.PartnerAgreementManager)

Pending Batches

I was deploying a lot of pipeline components and by simply stopping the BizTalk service(s), it installed successfully.

A possible HL7 pipeline wives' tale

I just got the HL7 DASM pipeline working with two custom Decode pipeline components (String Replace and Archive).

I was receiving batched messages, and if there was an error in any of the trigger messages, the entire batch was being rejected with no discernable error message other than the context property: ParseError=True (wow, I can really troubleshoot with that indicator)

So I was given hotfix KB 973910 and started testing it. I did not seem to fix the problem.

I changed and used the out of the box HL7 DASM, and it started working (debatching the file and suspending only the trigger message that was actually in error). I decided to rebuild the custom pipeline, I removed the HL7 DASM pipeline component from the .btp file, removed the HL7 DASM from the tool box, and the re-added the pipeline to the tool box and then added it to the .btp file. I then deployed it and ran a file through successfully.

Here is the wives' tale: If you have a custom HL7 pipeline component, you need to remove the HL7 DASM completely from Visual Studio and then re-add it so that BizTalk will see the new behavior.

 

Please let me know if this is a fallacy, and what the minimum amount of work that I have to do to have BizTalk see a newly hotfixed pipeline component.

HL7 Accelerator on a 64bit server

This has happened now three times to me, and I just received an email from a friend about this.

When you install the HL7 accelerator on a 64bit machine, you need to create a 32bit host; as the HL7 DASM and ASM are 32bit only.

A hint as to what kind of host needs to be set up is found in the root drive:

RootDrive 

To do this, you need to create a 32 bit host:

32BitHost

Create the Host Instance:

32BitHostInstance

Create a new send and receive handler using the new 32 bit host that is just created:

 Handler

Which ends up looking like this:

AllHostInstances

And now to change the actual receive or send port to use the 32 bit host instance

32BitReceiveHandler

Migrating Healthcare Databases

To summarize what they are using to migrate gigabytes of data is:

  1. 5 hours before the actual move, they make a full backup of their data in the database (SQL Server 2000)
  2. They use RoboCopy in triplicate to move the more than 20gb of data from one server to another
  3. They restore the data
  4. They do a differential of the last few hours of data

The entire process takes about two hours to fully migrate. The reason why they have allocated an additional 3 hours is so that if there is any problems during the migration, they have enough time to analyze the data and run a complete migration again.

Some of the things that they are looking at and testing is Virtualization using Hyper-V or VMWare to break their dependence on hardware.

HL7 Best Practices

After mulling over how to best implement HL7 interfaces, after reading Microsoft’s partner recommendations; having been involved in a few HL7 implementations myself and (via this blog) assisted many people with their companies HL7 implementation. Since Microsoft hasn’t ever asked me to write for them, I would like to offer some of the best practices that I have found that greatly reduce the amount of time it takes to bring up a HL7 implementation using BizTalk.

Please let me know if you have other items that assist.

Here are the things I have written about:
Create custom schemas for each data source
Optional Z Segment enhancements
MSH Segment Modifications
Context Properties of the HL7 Message
HL7 Mapping
Summary

Create custom schemas for each data source

I know that this seems logical, but I have come across a few companies that have not bothered to implement this, and simply have taken the out of the box schemas that Microsoft has delivered and ‘expanded’ or otherwise tweaked it to accept every data source’s definition. To do this is pretty easy. The steps are as follows:

Set up the Partner1 HL7 version project

Partner1ProjectSetup

Open up all of the schemas in a text editor and replace the default target namespace with the partner’s value.

Partner1Replace1

So lets now set up the project that will actually define the messages received or created, and reference both the Common project you just created and the 2XCommon (to be explained later)

Partner1References

Now let’s create the message we are going to be receiving

Partner1Replace2

Now we are able to make customizations

Partner1Mod

Now we can do the same thing for a second data source.

Partner2ProjectSetup 

And the replace

Partner2Replace1

The referencing of the parent projects and the creation of the message

Partner2ProjectSetup2

And now the target namespace replacement

Partner2Replace2

And the subsequent customizations to this feed

Partner2Mod

Okay, now we need to define to BizTalk, how it is going to know which set of schemas to use

Create the Party names and then open up the BTAHL7 Configuration Explorer

PartySetup

In the BTAHL7 Configuration Explorer, we define the target namespace.

Party1Namespace

Party2Namespace

Optional Z Segment enhancements

According to the documentation, to deal with Z segments, you create as part of your multipart HL7 message a System.String message part.

A better approach it to define a schema and use it as a Z Segment.

Since I might use this schema for every trading partner, I have added it to the 2XCommon project.

ZSegmentInProject

In an orchestration, we create the multi-part message.

When you create the multipart message, make sure that you first create the BodySegments first and then add the other parts (an error occurs when the orchestration attempts to pair up the body parts to the intended parts if it is not done correctly).

(Click to expand)

MappingMultiPartMessages

If you had followed even the latest ‘recommendations from the msdn’ by setting the Z Segments as a string, you can’t access the message parts directly, and would have to use a message assignment block to ‘extract’ the segments you want and then map what you want. (Bad practice if you ask me).

MSH Segment Modifications

I have seen this come up a few times, and I have asked the question once myself, so I might as well put it here:

You can’t have multiple MSH segments deployed, the HL7 DASM/ASM is looking for the MSH schema that comes pre packaged with the product (well, not quite, it is looking for a schema with the target namespace of http://microsoft.com/HealthCare/HL7/2X#MSH_25_GLO_DEF).

The question then arises, what if I have different looking MSH segments coming in from different trading partners?

The answer is to either modify the single MSH segment schema to handle all types of MSH segments, or to place a pre processing pipeline component in front of the HL7 DASM to allow it to conform to the out-of-the-box MSH schema.

Context Properties of the HL7 Message 

This really isn’t a best practice, but just an less than explicitly documented feature that I thought would be worth noting.

After you have created your outbound HL7 message, there are some properties that you need to assign.

// decimal representation of the MSH1
ORU_R01Msg(BTAHL7Schemas.MSH1) = 124; 
// characters representative of MSH2
ORU_R01Msg(BTAHL7Schemas.MSH2) = "^~\\&";
// defined so the BTAHL7 ASM does not handle it incorrectly
ORU_R01Msg(BTAHL7Schemas.ParseError) = false; 
// Do not include the Z Segment in the final output
ORU_R01Msg(BTAHL7Schemas.ZPartPresent) = false;
// append a <LF> to the segment seperator (normally just a <CR>)
ORU_R01Msg(BTAHL7Schemas.SegmentDelimiter2Char) = true;

HL7 Mapping

According to the HL7 v2 Developers guide located in BizTalk Server 2006 R2 documentation on msdn, down near the end, there is a section called Controlling the Order of Mapped elements, it states you should simply be able to write some customize XSLT to accomplish the mapping.

The example they provide is this:

<Sorted_Input>
 <A><one/></A>
 <B><two/></B>
 <A><one/></A>
 <B><two/></B>
</Sorted_Input>

The output, if you simply use the mapper creates the following output:

<Bad_Output>
 <A><one/></A>
 <A><one/></A>
 <B><two/></B>
 <B><two/></B>
</Bad_Output>

The answer is to simply modify the XSLT to use a for-each statement and it will solve it:

<xsl:for-each select="Sorted_Input">
    <Bad_Output>
        <xsl:for-each select="A">
            <A><one><xsl:value-of select="one"/></one></A>
        </xsl:for-each>
        <xsl:for-each select="B">
            <B><two><xsl:value-of select="two"/></two></B>
        </xsl:for-each>
    </Bad_Output>
</xsl:for-each>

Which creates the output:

<Good_Output>
 <A><one/></A>
 <B><two/></B>
 <A><one/></A>
 <B><two/></B>
</Good_Output>

When I read through this, I thought, the solution provided is too easy and it is not right. I have never seen any HL7 message come in that looks that simple!

I must be the only one that has come across this issue because no one has ever complained about it, or asked. but I have always had a hard time mapping the HL7 schemas to something a little more understandable.

Here is the out-of-the-box schema to the ORU_R01

OOB_ORU_R01

Which means that the xml document shows up in the message box looking like this:

HL7DASMMsg

Notice that the simple for-each situation will not work in this situation. Here are the problems I see:

The ORC_CommonOrderSegment followed by an OBR_ObservationRequestSegment OR the OBR_ObservationRequestSegment represent a new ‘Order’

The OBX_CobersationResultSegment can have a NTE_NotesAndCommentsSegment_2

I simply wanted to create the same input as output, except ‘levelled’ so I can map it to a different structure.

Here is the schema I created:

New_ORU_R01

Instead of explaining how to map it successfully, here is the xslt to do this transformation

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
xmlns:ns0="http://labcorp.com/HL7/2X">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/ns0:ORU_R01_231_GLO_DEF">
    <ns0:ORU_R01_231_GLO_DEF>
      <CompleteOrder>
        <Patient>
          <xsl:for-each select="PID_PatientIdentificationSegment">
            <PID_PatientIdentificationSegment>
              <PID_1_SetIdPid>
                <xsl:apply-templates select="PID_1_SetIdPid"/>
              </PID_1_SetIdPid>
              <PID_2_PatientId>
                <CX_0_Id>
                  <xsl:value-of select="PID_2_PatientId/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_2_PatientId>
              <PID_3_PatientIdentifierList>
                <CX_0_Id>
                  <xsl:value-of select="PID_3_PatientIdentifierList/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_3_PatientIdentifierList>
              <PID_4_AlternatePatientIdPid>
                <CX_0_Id>
                  <xsl:value-of select="PID_4_PatientIdentifierList/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_4_AlternatePatientIdPid>
              <PID_5_PatientName>
                <XPN_0_FamilyLastName>
                  <XPN_0_0_FamilyName>
                    <xsl:value-of  select="PID_5_PatientName/XPN_0_FamilyLastName/XPN_0_0_FamilyName"></xsl:value-of>
                  </XPN_0_0_FamilyName>
                </XPN_0_FamilyLastName>
                <XPN_1_GivenName>
                  <xsl:value-of select="PID_5_PatientName/XPN_1_GivenName"></xsl:value-of>
                </XPN_1_GivenName>
                <XPN_2_MiddleInitialOrName>
                  <xsl:value-of select="PID_5_PatientName/XPN_2_MiddleInitialOrName"></xsl:value-of>
                </XPN_2_MiddleInitialOrName>
              </PID_5_PatientName>
              <PID_6_MotherSMaidenName>
                <XPN_0_FamilyLastName>
                  <XPN_0_0_FamilyName>
                    <xsl:value-of select="PID_6_MotherSMaidenName/XPN_0_FamilyLastName/XPN_0_0_FamilyName"></xsl:value-of>
                  </XPN_0_0_FamilyName>
                </XPN_0_FamilyLastName>
              </PID_6_MotherSMaidenName>
              <PID_7_DateTimeOfBirth>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="PID_7_DateTimeOfBirth/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </PID_7_DateTimeOfBirth>
              <PID_8_Sex>
                <xsl:value-of select="PID_8_Sex"></xsl:value-of>
              </PID_8_Sex>
              <PID_9_PatientAlias>
                <XPN_0_FamilyLastName>
                  <XPN_0_0_FamilyName>
                    <xsl:value-of select="PID_9_PatientAlias/XPN_0_FamilyLastName/XPN_0_0_FamilyName"></xsl:value-of>
                  </XPN_0_0_FamilyName>
                </XPN_0_FamilyLastName>
              </PID_9_PatientAlias>
              <PID_10_Race>
                <CE_5_NameOfAlternateCodingSystem>
                  <xsl:value-of select="PID_10_Race/CE_0005_0_Identifier"></xsl:value-of>
                </CE_5_NameOfAlternateCodingSystem>
              </PID_10_Race>
              <PID_11_PatientAddress>
                <XAD_0_StreetAddress>
                  <xsl:value-of select="PID_11_PatientAddress/XAD_0_StreetAddress"></xsl:value-of>
                </XAD_0_StreetAddress>
              </PID_11_PatientAddress>
              <PID_12_CountyCode>
                <xsl:value-of select="PID_12_CountyCode"></xsl:value-of>
              </PID_12_CountyCode>
              <PID_13_PhoneNumberHome>
                <XTN_0_9999999999X99999CAnyText>
                  <xsl:value-of select="PID_13_PhoneNumberHome/XTN_0_9999999999X99999CAnyText"></xsl:value-of>
                </XTN_0_9999999999X99999CAnyText>
              </PID_13_PhoneNumberHome>
              <PID_14_PhoneNumberBusiness>
                <XTN_0_9999999999X99999CAnyText>
                  <xsl:value-of select="PID_14_PhoneNumberBusiness/XTN_0_9999999999X99999CAnyText"></xsl:value-of>
                </XTN_0_9999999999X99999CAnyText>
              </PID_14_PhoneNumberBusiness>
              <PID_15_PrimaryLanguage>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_15_PrimaryLanguage/CE_0296_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_15_PrimaryLanguage>
              <PID_16_MaritalStatus>
                <CE_2_NameOfCodingSystem>
                  <xsl:value-of select="PID_16_MaritalStatus/CE_0002_0_Identifier"></xsl:value-of>
                </CE_2_NameOfCodingSystem>
              </PID_16_MaritalStatus>
              <PID_17_Religion>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_17_Religion/CE_0006_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_17_Religion>
              <PID_18_PatientAccountNumber>
                <CX_0_Id>
                  <xsl:value-of select="PID_18_PatientAccountNumber/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_18_PatientAccountNumber>
              <PID_19_SsnNumberPatient>
                <xsl:value-of select="PID_19_SsnNumberPatient"></xsl:value-of>
              </PID_19_SsnNumberPatient>
              <PID_20_DriverSLicenseNumberPatient>
                <DLN_0_DriverSLicenseNumber>
                  <xsl:value-of select="PID_20_DriverSLicenseNumberPatient/DLN_0_DriverSLicenseNumber"></xsl:value-of>
                </DLN_0_DriverSLicenseNumber>
              </PID_20_DriverSLicenseNumberPatient>
              <PID_21_MotherSIdentifier>
                <CX_0_Id>
                  <xsl:value-of select="PID_21_MotherSIdentifier/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_21_MotherSIdentifier>
              <PID_22_EthnicGroup>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_22_EthnicGroup/CE_0189_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_22_EthnicGroup>
              <PID_23_BirthPlace>
                <xsl:value-of select="PID_23_BirthPlace"></xsl:value-of>
              </PID_23_BirthPlace>
              <PID_24_MultipleBirthIndicator>
                <xsl:value-of select="PID_24_MultipleBirthIndicator"></xsl:value-of>
              </PID_24_MultipleBirthIndicator>
              <PID_25_BirthOrder>
                <xsl:value-of select="PID_25_BirthOrder"></xsl:value-of>
              </PID_25_BirthOrder>
              <PID_26_Citizenship>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_26_Citizenship/CE_0171_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_26_Citizenship>
              <PID_27_VeteransMilitaryStatus>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_27_VeteransMilitaryStatus/CE_0172_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_27_VeteransMilitaryStatus>
              <PID_28_Nationality>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_28_Nationality/CE_0212_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_28_Nationality>
              <PID_29_PatientDeathDateAndTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="PID_29_PatientDeathDateAndTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </PID_29_PatientDeathDateAndTime>
            </PID_PatientIdentificationSegment>
          </xsl:for-each>
          <Visit>
            <PV1_PatientVisitSegment>
              <xsl:for-each select="PV1_PatientVisitSegment">
                <PV1_1_SetIdPv1>
                  <xsl:value-of select="PV1_1_SetIdPv1"></xsl:value-of>
                </PV1_1_SetIdPv1>
                <PV1_2_PatientClass>
                  <xsl:value-of select="PV1_2_PatientClass"></xsl:value-of>
                </PV1_2_PatientClass>
                <PV1_3_AssignedPatientLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_3_AssignedPatientLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_3_AssignedPatientLocation>
                <PV1_4_AdmissionType>
                  <xsl:value-of select="PV1_4_AdmissionType"></xsl:value-of>
                </PV1_4_AdmissionType>
                <PV1_5_PreadmitNumber>
                  <CX_0_Id>
                    <xsl:value-of select="PV1_5_PreadmitNumber/CX_0_Id"></xsl:value-of>
                  </CX_0_Id>
                </PV1_5_PreadmitNumber>
                <PV1_6_PriorPatientLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_6_PriorPatientLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_6_PriorPatientLocation>
                <PV1_7_AttendingDoctor>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_7_AttendingDoctor/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                  <XCN_1_FamilyLastName>
                    <XCN_1_0_FamilyName>
                      <xsl:value-of select="PV1_7_AttendingDoctor/XCN_1_FamilyLastName/XCN_1_0_FamilyName"></xsl:value-of>
                    </XCN_1_0_FamilyName>
                  </XCN_1_FamilyLastName>
                  <XCN_2_GivenName>
                    <xsl:value-of select="PV1_7_AttendingDoctor/XCN_2_GivenName"></xsl:value-of>
                  </XCN_2_GivenName>
                  <XCN_3_MiddleInitialOrName>
                    <xsl:value-of select="PV1_7_AttendingDoctor/XCN_3_MiddleInitialOrName"></xsl:value-of>
                  </XCN_3_MiddleInitialOrName>
                </PV1_7_AttendingDoctor>
                <PV1_8_ReferringDoctor>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_8_ReferringDoctor/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                </PV1_8_ReferringDoctor>
                <PV1_9_ConsultingDoctor>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_9_ConsultingDoctor/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                </PV1_9_ConsultingDoctor>
                <PV1_10_HospitalService>
                  <xsl:value-of select="PV1_10_HospitalService"></xsl:value-of>
                </PV1_10_HospitalService>
                <PV1_11_TemporaryLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_11_TemporaryLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_11_TemporaryLocation>
                <PV1_12_PreadmitTestIndicator>
                  <xsl:value-of select="PV1_12_PreadmitTestIndicator"></xsl:value-of>
                </PV1_12_PreadmitTestIndicator>
                <PV1_13_ReAdmissionIndicator>
                  <xsl:value-of select="PV1_13_ReAdmissionIndicator"></xsl:value-of>
                </PV1_13_ReAdmissionIndicator>
                <PV1_14_AdmitSource>
                  <xsl:value-of select="PV1_14_AdmitSource"></xsl:value-of>
                </PV1_14_AdmitSource>
                <PV1_15_AmbulatoryStatus>
                  <xsl:value-of select="PV1_15_AmbulatoryStatus"></xsl:value-of>
                </PV1_15_AmbulatoryStatus>
                <PV1_16_VipIndicator>
                  <xsl:value-of select="PV1_16_VipIndicator"></xsl:value-of>
                </PV1_16_VipIndicator>
                <PV1_17_AdmittingDoctor>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_17_AdmittingDoctor/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                </PV1_17_AdmittingDoctor>
                <PV1_18_PatientType>
                  <xsl:value-of select="PV1_13_ReAdmissionIndicator"></xsl:value-of>
                </PV1_18_PatientType>
                <PV1_19_VisitNumber>
                  <CX_0_Id>
                    <xsl:value-of select="PV1_19_VisitNumber/CX_0_Id"></xsl:value-of>
                  </CX_0_Id>
                </PV1_19_VisitNumber>
                <PV1_20_FinancialClass>
                  <FC_0_FinancialClass>
                    <xsl:value-of select="PV1_20_FinancialClass/FC_0_FinancialClass"></xsl:value-of>
                  </FC_0_FinancialClass>
                </PV1_20_FinancialClass>
                <PV1_21_ChargePriceIndicator>
                  <xsl:value-of select="PV1_21_ChargePriceIndicator"></xsl:value-of>
                </PV1_21_ChargePriceIndicator>
                <PV1_22_CourtesyCode>
                  <xsl:value-of select="PV1_22_CourtesyCode"></xsl:value-of>
                </PV1_22_CourtesyCode>
                <PV1_23_CreditRating>
                  <xsl:value-of select="PV1_23_CreditRating"></xsl:value-of>
                </PV1_23_CreditRating>
                <PV1_24_ContractCode>
                  <xsl:value-of select="PV1_24_ContractCode"></xsl:value-of>
                </PV1_24_ContractCode>
                <PV1_25_ContractEffectiveDate>
                  <xsl:value-of select="PV1_25_ContractEffectiveDate"></xsl:value-of>
                </PV1_25_ContractEffectiveDate>
                <PV1_26_ContractAmount>
                  <xsl:value-of select="PV1_26_ContractAmount"></xsl:value-of>
                </PV1_26_ContractAmount>
                <PV1_27_ContractPeriod>
                  <xsl:value-of select="PV1_27_ContractPeriod"></xsl:value-of>
                </PV1_27_ContractPeriod>
                <PV1_28_InterestCode>
                  <xsl:value-of select="PV1_28_InterestCode"></xsl:value-of>
                </PV1_28_InterestCode>
                <PV1_29_TransferToBadDebtCode>
                  <xsl:value-of select="PV1_29_TransferToBadDebtCode"></xsl:value-of>
                </PV1_29_TransferToBadDebtCode>
                <PV1_30_TransferToBadDebtDate>
                  <xsl:value-of select="PV1_30_TransferToBadDebtDate"></xsl:value-of>
                </PV1_30_TransferToBadDebtDate>
                <PV1_31_BadDebtAgencyCode>
                  <xsl:value-of select="PV1_31_BadDebtAgencyCode"></xsl:value-of>
                </PV1_31_BadDebtAgencyCode>
                <PV1_32_BadDebtTransferAmount>
                  <xsl:value-of select="PV1_32_BadDebtTransferAmount"></xsl:value-of>
                </PV1_32_BadDebtTransferAmount>
                <PV1_33_BadDebtRecoveryAmount>
                  <xsl:value-of select="PV1_33_BadDebtRecoveryAmount"></xsl:value-of>
                </PV1_33_BadDebtRecoveryAmount>
                <PV1_34_DeleteAccountIndicator>
                  <xsl:value-of select="PV1_34_DeleteAccountIndicator"></xsl:value-of>
                </PV1_34_DeleteAccountIndicator>
                <PV1_35_DeleteAccountDate>
                  <xsl:value-of select="PV1_35_DeleteAccountDate"></xsl:value-of>
                </PV1_35_DeleteAccountDate>
                <PV1_36_DischargeDisposition>
                  <xsl:value-of select="PV1_36_DischargeDisposition"></xsl:value-of>
                </PV1_36_DischargeDisposition>
                <PV1_37_DischargedToLocation>
                  <DLD_0_DischargeLocation>
                    <xsl:value-of select="PV1_37_DischargedToLocation/DLD_0_DischargeLocation"></xsl:value-of>
                  </DLD_0_DischargeLocation>
                </PV1_37_DischargedToLocation>
                <PV1_38_DietType>
                  <CE_0_Identifier>
                    <xsl:value-of select="PV1_38_DietType/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                </PV1_38_DietType>
                <PV1_39_ServicingFacility>
                  <xsl:value-of select="PV1_39_ServicingFacility"></xsl:value-of>
                </PV1_39_ServicingFacility>
                <PV1_40_BedStatus>
                  <xsl:value-of select="PV1_40_BedStatus"></xsl:value-of>
                </PV1_40_BedStatus>
                <PV1_41_AccountStatus>
                  <xsl:value-of select="PV1_41_AccountStatus"></xsl:value-of>
                </PV1_41_AccountStatus>
                <PV1_42_PendingLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_42_PendingLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_42_PendingLocation>
                <PV1_43_PriorTemporaryLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_43_PriorTemporaryLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_43_PriorTemporaryLocation>
                <PV1_44_AdmitDateTime>
                  <TS_0_TimeOfAnEvent>
                    <xsl:value-of select="PV1_44_AdmitDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                  </TS_0_TimeOfAnEvent>
                </PV1_44_AdmitDateTime>
                <PV1_45_DischargeDateTime>
                  <TS_0_TimeOfAnEvent>
                    <xsl:value-of select="PV1_45_DischargeDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                  </TS_0_TimeOfAnEvent>
                </PV1_45_DischargeDateTime>
                <PV1_46_CurrentPatientBalance>
                  <xsl:value-of select="PV1_46_CurrentPatientBalance"></xsl:value-of>
                </PV1_46_CurrentPatientBalance>
                <PV1_47_TotalCharges>
                  <xsl:value-of select="PV1_47_TotalCharges"></xsl:value-of>
                </PV1_47_TotalCharges>
                <PV1_48_TotalAdjustments>
                  <xsl:value-of select="PV1_48_TotalAdjustments"></xsl:value-of>
                </PV1_48_TotalAdjustments>
                <PV1_49_TotalPayments>
                  <xsl:value-of select="PV1_49_TotalPayments"></xsl:value-of>
                </PV1_49_TotalPayments>
                <PV1_50_AlternateVisitId>
                  <CX_0_Id>
                    <xsl:value-of select="PV1_50_AlternateVisitId/CX_0_Id"></xsl:value-of>
                  </CX_0_Id>
                </PV1_50_AlternateVisitId>
                <PV1_51_VisitIndicator>
                  <xsl:value-of select="PV1_51_VisitIndicator"></xsl:value-of>
                </PV1_51_VisitIndicator>
                <PV1_52_OtherHealthcareProvider>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_52_OtherHealthcareProvider/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                </PV1_52_OtherHealthcareProvider>
              </xsl:for-each>
            </PV1_PatientVisitSegment>
          </Visit>
        </Patient>
        <xsl:variable name="OrderStart" >
          &lt;Order&gt;
        </xsl:variable>
        <xsl:variable name="OrderEnd">&lt;/Order&gt;</xsl:variable>
        <xsl:for-each select="*">
          <xsl:if test="name()='ORC_CommonOrderSegment'">
            <xsl:value-of select="$OrderStart" disable-output-escaping="yes"/>
            <ORC_CommonOrderSegment>
              <ORC_1_OrderControl>
                <xsl:value-of select="ORC_1_OrderControl"></xsl:value-of>
              </ORC_1_OrderControl>
              <ORC_2_PlacerOrderNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="ORC_2_PlacerOrderNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </ORC_2_PlacerOrderNumber>
              <ORC_3_FillerOrderNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="ORC_3_FillerOrderNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </ORC_3_FillerOrderNumber>
              <ORC_4_PlacerGroupNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="ORC_4_PlacerGroupNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </ORC_4_PlacerGroupNumber>
              <ORC_5_OrderStatus>
                <xsl:value-of select="ORC_5_OrderStatus"></xsl:value-of>
              </ORC_5_OrderStatus>
              <ORC_6_ResponseFlag>
                <xsl:value-of select="ORC_6_ResponseFlag"></xsl:value-of>
              </ORC_6_ResponseFlag>
              <ORC_7_QuantityTiming>
                <TQ_0_Quantity>
                  <TQ_0_0_Quantity>
                    <xsl:value-of select="ORC_7_QuantityTiming/TQ_0_Quantity/TQ_0_0_Quantity"></xsl:value-of>
                  </TQ_0_0_Quantity>
                </TQ_0_Quantity>
              </ORC_7_QuantityTiming>
              <ORC_8_Parent>
                <EIP_0_ParentSPlacerOrderNumber>
                  <EIP_0_0_EntityIdentifier>
                    <xsl:value-of select="ORC_8_Parent/EIP_0_ParentSPlacerOrderNumber/EIP_0_0_EntityIdentifier"></xsl:value-of>
                  </EIP_0_0_EntityIdentifier>
                </EIP_0_ParentSPlacerOrderNumber>
              </ORC_8_Parent>
              <ORC_9_DateTimeOfTransaction>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="ORC_9_DateTimeOfTransaction/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </ORC_9_DateTimeOfTransaction>
              <ORC_10_EnteredBy>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="ORC_10_EnteredBy/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </ORC_10_EnteredBy>
              <ORC_11_VerifiedBy>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="ORC_11_VerifiedBy/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </ORC_11_VerifiedBy>
              <ORC_12_OrderingProvider>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
                <XCN_1_FamilyLastName>
                  <XCN_1_0_FamilyName>
                    <xsl:value-of select="ORC_12_OrderingProvider/XCN_1_FamilyLastName/XCN_1_0_FamilyName"></xsl:value-of>
                  </XCN_1_0_FamilyName>
                </XCN_1_FamilyLastName>
                <XCN_2_GivenName>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_2_GivenName"></xsl:value-of>
                </XCN_2_GivenName>
                <XCN_3_MiddleInitialOrName>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_3_MiddleInitialOrName"></xsl:value-of>
                </XCN_3_MiddleInitialOrName>
                <XCN_4_SuffixEGJrOrIii>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_4_SuffixEGJrOrIii"></xsl:value-of>
                </XCN_4_SuffixEGJrOrIii>
                <XCN_5_PrefixEGDr>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_5_PrefixEGDr"></xsl:value-of>
                </XCN_5_PrefixEGDr>
                <XCN_6_DegreeEGMd>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_6_DegreeEGMd"></xsl:value-of>
                </XCN_6_DegreeEGMd>
                <XCN_7_SourceTable>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_7_SourceTable"></xsl:value-of>
                </XCN_7_SourceTable>
                <XCN_8_AssigningAuthority>
                  <XCN_8_0_NamespaceId>
                    <xsl:value-of select="ORC_12_OrderingProvider/XCN_8_AssigningAuthority/XCN_8_0_NamespaceId"></xsl:value-of>
                  </XCN_8_0_NamespaceId>
                </XCN_8_AssigningAuthority>
                <XCN_9_NameTypeCode>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_9_NameTypeCode"></xsl:value-of>
                </XCN_9_NameTypeCode>
                <XCN_10_IdentifierCheckDigit>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_10_IdentifierCheckDigit"></xsl:value-of>
                </XCN_10_IdentifierCheckDigit>
                <XCN_11_CodeIdentifyingTheCheckDigitSchemeEmployed>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_11_CodeIdentifyingTheCheckDigitSchemeEmployed"></xsl:value-of>
                </XCN_11_CodeIdentifyingTheCheckDigitSchemeEmployed>
                <XCN_12_IdentifierTypeCode>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_12_IdentifierTypeCode"></xsl:value-of>
                </XCN_12_IdentifierTypeCode>
              </ORC_12_OrderingProvider>
              <ORC_13_EntererSLocation>
                <PL_0_PointOfCare>
                  <xsl:value-of select="ORC_13_EntererSLocation/PL_0_PointOfCare"></xsl:value-of>
                </PL_0_PointOfCare>
              </ORC_13_EntererSLocation>
              <ORC_14_CallBackPhoneNumber>
                <XTN_0_9999999999X99999CAnyText>
                  <xsl:value-of select="ORC_14_CallBackPhoneNumber/XTN_0_9999999999X99999CAnyText"></xsl:value-of>
                </XTN_0_9999999999X99999CAnyText>
              </ORC_14_CallBackPhoneNumber>
              <ORC_15_OrderEffectiveDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="ORC_15_OrderEffectiveDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </ORC_15_OrderEffectiveDateTime>
              <ORC_16_OrderControlCodeReason>
                <CE_0_Identifier>
                  <xsl:value-of select="ORC_16_OrderControlCodeReason/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </ORC_16_OrderControlCodeReason>
              <ORC_17_EnteringOrganization>
                <CE_0_Identifier>
                  <xsl:value-of select="ORC_17_EnteringOrganization/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </ORC_17_EnteringOrganization>
              <ORC_18_EnteringDevice>
                <CE_0_Identifier>
                  <xsl:value-of select="ORC_18_EnteringDevice/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </ORC_18_EnteringDevice>
              <ORC_19_ActionBy>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="ORC_19_ActionBy/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </ORC_19_ActionBy>
            </ORC_CommonOrderSegment>
          </xsl:if>
          <xsl:if test="name()='OBR_ObservationRequestSegment'">
            <xsl:if test="local-name(preceding-sibling::*[1])!='ORC_CommonOrderSegment'">
              <xsl:value-of select="$OrderStart" disable-output-escaping="yes"/>
            </xsl:if>
            <OBR_ObservationRequestSegment>
              <OBR_1_SetIdObr>
                <xsl:value-of select="OBR_1_SetIdObr"></xsl:value-of>
              </OBR_1_SetIdObr>
              <OBR_2_PlacerOrderNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="OBR_2_PlacerOrderNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </OBR_2_PlacerOrderNumber>
              <OBR_3_FillerOrderNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="OBR_3_FillerOrderNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </OBR_3_FillerOrderNumber>
              <OBR_4_UniversalServiceId>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_4_UniversalServiceId/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
                <CE_1_Text>
                  <xsl:value-of select="OBR_4_UniversalServiceId/CE_1_Text"></xsl:value-of>
                </CE_1_Text>
                <CE_2_NameOfCodingSystem>
                  <xsl:value-of select="OBR_4_UniversalServiceId/CE_2_NameOfCodingSystem"></xsl:value-of>
                </CE_2_NameOfCodingSystem>
              </OBR_4_UniversalServiceId>
              <OBR_5_PriorityObr>
                <xsl:value-of select="OBR_5_PriorityObr"></xsl:value-of>
              </OBR_5_PriorityObr>
              <OBR_6_RequestedDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_6_RequestedDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_6_RequestedDateTime>
              <OBR_7_ObservationDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_7_ObservationDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_7_ObservationDateTime>
              <OBR_8_ObservationEndDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_8_ObservationEndDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_8_ObservationEndDateTime>
              <OBR_9_CollectionVolume>
                <CQ_0_Quantity>
                  <xsl:value-of select="OBR_9_CollectionVolume/CQ_0_Quantity"></xsl:value-of>
                </CQ_0_Quantity>
              </OBR_9_CollectionVolume>
              <OBR_10_CollectorIdentifier>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="OBR_10_CollectorIdentifier/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </OBR_10_CollectorIdentifier>
              <OBR_11_SpecimenActionCode>
                <xsl:value-of select="OBR_11_SpecimenActionCode"></xsl:value-of>
              </OBR_11_SpecimenActionCode>
              <OBR_12_DangerCode>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_12_DangerCode/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_12_DangerCode>
              <OBR_13_RelevantClinicalInfo>
                <xsl:value-of select="OBR_13_RelevantClinicalInfo"></xsl:value-of>
              </OBR_13_RelevantClinicalInfo>
              <OBR_14_SpecimenReceivedDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_14_SpecimenReceivedDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_14_SpecimenReceivedDateTime>
              <OBR_15_SpecimenSource>
                <SPS_0_SpecimenSourceNameOrCode>
                  <SPS_0_0_Identifier>
                    <xsl:value-of select="OBR_15_SpecimenSource/SPS_0_SpecimenSourceNameOrCode/SPS_0_0_Identifier"></xsl:value-of>
                  </SPS_0_0_Identifier>
                </SPS_0_SpecimenSourceNameOrCode>
              </OBR_15_SpecimenSource>
              <OBR_16_OrderingProvider>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="OBR_16_OrderingProvider/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </OBR_16_OrderingProvider>
              <OBR_17_OrderCallbackPhoneNumber>
                <XTN_0_9999999999X99999CAnyText>
                  <xsl:value-of select="OBR_17_OrderCallbackPhoneNumber/XTN_0_9999999999X99999CAnyText"></xsl:value-of>
                </XTN_0_9999999999X99999CAnyText>
              </OBR_17_OrderCallbackPhoneNumber>
              <OBR_18_PlacerField1>
                <xsl:value-of select="OBR_18_PlacerField1"></xsl:value-of>
              </OBR_18_PlacerField1>
              <OBR_19_PlacerField2>
                <xsl:value-of select="OBR_19_PlacerField2"></xsl:value-of>
              </OBR_19_PlacerField2>
              <OBR_20_FillerField1>
                <xsl:value-of select="OBR_20_FillerField1"></xsl:value-of>
              </OBR_20_FillerField1>
              <OBR_21_FillerField2>
                <xsl:value-of select="OBR_21_FillerField2"></xsl:value-of>
              </OBR_21_FillerField2>
              <OBR_22_ResultsRptStatusChngDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_22_ResultsRptStatusChngDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_22_ResultsRptStatusChngDateTime>
              <OBR_23_ChargeToPractice>
                <MOC_0_DollarAmount>
                  <MOC_0_0_Quantity>
                    <xsl:value-of select="OBR_23_ChargeToPractice/MOC_0_DollarAmount/MOC_0_0_Quantity"></xsl:value-of>
                  </MOC_0_0_Quantity>
                </MOC_0_DollarAmount>
              </OBR_23_ChargeToPractice>
              <OBR_24_DiagnosticServSectId>
                <xsl:value-of select="OBR_24_DiagnosticServSectId"></xsl:value-of>
              </OBR_24_DiagnosticServSectId>
              <OBR_25_ResultStatus>
                <xsl:value-of select="OBR_25_ResultStatus"></xsl:value-of>
              </OBR_25_ResultStatus>
              <OBR_26_ParentResult>
                <PRL_0_Obx3ObservationIdentifierOfParentResult>
                  <PRL_0_0_Identifier>
                    <xsl:value-of select="OBR_26_ParentResult/PRL_0_Obx3ObservationIdentifierOfParentResult/PRL_0_0_Identifier"></xsl:value-of>
                  </PRL_0_0_Identifier>
                </PRL_0_Obx3ObservationIdentifierOfParentResult>
              </OBR_26_ParentResult>
              <OBR_27_QuantityTiming>
                <TQ_0_Quantity>
                  <TQ_0_0_Quantity>
                    <xsl:value-of select="OBR_27_QuantityTiming/TQ_0_Quantity/TQ_0_0_Quantity"></xsl:value-of>
                  </TQ_0_0_Quantity>
                </TQ_0_Quantity>
              </OBR_27_QuantityTiming>
              <OBR_28_ResultCopiesTo>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="OBR_28_ResultCopiesTo/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </OBR_28_ResultCopiesTo>
              <OBR_29_Parent>
                <EIP_0_ParentSPlacerOrderNumber>
                  <EIP_0_0_EntityIdentifier>
                    <xsl:value-of select="OBR_29_Parent/EIP_0_ParentSPlacerOrderNumber/EIP_0_0_EntityIdentifier"></xsl:value-of>
                  </EIP_0_0_EntityIdentifier>
                </EIP_0_ParentSPlacerOrderNumber>
              </OBR_29_Parent>
              <OBR_30_TransportationMode>
                <xsl:value-of select="OBR_30_TransportationMode"></xsl:value-of>
              </OBR_30_TransportationMode>
              <OBR_31_ReasonForStudy>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_31_ReasonForStudy/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_31_ReasonForStudy>
              <OBR_32_PrincipalResultInterpreter>
                <NDL_0_Name>
                  <NDL_0_0_IdNumberSt>
                    <xsl:value-of select="OBR_32_PrincipalResultInterpreter/NDL_0_Name/NDL_0_0_IdNumberSt"></xsl:value-of>
                  </NDL_0_0_IdNumberSt>
                </NDL_0_Name>
              </OBR_32_PrincipalResultInterpreter>
              <OBR_33_AssistantResultInterpreter>
                <NDL_0_Name>
                  <NDL_0_0_IdNumberSt>
                    <xsl:value-of select="OBR_33_AssistantResultInterpreter/NDL_0_Name/NDL_0_0_IdNumberSt"></xsl:value-of>
                  </NDL_0_0_IdNumberSt>
                </NDL_0_Name>
              </OBR_33_AssistantResultInterpreter>
              <OBR_34_Technician>
                <NDL_0_Name>
                  <NDL_0_0_IdNumberSt>
                    <xsl:value-of select="OBR_34_Technician/NDL_0_Name/NDL_0_0_IdNumberSt"></xsl:value-of>
                  </NDL_0_0_IdNumberSt>
                </NDL_0_Name>
              </OBR_34_Technician>
              <OBR_35_Transcriptionist>
                <NDL_0_Name>
                  <NDL_0_0_IdNumberSt>
                    <xsl:value-of select="OBR_35_Transcriptionist/NDL_0_Name/NDL_0_0_IdNumberSt"></xsl:value-of>
                  </NDL_0_0_IdNumberSt>
                </NDL_0_Name>
              </OBR_35_Transcriptionist>
              <OBR_36_ScheduledDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_36_ScheduledDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_36_ScheduledDateTime>
              <OBR_37_NumberOfSampleContainers>
                <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_37_NumberOfSampleContainers"></xsl:value-of>
              </OBR_37_NumberOfSampleContainers>
              <OBR_38_TransportLogisticsOfCollectedSample>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_38_TransportLogisticsOfCollectedSample/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_38_TransportLogisticsOfCollectedSample>
              <OBR_39_CollectorSComment>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_39_CollectorSComment/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_39_CollectorSComment>
              <OBR_40_TransportArrangementResponsibility>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_40_TransportArrangementResponsibility/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_40_TransportArrangementResponsibility>
              <OBR_41_TransportArranged>
                <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_41_TransportArranged"></xsl:value-of>
              </OBR_41_TransportArranged>
              <OBR_42_EscortRequired>
                <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_42_EscortRequired"></xsl:value-of>
              </OBR_42_EscortRequired>
            </OBR_ObservationRequestSegment>
          </xsl:if>
          <xsl:if test="name()='OBX_ObservationResultSegment'">
            <Observation>
              <OBX_ObservationResultSegment>
                <OBX_1_SetIdObx>
                  <xsl:value-of select="OBX_1_SetIdObx"></xsl:value-of>
                </OBX_1_SetIdObx>
                <OBX_2_ValueType>
                  <xsl:value-of select="OBX_2_ValueType"></xsl:value-of>
                </OBX_2_ValueType>
                <OBX_3_ObservationIdentifier>
                  <CE_0_Identifier>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                  <CE_1_Text>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_1_Text"></xsl:value-of>
                  </CE_1_Text>
                  <CE_2_NameOfCodingSystem>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_2_NameOfCodingSystem"></xsl:value-of>
                  </CE_2_NameOfCodingSystem>
                  <CE_3_AlternateIdentifier>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_3_AlternateIdentifier"></xsl:value-of>
                  </CE_3_AlternateIdentifier>
                  <CE_4_AlternateText>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_4_AlternateText"></xsl:value-of>
                  </CE_4_AlternateText>
                </OBX_3_ObservationIdentifier>
                <OBX_4_ObservationSubId>
                  <xsl:value-of select="OBX_4_ObservationSubId"></xsl:value-of>
                </OBX_4_ObservationSubId>
                <OBX_5_ObservationValue>
                  <CE_0_Identifier>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                  <CE_1_Text>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_1_Text"></xsl:value-of>
                  </CE_1_Text>
                  <CE_2_NameOfCodingSystem>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_2_NameOfCodingSystem"></xsl:value-of>
                  </CE_2_NameOfCodingSystem>
                  <CE_3_AlternateIdentifier>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_3_AlternateIdentifier"></xsl:value-of>
                  </CE_3_AlternateIdentifier>
                  <CE_4_AlternateText>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_4_AlternateText"></xsl:value-of>
                  </CE_4_AlternateText>
                </OBX_5_ObservationValue>
                <OBX_6_Units>
                  <CE_0_Identifier>
                    <xsl:value-of select="OBX_6_Units/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                </OBX_6_Units>
                <OBX_7_ReferencesRange>
                  <xsl:value-of select="OBX_7_ReferencesRange"></xsl:value-of>
                </OBX_7_ReferencesRange>
                <OBX_8_AbnormalFlags>
                  <xsl:value-of select="OBX_8_AbnormalFlags"></xsl:value-of>
                </OBX_8_AbnormalFlags>
                <OBX_9_Probability>
                  <xsl:value-of select="OBX_9_Probability"></xsl:value-of>
                </OBX_9_Probability>
                <OBX_10_NatureOfAbnormalTest>
                  <xsl:value-of select="OBX_10_NatureOfAbnormalTest"></xsl:value-of>
                </OBX_10_NatureOfAbnormalTest>
                <OBX_11_ObservationResultStatus>
                  <xsl:value-of select="OBX_11_ObservationResultStatus"></xsl:value-of>
                </OBX_11_ObservationResultStatus>
                <OBX_12_DateLastObsNormalValues>
                  <TS_0_TimeOfAnEvent>
                    <xsl:value-of select="OBX_12_DateLastObsNormalValues/TS_0_TimeOfAnEvent"></xsl:value-of>
                  </TS_0_TimeOfAnEvent>
                </OBX_12_DateLastObsNormalValues>
                <OBX_13_UserDefinedAccessChecks>
                  <xsl:value-of select="OBX_13_UserDefinedAccessChecks"></xsl:value-of>
                </OBX_13_UserDefinedAccessChecks>
                <OBX_14_DateTimeOfTheObservation>
                  <TS_0_TimeOfAnEvent>
                    <xsl:value-of select="OBX_14_DateTimeOfTheObservation/TS_0_TimeOfAnEvent"></xsl:value-of>
                  </TS_0_TimeOfAnEvent>
                </OBX_14_DateTimeOfTheObservation>
                <OBX_15_ProducerSId>
                  <CE_0_Identifier>
                    <xsl:value-of select="OBX_15_ProducerSId/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                  <CE_1_Text>
                    <xsl:value-of select="OBX_15_ProducerSId/CE_1_Text"></xsl:value-of>
                  </CE_1_Text>
                  <CE_2_NameOfCodingSystem>
                    <xsl:value-of select="OBX_15_ProducerSId/CE_2_NameOfCodingSystem"></xsl:value-of>
                  </CE_2_NameOfCodingSystem>
                </OBX_15_ProducerSId>
              </OBX_ObservationResultSegment>
              <xsl:if test="local-name(following-sibling::*[position()])='NTE_NotesAndCommentsSegment_2'">
                <NTE_NotesAndCommentsSegment_2>
                  <NTE_1_SetIdNte>
                    <xsl:value-of select="NTE_1_SetIdNte"></xsl:value-of>
                  </NTE_1_SetIdNte>
                  <NTE_2_SourceOfComment>
                    <xsl:value-of select="NTE_2_SourceOfComment"></xsl:value-of>
                  </NTE_2_SourceOfComment>
                  <NTE_3_Comment>
                    <xsl:value-of select="NTE_3_Comment"></xsl:value-of>
                  </NTE_3_Comment>
                </NTE_NotesAndCommentsSegment_2>
              </xsl:if>
            </Observation>
            <xsl:if test="local-name(following-sibling::*[position()])!='OBX_ObservationResultSegment'">
              <xsl:if test="local-name(following-sibling::*[position()])!='NTE_NotesAndCommentsSegment_2'">
                <xsl:value-of select="$OrderEnd" disable-output-escaping="yes"/>
              </xsl:if>
            </xsl:if>
          </xsl:if>
        </xsl:for-each>
      </CompleteOrder>
    </ns0:ORU_R01_231_GLO_DEF>
  </xsl:template>
</xsl:stylesheet>

Hope that this helps you understand what is going on, and I hope that this entry will assist you in getting up to speed quickly with HL7.

Now that I have written this, I am asking myself, if no one has come across these issues, and either complained to me or Microsoft that would have prompted a change, is anyone really using BizTalk to do true HL7 processing? I am thinking that people are using other tools better equipped to handle HL7.

The only other answer I can think of, is that I must be the one to be laughed at, as this XSLT took a while for me to craft, and everyone who enters the BizTalk world is a LOT smarter than me.

Data Types

Data Type Description
ST String Data:
String data is left justified with trailing blanks optional. Any displayable (printable) ACSII characters (hexadecimal values between 20 and 7E, inclusive).
|almost any data|
TX Text data:

String data meant for user display (on a terminal or printer). Such data would not necessarily be left justified since leading spaces may contribute greatly to the clarity of the presentation to the user. Because this type of data is intended for display, it may contain certain escape character sequences designed to control the display. Escape sequence formatting is defined later in this chapter in Section 2.4.6. Leading spaces should be included. Trailing spaces should be removed.
Since TX data is intended for display purposes, the repeat delimiter, when used with a TX data field, implies a series of repeating lines to be displayed on a printer or terminal. Therefore, the repeat delimiters are regarded as paragraph terminators or hard carriage returns (e.g., they would display as though a CR/LF were inserted in the text).
A receiving system would word-wrap the text between repeat delimiters in order to fit it into an arbitrarily sized display window but start any line beginning with a repeat delimiter on a new line.
| leading spaces are allowed.|

FT Formatted text data:
This data type is derived from the string data type by allowing the addition of embedded formatting instructions. These instructions are limited to those that are intrinsic and independent of the circumstances under which the field is being used. The actual instructions and their representation are described later in this chapter. The differences from a string data field and an FT field is of arbitrary length (up to 65k) and may contain formatting commands enclosed in escape characters.
|\.sp\(skip one vertical line)|
NM Numeric data:

A number represented as a series of ASCII numeric characters consisting of an optional leading sign (+ or -), the digits and an optional decimal point. In the absence of a sign, the number is assumed to be positive. If there is no decimal point the number is assumed to be an integer.

Leading zeros, or trailing zeros after a decimal point, are not significant. The two values 01.20 and 1.2 are identical. Except for the optional leading sign (+ or -) and the optional decimal point (.), no non-numeric ASCII characters are allowed. Thus, the value <12 should be encoded as a string data type.

|999|
|-123.792|

DT Date data:
Always in the format YYYYMMDD.
|19880704|
TM

Time data:

Always in the format HHMM[SS[.SSSS]][+/-ZZZZ] using a 24 hour clock notation. The seconds designation (SS) is optional. If not present it will be interpreted as 00. The fractional seconds designation is likewise optional. If not present it will be interpreted as .0000. The fractional seconds could be sent by a transmitter who requires greater precision than whole seconds. Fractional representations of minutes, hours or other higher orders units of time are not permitted. The time zone of the sender may be sent optionally as an offset from the coordinated universal time (previously known as Greenwich Mean Time.) Where the time zone is not present in a particular TM field but is included as part of the date/time field in the MSH segment, the MSH value will be used as the default time zone. Otherwise, the time is understood to refer to the local time of the sender. Midnight is represented as 0000. 

|235959+1130| 1 second before midnight in a time zone eleven and half hours ahead of Universal Coordinated Time (i.e., east of Greenwich).

|0800| Eight AM, local time of the sender.

|093544.2312| 44.2312 seconds after Nine thirty-five AM, local time of sender.

TS

Time Stamp data:

Contains the exact time of an event, including the date and time. Time stamp fields are always in the format:

YYYYMMDD[HHMM[SS[.SSSS]]][+/-ZZZZ]^<degree of precision>

The date portion of a time stamp follows the rules of a date field and the time portion follows the rules of a time field. When used as a birthdate, the HHMM portion is optional. If not present the HHMM portion will default to 0000, i.e., midnight of the day just beginning. The specific data representations used in the HL7 encoding rules are compatible with ISO 8824-1987(E). An optional second component indicates the degree of precision of the date (Y = year, L = month, D = day, H = hour, M = minute, S = second). (Maximum length of field is 26).

The HL7 Standard strongly recommends that all systems routinely send the time zone offset but does not require it. All HL7 systems are required to accept the time zone offset, but its implementation is application specific. For many applications the time of interest is the local time of the sender. For example, an application in the Eastern Standard Time zone receiving notification of an admission that takes place at 11:00 PM in San Francisco on December 11 would prefer to treat the admission as having occurred on December 11 rather than advancing the date to December 12.

One exception to this rule would be a clinical system that processed patient data collected in a clinic and a nearby hospital that happens to be in a different time zone. Such applications may choose to convert the data to a common representation. Similar concerns apply to the transitions to and from daylight saving time. HL7 supports such requirements by requiring that the time zone information be present when the information is sent. It does not, however, specify which of the treatments discussed here will be applied by the receiving system.

|17760704010159-0600| 1:01:59 on July 4, 1776 in the Eastern Standard Time zone.

|17760704010159-0500| 1:01:59 on July 4, 1776 in the Eastern Daylight Saving Time zone.

|198807050000| Midnight of the night extending from July 4 to July 5, 1988 in the local time zone of the sender.

|198807050000^D| Same as prior example, but precision extends only to the day. Could be used for a birth date.

PN

Person Name data:

<family name> ^ <given name> ^ <middle initial or name> ^ <suffix (e.g., JR or III)> ^ <prefix (e.g., DR)> ^ <degree (e.g., MD)>

A name includes multiple free text components as listed above. The maximum length of a PN field is 48 characters including component separators. The sending system may send upper- and lowercase or all uppercase. The receiving system may convert to all uppercase if required.

|SMITH^JOHN^J^III^DR^PHD|

TN Telephone Number data:

For use in the United States and conforming countries, the telephone number is always in the form:

[NN] [(999)]999-9999[X99999][B99999][C any text]

The optional first two digits are the country code. The optional X portion gives an extension. The optional B portion gives a beeper code. The optional C portion may be used for comments like, After 6:00. While no explicit limit is placed on the text field, receiving systems may be expected to truncate values that are more than 10 characters long. To accommodate the variability of institutional phone systems, the length of the extension and beeper numbers may be extended by local agreement.

|(415)925-0121X305|
|234-4532CWEEKENDS|

AD

Address data:

<street address> ^ < other designation> ^ <city> ^ <state or province> ^ <zip or postal code >^ <country >^ <type> ^ <other geographic designation>

All components are ST data type. The street or mailing address of a person or institution. For use within North America:

  1. state or province should be represented by the official US Postal service two-letter codes
  2. zip takes the form 99999[-9999], Canadian postal code is 6 alpha-numeric characters
  3. the country code is assumed to be USA if null
  4. other geographic designation includes county, bioregion, SMSA, etc.

Type is optional and defined by table 0190 - address type.

|10 ASH LN^#3^LIMA^OH^48132^""^|

Address Type:

C=Current or Temporary
P=Permanent
M=Mailing
B=Business
O=Office
H=Home

ID ID coded value:
The value of such a field follows the formatting rules for an ST field except that it is drawn from a table of legal values. Examples of ID fields include religion and sex.
SI Sequence ID value:
A positive integer in the form of an NM field. The uses of this field are defined in the chapters defining the segments and messages in which it appears.
CM Composite data:

A field that is a combination of other meaningful data fields. Each portion is called a component. The specific components of CM fields are defined within the field descriptions. Certain other composites have been separately identified and are described below. The use of this data type will be slowly phased out and new unique data types will be created.

Wherever a component of an HL7 field is itself an HL7 data type which contains components, its delimiters are demoted by one. Thus a component designated as a CE data type should be encoded as . Note that since HL7 delimiters are not recursive, an HL7 data type containing components cannot be a sub-component. When this level of detail is needed, each component of the HL7 data type can be encoded as a separate subcomponent.

CK Composite ID with check digit:

<ID number (NM)> ^ <check digit (NM)> ^ <code identifying the check digit scheme employed (ID)> ^ <assigning facility ID (ST)>

This data type is used for certain fields that commonly contain check digits, e.g., PID-3-Patient ID (Internal ID). If a site is not using check-digits for a particular CK field, the second and third components are not valued.

The check digit in this data type is not an add-on produced by the message processor. It is the check digit that is part of the identifying number used in the sending application. If the sending application does not include a self-generated check digit in the indentifying number, this component should be valued null.

The assigning facility ID is a unique name (up to six characters in length) of the system that stores the data. It is an ST data type. It is equivalent to the application ID of the placer or filler order number .Assigning facility ID's are unique across a given HL7 implementation.

Check digit scheme

M10=Mod 10 algorithm
M11=Mod 11 algorithm

The algorithm for calculating a Mod10 check digit is as follows:

Assume you have an identifier = 12345. Take the odd digit positions, counting from the right, i.e., 531, multiply this number by 2 to get 1062. Take the even digit positions, starting from the right (i.e., 42), prepend these to the 1062 to get 421062. Add all of these six digits together to get 15. Subtract this number from the next highest multiple of 10, i.e., 20 - 15 to get 5. The Mod10 check digit is 5. The Mod10 check digit for 401 is 0; for 9999, it's 4; for 99999999, it's 7.

The algorithm for calculating a Mod11 check digit is as follows:

Terms

d = digit of number starting from units digit, followed by 10's position, followed by 100's position, etc.
w = weight of digit position starting with the units position, followed by 10's position, followed by 100's position etc. Values for w = 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, etc. (repeats for each group of 6 digits)
c = check digit

Calculation

(Step 1) m = sum of (d * w) for positions 1, 2, etc. starting with units digit
for d = digit value starting with units position to highest order
for w = weight value from 2 to 7 for every six positions starting with units digit
(Step 2) c1 = m mod 11
(Step 3) if c1 = 0 then reset c1 = 1
(Step 4) c = (11 - c1) mod 10
Example:

if the number is 1234567, then the mod 11 check digit = 6

The calculations are:

         M  = (7*2)+(6*3)+(5*4)+(4*5)+(3*6)+(2*7)+(1*2)
            = 14 + 18 + 20 + 20 + 18 + 14 + 2
            = 106
         c1 = 106 mod 11
            = 7
         c  = (11-c1) mod 10
            =  4 mod 10
            =  4
       
Other variants of these check digit algorithms exist and may be used by local bilateral site agreement.

 

|128952^6^M11^ADT01|

CN Composite ID number and name:

<ID Number >^ <family name> ^ <given name> ^ <middle initial or name> ^ <suffix (e.g., JR or III) >^ p<refix (e.g., DR)> ^ <degree (e.g., MD)> ^ <source table>

All components are ST data type. A field identifying a person both as a coded value and with a text name. The first component is the coded ID according to a site-specific table. The second through the seventh components are the person's name as a PN field. The eighth component specifies the source table used for the first component. For specific fields, individual sites may elect to omit the ID or the name.

|12372^RIGGINS^JOHN^""^""^""^MD^ADT1|
|12372|
|^RIGGINS^JOHN^""^""^""^MD|

CQ Composite Quantity with units:

<quantity> ^ <units>

The first component is a quantity and the second is the units in which the quantity is expressed. Field by field, default units may be defined within the specifications. When the observation is measured in the default units, the units need not be transmitted. If the measure is recorded in units different from the default, the measurement units must be transmitted as the second component. If the units are ISO+ units, then units should be recorded as lowercase abbreviations as specified in Chapter 7. If the units are ANSI or local, the units and the source table must be recorded as specified in Chapter 7. But in these cases the component separator should be replaced by the subcomponent delimiter.

|123.7^kg| kilograms is an ISO unit
|150^lb&&ANS+|weight in pounds is a customary US unit
defined within ANSI+.

CE Coded Element:

This data type transmits codes and the text associated with the code. This type has six components arranged in two groups as follows:

<identifier >^ <text >^ <name of coding system> ^ <alternate identifier> ^ <alternate text> ^ <name of alternate coding system>

To allow all six components of a CE data type to be valued, the minimum length of this data type is 60.

identifier: Sequence of characters (the code) that uniquely identifies the item being referenced by the . Different coding schemes will have different elements here.
text: Name or description of the item in question. E.g., myocardial infarction or x-ray impression. Its data type is string (ST).
name of coding system: Each coding system will be assigned a unique identifier. This component will serve to identify the coding scheme being used in the identifier component. The combination of the identifier and name of coding system components will be a unique code for a data item. For backward compatibility, if this component is absent, it will be taken to mean the CPT-4 with ASTM extensions, i.e., AS4. Other coding systems that might appear here are ICD-9, ICD-10, SNOMED, etc. Each system will be given a unique identifying string. The current ASTM 1238-88 diagnostic/procedure/observation/drug ID/health outcomes coding systems are identified in the tables below. Others may be added as needed.

alternate components: these three components are defined analogously to the above for the alternate or local coding system. If the Alternate Text component is absent, and the Alternate Identifier is present, the Alternate Text will be taken to be the same as the Text component. If the Alternate Coding System component is absent, it will be taken to mean the locally defined system.

Note: The presence of two sets of equivalent codes in this data type is semantically different from a repetition of a CE-type field. With repetition, several distinct codes (with distinct meanings) may be transmitted.

|54.21^Laparoscopy^I9^42112^^AS4|
CF Coded element with formatted values:

This data type transmits codes and the formatted text associated with the code. This data type can be used to transmit for the first time the formatted text for the canned text portion of a report, for example, a standard radiologic description for a normal chest x-ray. The receiving system can store this information and in subsequent messages only the identifier need be sent. Another potential use of this data type is transmitting master file records that contain formatted text.

This data type has six components arranged in two groups as follows:

<identifier>^ <formatted text> ^ <name of coding system>^ <alternate identifier> ^ <alternate formatted text> ^ <name of alternate coding system>

The components, primary and alternate are defined exactly as in the CE data type with the exception of the second and fifth components which are of the formatted text data type.

OBX||CF|71020^CXR^CPMC||79989^
\H\Description:\N\\.sp\\ti+4\Heart is not enlarged.
There is no evidence of
pneumonia, effusion, pneumothorax or any mass
es.\.sp+3\\H\Impression:
\N\\.sp\\.ti+4\Negative chest.^CPMC
RP Reference Pointer:

This data type transmits information about data stored on another system. It contains a reference pointer that uniquely identifies the data on the other system, the identity of the other system, and the type of data. This information is transmitted in three components arranged as follows:

<pointer> ^ <application ID >^ <type of data>

pointer: A unique key assigned by the system that stores the data. The key, which is an ST data type, is used to identify and access the data.

application ID: A unique name (up to 6 characters in length) of the system that stores the data. It is an ST data type. It is equivalent to the application ID of the placer or filler order number (see Chapter 4). Application ID's must be unique across a given HL7 implementation.

type of data: A code that represents the type of data being stored. It is an ID data type.

SI=FT Scanned image

NS=Non-scanned image

SD=Scanned document

TX=Machine readable text document

FT=Formatted text

TQ Timing Quantity:
Describes when a service should be performed and how frequently.
MO

<quantity> ^ %lt;denomenation%gt;

The first component is a quantity and the second is the denomination in which the quantity is expressed. The values for the denomination component are those specified in ISO- 4217. If the denomination is not specified, MSH-17-country code is used to determine the default.

|99.50^USD| where USD is the ISO 4217 code for the U.S. American dollar.

Delimiter Values

Delimiter

Suggested Value

Encoding Character Position

Usage

Field Terminator

<CR>
hex 0D

  Terminates a segment record.
Field Separator

|

(0)

Separates two adjacent data fields within a segment.
Component Separator

^

1

Separates adjacent components of data fields where allowed.
Repetition Separator

~

2

Separates multiple occurrences of a field where allowed.
Escape Character

\

3

Escape character for TX and FT fields.
Sub-Component Separator

&

4

Separates adjacent subcomponents of data fields.

No connection could be made because the target machine actively refused it

Event Type: Error
Event Source: BizTalk Accelerator for HL7
Event Category: None
Event ID: 8706
Date:  20/08/2008
Time:  12:55:30
User:  N/A
Computer: IN12620
Description:
Unable to log message "An empty batch was received with fr..." to the event log due to exception:
"No connection could be made because the target machine actively refused it 127.0.0.1:4000".

Username: IN12620\BizTalk
Time: 20/08/2008 12:55:30

The issue, is obvious: The HL7 Logging Service is not running:

HL7LoggingService

FHS/FTS with no BHS/BTS segments

A friend recently asked if it was ABSOLUTELY necessary to have the BHS/BTS segments if batching was enabled.

I asked some friends and the HL7 DASM demands those segments:

[FHS] (file header segment)

{ [BHS] (batch header segment)

{ [MSH (zero or more HL7 messages)

....

....

....

] }

[BTS] (batch trailer segment)

}

[FTS] (file trailer segment)

The FHS segment is used to head a file (group of batches), that is why HL7 DASM always expect BHS segment after FHS segment.

The only way is to create a pipeline component that would live in the Decode stage that inserts those segments into the batched message.

Security Measures in relation to PHI with BTAHL7

Microsoft has put a lot of effort into making your environment secure, however, that still does not absolve you of some things that you still have to configure.

Here is an example (using the examples in the SDK) of showing PHI:

fragmentationError

Notice that you can essentially see EVERYTHING in that message, including that ever-so-important PHI.

There are a few things that you can to to remove/restrict access to that PHI.

Because there is the ability to see PHI in non secure places, Microsoft has a couple of places that you use to secure that data, based on your security policy. In some instances, the security stops at the firewall, if an intruder gets past the firewall, they have the keys to the kingdom. This security policy is fine for most instances, (thank goodness)! In my case, the last thing I want to do is have to peel off the layers of security to simply figure out that an element is missing from the HL7 message. At 2:00 am I simply want to log in and find out what is going on, what the error is, and fix it.

However, there are some out there that either do not trust their network admins, want to make troubleshooting harder, don’t trust their co workers, or were forced to implement additional security around PHI. For those, here are a few things that are available to increase security around PHI>

The first would be to turn off Event Logging and possibly choose SQL where more restrictions can be managed.

TurnEventLogOff

(Remember to restart the Audit and Logging Service)

Another would be to simply restrict who can have access to the event log in the first place, this can be done by changing the following key in the registry (did you see my disclaimer on the right side of this blog?)

Hive: HKEY_LOCAL_MACHINE
Key: SYSTEM\CurrentControlSet\Services\EventLog\Application
Name: RestrictGuestAccess
Type: REG_DWORD
Value: 1 Restrict access to Application log

But if you really want to get fancy, you can simply add the following entry into the BizTalk Server Operators group in Active Directory and restrict everyone else: (click to enlarge)

EventLogRestrictions

Preserve Order while mapping

There is the issue of the behavior of the mapping process creates invalid XML.

The input instance looks like this:

<xml> <loopA /> <loopB /> <loopA /> <loopB /> </xml>

However, when using the mapper, you create your output and it ends up looking like this:

<xml> <loopA /> <loopA /> <loopB /> <loopB /> </xml>

How to get this to work (only in R2) is to open up the btm file and change the following attribute from its default value of No to Yes in the mapsource element

PreserveSequenceOrder="No"

<mapsource Name="BizTalk Map" BizTalkServerMapperTool_Version="2.0" Version="2" XRange="100" YRange="420" OmitXmlDeclaration="Yes" TreatElementsAsRecords="No" OptimizeValueMapping="No" GenerateDefaultFixedNodes="Yes" PreserveSequenceOrder="No" CopyPIs="No" method="xml" xmlVersion="1.0" IgnoreNamespacesForLinks="Yes">

Here is the new code:

<mapsource Name="BizTalk Map" BizTalkServerMapperTool_Version="2.0" Version="2" XRange="100" YRange="420" OmitXmlDeclaration="Yes" TreatElementsAsRecords="No" OptimizeValueMapping="No" GenerateDefaultFixedNodes="Yes" PreserveSequenceOrder="Yes" CopyPIs="No" method="xml" xmlVersion="1.0" IgnoreNamespacesForLinks="Yes">

Online Support

I have just installed an online support link on the right of the blog. Seeing how it works. Try it out!

Online Support

I have just installed an online support link on the left of the blog. Seeing how it works. Try it out!

HL7 Message Encoding

To extend what I wrote about for the Encoding for HL7 messages post. There are two values that are used for the Message Encoding context properties. It isn't obvious but follow the logic:

According to Extended Encoding Support page in the Note section of step 5 you can only choose Western European or UTF8, so if I look at the Encoding Class documentation, the table below are the values you can use:

Value To Set Name Display
65001 utf-8 Unicode (UTF-8)
850 ibm850

Western European (DOS)

Event ID 5720, BTAHL7Schemas.MessageEncoding

In a follow up to my initial discovery of the new context property (largely undocumented as far as I can tell) called BTAHL7Schemas.MessageEncoding we were converting a working process from 2004 to 2006 R2 and we started getting this error:

Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5720
Date: Date
Time: Time
User: N/A
Computer: ComputerName
Description:
There was a failure executing the send pipeline: "BTAHL72XPipelines.BTAHL72XSendPipeline, BTAHL72XPipelines, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "BTAHL7 2.X Assembler" Send Port: "MLLPSendPort" URI: "localhost:11000" Reason: Object reference not set to an instance of an object.

So we put the MessageEncoding in and then started getting the following error:

Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5720
Date: Date
Time: Time
User: N/A
Computer: ComputerName
Description:
There was a failure executing the send pipeline: "BTAHL72XPipelines.BTAHL72XSendPipeline, BTAHL72XPipelines, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Source: "BTAHL7 2.X Assembler" Send Port: "HL7_SP" URI: "C:\Labs\HL7_Outbound\%MessageID%.txt" Reason: Specified cast is not valid.

Low and behold, hot fix 947261 that deals with these two error message. If you check version the following file Microsoft.solutions.btahl7.hl72fasm.dll, ours was at 2.0.302.0

Acknowledgment Event ID: 5778 - The published message message could not be routed because no subscribers were found

Another one of the gotchas (yes, my blog seems to be full of them) is the 'association' of the acknowledgment with the original message that  is generated from the BTAHL7 receive pipeline. In the BTAHL7 Configuration explorer, by default the Acknowledgment settings are as follows:

partnerdefaultsetup

Notice that the MSH15 and MSH16 overrides are set to AL- Always generate the System and Application Acknowledgment, and that below the Route ACK to send pipeline on request-response receive port is checked. This means that the default behavior of the pipeline is to generate two acknowledgments, and route one of them back along the receive location's send pipeline. What is it supposed to do with the second acknowledgment that it created?

That is where the error message is generated: Event ID 5778: The Messaging engine failed to process a message submitted by adapter: MLLP Source URL:{whaver server:port} Details: The published message could not be routed because no subscribers were found. This error occurs if the subscribing orchestration or send port has not been enlisted, or if some of the message properties necessary for subscription evaluation have not been promoted.

ackeventerror

The resolution: a simple solution is to create a send port for this data and drop it off as a file.

Not quite the elegant solution that I want to deal with, as now there is a maintenance aspect of making sure that this folder is purged.

Let's just not create the application acknowledgment. You do this by changing the parties definition from Original to Enhanced mode and turning the application acknowledgment to NE (never).

newpartnersetup

MS-HUG August 26-27

MicrosoftHUG_GoldenTicket_only

Is anyone going there this year?

Let me know.

Encoding for HL7 messages

I was helping a friend with a HL7 question about how to change the MSH1, and I decided to make sure that my syntax was correct so I looked at the help and

BAM

I noticed that there is a new context property

DoorbellFinalMessage(BTAHL7Schemas.MessageEncoding) = 65001;

Using BTAHL7 pipelines in multiple applications

A question was recently posted on the forums on how you can use the default pipelines in multiple applications.

I actually was stumped when I started testing the beta of BizTalk 2006 also.

The steps are pretty easy:

In your new application, right click the application and in the context menu click properties

context menu

In the properties click on references and Add BizTalk Application 1 (which is where the pipeline is installed to)

references

Now you can access the pipeline within your own application.

BizTalk Guru Newsletter - BAM Uninstall

Stephen Thomas hit me up to write an article for his newsletter (if you aren't automatically getting it, you should sign up for it here).

I wrote about how to automatically uninstall a BAM definition as part of the MSI uninstall. You can read about it here: http://www.biztalkgurus.com/newsletter/TheBizTalker-Volume-11.html

The one dilemma I have is that I cannot seem to figure out how to get a batch script to resolve the installation path by using this code in a batch script:

for /f "skip=2 tokens=2,*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\BizTalk Server\3.0" /v "InstallPath"') do SET BTSbm="%%~bTracking\bm.exe remove-all -DefinitionFile:"

I am looking into it and will update this blog entry when I finally do figure it out.

HL7 Accelerator installation on a 64 bit machine

If you are installing the HL7 accelerator on a 64 bit development environment, make sure that you install both BizTalk 2006 R2 and the HL7 components in the \Program Files (x86)\ folder.

If you don't the HL7 projects (BTAHL72X Common, ...) will not show up as available as BizTalk projects. You will still be able to create HL7 schemas using the new button'd dialog box, but the underlying projects are not available.

HL7 accelerator 1.3 versus 2.0

One of the most noticeable differences between the 2006 and the 2006 R2  is the dialog on creating new schemas. Here is what it looks like in 2006

oldHL7Dialog

I never quite got that pressing Finish created the schema, and Cancel closed the dialog box. In my meetings with the developers, I asked if that could be changed.

Viola!

newHL7Dialog

Custom Trigger Message Update

I have updated my custom trigger message entry here since a friend tried unsuccessfully to follow my instructions.

I have added a few more pictures and have noted some gotcha's.

RHIO's, HIE's, and Healthcare IT

If you are interested in learning about the RHIO HIE space, my business partner Mark Singh keeps an active blog about the things that are going on in the physician's world.

The company site is here and his blog is here.

Go take a look and let me know what you think!

«February»
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
28123456
78910111213