Draft dQM CMS Content Implementation Guide
2025.1.0 - CI Build

Draft dQM CMS Content Implementation Guide, published by cqframework. This guide is not an authorized publication; it is the continuous build for version 2025.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/dqm-content-cms-2025/ and changes regularly. See the Directory of published versions

: CMS349FHIRHIVScreening - XML Representation

Draft as of 2026-09-19

Raw xml | Download


<Library xmlns="http://hl7.org/fhir">
  <id value="CMS349FHIRHIVScreening"/>
  <text>
    <status value="extensions"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
  <table class="narrative-table">
    <tbody>
<tr>


<th colspan="2" scope="row" class="row-header"><a name="metadata"> </a>Metadata</th>


</tr>







<tr>


<th scope="row" class="row-header">Version</th>



<td class="content-container">1.1.000</td>


</tr>
















<tr>


<th scope="row" class="row-header">Status</th>



<td class="content-container">Draft</td>


</tr>







































<tr>


<th scope="row" class="row-header">Type</th>



<td class="content-container">
    <a href="http://terminology.hl7.org/7.1.0/CodeSystem-library-type.html">http://terminology.hl7.org/CodeSystem/library-type</a>#logic-library


</td>


</tr>













<tr>


<th colspan="2" scope="row" class="row-header"><a name="parameters"> </a>Parameters</th>


</tr>


<tr>


<th scope="row" class="row-header">Parameter</th>



<td class="content-container">None</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>
        <a name="cql-content"> </a>
        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
NOTE: For use by March 2026 US Realm Connectathon participants for internal use only. Not for use or distribution in commercial products.
*/
library CMS349FHIRHIVScreening version '1.1.000'

using USQualityCore version '0.1.0-cibuild'
using USCore version '6.1.0-derived'
using FHIR version '4.0.1'

include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' called FHIRHelpers
include hl7.fhir.uv.cql.FHIRCommon version '2.0.0' called FHIRCommon
include hl7.fhir.us.cql.USCoreCommon version '2.0.0-ballot' called USCoreCommon
include hl7.fhir.us.cql.USCoreElements version '2.0.0-ballot' called USCoreElements

include CQMCommon version '5.1.000' called CQMCommon
include USQualityCoreCommon version '0.1.0-cibuild' called USQualityCoreCommon
include SupplementalDataElements version '6.1.000' called SDE
include Status version '2.1.000' called Status

codesystem &quot;LOINC&quot;: 'http://loinc.org'

valueset &quot;HIV&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.120.12.1003'
valueset &quot;Human Immunodeficiency Virus (HIV) Laboratory Test Codes (Ab and Ag)&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1056.50'
valueset &quot;Office Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001'
valueset &quot;Preventive Care Services - Established Office Visit, 18 and Up&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1025'
valueset &quot;Preventive Care Services, Initial Office Visit, 0 to 17&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1022'
valueset &quot;Preventive Care Services-Initial Office Visit, 18 and Up&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1023'
valueset &quot;Preventive Care, Established Office Visit, 0 to 17&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1024'

code &quot;HIV 1 and 2 tests - Meaningful Use set&quot;: '75622-1' from &quot;LOINC&quot; display 'HIV 1 and 2 tests - Meaningful Use set'

parameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;
  default Interval[@2026-01-01T00:00:00.000Z, @2027-01-01T00:00:00.000Z)

context Patient

define &quot;Initial Population&quot;:
  AgeInYearsAt(date from start of &quot;Measurement Period&quot;) in Interval[15, 65]
    and exists &quot;Qualifying Encounters&quot;

define &quot;Denominator&quot;:
  &quot;Initial Population&quot;

define &quot;Numerator&quot;:
  ( &quot;Has HIV Test Performed&quot; )

define &quot;Denominator Exclusions&quot;:
  // [E-13] base FHIR.Condition retrieve (defect-tracking/engine-issues.md E-13)
  // Original:
  //   exists ( ( [ConditionProblemsHealthConcerns: &quot;HIV&quot;]
  //       union [ConditionEncounterDiagnosis: &quot;HIV&quot;] ) HIVDiagnosis
  exists ( ( [FHIR.Condition: &quot;HIV&quot;] ) HIVDiagnosis
      where HIVDiagnosis.prevalenceInterval ( ) starts before day of start of &quot;Measurement Period&quot;
        and HIVDiagnosis.isVerified ( )
  )

define &quot;Denominator Exceptions&quot;:
  &quot;Patient Expired&quot;

define &quot;Qualifying Encounters&quot;:
  ( [&quot;Encounter&quot;: &quot;Preventive Care Services, Initial Office Visit, 0 to 17&quot;]
    union [&quot;Encounter&quot;: &quot;Preventive Care Services-Initial Office Visit, 18 and Up&quot;]
    union [&quot;Encounter&quot;: &quot;Preventive Care, Established Office Visit, 0 to 17&quot;]
    union [&quot;Encounter&quot;: &quot;Preventive Care Services - Established Office Visit, 18 and Up&quot;]
    union [&quot;Encounter&quot;: &quot;Office Visit&quot;] ) Encounter
    where Encounter.period during day of &quot;Measurement Period&quot;
      and Encounter.status = 'finished'

define &quot;Patient Expired&quot;:
  Patient.deceased on or before day of end of &quot;Measurement Period&quot;

