<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.259
Name: [4] Biegunka
Description: Biegunka
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000">
   <title>[4] Biegunka</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.259
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]
Item: (plCdaDiarrheaFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]"
         id="d16e9815-false-d38555e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="count(hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]) &gt;= 1">(plCdaDiarrheaFindingEntry): element hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="count(hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]) &lt;= 1">(plCdaDiarrheaFindingEntry): element hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.259
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]
Item: (plCdaDiarrheaFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]"
         id="d16e9840-false-d38572e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="string(@classCode) = ('OBS')">(plCdaDiarrheaFindingEntry): The value for classCode SHALL be 'OBS'. Found: "<value-of select="@classCode"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaDiarrheaFindingEntry): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="@negationInd">(plCdaDiarrheaFindingEntry): attribute @negationInd SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="not(@negationInd) or string(@negationInd)=('true','false')">(plCdaDiarrheaFindingEntry): Attribute @negationInd SHALL be of data type 'bl'  - '<value-of select="@negationInd"/>'</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']) &gt;= 1">(plCdaDiarrheaFindingEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']) &lt;= 1">(plCdaDiarrheaFindingEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '62315008' and @codeSystem = '2.16.840.1.113883.6.96')]) &gt;= 1">(plCdaDiarrheaFindingEntry): element hl7:code[(@code = '62315008' and @codeSystem = '2.16.840.1.113883.6.96')] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '62315008' and @codeSystem = '2.16.840.1.113883.6.96')]) &lt;= 1">(plCdaDiarrheaFindingEntry): element hl7:code[(@code = '62315008' and @codeSystem = '2.16.840.1.113883.6.96')] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaDiarrheaFindingEntry): element hl7:statusCode[@code = 'completed'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaDiarrheaFindingEntry): element hl7:statusCode[@code = 'completed'] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.259
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']
Item: (plCdaDiarrheaFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']"
         id="d16e9848-false-d38621e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.259')">(plCdaDiarrheaFindingEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.259'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.259
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]/hl7:code[(@code = '62315008' and @codeSystem = '2.16.840.1.113883.6.96')]
Item: (plCdaDiarrheaFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]/hl7:code[(@code = '62315008' and @codeSystem = '2.16.840.1.113883.6.96')]"
         id="d16e9853-false-d38633e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="@nullFlavor or (@code='62315008' and @codeSystem='2.16.840.1.113883.6.96' and @displayName='Diarrhea (finding)' and @codeSystemName='SNOMED-CT')">(plCdaDiarrheaFindingEntry): The element value SHALL be one of 'code '62315008' codeSystem '2.16.840.1.113883.6.96' displayName='Diarrhea (finding)' codeSystemName='SNOMED-CT''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.259
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]/hl7:statusCode[@code = 'completed']
Item: (plCdaDiarrheaFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.259']]/hl7:statusCode[@code = 'completed']"
         id="d16e9859-false-d38647e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.259-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaDiarrheaFindingEntry): The element value SHALL be one of 'code 'completed''.</assert>
   </rule>
</pattern>
