Using CQL With FHIR
3.0.0-ballot - STU 3 Ballot

Using CQL With FHIR - Downloaded Version null See the Directory of published versions

## : Example Logic Library - Module Definition

Page standards status: Informative

Raw xml | Download

    <Library xmlns="http://hl7.org/fhir">
      <id value="module-example"/>
      <meta>
        <profile
                 value="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-module"/>
      </meta>
      <language value="en"/>
      <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">Metadata</th>

    </tr>

    <tr>

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

    <td class="content-container">Example Logic Library - Module Definition</td>

    </tr>

    <tr>

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

    <td class="content-container">3.0.0-ballot</td>

    </tr>

    <tr>

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

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

    </tr>

    <tr>

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

    <td class="content-container">urn:oid:2.16.840.1.113883.4.642.40.37.28.8</td>

    </tr>

    <tr>

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

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

    </tr>

    <tr>

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

    <td class="content-container">
        World

    </td>

    </tr>

    <tr>

    <th scope="row" class="row-header">Steward (Publisher)</th>

    <td class="content-container">HL7 International / Clinical Decision Support</td>

    </tr>

    <tr>

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

    <td class="content-container"><div><p>This library is used as an example module definition in the Using FHIR with CQL Implementation Guide</p>
    </div></td>

    </tr>

    <tr>

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

    <td class="content-container">
        module-definition from <a href="http://terminology.hl7.org/7.3.0/CodeSystem-library-type.html">http://terminology.hl7.org/CodeSystem/library-type</a>

    </td>

    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: QICore model information

        <br/>

        <em>Resource</em>: <code>http://example.org/fhir/us/qicore/Library/QICore-ModelInfo|4.1.1</code>
        <br/>
        <em>Canonical URL</em>: <tt>http://example.org/fhir/us/qicore/Library/QICore-ModelInfo|4.1.1</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Library FHIRHelpers

        <br/>

        <em>Resource</em>: <code>http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|3.0.0-ballot</code>
        <br/>
        <em>Canonical URL</em>: <tt>http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|3.0.0-ballot</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Code system Diagnosis Role

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.3.0/CodeSystem-diagnosis-role.html">Diagnosis Role</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/diagnosis-role</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Emergency Department Visit

        <br/>

        <em>Resource</em>: <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.113883.3.117.1.7.1.292-20210611">Emergency Department Visit</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Psychiatric/Mental Health Patient

        <br/>

        <em>Resource</em>: <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.113883.3.117.1.7.1.299-20170816">Psychiatric/Mental Health Diagnosis</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Hospital Settings

        <br/>

        <em>Resource</em>: <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.113762.1.4.1111.126-20200305">Hospital Settings</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.126</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set ONC Administrative Sex

        <br/>

        <em>Resource</em>: <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.113762.1.4.1-20150331">Administrative Sex MF</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Race

        <br/>

        <em>Resource</em>: <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.114222.4.11.836-20121025">Race</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Ethnicity

        <br/>

        <em>Resource</em>: <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.114222.4.11.837-20121025">Ethnicity</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Payer

        <br/>

        <em>Resource</em>: <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.114222.4.11.3591-20250419">Payer Type</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591</tt>

      </td>
    </tr>

    <tr>
      <th scope="row" class="row-header">Data Requirement</th>
      <td class="content-container">
        <em>Type</em>: Patient
        <br/>

        <em>Profile(s)</em>:

        <code>http://example.org/fhir/us/qicore/StructureDefinition/qicore-patient</code>
        <br/>

        <em>Must Support Elements</em>: extension('http://example.org/fhir/us/core/StructureDefinition/us-core-ethnicity')
        <br/>

      </td>
    </tr>

    <tr>
      <th scope="row" class="row-header">Data Requirement</th>
      <td class="content-container">
        <em>Type</em>: Encounter
        <br/>

        <em>Profile(s)</em>:

        <code>http://example.org/fhir/us/qicore/StructureDefinition/qicore-encounter</code>
        <br/>

        <em>Code Filter(s)</em>:
        <br/>

        <span class="tab-one"><em>Path</em>: type</span>
        <br/>

        <span class="tab-one"><em>ValueSet</em>:</span> <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.113883.3.117.1.7.1.292-20210611">Emergency Department Visit</a>
        <br/>

      </td>
    </tr>

    <tr>
      <th scope="row" class="row-header">Data Requirement</th>
      <td class="content-container">
        <em>Type</em>: Condition
        <br/>

        <em>Profile(s)</em>:

        <a href="http://hl7.org/fhir/R4/condition.html">Condition</a>
        <br/>

        <em>Code Filter(s)</em>:
        <br/>

        <span class="tab-one"><em>Path</em>: id</span>
        <br/>

      </td>
    </tr>

    <tr>
      <th scope="row" class="row-header">Data Requirement</th>
      <td class="content-container">
        <em>Type</em>: Coverage
        <br/>

        <em>Profile(s)</em>:

        <code>http://example.org/fhir/us/qicore/StructureDefinition/qicore-coverage</code>
        <br/>

        <em>Code Filter(s)</em>:
        <br/>

        <span class="tab-one"><em>Path</em>: type</span>
        <br/>

        <span class="tab-one"><em>ValueSet</em>:</span> <a href="https://tx.fhir.org/r4/ValueSet/2.16.840.1.114222.4.11.3591-20250419">Payer Type</a>
        <br/>

      </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"/>

      <td class="content-container">
        <table>
          <thead>
            <tr>
              <td><em>Name</em></td>
              <td><em>Use</em></td>
              <td><em>Card.</em></td>
              <td><em>Type</em></td>
              <td><em>Documentation</em></td>
            </tr>
          </thead>
          <tbody>

            <tr>
              <td>Measurement Period</td>
              <td>In</td>
              <td>0..1</td>
              <td>Period</td>
              <td/>
            </tr>

            <tr>
              <td>Patient</td>
              <td>Out</td>
              <td>0..1</td>
              <td>Patient</td>
              <td/>
            </tr>

            <tr>
              <td>Inpatient Encounter</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>Initial Population</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>Measure Population</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>Stratifier 1</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>Stratifier 2</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>Stratifier 3</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>Stratifier 4</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Ethnicity</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Coding</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Payer</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Resource</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Race</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Coding</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Sex</td>
              <td>Out</td>
              <td>0..1</td>
              <td>Coding</td>
              <td/>
            </tr>

          </tbody>
        </table>
      </td>
    </tr>

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

        </tbody>
      </table>
    </div>
      </text>
      <url value="http://hl7.org/fhir/uv/cql/Library/module-example"/>
      <identifier>
        <use value="official"/>
        <system value="http://example.org/fhir/cqi/ecqm/Library/Identifier"/>
        <value value="EXMLogic"/>
      </identifier>
      <identifier>
        <system value="urn:ietf:rfc:3986"/>
        <value value="urn:oid:2.16.840.1.113883.4.642.40.37.28.8"/>
      </identifier>
      <version value="3.0.0-ballot"/>
      <name value="EXMLogicModuleDefinition"/>
      <title value="Example Logic Library - Module Definition"/>
      <status value="active"/>
      <experimental value="true"/>
      <type>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
          <code value="module-definition"/>
        </coding>
      </type>
      <date value="2019-09-03"/>
      <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="This library is used as an example module definition in the Using FHIR with CQL Implementation Guide"/>
      <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="QICore model information"/>
        <resource
                  value="http://example.org/fhir/us/qicore/Library/QICore-ModelInfo|4.1.1"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Library FHIRHelpers"/>
        <resource
                  value="http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|3.0.0-ballot"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Code system Diagnosis Role"/>
        <resource value="http://terminology.hl7.org/CodeSystem/diagnosis-role"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Emergency Department Visit"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Psychiatric/Mental Health Patient"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Hospital Settings"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.126"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set ONC Administrative Sex"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Race"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Ethnicity"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837"/>
      </relatedArtifact>
      <relatedArtifact>
        <type value="depends-on"/>
        <display value="Value set Payer"/>
        <resource
                  value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
      </relatedArtifact>
      <parameter>
        <name value="Measurement Period"/>
        <use value="in"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Period"/>
      </parameter>
      <parameter>
        <name value="Patient"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Patient"/>
      </parameter>
      <parameter>
        <name value="Inpatient Encounter"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Initial Population"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Measure Population"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Stratifier 1"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Stratifier 2"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Stratifier 3"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="Stratifier 4"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Encounter"/>
      </parameter>
      <parameter>
        <name value="SDE Ethnicity"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Coding"/>
      </parameter>
      <parameter>
        <name value="SDE Payer"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Resource"/>
      </parameter>
      <parameter>
        <name value="SDE Race"/>
        <use value="out"/>
        <min value="0"/>
        <max value="*"/>
        <type value="Coding"/>
      </parameter>
      <parameter>
        <name value="SDE Sex"/>
        <use value="out"/>
        <min value="0"/>
        <max value="1"/>
        <type value="Coding"/>
      </parameter>
      <dataRequirement>
        <extension
                   url="http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern">
          <valueString value="Patient?_id={{context.patientId}}"/>
        </extension>
        <extension
                   url="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-fhirQueryPatternCoverage">
          <valueCode value="partial"/>
        </extension>
        <type value="Patient"/>
        <profile
                 value="http://example.org/fhir/us/qicore/StructureDefinition/qicore-patient"/>
        <mustSupport
                     value="extension('http://example.org/fhir/us/core/StructureDefinition/us-core-ethnicity')">
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/rendered-value">
            <valueString value="ethnicity"/>
          </extension>
        </mustSupport>
      </dataRequirement>
      <dataRequirement>
        <extension
                   url="http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern">
          <valueString
                       value="Encounter?status=finished&amp;subject=Patient/{{context.patientId}}&amp;type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"/>
        </extension>
        <extension
                   url="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-fhirQueryPatternCoverage">
          <valueCode value="partial"/>
        </extension>
        <extension url="http://hl7.org/fhir/StructureDefinition/cqf-isSelective">
          <valueBoolean value="true"/>
        </extension>
        <extension url="http://hl7.org/fhir/StructureDefinition/cqf-valueFilter">
          <extension url="path">
            <valueString value="status"/>
          </extension>
          <extension url="comparator">
            <valueCode value="eq"/>
          </extension>
          <extension url="value">
            <valueString value="finished"/>
          </extension>
        </extension>
        <type value="Encounter"/>
        <profile
                 value="http://example.org/fhir/us/qicore/StructureDefinition/qicore-encounter"/>
        <codeFilter>
          <path value="type"/>
          <valueSet
                    value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <type value="Condition"/>
        <profile value="http://hl7.org/fhir/StructureDefinition/Condition"/>
        <codeFilter>
          <path value="id"/>
        </codeFilter>
      </dataRequirement>
      <dataRequirement>
        <extension
                   url="http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern">
          <valueString
                       value="Coverage?policy-holder=Patient/{{context.patientId}}&amp;type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
        </extension>
        <extension
                   url="http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern">
          <valueString
                       value="Coverage?subscriber=Patient/{{context.patientId}}&amp;type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
        </extension>
        <extension
                   url="http://hl7.org/fhir/StructureDefinition/cqf-fhirQueryPattern">
          <valueString
                       value="Coverage?beneficiary=Patient/{{context.patientId}}&amp;type:in=http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
        </extension>
        <extension
                   url="http://hl7.org/fhir/uv/cql/StructureDefinition/cql-fhirQueryPatternCoverage">
          <valueCode value="partial"/>
        </extension>
        <type value="Coverage"/>
        <profile
                 value="http://example.org/fhir/us/qicore/StructureDefinition/qicore-coverage"/>
        <codeFilter>
          <path value="type"/>
          <valueSet
                    value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
        </codeFilter>
      </dataRequirement>
    </Library>