<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.1937.777.63.10.701
Name: Accertamenti e Controlli Consigliati (Tele)
Description: Recommendation [Interpretation] Document (LOINC: 62385-0 )
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549">
   <title>Accertamenti e Controlli Consigliati (Tele)</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <rule fpi="RULC-1"
         context="*[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]"
         id="d44e7009-false-d933979e0">
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@classCode) = ('DOCSECT') or not(@classCode)">(Accertamenti e Controlli Consigliati (Tele)): The value for classCode SHALL be 'DOCSECT'. Found: "<value-of select="@classCode"/>"</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@moodCode) = ('EVN') or not(@moodCode)">(Accertamenti e Controlli Consigliati (Tele)): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.1937.777.63.10.701']) &lt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:templateId[@root = '2.16.840.1.113883.3.1937.777.63.10.701'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:id) &lt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:id appears too often [max 1x].</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]) &gt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')] is required [min 1x].</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]) &lt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:title) &lt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:title appears too often [max 1x].</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:text) &gt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:text is required [min 1x].</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:text) &lt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:text appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:templateId[@root = '2.16.840.1.113883.3.1937.777.63.10.701']
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <rule fpi="RULC-1"
         context="*[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:templateId[@root = '2.16.840.1.113883.3.1937.777.63.10.701']"
         id="d44e7015-false-d934035e0">
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@root) = ('2.16.840.1.113883.3.1937.777.63.10.701')">(Accertamenti e Controlli Consigliati (Tele)): The value for root SHALL be '2.16.840.1.113883.3.1937.777.63.10.701'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:id
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <rule fpi="RULC-1"
         context="*[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]"
         id="d44e7022-false-d934055e0">
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@code) = ('80615-8')">(Accertamenti e Controlli Consigliati (Tele)): The value for code SHALL be '80615-8'. Found: "<value-of select="@code"/>"</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@codeSystem) = ('2.16.840.1.113883.6.1')">(Accertamenti e Controlli Consigliati (Tele)): The value for codeSystem SHALL be '2.16.840.1.113883.6.1'. Found: "<value-of select="@codeSystem"/>"</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@codeSystemName) = ('LOINC') or not(@codeSystemName)">(Accertamenti e Controlli Consigliati (Tele)): The value for codeSystemName SHALL be 'LOINC'. Found: "<value-of select="@codeSystemName"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:title
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:text
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:entry[hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']]
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <rule fpi="RULC-1"
         context="*[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:entry[hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']]"
         id="d44e7045-false-d934091e0">
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@typeCode),'\s'))"/>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="not(@typeCode) or empty($theAttValue[not(. = (doc('include/voc-2.16.840.1.113883.1.11.19446-DYNAMIC.xml')/*/valueSet/conceptList/concept/@code))])">(Accertamenti e Controlli Consigliati (Tele)): The value for typeCode SHALL be selected from value set '2.16.840.1.113883.1.11.19446' x_ActRelationshipEntry (DYNAMIC).</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@contextConductionInd) = ('true') or not(@contextConductionInd)">(Accertamenti e Controlli Consigliati (Tele)): The value for contextConductionInd SHALL be 'true'. Found: "<value-of select="@contextConductionInd"/>"</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']) &gt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:act[@classCode = 'ACT'][@moodCode = 'PRP'] is required [min 1x].</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']) &lt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:act[@classCode = 'ACT'][@moodCode = 'PRP'] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:entry[hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']]/hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <rule fpi="RULC-1"
         context="*[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:entry[hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']]/hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']"
         id="d44e7063-false-d934123e0">
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@moodCode) = ('PRP')">(Accertamenti e Controlli Consigliati (Tele)): The value for moodCode SHALL be 'PRP'. Found: "<value-of select="@moodCode"/>"</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="string(@classCode) = ('ACT')">(Accertamenti e Controlli Consigliati (Tele)): The value for classCode SHALL be 'ACT'. Found: "<value-of select="@classCode"/>"</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:code) &gt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:code is required [min 1x].</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="count(hl7:code) &lt;= 1">(Accertamenti e Controlli Consigliati (Tele)): element hl7:code appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:entry[hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']]/hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']/hl7:code
Item: (Accertamenti e Controlli Consigliati (Tele))
-->

   <rule fpi="RULC-1"
         context="*[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:entry[hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']]/hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']/hl7:code"
         id="d44e7069-false-d934147e0">
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="@code">(Accertamenti e Controlli Consigliati (Tele)): attribute @code SHALL be present.</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="not(@code) or (string-length(@code) &gt; 0 and not(matches(@code,'\s')))">(Accertamenti e Controlli Consigliati (Tele)): Attribute @code SHALL be of data type 'cs'  - '<value-of select="@code"/>'</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="@codeSystem">(Accertamenti e Controlli Consigliati (Tele)): attribute @codeSystem SHALL be present.</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="not(@codeSystem) or matches(@codeSystem,'^[0-2](\.(0|[1-9]\d*))*$') or matches(@codeSystem,'^[A-Fa-f\d]{8}-[A-Fa-f\d]{4}-[A-Fa-f\d]{4}-[A-Fa-f\d]{4}-[A-Fa-f\d]{12}$') or matches(@codeSystem,'^[A-Za-z][A-Za-z\d\-]*$')">(Accertamenti e Controlli Consigliati (Tele)): Attribute @codeSystem SHALL be of data type 'uid'  - '<value-of select="@codeSystem"/>'</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="not(@codeSystemName) or string-length(@codeSystemName)&gt;0">(Accertamenti e Controlli Consigliati (Tele)): Attribute @codeSystemName SHALL be of data type 'st'  - '<value-of select="@codeSystemName"/>'</assert>
      <assert role="error"
              see="https://hl7itig.art-decor.pub/hl7itig-html-20251014T155738/tmp-2.16.840.1.113883.3.1937.777.63.10.701-2025-06-09T105549.html"
              test="not(@displayName) or string-length(@displayName)&gt;0">(Accertamenti e Controlli Consigliati (Tele)): Attribute @displayName SHALL be of data type 'st'  - '<value-of select="@displayName"/>'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.1937.777.63.10.701
Context: *[hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]]/hl7:section[hl7:code[(@code = '80615-8' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:entry[hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']]/hl7:act[@classCode = 'ACT'][@moodCode = 'PRP']/hl7:code/hl7:translation
Item: (Accertamenti e Controlli Consigliati (Tele))
-->
</pattern>
