<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.305
Name: [4] Pomiar stężenie glikemii z oceną według normy (mmol/l)
Description: Pomiar stężenie glikemii (mmol/l)
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.305-2025-02-26T000000">
   <title>[4] Pomiar stężenie glikemii z oceną według normy (mmol/l)</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.305
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]
Item: (plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry)
-->

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

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]"
         id="d16e14392-false-d55061e0">
      <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.305-2025-02-26T000000.html"
              test="string(@classCode) = ('OBS')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']) &gt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305'] 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.305-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']) &lt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305'] 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.305-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '15074-8' and @codeSystem = '2.16.840.1.113883.6.1')]) &gt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:code[(@code = '15074-8' 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.305-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '15074-8' and @codeSystem = '2.16.840.1.113883.6.1')]) &lt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:code[(@code = '15074-8' 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.305-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="count(hl7:value[not(@nullFlavor)]) &gt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="count(hl7:value[not(@nullFlavor)]) &lt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:value[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.305-2025-02-26T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]) &gt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]] 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.305-2025-02-26T000000.html"
              test="count(hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]) &lt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.305
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']
Item: (plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry)
-->

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

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:code[(@code = '15074-8' and @codeSystem = '2.16.840.1.113883.6.1')]"
         id="d16e14403-false-d55136e0">
      <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.305-2025-02-26T000000.html"
              test="@nullFlavor or (@code='15074-8' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Glucose [Mass/volume] in Blood' and @codeSystemName='LOINC')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): The element value SHALL be one of 'code '15074-8' codeSystem '2.16.840.1.113883.6.1' displayName='Glucose [Mass/volume] in Blood' codeSystemName='LOINC''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.305
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:statusCode[@code = 'completed']
Item: (plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry)
-->

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

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:value[not(@nullFlavor)]"
         id="d16e14414-false-d55163e0">
      <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.305-2025-02-26T000000.html"
              test="@value">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="not(@value) or matches(string(@value), '^[-+]?\d*\.?[0-9]+([eE][-+]?\d+)?$')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="string(@unit) = ('mmol/l')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): The value for unit SHALL be 'mmol/l'. Found: "<value-of select="@unit"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.305
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]
Item: (plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]"
         id="d16e14426-false-d55182e0">
      <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.305-2025-02-26T000000.html"
              test="string(@typeCode) = ('COMP')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="count(hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]) &gt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]] 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.305-2025-02-26T000000.html"
              test="count(hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]) &lt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.305
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]/hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]
Item: (plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]/hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]"
         id="d16e14430-false-d55208e0">
      <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.305-2025-02-26T000000.html"
              test="string(@classCode) = ('OBS')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="count(hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]) &gt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)] 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.305-2025-02-26T000000.html"
              test="count(hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]) &lt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): element hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)] 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.305-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): 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.305
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]/hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]
Item: (plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]/hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]"
         id="d16e14436-false-d55247e0">
      <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.305-2025-02-26T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1][conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem]])">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): The element value SHALL be one of '2.16.840.1.113883.3.4424.13.11.248 Ocena stężenia glukozy (DYNAMIC)'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.305
Context: *[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]/hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:statusCode[@code = 'completed']
Item: (plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]]/hl7:observation[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.305']]/hl7:entryRelationship[hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]]/hl7:observation[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.248-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:statusCode[@code = 'completed']"
         id="d16e14443-false-d55265e0">
      <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.305-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaBloodGlucoseMgPerDlLevelWithAssessmentFindingEntry): The element value SHALL be one of 'code 'completed''.</assert>
   </rule>
</pattern>