define &quot;Has HIV Test Performed&quot;:
  exists ( [&quot;LaboratoryResultObservation&quot;: &quot;Human Immunodeficiency Virus (HIV) Laboratory Test Codes (Ab and Ag)&quot;]
    union [&quot;LaboratoryResultObservation&quot;: &quot;HIV 1 and 2 tests - Meaningful Use set&quot;] ) HIVTest
    where HIVTest.value is not null
      and AgeInYearsAt(date from start of HIVTest.effective.toInterval()) in Interval[15, 65]
      and HIVTest.effective.toInterval ( ) starts before day of end of &quot;Measurement Period&quot;
      and ( HIVTest.status = 'final'
          or HIVTest.status = 'amended'
          or HIVTest.status = 'corrected'
      )

define &quot;SDE Ethnicity&quot;:
  SDE.&quot;SDE Ethnicity&quot;

define &quot;SDE Payer&quot;:
  SDE.&quot;SDE Payer&quot;

define &quot;SDE Race&quot;:
  SDE.&quot;SDE Race&quot;

define &quot;SDE Sex&quot;:
  SDE.&quot;SDE Sex&quot;

/*
@description: Returns true if the given condition either has no verification status or has a verification status of confirmed, unconfirmed, provisional, or differential
*/


define fluent function isVerified(condition Choice&lt;ConditionEncounterDiagnosis, ConditionProblemsHealthConcerns&gt;):
  condition.verificationStatus is not null implies ( condition.verificationStatus ~ Status.&quot;confirmed&quot;
      or condition.verificationStatus ~ Status.&quot;unconfirmed&quot;
      or condition.verificationStatus ~ Status.&quot;provisional&quot;
      or condition.verificationStatus ~ Status.&quot;differential&quot;
  )</code></pre>
      </td>
    </tr>
    
  



<tr>
  <th colspan="2" scope="row" class="row-header">Generated using version 0.5.6 of the sample-content-ig Liquid templates</th>
</tr>

    </tbody>
  </table>
</div>
  </text>
  <extension
             url="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-softwaresystem">
    <valueReference>
      <reference value="Device/cqf-tooling"/>
    </valueReference>
  </extension>
  <url value="https://madie.cms.gov/Library/CMS349FHIRHIVScreening"/>
  <version value="1.1.000"/>
  <name value="CMS349FHIRHIVScreening"/>
  <status value="draft"/>
  <type>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
      <code value="logic-library"/>
    </coding>
  </type>
  <date value="2026-09-19T16:31:14+00:00"/>
  <content>
    <contentType value="text/cql"/>
    <data
          value="LyoKTk9URTogRm9yIHVzZSBieSBNYXJjaCAyMDI2IFVTIFJlYWxtIENvbm5lY3RhdGhvbiBwYXJ0aWNpcGFudHMgZm9yIGludGVybmFsIHVzZSBvbmx5LiBOb3QgZm9yIHVzZSBvciBkaXN0cmlidXRpb24gaW4gY29tbWVyY2lhbCBwcm9kdWN0cy4KKi8KbGlicmFyeSBDTVMzNDlGSElSSElWU2NyZWVuaW5nIHZlcnNpb24gJzEuMS4wMDAnCgp1c2luZyBVU1F1YWxpdHlDb3JlIHZlcnNpb24gJz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pb246IFJldHVybnMgdHJ1ZSBpZiB0aGUgZ2l2ZW4gY29uZGl0aW9uIGVpdGhlciBoYXMgbm8gdmVyaWZpY2F0aW9uIHN0YXR1cyBvciBoYXMgYSB2ZXJpZmljYXRpb24gc3RhdHVzIG9mIGNvbmZpcm1lZCwgdW5jb25maXJtZWQsIHByb3Zpc2lvbmFsLCBvciBkaWZmZXJlbnRpYWwKKi8KCgpkZWZpbmUgZmx1ZW50IGZ1bmN0aW9uIGlzVmVyaWZpZWQoY29uZGl0aW9uIENob2ljZTxDb25kaXRpb25FbmNvdW50ZXJEaWFnbm9zaXMsIENvbmRpdGlvblByb2JsZW1zSGVhbHRoQ29uY2VybnM+KToKICBjb25kaXRpb24udmVyaWZpY2F0aW9uU3RhdHVzIGlzIG5vdCBudWxsIGltcGxpZXMgKCBjb25kaXRpb24udmVyaWZpY2F0aW9uU3RhdHVzIH4gU3RhdHVzLiJjb25maXJtZWQiCiAgICAgIG9yIGNvbmRpdGlvbi52ZXJpZmljYXRpb25TdGF0dXMgfiBTdGF0dXMuInVuY29uZmlybWVkIgogICAgICBvciBjb25kaXRpb24udmVyaWZpY2F0aW9uU3RhdHVzIH4gU3RhdHVzLiJwcm92aXNpb25hbCIKICAgICAgb3IgY29uZGl0aW9uLnZlcmlmaWNhdGlvblN0YXR1cyB+IFN0YXR1cy4iZGlmZmVyZW50aWFsIgogICk="/>
    <url value="https://madie.cms.gov/Library-CMS349FHIRHIVScreening.cql"/>
  </content>
</Library>