<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.3.197
Name: [3] Sekcja informacji o materiale do przeprowadzenia badania cytologicznego
Description: Szablon CDA dla sekcji informacji o materiale do przeprowadzenia badania cytologicznego
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000">
   <title>[3] Sekcja informacji o materiale do przeprowadzenia badania cytologicznego</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197'])&gt;=1 and not(hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='DOCSECT' or not(@classCode)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'DOCSECT'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN' or not(@moodCode)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.197'])&gt;=1 and not(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.197']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.197'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.197'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.197'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')])&gt;=1 and not(hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:title)&gt;=1 and not(hl7:title/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:title jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:title)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:title występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&gt;=1 and not(hl7:text/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entry[hl7:procedure/@classCode='PROC'])&gt;=1 and not(hl7:entry[hl7:procedure/@classCode='PROC']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entry[hl7:procedure/@classCode='PROC'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT'])&gt;=1 and not(hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.197']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.197']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="II"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.13.10.3.197'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.13.10.3.197'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @root MUSI być typu 'oid'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CE' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CE", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CE"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Prescription for diagnostic or specialist care Document' and @codeSystemName='LOINC')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code '57832-8' codeSystem '2.16.840.1.113883.6.1' displayName='Prescription for diagnostic or specialist care Document' codeSystemName='LOINC'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:translation[(@code='DOPMDPBC' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:translation[(@code='DOPMDPBC' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:translation[(@code='DOPMDPBC' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:translation[(@code='DOPMDPBC' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:translation[(@code='DOPMDPBC' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')]/hl7:translation[(@code='DOPMDPBC' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:code[(@code='57832-8' and @codeSystem='2.16.840.1.113883.6.1')]/hl7:translation[(@code='DOPMDPBC' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='DOPMDPBC' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Dane o pobranym materiale do przeprowadzenia badania cytologicznego' and @codeSystemName='AtrybutyWBCYT')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'DOPMDPBC' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Dane o pobranym materiale do przeprowadzenia badania cytologicznego' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:title
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:title"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='ST' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:ST", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="ST"/>
      <let name="theValue" value="text()"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="text()='Pobrany materiał'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): zawartość elementu hl7:title MUSI wynosić ''Pobrany materiał''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:text
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:text"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='SD.TEXT' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:SD.TEXT", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="SD.TEXT"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @typeCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:procedure)&gt;=1 and not(hl7:procedure/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:procedure jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:procedure)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:procedure występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='PROC'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'PROC'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <let name="elmcount"
           value="count(hl7:code[@codeSystemName='ICD-9-PL']|hl7:code[@nullFlavor='NI'])"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="$elmcount&gt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): wybór (hl7:code[@codeSystemName='ICD-9-PL'] lub hl7:code[@nullFlavor='NI']) zawiera zbyt mało elementów [min 1x]</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="$elmcount&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): wybór (hl7:code[@codeSystemName='ICD-9-PL'] lub hl7:code[@nullFlavor='NI']) zawiera zbyt dużo elementów [min 1x]</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[@codeSystemName='ICD-9-PL'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[@codeSystemName='ICD-9-PL'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[@nullFlavor='NI'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[@nullFlavor='NI'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:targetSiteCode[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor])&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:targetSiteCode[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor] jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:targetSiteCode[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:targetSiteCode[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&gt;=1 and not(hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&gt;=1 and not(hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&gt;=1 and not(hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:code[@codeSystemName='ICD-9-PL']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:code[@codeSystemName='ICD-9-PL']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@codeSystem='2.16.840.1.113883.3.4424.11.2.6' and @codeSystemName='ICD-9-PL')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić codeSystem '2.16.840.1.113883.3.4424.11.2.6' codeSystemName='ICD-9-PL'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@code">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): atrybut @code MUSI wystąpić.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@code) or (string-length(@code)&gt;0 and not(matches(@code,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @code MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@displayName">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): atrybut @displayName MUSI wystąpić.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@displayName) or string-length(@displayName)&gt;0">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @displayName MUSI być typu 'st'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:code[@nullFlavor='NI']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:code[@nullFlavor='NI']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@nullFlavor)='NI'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @nullFlavor MUSI wynosić 'NI'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or (string-length(@nullFlavor)&gt;0 and not(matches(@nullFlavor,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @nullFlavor MUSI być typu 'cs'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:targetSiteCode[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:targetSiteCode[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <let name="theCodeSystemVersion" value="@codeSystemVersion"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet[conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion] or completeCodeSystem[@codeSystem=$theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion]])">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić Topografia Topografia materiału do rozpoznania patomorfologicznego (DYNAMICZNE).</assert>
      <let name="theNullFlavor" value="@nullFlavor"/>
      <let name="validNullFlavorsFound"
           value="exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.179-DYNAMIC.xml')/*/valueSet/conceptList/exception[@code = $theNullFlavor][@codeSystem = '2.16.840.1.113883.5.1008'])"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or not(empty(($validNullFlavorsFound))) or @nullFlavor=('NI')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Kod braku danych dla @code MUSI pochodzić ze zbioru dopuszczalnych kodów braku danych zdefiniowanych dla tego atrybutu lub powiązanych ze zbiorem wartości Topografia Topografia materiału do rozpoznania patomorfologicznego (DYNAMICZNE)</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or (string-length(@nullFlavor)&gt;0 and not(matches(@nullFlavor,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @nullFlavor MUSI być typu 'cs'</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@nullFlavor),' '))"/>
      <let name="theAttCheck"
           value="distinct-values(for $code in tokenize(@nullFlavor,' ') return if ($code=('NI')) then ($code) else ())"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or count($theAttValue) = count($theAttCheck)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla nullFlavor MUSI wynosić 'kod NI'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@typeCode)='COMP'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='OBS'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:effectiveTime)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:effectiveTime jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:effectiveTime)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:effectiveTime występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor])&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor] jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Sposób pobrania materiału' and @codeSystemName='AtrybutyWBCYT')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'SPOBM' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Sposób pobrania materiału' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:effectiveTime
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:effectiveTime"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='IVL_TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:IVL_TS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="IVL_TS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or (string-length(@nullFlavor)&gt;0 and not(matches(@nullFlavor,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @nullFlavor MUSI być typu 'cs'</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@nullFlavor),' '))"/>
      <let name="theAttCheck"
           value="distinct-values(for $code in tokenize(@nullFlavor,' ') return if ($code=('NI')) then ($code) else ())"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or count($theAttValue) = count($theAttCheck)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla nullFlavor MUSI wynosić 'kod NI'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <let name="theCodeSystemVersion" value="@codeSystemVersion"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet[conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion] or completeCodeSystem[@codeSystem=$theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion]])">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić CytologiaSposobPobraniaMaterialu Sposób pobrania materiału w cytologii (DYNAMICZNE).</assert>
      <let name="theNullFlavor" value="@nullFlavor"/>
      <let name="validNullFlavorsFound"
           value="exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.180-DYNAMIC.xml')/*/valueSet/conceptList/exception[@code = $theNullFlavor][@codeSystem = '2.16.840.1.113883.5.1008'])"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or not(empty(($validNullFlavorsFound))) or @nullFlavor=('NI')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Kod braku danych dla @code MUSI pochodzić ze zbioru dopuszczalnych kodów braku danych zdefiniowanych dla tego atrybutu lub powiązanych ze zbiorem wartości CytologiaSposobPobraniaMaterialu Sposób pobrania materiału w cytologii (DYNAMICZNE)</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or (string-length(@nullFlavor)&gt;0 and not(matches(@nullFlavor,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @nullFlavor MUSI być typu 'cs'</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@nullFlavor),' '))"/>
      <let name="theAttCheck"
           value="distinct-values(for $code in tokenize(@nullFlavor,' ') return if ($code=('NI')) then ($code) else ())"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or count($theAttValue) = count($theAttCheck)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla nullFlavor MUSI wynosić 'kod NI'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@typeCode)='COMP'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='OBS'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value)&gt;=1 and not(hl7:value/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Sposób pobrania materiału - opis' and @codeSystemName='AtrybutyWBCYT')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'SPOBMO' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Sposób pobrania materiału - opis' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SPOBMO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='ST' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:ST", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="ST"/>
      <let name="theValue" value="text()"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@typeCode)='COMP'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='OBS'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:effectiveTime)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:effectiveTime jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:effectiveTime)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:effectiveTime występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor])&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor] jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Sposób utrwalenia materiału' and @codeSystemName='AtrybutyWBCYT')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'SUTRM' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Sposób utrwalenia materiału' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:effectiveTime
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:effectiveTime"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='IVL_TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:IVL_TS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="IVL_TS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or (string-length(@nullFlavor)&gt;0 and not(matches(@nullFlavor,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @nullFlavor MUSI być typu 'cs'</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@nullFlavor),' '))"/>
      <let name="theAttCheck"
           value="distinct-values(for $code in tokenize(@nullFlavor,' ') return if ($code=('NI','NA')) then ($code) else ())"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or count($theAttValue) = count($theAttCheck)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla nullFlavor MUSI wynosić 'kod NI lub kod NA'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code) or @nullFlavor]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <let name="theCodeSystemVersion" value="@codeSystemVersion"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet[conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion] or completeCodeSystem[@codeSystem=$theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion]])">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić CytologiaSposobUtrwaleniaMaterialu Sposób utrwalenia materiału w cytologii (DYNAMICZNE).</assert>
      <let name="theNullFlavor" value="@nullFlavor"/>
      <let name="validNullFlavorsFound"
           value="exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.181-DYNAMIC.xml')/*/valueSet/conceptList/exception[@code = $theNullFlavor][@codeSystem = '2.16.840.1.113883.5.1008'])"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or not(empty(($validNullFlavorsFound))) or @nullFlavor=('NI')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Kod braku danych dla @code MUSI pochodzić ze zbioru dopuszczalnych kodów braku danych zdefiniowanych dla tego atrybutu lub powiązanych ze zbiorem wartości CytologiaSposobUtrwaleniaMaterialu Sposób utrwalenia materiału w cytologii (DYNAMICZNE)</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or (string-length(@nullFlavor)&gt;0 and not(matches(@nullFlavor,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @nullFlavor MUSI być typu 'cs'</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@nullFlavor),' '))"/>
      <let name="theAttCheck"
           value="distinct-values(for $code in tokenize(@nullFlavor,' ') return if ($code=('NI')) then ($code) else ())"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or count($theAttValue) = count($theAttCheck)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla nullFlavor MUSI wynosić 'kod NI'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@typeCode)='COMP'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='OBS'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value)&gt;=1 and not(hl7:value/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Materiał utrwalony - zastosowany utrwalacz' and @codeSystemName='AtrybutyWBCYT')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'SUTRMZASTUTRW' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Materiał utrwalony - zastosowany utrwalacz' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRM' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='SUTRMZASTUTRW' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='ST' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:ST", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="ST"/>
      <let name="theValue" value="text()"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@typeCode)='COMP'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='OBS'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)])&gt;=1 and not(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Rodzaj materiału' and @codeSystemName='AtrybutyWBCYT')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'RODZMAT' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Rodzaj materiału' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='RODZMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <let name="theCodeSystemVersion" value="@codeSystemVersion"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet[conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion] or completeCodeSystem[@codeSystem=$theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion]])">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić CytologiaRodzajMaterialu Rodzaj materiału w cytologii (DYNAMICZNE).</assert>
      <let name="theNullFlavor" value="@nullFlavor"/>
      <let name="validNullFlavorsFound"
           value="exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.182-DYNAMIC.xml')/*/valueSet/conceptList/exception[@code = $theNullFlavor][@codeSystem = '2.16.840.1.113883.5.1008'])"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@nullFlavor) or not(empty(($validNullFlavorsFound))) ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Kod braku danych dla @code MUSI pochodzić ze zbioru dopuszczalnych kodów braku danych zdefiniowanych dla tego atrybutu lub powiązanych ze zbiorem wartości CytologiaRodzajMaterialu Rodzaj materiału w cytologii (DYNAMICZNE)</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@typeCode)='COMP'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='OBS'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Dodatkowy opis dla pobranego materiału' and @codeSystemName='AtrybutyWBCYT')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'POBMATDODOPIS' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Dodatkowy opis dla pobranego materiału' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:procedure/@classCode='PROC']/hl7:procedure/hl7:entryRelationship[hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]]/hl7:observation[hl7:code[(@code='POBMATDODOPIS' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@classCode)='ACT'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @classCode MUSI wynosić 'ACT'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="string(@moodCode)='EVN'">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&gt;=1 ">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:effectiveTime)&gt;=1 and not(hl7:effectiveTime/@nullFlavor)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:effectiveTime jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="count(hl7:effectiveTime)&lt;=1">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): element hl7:effectiveTime występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Przyjęcie materiału' and @codeSystemName='AtrybutyWBCYT')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'PRZYJMAT' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Przyjęcie materiału' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.197
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:effectiveTime
Item: (plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.197']/hl7:entry[hl7:act/hl7:code/@code='PRZYJMAT']/hl7:act[hl7:code[(@code='PRZYJMAT' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:effectiveTime"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.197-2023-10-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaInformationAboutReferralForCytologicalDiagnosisCollectedMaterialSection): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:TS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="TS"/>
      <let name="theValue" value="@value"/>
   </rule>
</pattern>
