Using CQL with FHIR
1.0.0-snapshot - Snapshot International flag

This page is part of the Using CQL with FHIR Implementation Guide (v1.0.0-snapshot: STU1 Draft) based on FHIR (HL7® FHIR® Standard) R4. . For a full list of available versions, see the Directory of published versions

: CQL Example - XML Representation

Active as of 2024-04-06

Raw xml | Download



<Library xmlns="http://hl7.org/fhir">
  <id value="CQLExample"/>
  <meta>
    <profile
             value="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-library"/>
  </meta>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><h2>Related Artifacts</h2><table class="grid"><tr><td>depends-on</td><td>FHIR model information</td><td><code>http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1</code></td></tr><tr><td>depends-on</td><td>Library FHIRHelpers</td><td><code>http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1</code></td></tr><tr><td>depends-on</td><td>Code system LOINC</td><td><a href="http://terminology.hl7.org/5.3.0/CodeSystem-v3-loinc.html">Logical Observation Identifiers, Names and Codes (LOINC)</a></td></tr></table><h2>Parameters</h2><table class="grid"><tr><td>GlucoseThreshold</td><td>in</td><td>0</td><td>1</td><td>Quantity</td></tr><tr><td>Patient</td><td>out</td><td>0</td><td>1</td><td>Patient</td></tr><tr><td>Blood Glucose Observations</td><td>out</td><td>0</td><td>*</td><td>Observation</td></tr></table><h2>Data Requirements</h2><table class="grid"><tr><td colspan="2"><b>Type</b>: <a href="http://hl7.org/fhir/R4/patient.html">Patient</a> (<a href="http://hl7.org/fhir/R4/patient.html">Patient</a>)</td></tr></table><table class="grid"><tr><td colspan="2"><b>Type</b>: <a href="http://hl7.org/fhir/R4/observation.html">Observation</a> (<a href="http://hl7.org/fhir/R4/observation.html">Observation</a>)</td></tr><tr style="background-color: #efefef"><td>Filter</td><td>Value</td></tr><tr><td>code</td><td>One of these codes: <a href="https://loinc.org/2339-0">Logical Observation Identifiers, Names and Codes (LOINC)</a> 2339-0: Glucose Bld-mCnc</td></tr></table><h2>Contents</h2><p><code>text/cql</code></p><pre><code class="language-sql">library CQLExample

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'

codesystem LOINC: 'http://loinc.org'
code &quot;Blood Glucose&quot;: '2339-0' from LOINC display 'Glucose Bld-mCnc'

parameter GlucoseThreshold Quantity

context Patient

define &quot;Blood Glucose Observations&quot;:
  [Observation: &quot;Blood Glucose&quot;] BG
    where BG.value &gt; GlucoseThreshold
