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

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

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]"
         id="d16e14948-false-d57550e0">
      <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.330-2025-02-26T000000.html"
              test="string(@classCode) = ('OBS')">(plCdaPhysicalFindingsEntry): 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.330-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaPhysicalFindingsEntry): 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.330-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']) &gt;= 1">(plCdaPhysicalFindingsEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330'] 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.330-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']) &lt;= 1">(plCdaPhysicalFindingsEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330'] 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.330-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '29544-4' and @codeSystem = '2.16.840.1.113883.6.1')]) &gt;= 1">(plCdaPhysicalFindingsEntry): element hl7:code[(@code = '29544-4' and @codeSystem = '2.16.840.1.113883.6.1')] 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.330-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '29544-4' and @codeSystem = '2.16.840.1.113883.6.1')]) &lt;= 1">(plCdaPhysicalFindingsEntry): element hl7:code[(@code = '29544-4' and @codeSystem = '2.16.840.1.113883.6.1')] 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.330-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaPhysicalFindingsEntry): 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.330-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaPhysicalFindingsEntry): 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.330-2025-02-26T000000.html"
              test="count(hl7:value[not(@nullFlavor)]) &gt;= 1">(plCdaPhysicalFindingsEntry): 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.330-2025-02-26T000000.html"
              test="count(hl7:value[not(@nullFlavor)]) &lt;= 1">(plCdaPhysicalFindingsEntry): 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.330
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']
Item: (plCdaPhysicalFindingsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']"
         id="d16e14954-false-d57602e0">
      <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.330-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.330')">(plCdaPhysicalFindingsEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.330'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.330
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]/hl7:code[(@code = '29544-4' and @codeSystem = '2.16.840.1.113883.6.1')]
Item: (plCdaPhysicalFindingsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]/hl7:code[(@code = '29544-4' and @codeSystem = '2.16.840.1.113883.6.1')]"
         id="d16e14959-false-d57614e0">
      <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.330-2025-02-26T000000.html"
              test="@nullFlavor or (@code='29544-4' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Physical findings' and @codeSystemName='LOINC')">(plCdaPhysicalFindingsEntry): The element value SHALL be one of 'code '29544-4' codeSystem '2.16.840.1.113883.6.1' displayName='Physical findings' codeSystemName='LOINC''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.330
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]/hl7:statusCode[@code = 'completed']
Item: (plCdaPhysicalFindingsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]/hl7:statusCode[@code = 'completed']"
         id="d16e14964-false-d57628e0">
      <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.330-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaPhysicalFindingsEntry): 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.330
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.330']]/hl7:value[not(@nullFlavor)]
Item: (plCdaPhysicalFindingsEntry)
-->
</pattern>
