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

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

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']"
         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.201-2023-04-27T000000.html"
              test="string(@classCode)='DOCSECT' or not(@classCode)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201-2023-04-27T000000.html"
              test="string(@moodCode)='EVN' or not(@moodCode)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201-2023-04-27T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.201'])&gt;=1 and not(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.201']/@nullFlavor)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.201'] 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.201-2023-04-27T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.201'])&lt;=1">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.201'] 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.201-2023-04-27T000000.html"
              test="count(hl7:code[(@code='102034-6' and @codeSystem='2.16.840.1.113883.6.1')])&gt;=1 and not(hl7:code[(@code='102034-6' and @codeSystem='2.16.840.1.113883.6.1')]/@nullFlavor)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): element hl7:code[(@code='102034-6' 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.201-2023-04-27T000000.html"
              test="count(hl7:code[(@code='102034-6' and @codeSystem='2.16.840.1.113883.6.1')])&lt;=1">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): element hl7:code[(@code='102034-6' 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.201-2023-04-27T000000.html"
              test="count(hl7:title)&gt;=1 and not(hl7:title/@nullFlavor)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201-2023-04-27T000000.html"
              test="count(hl7:title)&lt;=1">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201-2023-04-27T000000.html"
              test="count(hl7:text)&gt;=1 and not(hl7:text/@nullFlavor)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201-2023-04-27T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201-2023-04-27T000000.html"
              test="count(hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180'])&gt;=1 and not(hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/@nullFlavor)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): element hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180'] jest mandatory [min 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.201
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.3.201']
Item: (plCdaMicroscopicFeaturesCytologicalDiagnosisSection)
-->

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

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']/hl7:code[(@code='102034-6' 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.201-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)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201-2023-04-27T000000.html"
              test="@nullFlavor or (@code='102034-6' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Pathology report microscopic observation in Specimen' and @codeSystemName='LOINC')">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): Wartość elementu MUSI wynosić code '102034-6' codeSystem '2.16.840.1.113883.6.1' displayName='Pathology report microscopic observation in Specimen' 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.201-2023-04-27T000000.html"
              test="count(hl7:translation[(@code='OpisMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:translation[(@code='OpisMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): element hl7:translation[(@code='OpisMikro' 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.201-2023-04-27T000000.html"
              test="count(hl7:translation[(@code='OpisMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): element hl7:translation[(@code='OpisMikro' 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.201
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']/hl7:code[(@code='102034-6' and @codeSystem='2.16.840.1.113883.6.1')]/hl7:translation[(@code='OpisMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaMicroscopicFeaturesCytologicalDiagnosisSection)
-->

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']/hl7:code[(@code='102034-6' and @codeSystem='2.16.840.1.113883.6.1')]/hl7:translation[(@code='OpisMikro' 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.201-2023-04-27T000000.html"
              test="@nullFlavor or (@code='OpisMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Opis mikroskopowy' and @codeSystemName='AtrybutyWBCYT')">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): Wartość elementu MUSI wynosić code 'OpisMikro' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Opis mikroskopowy' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.3.201
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']/hl7:title
Item: (plCdaMicroscopicFeaturesCytologicalDiagnosisSection)
-->

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

   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']/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.201-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)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201
Context: *[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']/hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']
Item: (plCdaMicroscopicFeaturesCytologicalDiagnosisSection)
-->
   <rule context="*[hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']]/hl7:section[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.3.201']/hl7:entry[hl7:organizer/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.3.201-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): 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.201-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaMicroscopicFeaturesCytologicalDiagnosisSection): Atrybut @typeCode MUSI być typu 'cs'</assert>
   </rule>
</pattern>
