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

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

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]"
         id="d16e12359-false-d48002e0">
      <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.278-2025-02-26T000000.html"
              test="string(@classCode) = ('ACT')">(plCdaRescueContactPersonEntry): 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.278-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaRescueContactPersonEntry): 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.278-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']) &gt;= 1">(plCdaRescueContactPersonEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278'] 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.278-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']) &lt;= 1">(plCdaRescueContactPersonEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278'] 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.278-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'KMCR_Vd' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]) &gt;= 1">(plCdaRescueContactPersonEntry): element hl7:code[(@code = 'KMCR_Vd' 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.278-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'KMCR_Vd' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]) &lt;= 1">(plCdaRescueContactPersonEntry): element hl7:code[(@code = 'KMCR_Vd' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.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.278-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaRescueContactPersonEntry): 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.278-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaRescueContactPersonEntry): 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.278-2025-02-26T000000.html"
              test="count(hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]) &gt;= 1">(plCdaRescueContactPersonEntry): element hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole] 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.278-2025-02-26T000000.html"
              test="count(hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]) &lt;= 1">(plCdaRescueContactPersonEntry): element hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.278
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']
Item: (plCdaRescueContactPersonEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']"
         id="d16e12365-false-d48054e0">
      <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.278-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.278')">(plCdaRescueContactPersonEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.278'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.278
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:code[(@code = 'KMCR_Vd' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]
Item: (plCdaRescueContactPersonEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:code[(@code = 'KMCR_Vd' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]"
         id="d16e12370-false-d48066e0">
      <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.278-2025-02-26T000000.html"
              test="@nullFlavor or (@code='KMCR_Vd' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.1' and @displayName='Osoba do kontaktu' and @codeSystemName='WpisDoKMCR_KMLZRM')">(plCdaRescueContactPersonEntry): The element value SHALL be one of 'code 'KMCR_Vd' codeSystem '2.16.840.1.113883.3.4424.13.5.30.1' displayName='Osoba do kontaktu' codeSystemName='WpisDoKMCR_KMLZRM''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.278
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:statusCode[@code = 'completed']
Item: (plCdaRescueContactPersonEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:statusCode[@code = 'completed']"
         id="d16e12375-false-d48080e0">
      <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.278-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaRescueContactPersonEntry): 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.278
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]
Item: (plCdaRescueContactPersonEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]"
         id="d16e12381-false-d48093e0">
      <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.278-2025-02-26T000000.html"
              test="string(@typeCode) = ('INF')">(plCdaRescueContactPersonEntry): The value for typeCode SHALL be 'INF'. 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.278-2025-02-26T000000.html"
              test="count(hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]) &gt;= 1">(plCdaRescueContactPersonEntry): element hl7:participantRole[not(@nullFlavor)][hl7:playingEntity] 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.278-2025-02-26T000000.html"
              test="count(hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]) &lt;= 1">(plCdaRescueContactPersonEntry): element hl7:participantRole[not(@nullFlavor)][hl7:playingEntity] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.278
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]
Item: (plCdaRescueContactPersonEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]"
         id="d16e12385-false-d48113e0">
      <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.278-2025-02-26T000000.html"
              test="string(@classCode) = ('ROL') or not(@classCode)">(plCdaRescueContactPersonEntry): The value for classCode SHALL be 'ROL'. 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.278-2025-02-26T000000.html"
              test="count(hl7:playingEntity[not(@nullFlavor)]) &gt;= 1">(plCdaRescueContactPersonEntry): element hl7:playingEntity[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.278-2025-02-26T000000.html"
              test="count(hl7:playingEntity[not(@nullFlavor)]) &lt;= 1">(plCdaRescueContactPersonEntry): element hl7:playingEntity[not(@nullFlavor)] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.278
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]/hl7:playingEntity[not(@nullFlavor)]
Item: (plCdaRescueContactPersonEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]/hl7:playingEntity[not(@nullFlavor)]"
         id="d16e12389-false-d48133e0">
      <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.278-2025-02-26T000000.html"
              test="string(@classCode) = ('ENT') or not(@classCode)">(plCdaRescueContactPersonEntry): The value for classCode SHALL be 'ENT'. 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.278-2025-02-26T000000.html"
              test="string(@determinerCode) = ('INSTANCE') or not(@determinerCode)">(plCdaRescueContactPersonEntry): The value for determinerCode SHALL be 'INSTANCE'. Found: "<value-of select="@determinerCode"/>"</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.278-2025-02-26T000000.html"
              test="count(hl7:name[not(@nullFlavor)]) &gt;= 1">(plCdaRescueContactPersonEntry): 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.278-2025-02-26T000000.html"
              test="count(hl7:name[not(@nullFlavor)]) &lt;= 1">(plCdaRescueContactPersonEntry): element hl7:name[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.278-2025-02-26T000000.html"
              test="count(hl7:desc[not(@nullFlavor)]) &gt;= 1">(plCdaRescueContactPersonEntry): element hl7:desc[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.278-2025-02-26T000000.html"
              test="count(hl7:desc[not(@nullFlavor)]) &lt;= 1">(plCdaRescueContactPersonEntry): element hl7:desc[not(@nullFlavor)] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.278
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]/hl7:playingEntity[not(@nullFlavor)]/hl7:name[not(@nullFlavor)]
Item: (plCdaRescueContactPersonEntry)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.278
Context: *[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]/hl7:playingEntity[not(@nullFlavor)]/hl7:desc[not(@nullFlavor)]
Item: (plCdaRescueContactPersonEntry)
-->
</pattern>
