<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.276
Name: [4] KMCR Vb Postępowanie z pacjentem, Leki
Description: KMCR Vb Postępowanie z pacjentem, Leki
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.276-2025-02-26T000000">
   <title>[4] KMCR Vb Postępowanie z pacjentem, Leki</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

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

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]"
         id="d16e12189-false-d47283e0">
      <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.276-2025-02-26T000000.html"
              test="string(@classCode) = ('BATTERY')">(plCdaRescueMedicationAdministrationEntry): The value for classCode SHALL be 'BATTERY'. 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.276-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaRescueMedicationAdministrationEntry): 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.276-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276'] 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.276-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276'] 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.276-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'MEDLIST' and @codeSystem = '2.16.840.1.113883.11.13953')]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:code[(@code = 'MEDLIST' and @codeSystem = '2.16.840.1.113883.11.13953')] 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.276-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'MEDLIST' and @codeSystem = '2.16.840.1.113883.11.13953')]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:code[(@code = 'MEDLIST' and @codeSystem = '2.16.840.1.113883.11.13953')] 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.276-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): 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.276-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): 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.276-2025-02-26T000000.html"
              test="count(hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']] 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.276-2025-02-26T000000.html"
              test="count(hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']"
         id="d16e12195-false-d47335e0">
      <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.276-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.276')">(plCdaRescueMedicationAdministrationEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.276'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:code[(@code = 'MEDLIST' and @codeSystem = '2.16.840.1.113883.11.13953')]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:code[(@code = 'MEDLIST' and @codeSystem = '2.16.840.1.113883.11.13953')]"
         id="d16e12200-false-d47347e0">
      <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.276-2025-02-26T000000.html"
              test="@nullFlavor or (@code='MEDLIST' and @codeSystem='2.16.840.1.113883.11.13953' and @displayName='medication list' and @codeSystemName='ActCode')">(plCdaRescueMedicationAdministrationEntry): The element value SHALL be one of 'code 'MEDLIST' codeSystem '2.16.840.1.113883.11.13953' displayName='medication list' codeSystemName='ActCode''.</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.276-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'KMCR_Vb' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:translation[(@code = 'KMCR_Vb' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.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.276-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'KMCR_Vb' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:translation[(@code = 'KMCR_Vb' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:code[(@code = 'MEDLIST' and @codeSystem = '2.16.840.1.113883.11.13953')]/hl7:translation[(@code = 'KMCR_Vb' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:code[(@code = 'MEDLIST' and @codeSystem = '2.16.840.1.113883.11.13953')]/hl7:translation[(@code = 'KMCR_Vb' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]"
         id="d16e12204-false-d47370e0">
      <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.276-2025-02-26T000000.html"
              test="@nullFlavor or (@code='KMCR_Vb' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.1' and @displayName='Postępowanie z pacjentem, Leki' and @codeSystemName='WpisDoKMCR_KMLZRM')">(plCdaRescueMedicationAdministrationEntry): The element value SHALL be one of 'code 'KMCR_Vb' codeSystem '2.16.840.1.113883.3.4424.13.5.30.1' displayName='Postępowanie z pacjentem, Leki' codeSystemName='WpisDoKMCR_KMLZRM''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:statusCode[@code = 'completed']
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:statusCode[@code = 'completed']"
         id="d16e12210-false-d47384e0">
      <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.276-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaRescueMedicationAdministrationEntry): 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.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]"
         id="d16e12216-false-d47397e0">
      <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.276-2025-02-26T000000.html"
              test="string(@typeCode) = ('COMP') or not(@typeCode)">(plCdaRescueMedicationAdministrationEntry): The value for typeCode SHALL be 'COMP'. Found: "<value-of select="@typeCode"/>"</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.276-2025-02-26T000000.html"
              test="count(hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable] 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.276-2025-02-26T000000.html"
              test="count(hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]"
         id="d16e12220-false-d47417e0">
      <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.276-2025-02-26T000000.html"
              test="string(@classCode) = ('SBADM')">(plCdaRescueMedicationAdministrationEntry): The value for classCode SHALL be 'SBADM'. 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.276-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaRescueMedicationAdministrationEntry): 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.276-2025-02-26T000000.html"
              test="count(hl7:text[not(@nullFlavor)]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:text[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.276-2025-02-26T000000.html"
              test="count(hl7:text[not(@nullFlavor)]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:text[not(@nullFlavor)] 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.276-2025-02-26T000000.html"
              test="count(hl7:routeCode[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.1.11.14581-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem) or @nullFlavor]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:routeCode[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.1.11.14581-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem) or @nullFlavor] 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.276-2025-02-26T000000.html"
              test="count(hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct] 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.276-2025-02-26T000000.html"
              test="count(hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:text[not(@nullFlavor)]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:routeCode[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.1.11.14581-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem) or @nullFlavor]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:routeCode[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.1.11.14581-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem) or @nullFlavor]"
         id="d16e12235-false-d47469e0">
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <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.276-2025-02-26T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.1.11.14581-DYNAMIC.xml')//valueSet[1][conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem]])">(plCdaRescueMedicationAdministrationEntry): The element value SHALL be one of '2.16.840.1.113883.1.11.14581 RouteOfAdministration (DYNAMIC)'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]"
         id="d16e12240-false-d47486e0">
      <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.276-2025-02-26T000000.html"
              test="count(hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial] 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.276-2025-02-26T000000.html"
              test="count(hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]/hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]/hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]"
         id="d16e12242-false-d47502e0">
      <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.276-2025-02-26T000000.html"
              test="count(hl7:manufacturedMaterial[not(@nullFlavor)]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:manufacturedMaterial[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.276-2025-02-26T000000.html"
              test="count(hl7:manufacturedMaterial[not(@nullFlavor)]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:manufacturedMaterial[not(@nullFlavor)] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]/hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]/hl7:manufacturedMaterial[not(@nullFlavor)]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]/hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]/hl7:manufacturedMaterial[not(@nullFlavor)]"
         id="d16e12244-false-d47518e0">
      <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.276-2025-02-26T000000.html"
              test="count(hl7:code[@codeSystem = '2.16.840.1.113883.3.4424.6.1' or @nullFlavor]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:code[@codeSystem = '2.16.840.1.113883.3.4424.6.1' or @nullFlavor] 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.276-2025-02-26T000000.html"
              test="count(hl7:name[not(@nullFlavor)]) &gt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:name[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.276-2025-02-26T000000.html"
              test="count(hl7:name[not(@nullFlavor)]) &lt;= 1">(plCdaRescueMedicationAdministrationEntry): element hl7:name[not(@nullFlavor)] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]/hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]/hl7:manufacturedMaterial[not(@nullFlavor)]/hl7:code[@codeSystem = '2.16.840.1.113883.3.4424.6.1' or @nullFlavor]
Item: (plCdaRescueMedicationAdministrationEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]/hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]/hl7:manufacturedMaterial[not(@nullFlavor)]/hl7:code[@codeSystem = '2.16.840.1.113883.3.4424.6.1' or @nullFlavor]"
         id="d16e12246-false-d47542e0">
      <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.276-2025-02-26T000000.html"
              test="@nullFlavor or (@codeSystem='2.16.840.1.113883.3.4424.6.1')">(plCdaRescueMedicationAdministrationEntry): The element value SHALL be one of 'codeSystem '2.16.840.1.113883.3.4424.6.1''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.276
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.276']]/hl7:component[not(@nullFlavor)][hl7:substanceAdministration[@classCode = 'SBADM'][@moodCode = 'EVN']]/hl7:substanceAdministration[not(@nullFlavor)][@classCode = 'SBADM'][@moodCode = 'EVN'][hl7:consumable]/hl7:consumable[not(@nullFlavor)][hl7:manufacturedProduct]/hl7:manufacturedProduct[not(@nullFlavor)][hl7:manufacturedMaterial]/hl7:manufacturedMaterial[not(@nullFlavor)]/hl7:name[not(@nullFlavor)]
Item: (plCdaRescueMedicationAdministrationEntry)
-->
</pattern>
