none
XSL .| Following sibling for grouping provider and clients in 837 - issue RRS feed

  • Question

  • Hi,

    I have a below input XML, which i have to map it to my 837 schema within BizTalk Server. While creating the output 837 I have group my claims in such a way that for every 1500 claim loops (2300) i have to create a new ST within the 837. Also i did a grouping in the service level to group 20 service lines in a 2300 loop. All these work fine when there is a single provider available in th einput schema. If there are multiple providers and clients available in the input file, the entire set of claims in the input files are getting grouped in a single 2300 loop. I use the following select while grouping:

    select=".| following-sibling::ClaimRecords[position() < 5]"

    <?xml version="1.0" encoding="utf-16" ?>- <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns=http://CD_837PClaims_Filing.GroupedClaims targetNamespace=http://CD_837PClaims_Filing.GroupedClaims xmlns:xs="http://www.w3.org/2001/XMLSchema">
    - <xs:element name="GroupedRecord">
    - <xs:complexType>
    - <xs:sequence>
    - <xs:element name="RecordDetails">
    - <xs:complexType>
    - <xs:sequence>
    - <xs:element minOccurs="1" maxOccurs="unbounded" name="ProviderDetails">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="ProviderXref" type="xs:string" />
      <xs:element name="ProviderCompanyName" type="xs:string" />
      <xs:element name="ProviderMedicAidID" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="PHL01" type="xs:string" />
    - <xs:element minOccurs="1" maxOccurs="unbounded" name="ClientRecords">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element minOccurs="0" name="EntityXref" type="xs:string" />
      <xs:element name="ClientLastName" type="xs:string" />
      <xs:element name="ClientFirstName" type="xs:string" />
      <xs:element name="ClientDOB" type="xs:string" />
      <xs:element name="ClientGender" type="xs:string" />
      <xs:element name="ACRServiceID" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="DiagnosisCode" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="TransactionCount" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="CHL01" type="xs:string" />
      <xs:element minOccurs="1" maxOccurs="unbounded" name="CLM01" type="xs:string" />
    - <xs:element minOccurs="1" maxOccurs="unbounded" name="ClaimRecords">
    - <xs:complexType>
    - <xs:sequence>
      <xs:element name="ClaimXref" type="xs:string" />
      <xs:element name="ClaimID" type="xs:string" />
      <xs:element name="ServiceXref" type="xs:string" />
      <xs:element name="UnitType" type="xs:string" />
      <xs:element name="Quantity" type="xs:string" />
      <xs:element name="Amount" type="xs:string" />
      <xs:element name="AmountType" type="xs:string" />
      <xs:element name="ServiceLineModifier" type="xs:string" />
      <xs:element name="Index" type="xs:string" />
      <xs:element name="ACRServiceID" type="xs:string" />
      <xs:element maxOccurs="unbounded" name="CLM01" type="xs:string" />
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>
    If i use that select option for my grouping does it group all the claims from different provider/client- combinations to a single 2300 loop? Below is the XSL used for the same logic.
    <?xml version="1.0" encoding="utf-16"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0 userCSharp ScriptNS0" version="1.0" xmlns:s0="http://OK_837PClaims_Filing.GroupedClaims" xmlns:ns0="http://schemas.microsoft.com/BizTalk/EDI/X12/2006" xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp" xmlns:ScriptNS0="http://schemas.microsoft.com/BizTalk/2003/ScriptNS0">
      <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
      <xsl:template match="/">
        <!--<xsl:call-template name="GroupRec">
          <xsl:with-param name="Group" select="GroupedRecord"/>
        </xsl:call-template>-->
        <xsl:apply-templates select="/s0:GroupedRecord"></xsl:apply-templates>
      </xsl:template>
      <xsl:template name="GroupRec" match="RecordDetails">
        <!--<xsl:param name="Group" />-->
        <ns0:X12_00401_837_P>
        <!--<xsl:for-each select="ProviderDetails[position() mod 10 = 1]">-->
          <xsl:for-each select="ProviderDetails[position() mod 10 = 1]">
          <xsl:call-template name="ClientGroup">
            <xsl:with-param name="Cgrp" select=". | following-sibling::ProviderDetails[position() &lt; 10]"/>
            </xsl:call-template>
          </xsl:for-each>
        </ns0:X12_00401_837_P>
      </xsl:template>
      <xsl:template name="ClientGroup" match="ProviderDetails" >
        <xsl:param name="Cgrp" />
        <xsl:variable name="var:v1" select="userCSharp:DateCurrentDate()" />
        <xsl:variable name="var:v3" select="userCSharp:DateCurrentTime()" />
        <!--<ns0:X12_00401_837_P>-->
          <ST>
            <ST01>
              <xsl:text>837</xsl:text>
            </ST01>
            <ST02>
              <xsl:text>0001</xsl:text>
            </ST02>
          </ST>
          <ns0:BHT_BeginningOfHierarchicalTransaction_TS837Q1>
            <BHT01__HierarchicalStructureCode>
              <xsl:text>0019</xsl:text>
            </BHT01__HierarchicalStructureCode>
            <BHT02__TransactionSetPurposeCode>
              <xsl:text>00</xsl:text>
            </BHT02__TransactionSetPurposeCode>
            <BHT03__OriginatorApplicationTransactionIdentifier>
              <xsl:text>0001</xsl:text>
            </BHT03__OriginatorApplicationTransactionIdentifier>
            <xsl:variable name="var:v2" select="userCSharp:MyDateFormat(string($var:v1))" />
            <BHT04__TransactionSetCreationDate>
              <xsl:value-of select="$var:v2" />
            </BHT04__TransactionSetCreationDate>
            <xsl:variable name="var:v4" select="userCSharp:MyTimeFormat(string($var:v3))" />
            <BHT05__TransactionSetCreationTime>
              <xsl:value-of select="$var:v4" />
            </BHT05__TransactionSetCreationTime>
            <BHT06__ClaimOrEncounterIdentifier>
              <xsl:text>CH</xsl:text>
            </BHT06__ClaimOrEncounterIdentifier>
          </ns0:BHT_BeginningOfHierarchicalTransaction_TS837Q1>
          <ns0:REF_TransmissionTypeIdentification_TS837Q1>
            <REF01__ReferenceIdentificationQualifier>
              <xsl:text>87</xsl:text>
            </REF01__ReferenceIdentificationQualifier>
            <REF02__TransmissionTypeCode>
              <xsl:text>jkhdsjkhdjkhj</xsl:text>
            </REF02__TransmissionTypeCode>
          </ns0:REF_TransmissionTypeIdentification_TS837Q1>
          <ns0:TS837Q1_1000A_Loop>
            <ns0:NM1_SubmitterName_TS837Q1_1000A>
                      </ns0:PER_SubmitterEDIContactInformation_TS837Q1_1000A>
          </ns0:TS837Q1_1000A_Loop>
          <ns0:TS837Q1_1000B_Loop>
                    </ns0:NM1_ReceiverName_TS837Q1_1000B>
          </ns0:TS837Q1_1000B_Loop>
          <xsl:for-each select="$Cgrp/ProviderMedicAidID">
            <xsl:variable name="var:v9" select="string($Cgrp/NPI/text())" />
            <xsl:variable name="var:v10" select="string($Cgrp/TaxonomyCode/text())" />
            <xsl:variable name="var:v12" select="userCSharp:StringConcat(string($Cgrp/ProviderAddressLine1/text()) , &quot; &quot; , string($Cgrp/ProviderAddressLine2/text()))" />
            <ns0:TS837Q1_2000A_Loop>
              <!--<xsl:for-each select="$Cgrp/PHL01">-->
                <ns0:HL_BillingPaytoProviderHierarchicalLevel_TS837Q1_2000A>
                              </ns0:N4_BillingProviderCityStateZIPCode_TS837Q1_2010AA>
                  <ns0:REF_TS837Q1_2010AA_SubLoop>
                    <ns0:REF_BillingProviderSecondaryIdentification_TS837Q1_2010AA_Loop>
                      <ns0:REF_BillingProviderSecondaryIdentification_TS837Q1_2010AA>
                        <xsl:variable name="var:v17" select="userCSharp:ValidNPI($var:v9 , $var:v10)" />
                        <xsl:variable name="var:v18" select="userCSharp:LogicalEq(string($var:v17) , &quot;true&quot;)" />
                        <xsl:if test="string($var:v18)='true'">
                          <xsl:variable name="var:v19" select="userCSharp:StringUpperCase(&quot;EI&quot;)" />
                          <REF01__ReferenceIdentificationQualifier>
                            <xsl:value-of select="$var:v19" />
                          </REF01__ReferenceIdentificationQualifier>
                        </xsl:if>
                        <xsl:variable name="var:v20" select="userCSharp:LogicalEq(string($var:v17) , &quot;false&quot;)" />
                        <xsl:if test="string($var:v20)='true'">
                          <xsl:variable name="var:v21" select="userCSharp:StringUpperCase(&quot;1d&quot;)" />
                          <REF01__ReferenceIdentificationQualifier>
                            <xsl:value-of select="$var:v21" />
                          </REF01__ReferenceIdentificationQualifier>
                        </xsl:if>
                        <xsl:variable name="var:v22" select="userCSharp:ValidNPI($var:v9 , $var:v10)" />
                        <xsl:variable name="var:v23" select="userCSharp:LogicalEq(string($var:v22) , &quot;true&quot;)" />
                        <xsl:if test="string($var:v23)='true'">
                          <xsl:variable name="var:v24" select="string($Cgrp/FID/text())" />
                          <xsl:variable name="var:v25" select="userCSharp:GetFID($var:v24)" />
                          <REF02__BillingProviderAdditionalIdentifier>
                            <xsl:value-of select="$var:v25" />
                          </REF02__BillingProviderAdditionalIdentifier>
                        </xsl:if>
                        <xsl:variable name="var:v26" select="userCSharp:LogicalEq(string($var:v22) , &quot;false&quot;)" />
                        <xsl:if test="string($var:v26)='true'">
                          <xsl:variable name="var:v27" select="userCSharp:GetProviderMedicAidId(string($Cgrp/ProviderMedicAidID/text()))" />
                          <REF02__BillingProviderAdditionalIdentifier>
                            <xsl:value-of select="$var:v27" />
                          </REF02__BillingProviderAdditionalIdentifier>
                        </xsl:if>
                        <!--<xsl:value-of select="./text()" />-->
                      </ns0:REF_BillingProviderSecondaryIdentification_TS837Q1_2010AA>
                    </ns0:REF_BillingProviderSecondaryIdentification_TS837Q1_2010AA_Loop>
                  </ns0:REF_TS837Q1_2010AA_SubLoop>
                </ns0:TS837Q1_2010AA_Loop>
              </ns0:TS837Q1_2010A_SubLoop>
              <xsl:for-each select="$Cgrp/ClientRecords">
                <xsl:variable name="var:v31" select="userCSharp:StringConcat(string($Cgrp/ClientRecords/ClientAddressLine1/text()) , &quot; &quot; , string(ClientAddressLine2/text()))" />
                <xsl:variable name="var:v61" select="userCSharp:LogicalEq(&quot;true&quot; , &quot;false&quot;)" />
                <ns0:TS837Q1_2000B_Loop>
                  <ns0:HL_SubscriberHierarchicalLevel_TS837Q1_2000B>
                    <HL01__HierarchicalIDNumber>
                      <xsl:value-of select="$Cgrp/ClientRecords/CHL01/text()" />
                                 <ns0:TS837Q1_2300_Loop>
                  <xsl:for-each select="$Cgrp/ClientRecords/ClaimRecords[position() mod 5 = 1]">
                    <xsl:call-template name="claimGroup">
                      <xsl:with-param name="grp" select=".| following-sibling::ClaimRecords[position() &lt; 5]"/>
                    </xsl:call-template>
                    <xsl:for-each select=".| following-sibling::ClaimRecords[position() &lt; 5]">
                       <xsl:variable name="var:v45" select="string(ServiceLineModifier/text())" />
                        <ns0:TS837Q1_2400_Loop>
                          <ns0:LX_ServiceLine_TS837Q1_2400>
                            <LX01__AssignedNumber>
                              <xsl:value-of select="Index/text()" />
                            </LX01__AssignedNumber>
                          </ns0:LX_ServiceLine_TS837Q1_2400>
    If the .| following sibling will not work, is there any other options available? (I could not post the entire xsl as its very big)
    Thanks!
    Appreciated!


    Ram
    Thursday, June 17, 2010 9:09 PM

