<Library xmlns="http://hl7.org/fhir">
   <id value="CMS68FHIRDocumentationCurrentMeds"></id>
   <meta>
      <profile value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablelibrary"></profile>
      <profile value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-computablelibrary"></profile>
      <profile value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-publishablelibrary"></profile>
      <profile value="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-executablelibrary"></profile>
      <profile value="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library"></profile>
      <profile value="http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library"></profile>
      <profile value="http://hl7.org/fhir/uv/cql/StructureDefinition/elm-xml-library"></profile>
   </meta>
   <language value="en"></language>
   <text>
      <status value="extensions"></status>
      <div xmlns="http://www.w3.org/1999/xhtml" class="col-12"> 
         <table class="narrative-table"> 
            <tbody> 
               <tr> 
                  <th colspan="2" scope="row" class="row-header">Metadata</th> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Title</th> 
                  <td class="content-container">CMS68FHIRDocumentationCurrentMeds</td> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Version</th> 
                  <td class="content-container">1.0.000</td> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Identifier</th> 
                  <td class="content-container">CMS68FHIRDocumentationCurrentMeds</td> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Steward (Publisher)</th> 
                  <td class="content-container">Centers for Medicare &amp; Medicaid Services (CMS)</td> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Description</th> 
                  <td class="content-container">CMS68FHIRDocumentationCurrentMeds</td> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Type</th> 
                  <td class="content-container">[http://terminology.hl7.org/CodeSystem/library-type#logic-library]</td> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Data Requirement</th> 
                  <td class="content-container"> 
                     <em>Type</em>: Procedure 
                     <br></br> 
                     <em>Profile(s)</em>:  http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure 
                     <br></br>   
                     <em>Must Support Elements</em>: code, performed, status, status.value 
                     <br></br>  
                     <em>Code Filter(s)</em>: 
                     <br></br>  
                     <span class="tab-one">
                        <em>Path</em>: code
                     </span> 
                     <br></br>   
                     <span class="tab-one">
                        <em>Code(s)</em>:  http://snomed.info/sct#428191000124101: 'Documentation of current medications (procedure)'  
                     </span> 
                     <br></br>  
                  </td> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Data Requirement</th> 
                  <td class="content-container"> 
                     <em>Type</em>: Encounter 
                     <br></br> 
                     <em>Profile(s)</em>:  http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter 
                     <br></br>   
                     <em>Must Support Elements</em>: type, status, status.value, period 
                     <br></br>  
                     <em>Code Filter(s)</em>: 
                     <br></br>  
                     <span class="tab-one">
                        <em>Path</em>: type
                     </span> 
                     <br></br>  
                     <span class="tab-one">
                        <em>ValueSet</em>:
                     </span> http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834 
                     <br></br>   
                  </td> 
               </tr> 
               <tr> 
                  <th scope="row" class="row-header">Data Requirement</th> 
                  <td class="content-container"> 
                     <em>Type</em>: Procedure 
                     <br></br> 
                     <em>Profile(s)</em>:  http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone 
                     <br></br>   
                     <em>Must Support Elements</em>: code, extension, status, status.value, reasonCode 
                     <br></br>  
                     <em>Code Filter(s)</em>: 
                     <br></br>  
                     <span class="tab-one">
                        <em>Path</em>: code
                     </span> 
                     <br></br>   
                     <span class="tab-one">
                        <em>Code(s)</em>:  http://snomed.info/sct#428191000124101: 'Documentation of current medications (procedure)'  
                     </span> 
                     <br></br>  
                  </td> 
               </tr> 
               <tr> 
                  <th colspan="2" scope="row" class="row-header">Library Content</th> 
               </tr>  
               <tr> 
                  <th scope="row" class="row-header">CQL Content</th> 
                  <td> 
                     <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">library CMS68FHIRDocumentationCurrentMeds version '1.0.000'

using QICore version '6.0.0'

include FHIRHelpers version '4.4.000' called FHIRHelpers
include QICoreCommon version '4.0.000' called QICoreCommon
include SupplementalDataElements version '5.1.000' called SDE

codesystem "SNOMEDCT": 'http://snomed.info/sct'

valueset "Encounter to Document Medications": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834'

code "Acute health crisis (finding)": '705016005' from "SNOMEDCT" display 'Acute health crisis (finding)'
code "Documentation of current medications (procedure)": '428191000124101' from "SNOMEDCT" display 'Documentation of current medications (procedure)'

parameter "Measurement Period" Interval&lt;DateTime&gt;

context Patient

define "SDE Ethnicity":
  SDE."SDE Ethnicity"

define "SDE Payer":
  SDE."SDE Payer"

define "SDE Race":
  SDE."SDE Race"

define "SDE Sex":
  SDE."SDE Sex"

define "Denominator":
  "Initial Population"

define "Qualifying Encounter During Day of Measurement Period":
  ["Encounter": "Encounter to Document Medications"] ValidEncounter
    where ValidEncounter.status = 'finished'
      and ValidEncounter.period during day of "Measurement Period"

define "Initial Population":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter

define "Numerator":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter
    with [Procedure: "Documentation of current medications (procedure)"] MedicationsDocumented
      such that MedicationsDocumented.performed.toInterval ( ) starts during day of QualifyingEncounter.period
        and MedicationsDocumented.performed.toInterval ( ).hasEnd ( )
        and MedicationsDocumented.status = 'completed'

define "Denominator Exceptions":
  "Qualifying Encounter During Day of Measurement Period" QualifyingEncounter
    with [ProcedureNotDone: code ~ "Documentation of current medications (procedure)"] MedicationsNotDocumented
      such that MedicationsNotDocumented.recorded during day of QualifyingEncounter.period
        and MedicationsNotDocumented.status = 'not-done'
        and exists ( MedicationsNotDocumented.reasonCode reasonItem
            where reasonItem ~ "Acute health crisis (finding)"
        )</code></pre> 
                  </td> 
               </tr>   
               <tr> 
                  <th colspan="2" scope="row" class="row-header">Generated using version 0.4.8 of the sample-content-ig Liquid templates</th> 
               </tr> 
            </tbody> 
         </table> 
      </div>
   </text>
   <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
      <valueCoding>
         <system value="http://snomed.info/sct"></system>
         <code value="705016005"></code>
         <display value="Acute health crisis (finding)"></display>
      </valueCoding>
   </extension>
   <extension url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
      <valueCoding>
         <system value="http://snomed.info/sct"></system>
         <code value="428191000124101"></code>
         <display value="Documentation of current medications (procedure)"></display>
      </valueCoding>
   </extension>
   <url value="https://madie.cms.gov/Library/CMS68FHIRDocumentationCurrentMeds"></url>
   <identifier>
      <use value="official"></use>
      <system value="https://madie.cms.gov/login"></system>
      <value value="CMS68FHIRDocumentationCurrentMeds"></value>
   </identifier>
   <version value="1.0.000"></version>
   <name value="CMS68FHIRDocumentationCurrentMeds"></name>
   <title value="CMS68FHIRDocumentationCurrentMeds"></title>
   <status value="active"></status>
   <experimental value="false"></experimental>
   <type>
      <coding>
         <system value="http://terminology.hl7.org/CodeSystem/library-type"></system>
         <code value="logic-library"></code>
      </coding>
   </type>
   <date value="2025-08-21T13:34:24+00:00"></date>
   <publisher value="Centers for Medicare &amp; Medicaid Services (CMS)"></publisher>
   <description value="CMS68FHIRDocumentationCurrentMeds"></description>
   <relatedArtifact>
      <type value="depends-on"></type>
      <display value="QICore model information"></display>
      <resource value="http://hl7.org/fhir/Library/QICore-ModelInfo"></resource>
   </relatedArtifact>
   <relatedArtifact>
      <type value="depends-on"></type>
      <display value="Library SDE"></display>
      <resource value="https://madie.cms.gov/Library/SupplementalDataElements|5.1.000"></resource>
   </relatedArtifact>
   <relatedArtifact>
      <type value="depends-on"></type>
      <display value="Library FHIRHelpers"></display>
      <resource value="https://madie.cms.gov/Library/FHIRHelpers|4.4.000"></resource>
   </relatedArtifact>
   <relatedArtifact>
      <type value="depends-on"></type>
      <display value="Library QICoreCommon"></display>
      <resource value="https://madie.cms.gov/Library/QICoreCommon|4.0.000"></resource>
   </relatedArtifact>
   <relatedArtifact>
      <type value="depends-on"></type>
      <display value="Code system SNOMEDCT"></display>
      <resource value="http://snomed.info/sct"></resource>
   </relatedArtifact>
   <relatedArtifact>
      <type value="depends-on"></type>
      <display value="Value set Encounter to Document Medications"></display>
      <resource value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834"></resource>
   </relatedArtifact>
   <dataRequirement>
      <type value="Procedure"></type>
      <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure"></profile>
      <mustSupport value="code"></mustSupport>
      <mustSupport value="performed"></mustSupport>
      <mustSupport value="status"></mustSupport>
      <mustSupport value="status.value"></mustSupport>
      <codeFilter>
         <path value="code"></path>
         <code>
            <system value="http://snomed.info/sct"></system>
            <code value="428191000124101"></code>
            <display value="Documentation of current medications (procedure)"></display>
         </code>
      </codeFilter>
   </dataRequirement>
   <dataRequirement>
      <type value="Encounter"></type>
      <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"></profile>
      <mustSupport value="type"></mustSupport>
      <mustSupport value="status"></mustSupport>
      <mustSupport value="status.value"></mustSupport>
      <mustSupport value="period"></mustSupport>
      <codeFilter>
         <path value="type"></path>
         <valueSet value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1834"></valueSet>
      </codeFilter>
   </dataRequirement>
   <dataRequirement>
      <type value="Procedure"></type>
      <profile value="http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedurenotdone"></profile>
      <mustSupport value="code"></mustSupport>
      <mustSupport value="extension"></mustSupport>
      <mustSupport value="status"></mustSupport>
      <mustSupport value="status.value"></mustSupport>
      <mustSupport value="reasonCode"></mustSupport>
      <codeFilter>
         <path value="code"></path>
         <code>
            <system value="http://snomed.info/sct"></system>
            <code value="428191000124101"></code>
            <display value="Documentation of current medications (procedure)"></display>
         </code>
      </codeFilter>
   </dataRequirement>
   <content>
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vcm1lZC50b0ludGVydmFsICggKSBzdGFydHMgZHVyaW5nIGRheSBvZiBRdWFsaWZ5aW5nRW5jb3VudGVyLnBlcmlvZA0KICAgICAgICBhbmQgTWVkaWNhdGlvbnNEb2N1bWVudGVkLnBlcmZvcm1lZC50b0ludGVydmFsICggKS5oYXNFbmQgKCApDQogICAgICAgIGFuZCBNZWRpY2F0aW9uc0RvY3VtZW50ZWQuc3RhdHVzID0gJ2NvbXBsZXRlZCcNCg0KZGVmaW5lICJEZW5vbWluYXRvciBFeGNlcHRpb25zIjoNCiAgIlF1YWxpZnlpbmcgRW5jb3VudGVyIER1cmluZyBEYXkgb2YgTWVhc3VyZW1lbnQgUGVyaW9kIiBRdWFsaWZ5aW5nRW5jb3VudGVyDQogICAgd2l0aCBbUHJvY2VkdXJlTm90RG9uZTogY29kZSB+ICJEb2N1bWVudGF0aW9uIG9mIGN1cnJlbnQgbWVkaWNhdGlvbnMgKHByb2NlZHVyZSkiXSBNZWRpY2F0aW9uc05vdERvY3VtZW50ZWQNCiAgICAgIHN1Y2ggdGhhdCBNZWRpY2F0aW9uc05vdERvY3VtZW50ZWQucmVjb3JkZWQgZHVyaW5nIGRheSBvZiBRdWFsaWZ5aW5nRW5jb3VudGVyLnBlcmlvZA0KICAgICAgICBhbmQgTWVkaWNhdGlvbnNOb3REb2N1bWVudGVkLnN0YXR1cyA9ICdub3QtZG9uZScNCiAgICAgICAgYW5kIGV4aXN0cyAoIE1lZGljYXRpb25zTm90RG9jdW1lbnRlZC5yZWFzb25Db2RlIHJlYXNvbkl0ZW0NCiAgICAgICAgICAgIHdoZXJlIHJlYXNvbkl0ZW0gfiAiQWN1dGUgaGVhbHRoIGNyaXNpcyAoZmluZGluZykiDQogICAgICAgICk="></data>
   </content>
   <content>
      <contentType value="application/elm+json"></contentType>
      <data value="[encoded data, 230464 characters]"></data>
   </content>
</Library>