</code></pre></div>
  </text>
  <contained>
    <Parameters>
      <id value="options"/>
      <parameter>
        <name value="translatorVersion"/>
        <valueString value="3.9.0"/>
      </parameter>
      <parameter>
        <name value="enableAnnotations"/>
        <valueBoolean value="true"/>
      </parameter>
      <parameter>
        <name value="enableLocators"/>
        <valueBoolean value="true"/>
      </parameter>
      <parameter>
        <name value="disableListDemotion"/>
        <valueBoolean value="true"/>
      </parameter>
      <parameter>
        <name value="disableListPromotion"/>
        <valueBoolean value="true"/>
      </parameter>
      <parameter>
        <name value="format"/>
        <valueString value="JSON"/>
      </parameter>
      <parameter>
        <name value="format"/>
        <valueString value="XML"/>
      </parameter>
      <parameter>
        <name value="analyzeDataRequirements"/>
        <valueBoolean value="false"/>
      </parameter>
      <parameter>
        <name value="collapseDataRequirements"/>
        <valueBoolean value="true"/>
      </parameter>
      <parameter>
        <name value="compatibilityLevel"/>
        <valueString value="1.5"/>
      </parameter>
      <parameter>
        <name value="enableCqlOnly"/>
        <valueBoolean value="false"/>
      </parameter>
      <parameter>
        <name value="errorLevel"/>
        <valueString value="Info"/>
      </parameter>
      <parameter>
        <name value="signatureLevel"/>
        <valueString value="Overloads"/>
      </parameter>
      <parameter>
        <name value="validateUnits"/>
        <valueBoolean value="true"/>
      </parameter>
      <parameter>
        <name value="verifyOnly"/>
        <valueBoolean value="false"/>
      </parameter>
    </Parameters>
  </contained>
  <extension url="http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions">
    <valueReference>
      <reference value="#options"/>
    </valueReference>
  </extension>
  <url value="http://hl7.org/fhir/uv/cql/Library/CQLExample"/>
  <identifier>
    <system value="urn:ietf:rfc:3986"/>
    <value value="urn:oid:2.16.840.1.113883.4.642.40.37.28.2"/>
  </identifier>
  <version value="1.0.0-snapshot"/>
  <name value="CQLExample"/>
  <title value="CQL Example"/>
  <status value="active"/>
  <experimental value="true"/>
  <type>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
      <code value="logic-library"/>
    </coding>
  </type>
  <date value="2024-04-06T09:37:49+11:00"/>
  <publisher value="HL7 International / Clinical Decision Support"/>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/dss"/>
    </telecom>
  </contact>
  <description
               value="Example CQL Library illustrating the CQL Profile (a Library with only text/cql content)"/>
  <jurisdiction>
    <coding>
      <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
      <code value="001"/>
      <display value="World"/>
    </coding>
  </jurisdiction>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="FHIR model information"/>
    <resource
              value="http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Library FHIRHelpers"/>
    <resource
              value="http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1"/>
  </relatedArtifact>
  <relatedArtifact>
    <type value="depends-on"/>
    <display value="Code system LOINC"/>
    <resource value="http://loinc.org"/>
  </relatedArtifact>
  <parameter>
    <name value="GlucoseThreshold"/>
    <use value="in"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Quantity"/>
  </parameter>
  <parameter>
    <name value="Patient"/>
    <use value="out"/>
    <min value="0"/>
    <max value="1"/>
    <type value="Patient"/>
  </parameter>
  <parameter>
    <name value="Blood Glucose Observations"/>
    <use value="out"/>
    <min value="0"/>
    <max value="*"/>
    <type value="Observation"/>
  </parameter>
  <dataRequirement>
    <type value="Patient"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
  </dataRequirement>
  <dataRequirement>
    <type value="Observation"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/Observation"/>
    <mustSupport value="code"/>
    <mustSupport value="value"/>
    <codeFilter>
      <path value="code"/>
      <code>
        <system value="http://loinc.org"/>
        <code value="2339-0"/>
        <display value="Glucose Bld-mCnc"/>
      </code>
    </codeFilter>
  </dataRequirement>
  <content>
    <contentType value="text/cql"/>
    <data
          value="bGlicmFyeSBDUUxFeGFtcGxlDQoNCnVzaW5nIEZISVIgdmVyc2lvbiAnNC4wLjEnDQoNCmluY2x1ZGUgRkhJUkhlbHBlcnMgdmVyc2lvbiAnNC4wLjEnDQoNCmNvZGVzeXN0ZW0gTE9JTkM6ICdodHRwOi8vbG9pbmMub3JnJw0KY29kZSAiQmxvb2QgR2x1Y29zZSI6ICcyMzM5LTAnIGZyb20gTE9JTkMgZGlzcGxheSAnR2x1Y29zZSBCbGQtbUNuYycNCg0KcGFyYW1ldGVyIEdsdWNvc2VUaHJlc2hvbGQgUXVhbnRpdHkNCg0KY29udGV4dCBQYXRpZW50DQoNCmRlZmluZSAiQmxvb2QgR2x1Y29zZSBPYnNlcnZhdGlvbnMiOg0KICBbT2JzZXJ2YXRpb246ICJCbG9vZCBHbHVjb3NlIl0gQkcNCiAgICB3aGVyZSBCRy52YWx1ZSA+IEdsdWNvc2VUaHJlc2hvbGQNCg=="/>
  </content>
</Library>