<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.325
Name: [4] Uprawnienia i dane płatnika na karcie medycznych czynności ratunkowych
Description: Uprawnienia i dane płatnika na karcie medycznych czynności ratunkowych
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.325-2025-02-26T000000">
   <title>[4] Uprawnienia i dane płatnika na karcie medycznych czynności ratunkowych</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]"
         id="d16e14653-false-d56385e0">
      <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.325-2025-02-26T000000.html"
              test="string(@classCode) = ('ACT')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for classCode SHALL be 'ACT'. 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.325-2025-02-26T000000.html"
              test="string(@moodCode) = ('DEF')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for moodCode SHALL be 'DEF'. 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.325-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']) &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325'] 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.325-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325'] 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.325-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '48768-6' and @codeSystem = '2.16.840.1.113883.6.1')]) &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:code[(@code = '48768-6' 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.325-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '48768-6' and @codeSystem = '2.16.840.1.113883.6.1')]) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:code[(@code = '48768-6' 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.325-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): 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.325-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): 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.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']"
         id="d16e14659-false-d56437e0">
      <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.325-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.325')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.325'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:id
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:code[(@code = '48768-6' and @codeSystem = '2.16.840.1.113883.6.1')]
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:code[(@code = '48768-6' and @codeSystem = '2.16.840.1.113883.6.1')]"
         id="d16e14666-false-d56457e0">
      <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.325-2025-02-26T000000.html"
              test="@nullFlavor or (@code='48768-6' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Payment source')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The element value SHALL be one of 'code '48768-6' codeSystem '2.16.840.1.113883.6.1' displayName='Payment source''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:statusCode[@code = 'completed']
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:statusCode[@code = 'completed']"
         id="d16e14672-false-d56471e0">
      <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.325-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): 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.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]">
      <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.325-2025-02-26T000000.html"
              test="@typeCode">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): attribute @typeCode SHALL be present.</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@typeCode),'\s'))"/>
      <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.325-2025-02-26T000000.html"
              test="not(@typeCode) or empty($theAttValue[not(. = (('COMP')))])">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for typeCode SHALL be 'code 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.325-2025-02-26T000000.html"
              test="count(hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]) &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]] 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.325-2025-02-26T000000.html"
              test="count(hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]] appears too often [max 1x].</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]">
      <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.325-2025-02-26T000000.html"
              test="@classCode">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): attribute @classCode SHALL be present.</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@classCode),'\s'))"/>
      <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.325-2025-02-26T000000.html"
              test="not(@classCode) or empty($theAttValue[not(. = (('ACT')))])">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for classCode SHALL be 'code ACT'. 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.325-2025-02-26T000000.html"
              test="@moodCode">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): attribute @moodCode SHALL be present.</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@moodCode),'\s'))"/>
      <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.325-2025-02-26T000000.html"
              test="not(@moodCode) or empty($theAttValue[not(. = (('EVN')))])">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for moodCode SHALL be 'code 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.325-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]) &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')] 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.325-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')] 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.325-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): 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.325-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): 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.325-2025-02-26T000000.html"
              test="count(hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]) &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity] is required [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.325-2025-02-26T000000.html"
              test="count(hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity] appears too often [max 1x].</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:id[@nullFlavor = 'NA']
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:id[@nullFlavor = 'NA']">
      <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.325-2025-02-26T000000.html"
              test="string(@nullFlavor) = ('NA')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for nullFlavor SHALL be 'NA'. Found: "<value-of select="@nullFlavor"/>"</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]">
      <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.325-2025-02-26T000000.html"
              test="@nullFlavor or (@code='PUBLICPOL' and @codeSystem='2.16.840.1.113883.5.4')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The element value SHALL be one of 'code 'PUBLICPOL' codeSystem '2.16.840.1.113883.5.4''.</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:statusCode[@code = 'completed']
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:statusCode[@code = 'completed']">
      <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.325-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): 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.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]">
      <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.325-2025-02-26T000000.html"
              test="string(@typeCode) = ('PRF')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for typeCode SHALL be 'PRF'. 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.325-2025-02-26T000000.html"
              test="count(hl7:assignedEntity) &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:assignedEntity is required [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.325-2025-02-26T000000.html"
              test="count(hl7:assignedEntity) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:assignedEntity appears too often [max 1x].</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]/hl7:assignedEntity
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]/hl7:assignedEntity">
      <let name="elmcount"
           value="count(hl7:id[@root='2.16.840.1.113883.3.4424.3.1'] | hl7:id[@root='1.0.3166.1'] | hl7:id[@root='2.16.840.1.113883.3.4424.11.1.49'])"/>
      <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.325-2025-02-26T000000.html"
              test="$elmcount &gt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): choice (hl7:id[@root='2.16.840.1.113883.3.4424.3.1']  or  hl7:id[@root='1.0.3166.1']  or  hl7:id[@root='2.16.840.1.113883.3.4424.11.1.49']) does not contain enough elements [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.325-2025-02-26T000000.html"
              test="$elmcount &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): choice (hl7:id[@root='2.16.840.1.113883.3.4424.3.1']  or  hl7:id[@root='1.0.3166.1']  or  hl7:id[@root='2.16.840.1.113883.3.4424.11.1.49']) contains too many elements [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.325-2025-02-26T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.3.1']) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:id[@root='2.16.840.1.113883.3.4424.3.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.325-2025-02-26T000000.html"
              test="count(hl7:id[@root='1.0.3166.1']) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:id[@root='1.0.3166.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.325-2025-02-26T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.11.1.49']) &lt;= 1">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): element hl7:id[@root='2.16.840.1.113883.3.4424.11.1.49'] appears too often [max 1x].</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]/hl7:assignedEntity/hl7:id[@root='2.16.840.1.113883.3.4424.3.1']
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]/hl7:assignedEntity/hl7:id[@root='2.16.840.1.113883.3.4424.3.1']">
      <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.325-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.3.1')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.3.1'. Found: "<value-of select="@root"/>"</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.325-2025-02-26T000000.html"
              test="@extension">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): attribute @extension 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.325-2025-02-26T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]/hl7:assignedEntity/hl7:id[@root='1.0.3166.1']
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]/hl7:assignedEntity/hl7:id[@root='1.0.3166.1']">
      <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.325-2025-02-26T000000.html"
              test="string(@root) = ('1.0.3166.1')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for root SHALL be '1.0.3166.1'. Found: "<value-of select="@root"/>"</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.325-2025-02-26T000000.html"
              test="@extension">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): attribute @extension 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.325-2025-02-26T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</assert>
      <assert role="warning"
              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.325-2025-02-26T000000.html"
              test="@extension=('AT','BE','BG','CY','CZ','DK','EE','FI','FR','GR','ES','NL','IS','IE','LI','LT','LU','LF','MT','DE','NO','PT','RO','SK','SI','CH','SE','HU','GB','IT','HR')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): Nieprawidłowy identyfikator instytucji właściwej dla koordynacji</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.325
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]/hl7:assignedEntity/hl7:id[@root='2.16.840.1.113883.3.4424.11.1.49']
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
-->
   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]/hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]/hl7:performer[@typeCode = 'PRF'][hl7:assignedEntity]/hl7:assignedEntity/hl7:id[@root='2.16.840.1.113883.3.4424.11.1.49']">
      <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.325-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.11.1.49')">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.11.1.49'. Found: "<value-of select="@root"/>"</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.325-2025-02-26T000000.html"
              test="@extension">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): attribute @extension 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.325-2025-02-26T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaParamedicRescueSummaryNoteCoverageActivityEntry): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</assert>
   </rule>

   <!--
Template derived rules for ID: plcda-d16e14677
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.325']]/hl7:entryRelationship[hl7:act[hl7:code[(@code = 'PUBLICPOL' and @codeSystem = '2.16.840.1.113883.5.4')]]]
Item: (plCdaParamedicRescueSummaryNoteCoverageActivityEntry)
--></pattern>