All replies

  • Hi, Ram

    Could you give us a simple xml sample, and your expect output.
    This posting is provided "AS IS" with no warranties, and confers no rights. Microsoft Online Community Support My Blog:http://xhinker.com
    Monday, June 21, 2010 7:30 AM
    Moderator
  • Hi Andrew,

    Thanks for your reply!! Basically what i need to do is to group the claims that are inside a Client record node to the 2300 Claims loop. While doing so i do not want to group the claims of two different clients under a single 2300 loop. I did a  .| following sibling on the claim records node inside the client records and found that all the claims irrespective of the clients are getting grouped. The input will be something like this:

    <groupedrecord>
       <recorddetails>
           <providerdetails>
             <providername>something</providername>
             .......................
             .......................
             <clientdetails>
               <clientname>something</clientname>
                ...................................
                ...................................
                 <claimrecords>
                 -----------------------------------------
                 ------------------------------------------
                 </claimrecords>
          <claimrecords>
                 -----------------------------------------
                 ------------------------------------------
                 </claimrecords>
          <claimrecords>
                 -----------------------------------------
                 ------------------------------------------
                 </claimrecords>
                 <claimrecords>
                 -----------------------------------------
                 ------------------------------------------
                 </claimrecords>
                 </clientdetails>
            <clientdetails>
               <clientname>something</clientname>
                ...................................
                ...................................
                 <claimrecords>
                 -----------------------------------------
                 ------------------------------------------
                 </claimrecords>
          <claimrecords>
                 -----------------------------------------
                 ------------------------------------------
                 </claimrecords>
          <claimrecords>
                 -----------------------------------------
                 ------------------------------------------
                 </claimrecords>
                 <claimrecords>
                 -----------------------------------------
                 ------------------------------------------
                 </claimrecords>
              </clientdetails>
      </providerdetails>
    </recorddetails>
    </groupedrecord>

    In the above sample we have two different clients under the same provider, sometimes there will be even more. Also the input schema is designed in such a way that there can be more providerdetails inside a recorddetails each with having atleast one client and atleast one claim. Now if i group the claims using the .| following sibling , it groups all the claims into a single 2300 loop. I have to do this because inside a 2300 loop, im supposed to have just 20 servicelines (i.e claims) so im grouping on them in 20's...if there are more than 20 claims available in a single client i group the first 20 in the 2300 loop then the next and so on. Is this possible without using the .| following sibling ? I might think of using the muenchian method along with .| following sibling, but i have no clue on how this is possible. Any help is appreciated !

    Thanks!


    Ram
    Monday, June 21, 2010 4:56 PM
  • I must say that, the above situation happens only when the provider are grouped in first place, like grouping the providers in 10 and then group the client and claims under it. I used few templates and called one template from the other, when i group the Provider all the records under the provider group are accessible by the parameter I defined for the group. So after the provider are grouped, if i group the claims under the Provider by accessing the template parameter, every claim inside a provider group is grouped together.

    Is there any way to avoid this?

    Thanks!


    Ram
    Wednesday, June 23, 2010 11:08 PM