<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.3.202
Name: [3] Sekcja informacji wyniku rozpoznania patomorfologicznego w badaniu cytologicznym
Description: Szablon CDA dla sekcji rozpoznania patomorfologicznego w badaniu cytologicznym
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.3.202-2023-04-27T000000">
   <title>[3] Sekcja informacji wyniku rozpoznania patomorfologicznego w badaniu cytologicznym</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]"
         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.202-2023-04-27T000000.html"
              test="count(hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202'])&gt;=1 and not(hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202'] 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.202-2023-04-27T000000.html"
              test="count(hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202'])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']"
         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.202-2023-04-27T000000.html"
              test="string(@classCode)='DOCSECT' or not(@classCode)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="string(@moodCode)='EVN' or not(@moodCode)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.202'])&gt;=1 and not(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.202']/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.202'] 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.202-2023-04-27T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.202'])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.202'] 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.202-2023-04-27T000000.html"
              test="count(hl7:code[(@code='22637-3' and @codeSystem='2.16.840.1.113883.6.1')])&gt;=1 and not(hl7:code[(@code='22637-3' and @codeSystem='2.16.840.1.113883.6.1')]/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:code[(@code='22637-3' 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.202-2023-04-27T000000.html"
              test="count(hl7:code[(@code='22637-3' and @codeSystem='2.16.840.1.113883.6.1')])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:code[(@code='22637-3' 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.202-2023-04-27T000000.html"
              test="count(hl7:title)&gt;=1 and not(hl7:title/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:title)&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:text)&gt;=1 and not(hl7:text/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO'])&gt;=1 and not(hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO'] 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.202-2023-04-27T000000.html"
              test="count(hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO'])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO'] 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.202-2023-04-27T000000.html"
              test="count(hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.181'])&gt;=1 and not(hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.181']/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.181'] 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.202-2023-04-27T000000.html"
              test="count(hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.181'])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.181'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.202']
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.202']"
         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.202-2023-04-27T000000.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)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.13.10.3.202'">(plCdaPathomorphologicalDiagnosisResultInCytologySection): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.13.10.3.202'.</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.202-2023-04-27T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaPathomorphologicalDiagnosisResultInCytologySection): Atrybut @root MUSI być typu 'oid'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:code[(@code='22637-3' and @codeSystem='2.16.840.1.113883.6.1')]
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:code[(@code='22637-3' 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.202-2023-04-27T000000.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)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="@nullFlavor or (@code='22637-3' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Pathology report final diagnosis Narrative' and @codeSystemName='LOINC')">(plCdaPathomorphologicalDiagnosisResultInCytologySection): Wartość elementu MUSI wynosić code '22637-3' codeSystem '2.16.840.1.113883.6.1' displayName='Pathology report final diagnosis Narrative' 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.202-2023-04-27T000000.html"
              test="count(hl7:translation[(@code='ROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:translation[(@code='ROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:translation[(@code='ROZPATO' 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.202-2023-04-27T000000.html"
              test="count(hl7:translation[(@code='ROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:translation[(@code='ROZPATO' 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.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:code[(@code='22637-3' and @codeSystem='2.16.840.1.113883.6.1')]/hl7:translation[(@code='ROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:code[(@code='22637-3' and @codeSystem='2.16.840.1.113883.6.1')]/hl7:translation[(@code='ROZPATO' 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.202-2023-04-27T000000.html"
              test="@nullFlavor or (@code='ROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Rozpoznanie patomorfologiczne' and @codeSystemName='AtrybutyWBCYT')">(plCdaPathomorphologicalDiagnosisResultInCytologySection): Wartość elementu MUSI wynosić code 'ROZPATO' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Rozpoznanie patomorfologiczne' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:title
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/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.202-2023-04-27T000000.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)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="text()='Rozpoznanie patomorfologiczne'">(plCdaPathomorphologicalDiagnosisResultInCytologySection): zawartość elementu hl7:title MUSI wynosić ''Rozpoznanie patomorfologiczne''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:text
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/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.202-2023-04-27T000000.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)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']"
         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.202-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:observation[hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:observation[hl7:code[(@code='RODZROZPATO' 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.202-2023-04-27T000000.html"
              test="count(hl7:observation[hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:observation[hl7:code[(@code='RODZROZPATO' 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.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/hl7:observation[hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/hl7:observation[hl7:code[(@code='RODZROZPATO' 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.202-2023-04-27T000000.html"
              test="string(@classCode)='OBS'">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="string(@moodCode)='EVN'">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:code[(@code='RODZROZPATO' 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.202-2023-04-27T000000.html"
              test="count(hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:code[(@code='RODZROZPATO' 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.202-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-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.177-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]/@nullFlavor)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-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.202-2023-04-27T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)])&lt;=1">(plCdaPathomorphologicalDiagnosisResultInCytologySection): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-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.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/hl7:observation[hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/hl7:observation[hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='RODZROZPATO' 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.202-2023-04-27T000000.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)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="@nullFlavor or (@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Rodzaj rozpoznania patomorfologicznego' and @codeSystemName='AtrybutyWBCYT')">(plCdaPathomorphologicalDiagnosisResultInCytologySection): Wartość elementu MUSI wynosić code 'RODZROZPATO' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Rodzaj rozpoznania patomorfologicznego' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/hl7:observation[hl7:code[(@code='RODZROZPATO' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/hl7:observation[hl7:code[(@code='RODZROZPATO' 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.202-2023-04-27T000000.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)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaPathomorphologicalDiagnosisResultInCytologySection): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/hl7:observation[hl7:code[(@code='RODZROZPATO' 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.177-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:observation/hl7:code/@code='RODZROZPATO']/hl7:observation[hl7:code[(@code='RODZROZPATO' 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.177-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-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.202-2023-04-27T000000.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)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.177-DYNAMIC.xml')/*/valueSet[conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion] or completeCodeSystem[@codeSystem=$theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion]])">(plCdaPathomorphologicalDiagnosisResultInCytologySection): Wartość elementu MUSI wynosić RodzajRozpoznaniaPatomorfologicznego Rodzaj 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.177-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.202-2023-04-27T000000.html"
              test="not(@nullFlavor) or not(empty(($validNullFlavorsFound))) ">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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 RodzajRozpoznaniaPatomorfologicznego Rodzaj rozpoznania patomorfologicznego (DYNAMICZNE)</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.202
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.181']
Item: (plCdaPathomorphologicalDiagnosisResultInCytologySection)
-->
   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.202']/hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.181']">
      <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.202-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaPathomorphologicalDiagnosisResultInCytologySection): 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.202-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaPathomorphologicalDiagnosisResultInCytologySection): Atrybut @typeCode MUSI być typu 'cs'</assert>
   </rule>
</pattern>
