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

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]"
         id="d16e8278-false-d33194e0">
      <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.242-2025-02-26T000000.html"
              test="count(hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]) &gt;= 1">(plCdaRespiratoryRateEntry): element hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']] 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.242-2025-02-26T000000.html"
              test="count(hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]) &lt;= 1">(plCdaRespiratoryRateEntry): element hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.242
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]
Item: (plCdaRespiratoryRateEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]"
         id="d16e8305-false-d33211e0">
      <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.242-2025-02-26T000000.html"
              test="string(@classCode) = ('OBS')">(plCdaRespiratoryRateEntry): 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.242-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaRespiratoryRateEntry): 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.242-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']) &gt;= 1">(plCdaRespiratoryRateEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242'] 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.242-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']) &lt;= 1">(plCdaRespiratoryRateEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242'] 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.242-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '86290005' and @codeSystem = '2.16.840.1.113883.6.96')]) &gt;= 1">(plCdaRespiratoryRateEntry): element hl7:code[(@code = '86290005' 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.242-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '86290005' and @codeSystem = '2.16.840.1.113883.6.96')]) &lt;= 1">(plCdaRespiratoryRateEntry): element hl7:code[(@code = '86290005' 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.242-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaRespiratoryRateEntry): 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.242-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaRespiratoryRateEntry): element hl7:statusCode[@code = 'completed'] 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.242-2025-02-26T000000.html"
              test="count(hl7:value[not(@nullFlavor)]) &gt;= 1">(plCdaRespiratoryRateEntry): element hl7:value[not(@nullFlavor)] 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.242-2025-02-26T000000.html"
              test="count(hl7:value[not(@nullFlavor)]) &lt;= 1">(plCdaRespiratoryRateEntry): element hl7:value[not(@nullFlavor)] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.242
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']
Item: (plCdaRespiratoryRateEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']"
         id="d16e8311-false-d33263e0">
      <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.242-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.242')">(plCdaRespiratoryRateEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.242'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.242
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]/hl7:code[(@code = '86290005' and @codeSystem = '2.16.840.1.113883.6.96')]
Item: (plCdaRespiratoryRateEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]/hl7:code[(@code = '86290005' and @codeSystem = '2.16.840.1.113883.6.96')]"
         id="d16e8316-false-d33275e0">
      <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.242-2025-02-26T000000.html"
              test="@nullFlavor or (@code='86290005' and @codeSystem='2.16.840.1.113883.6.96' and @displayName='Respiratory rate (observable entity)' and @codeSystemName='SNOMED-CT')">(plCdaRespiratoryRateEntry): The element value SHALL be one of 'code '86290005' codeSystem '2.16.840.1.113883.6.96' displayName='Respiratory rate (observable entity)' codeSystemName='SNOMED-CT''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.242
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]/hl7:statusCode[@code = 'completed']
Item: (plCdaRespiratoryRateEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]/hl7:statusCode[@code = 'completed']"
         id="d16e8321-false-d33289e0">
      <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.242-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaRespiratoryRateEntry): The element value SHALL be one of 'code 'completed''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.242
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]/hl7:value[not(@nullFlavor)]
Item: (plCdaRespiratoryRateEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.242']]/hl7:value[not(@nullFlavor)]"
         id="d16e8327-false-d33302e0">
      <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.242-2025-02-26T000000.html"
              test="@value">(plCdaRespiratoryRateEntry): attribute @value 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.242-2025-02-26T000000.html"
              test="not(@value) or matches(string(@value), '^[-+]?\d*\.?[0-9]+([eE][-+]?\d+)?$')">(plCdaRespiratoryRateEntry): Attribute @value is not a valid real number <value-of select="@value"/>
      </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.242-2025-02-26T000000.html"
              test="string(@unit) = ('/min')">(plCdaRespiratoryRateEntry): The value for unit SHALL be '/min'. Found: "<value-of select="@unit"/>"</assert>
   </rule>
</pattern>
