Your User Friendly Name for MyContentIG Here
0.5.3 - CI Build

Your User Friendly Name for MyContentIG Here, published by HL7 International - [Some] Work Group. This guide is not an authorized publication; it is the continuous build for version 0.5.3 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/sample-content-ig/ and changes regularly. See the Directory of published versions

## : Questionnaire Measure Example - XML Representation

Draft as of 2025-09-29

Raw xml | Download

    <Measure xmlns="http://hl7.org/fhir">
      <id value="QuestionnaireMeasureExample"/>
      <meta>
        <profile
                 value="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/computable-measure-cqfm"/>
      </meta>
      <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">Questionnaire Measure Example</td>

    </tr>

    <tr>

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

    <td class="content-container">0.5.3</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">Experimental</th>

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

    </tr>

    <tr>

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

    <td class="content-container">
        001 from <a href="http://unstats.un.org/unsd/methods/m49/m49.htm">http://unstats.un.org/unsd/methods/m49/m49.htm</a>

    </td>

    </tr>

    <tr>

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

    <td class="content-container">HL7 International - [Some] Work Group</td>

    </tr>

    <tr>

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

    <td class="content-container"><div><p>Example measure illustrating a continuous variable measure calculating scores from multiple questionnaires</p>
    </div></td>

    </tr>

    <tr>

    <th scope="row" class="row-header">Measure Scoring</th>

    <td class="content-container">
        Continuous Variable

    </td>

    </tr>

    <tr>

    <th scope="row" class="row-header">Improvement Notation</th>

    <td class="content-container">
        increase from <a href="http://terminology.hl7.org/7.0.0/CodeSystem-measure-improvement-notation.html">http://terminology.hl7.org/CodeSystem/measure-improvement-notation</a>

    </td>

    </tr>

    <tr>

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

    <td class="content-container">
        process from <a href="http://terminology.hl7.org/7.0.0/CodeSystem-measure-type.html">http://terminology.hl7.org/CodeSystem/measure-type</a>

    </td>

    </tr>

        <tr>

    <th colspan="2" scope="row" class="row-header">Measure Group (Rate) (ID: group-1)</th>

    </tr>

        <tr>

    <th scope="row" class="row-header">Initial Population</th>

          <td class="content-container">

            <em>ID</em>: 8A48538B-80BB-4E8B-9716-559C657278FD
            <br/>

              <em>Description</em>: No description provided

                  <em>Criteria</em>: <a href="#group-1-8A48538B-80BB-4E8B-9716-559C657278FD">Initial Population</a>

          </td>
        </tr>

        <tr>

    <th scope="row" class="row-header">Measure Population</th>

          <td class="content-container">

            <em>ID</em>: 8FBD6CFA-99E4-4108-B083-91067C55170E
            <br/>

              <em>Description</em>: No description provided

                  <em>Criteria</em>: <a href="#group-1-8FBD6CFA-99E4-4108-B083-91067C55170E">Measure Population</a>

          </td>
        </tr>

        <tr>

    <th scope="row" class="row-header">Measure Observation</th>

          <td class="content-container">

            <em>ID</em>: 8B71AD15-47EB-4939-8318-1DF60CABCFD6
            <br/>

              <em>Description</em>: No description provided

                  <em>Criteria</em>: <a href="#group-1-8B71AD15-47EB-4939-8318-1DF60CABCFD6">MeasureObservation</a>

              <br/><em>Input Population</em>: 8FBD6CFA-99E4-4108-B083-91067C55170E

              <em>AggregateMethod</em>: average

          </td>
        </tr>

    <tr>

    <th colspan="2" scope="row" class="row-header">Measure Logic</th>

    </tr>

    <tr>

    <th scope="row" class="row-header">Primary Library</th>

    <td class="content-container"><a href="Library-QuestionnaireMeasureExample.html">QuestionnaireMeasureExample</a></td>

    </tr>

    <tr>
      <th scope="row" class="row-header">Contents</th>
      <td class="content-container">
        <em><a href="#population-criteria">Population Criteria</a></em>
        <br/>
        <em><a href="#definitions">Logic Definitions</a></em>
        <br/>
        <em><a href="#terminology">Terminology</a></em>
        <br/>
        <em><a href="#dependencies">Dependencies</a></em>
        <br/>
        <em><a href="#data-requirements">Data Requirements</a></em>
        <br/>
        <em><a href="#parameters">Parameters</a></em>
        <br/>
      </td>
    </tr>

      <tr>

    <th colspan="2" scope="row" class="row-header"><a name="population-criteria"> </a>Population Criteria</th>

    </tr>

        <tr>

    <th colspan="2" scope="row" class="row-header">Measure Group (Rate) (ID: group-1)</th>

    </tr>

                <tr>
      <th scope="row" rowspan="2" class="row-header">

        Initial Population

      </th>
    </tr>
    <tr>

      <td>

          <a name="group-1-8A48538B-80BB-4E8B-9716-559C657278FD"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Initial Population&quot;:
      AgeInYearsAt(start of &quot;Measurement Period&quot;) &gt;= 18</code></pre>

          <a href="#questionnairemeasureexample-initial-population"><em>Definition</em></a>

      </td>

    </tr>

                <tr>
      <th scope="row" rowspan="2" class="row-header">

        Measure Population

      </th>
    </tr>
    <tr>

      <td>

          <a name="group-1-8FBD6CFA-99E4-4108-B083-91067C55170E"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">// Likely some condition or other relevant characteristic such as a depression diagnosis
    define &quot;Measure Population&quot;:
      true</code></pre>

          <a href="#questionnairemeasureexample-measure-population"><em>Definition</em></a>

      </td>

    </tr>

                <tr>
      <th scope="row" rowspan="2" class="row-header">

        Measure Observation

      </th>
    </tr>
    <tr>

      <td>

          <a name="group-1-8B71AD15-47EB-4939-8318-1DF60CABCFD6"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
    Measure observation is a function defined in terms of the types of members of the measure
    population, Patient in this case. In a population evaluation scenario, the measure
    observation is evaluated for every member of the population.

    In an individual report scenario, however, the measure observation is evaluated for
    the current patient. Note that the patient context is flowing through the call here
    */
    define function &quot;MeasureObservation&quot;(patient Patient):
      PHQ9Logic.CalculateTotalScore</code></pre>

          <a href="#questionnairemeasureexample-measureobservation"><em>Definition</em></a>

      </td>

    </tr>

      <tr>

    <th colspan="2" scope="row" class="row-header"><a name="definitions"> </a>Logic Definitions</th>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> QuestionnaireMeasureExample</td>

    </tr>
    <tr>

      <td>

          <a name="questionnairemeasureexample-initial-population"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Initial Population&quot;:
      AgeInYearsAt(start of &quot;Measurement Period&quot;) &gt;= 18</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> QuestionnaireMeasureExample</td>

    </tr>
    <tr>

      <td>

          <a name="questionnairemeasureexample-measure-population"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">// Likely some condition or other relevant characteristic such as a depression diagnosis
    define &quot;Measure Population&quot;:
      true</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> QuestionnaireMeasureExample</td>

    </tr>
    <tr>

      <td>

          <a name="questionnairemeasureexample-measureobservation"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
    Measure observation is a function defined in terms of the types of members of the measure
    population, Patient in this case. In a population evaluation scenario, the measure
    observation is evaluated for every member of the population.

    In an individual report scenario, however, the measure observation is evaluated for
    the current patient. Note that the patient context is flowing through the call here
    */
    define function &quot;MeasureObservation&quot;(patient Patient):
      PHQ9Logic.CalculateTotalScore</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> PHQ9LogicExample</td>

    </tr>
    <tr>

      <td>

          <a name="phq9logicexample-questionnaireresponse"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">// Use the QuestionnaireResponse provided as a parameter if available
    // Otherwise look it up from the record
    define &quot;QuestionnaireResponse&quot;:
      if response is not null then
        response
      else
        Last(
          [QuestionnaireResponse] QR
            where QR.questionnaire = 'http://somewhere.org/fhir/uv/mycontentig/Questionnaire/phq-9-questionnaire'
            sort by (authored as FHIR.dateTime) desc
        )</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> PHQ9LogicExample</td>

    </tr>
    <tr>

      <td>

          <a name="phq9logicexample-responses"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">// NOTE: This ties this logic directly to this particular rendering of the Questionnaire.
    // Ideally the items would be filtered based on Code of the Item, rather than the LinkId,
    // but that would require pulling in the Questionnaire because the QuestionnaireResponse
    // only has the LinkId.
    define &quot;Responses&quot;:
      &quot;QuestionnaireResponse&quot; QR
        return QR.item I where I.linkId in {
          'LittleInterest',
          'FeelingDown',
          'TroubleSleeping',
          'FeelingTired',
          'BadApetite',
          'FeelingBadAboutSelf',
          'TroubleConcetrating',
          'MovingSpeaking'
        }</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> PHQ9LogicExample</td>

    </tr>
    <tr>

      <td>

          <a name="phq9logicexample-calculatetotalscore"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;CalculateTotalScore&quot;:
      Sum(&quot;Responses&quot; R return all AnswerCardinality(First(R.answer.value)))</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> PHQ9LogicExample</td>

    </tr>
    <tr>

      <td>

          <a name="phq9logicexample-answercardinality"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">/*
    @source: https://www.med.umich.edu/1info/FHP/practiceguides/depress/score.pdf
    */
    define function &quot;AnswerCardinality&quot;(answer Coding):
      case
        when answer ~ &quot;Not at all&quot; then 0
        when answer ~ &quot;Several days&quot; then 1
        when answer ~ &quot;More than half the days&quot; then 2
        when answer ~ &quot;Nearly every day&quot; then 3
        else null
      end</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

    </tr>
    <tr>

      <td>

          <a name="fhirhelpers-tostring"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToString(value uri): value.value</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

    </tr>
    <tr>

      <td>

          <a name="fhirhelpers-tostring"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToString(value string): value.value</code></pre>
      </td>

    </tr>

    <tr>
      <th scope="row" rowspan="2" class="row-header">
        Logic Definition
      </th>

      <td class="content-container"><em>Library Name:</em> FHIRHelpers</td>

    </tr>
    <tr>

      <td>

          <a name="fhirhelpers-tocode"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define function ToCode(coding FHIR.Coding):
        if coding is null then
            null
        else
            System.Code {
              code: coding.code.value,
              system: coding.system.value,
              version: coding.version.value,
              display: coding.display.value
            }</code></pre>
      </td>

    </tr>

      <tr>

    <th colspan="2" scope="row" class="row-header"><a name="terminology"> </a>Terminology</th>

    </tr>

    <tr>

    <th scope="row" class="row-header">Code System</th>

      <td class="content-container">

        <em>Description</em>: Code system LOINC

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/5.2.0/CodeSystem-v3-loinc.html">Logical Observation Identifiers, Names and Codes (LOINC)</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://loinc.org</tt>

      </td>
    </tr>

      <tr>
        <th scope="row" class="row-header">Direct Reference Code</th>
        <td class="content-container">

          <em>Code</em>: LA6568-5
          <br/>
          <em>System</em>: <tt>http://loinc.org</tt>
        </td>
      </tr>

      <tr>
        <th scope="row" class="row-header">Direct Reference Code</th>
        <td class="content-container">

          <em>Code</em>: LA6569-3
          <br/>
          <em>System</em>: <tt>http://loinc.org</tt>
        </td>
      </tr>

      <tr>
        <th scope="row" class="row-header">Direct Reference Code</th>
        <td class="content-container">

          <em>Code</em>: LA6570-1
          <br/>
          <em>System</em>: <tt>http://loinc.org</tt>
        </td>
      </tr>

      <tr>
        <th scope="row" class="row-header">Direct Reference Code</th>
        <td class="content-container">

          <em>Code</em>: LA6571-9
          <br/>
          <em>System</em>: <tt>http://loinc.org</tt>
        </td>
      </tr>

      <tr>

    <th colspan="2" scope="row" class="row-header"><a name="dependencies"> </a>Dependencies</th>

    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Library PHQ9Logic

        <br/>

        <em>Resource</em>: <a href="Library-PHQ9LogicExample.html">PHQ9LogicExample</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://somewhere.org/fhir/uv/mycontentig/Library/PHQ9LogicExample</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://somewhere.org/fhir/uv/mycontentig/Library/FHIRHelpers|4.0.1</code>
        <br/>
        <em>Canonical URL</em>: <tt>http://somewhere.org/fhir/uv/mycontentig/Library/FHIRHelpers|4.0.1</tt>

      </td>
    </tr>

      <tr>

    <th colspan="2" scope="row" class="row-header"><a name="data-requirements"> </a>Data Requirements</th>

    </tr>

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

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

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

        <em>Must Support Elements</em>: questionnaire, item, answer
        <br/>

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

        <a href="http://hl7.org/fhir/R4/patient.html">Patient</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>response</td>
              <td>In</td>
              <td>0..1</td>
              <td>QuestionnaireResponse</td>
              <td/>
            </tr>

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

            <tr>
              <td>Initial Population</td>
              <td>Out</td>
              <td>0..1</td>
              <td>boolean</td>
              <td/>
            </tr>

            <tr>
              <td>Measure Population</td>
              <td>Out</td>
              <td>0..1</td>
              <td>boolean</td>
              <td/>
            </tr>

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

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

        </tbody>
      </table>
    </div>
      </text>
      <contained>
        <Library>
          <id value="effective-data-requirements"/>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
            <valueCoding>
              <system value="http://loinc.org"/>
              <code value="LA6568-5"/>
            </valueCoding>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
            <valueCoding>
              <system value="http://loinc.org"/>
              <code value="LA6569-3"/>
            </valueCoding>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
            <valueCoding>
              <system value="http://loinc.org"/>
              <code value="LA6570-1"/>
            </valueCoding>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
            <valueCoding>
              <system value="http://loinc.org"/>
              <code value="LA6571-9"/>
            </valueCoding>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="PHQ9LogicExample"/>
            </extension>
            <extension url="name">
              <valueString value="QuestionnaireResponse"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="// Use the QuestionnaireResponse provided as a parameter if available
    // Otherwise look it up from the record
    define &quot;QuestionnaireResponse&quot;:
      if response is not null then
        response
      else
        Last(
          [QuestionnaireResponse] QR
            where QR.questionnaire = 'http://somewhere.org/fhir/uv/mycontentig/Questionnaire/phq-9-questionnaire'
            sort by (authored as FHIR.dateTime) desc
        )"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="0"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="PHQ9LogicExample"/>
            </extension>
            <extension url="name">
              <valueString value="Responses"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="// NOTE: This ties this logic directly to this particular rendering of the Questionnaire.
    // Ideally the items would be filtered based on Code of the Item, rather than the LinkId,
    // but that would require pulling in the Questionnaire because the QuestionnaireResponse
    // only has the LinkId.
    define &quot;Responses&quot;:
      &quot;QuestionnaireResponse&quot; QR
        return QR.item I where I.linkId in {
          'LittleInterest',
          'FeelingDown',
          'TroubleSleeping',
          'FeelingTired',
          'BadApetite',
          'FeelingBadAboutSelf',
          'TroubleConcetrating',
          'MovingSpeaking'
        }"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="1"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="PHQ9LogicExample"/>
            </extension>
            <extension url="name">
              <valueString value="CalculateTotalScore"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="define &quot;CalculateTotalScore&quot;:
      Sum(&quot;Responses&quot; R return all AnswerCardinality(First(R.answer.value)))"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="2"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="QuestionnaireMeasureExample"/>
            </extension>
            <extension url="name">
              <valueString value="Initial Population"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="define &quot;Initial Population&quot;:
      AgeInYearsAt(start of &quot;Measurement Period&quot;) &gt;= 18"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="3"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="QuestionnaireMeasureExample"/>
            </extension>
            <extension url="name">
              <valueString value="Measure Population"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="// Likely some condition or other relevant characteristic such as a depression diagnosis
    define &quot;Measure Population&quot;:
      true"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="4"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="QuestionnaireMeasureExample"/>
            </extension>
            <extension url="name">
              <valueString value="MeasureObservation"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="/*
    Measure observation is a function defined in terms of the types of members of the measure
    population, Patient in this case. In a population evaluation scenario, the measure
    observation is evaluated for every member of the population.

    In an individual report scenario, however, the measure observation is evaluated for
    the current patient. Note that the patient context is flowing through the call here
    */
    define function &quot;MeasureObservation&quot;(patient Patient):
      PHQ9Logic.CalculateTotalScore"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="5"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="FHIRHelpers"/>
            </extension>
            <extension url="name">
              <valueString value="ToString"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="define function ToString(value uri): value.value"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="6"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="FHIRHelpers"/>
            </extension>
            <extension url="name">
              <valueString value="ToString"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="define function ToString(value string): value.value"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="7"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="PHQ9LogicExample"/>
            </extension>
            <extension url="name">
              <valueString value="AnswerCardinality"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="/*
    @source: https://www.med.umich.edu/1info/FHP/practiceguides/depress/score.pdf
    */
    define function &quot;AnswerCardinality&quot;(answer Coding):
      case
        when answer ~ &quot;Not at all&quot; then 0
        when answer ~ &quot;Several days&quot; then 1
        when answer ~ &quot;More than half the days&quot; then 2
        when answer ~ &quot;Nearly every day&quot; then 3
        else null
      end"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="8"/>
            </extension>
          </extension>
          <extension
                     url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
            <extension url="libraryName">
              <valueString value="FHIRHelpers"/>
            </extension>
            <extension url="name">
              <valueString value="ToCode"/>
            </extension>
            <extension url="statement">
              <valueString
                           value="define function ToCode(coding FHIR.Coding):
        if coding is null then
            null
        else
            System.Code {
              code: coding.code.value,
              system: coding.system.value,
              version: coding.version.value,
              display: coding.display.value
            }"/>
            </extension>
            <extension url="displaySequence">
              <valueInteger value="9"/>
            </extension>
          </extension>
          <name value="EffectiveDataRequirements"/>
          <status value="active"/>
          <type>
            <coding>
              <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
              <code value="module-definition"/>
            </coding>
          </type>
          <relatedArtifact>
            <type value="depends-on"/>
            <display value="Library PHQ9Logic"/>
            <resource
                      value="http://somewhere.org/fhir/uv/mycontentig/Library/PHQ9LogicExample"/>
          </relatedArtifact>
          <relatedArtifact>
            <type value="depends-on"/>
            <display value="Library FHIRHelpers"/>
            <resource
                      value="http://somewhere.org/fhir/uv/mycontentig/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="response"/>
            <use value="in"/>
            <min value="0"/>
            <max value="1"/>
            <type value="QuestionnaireResponse"/>
          </parameter>
          <parameter>
            <name value="Measurement Period"/>
            <use value="in"/>
            <min value="0"/>
            <max value="1"/>
            <type value="Period"/>
          </parameter>
          <parameter>
            <name value="Initial Population"/>
            <use value="out"/>
            <min value="0"/>
            <max value="1"/>
            <type value="boolean"/>
          </parameter>
          <parameter>
            <name value="Measure Population"/>
            <use value="out"/>
            <min value="0"/>
            <max value="1"/>
            <type value="boolean"/>
          </parameter>
          <dataRequirement>
            <type value="QuestionnaireResponse"/>
            <profile
                     value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"/>
            <mustSupport value="questionnaire"/>
            <mustSupport value="item"/>
            <mustSupport value="answer"/>
          </dataRequirement>
          <dataRequirement>
            <type value="Patient"/>
            <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
          </dataRequirement>
        </Library>
      </contained>
      <extension
                 url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem">
        <valueReference>🔗
          <reference value="Device/cqf-tooling"/>
        </valueReference>
      </extension>
      <extension
                 url="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements">
        <valueCanonical value="#effective-data-requirements"/>
      </extension>
      <url
           value="http://somewhere.org/fhir/uv/mycontentig/Measure/QuestionnaireMeasureExample"/>
      <version value="0.5.3"/>
      <name value="QuestionnaireMeasureExample"/>
      <title value="Questionnaire Measure Example"/>
      <status value="draft"/>
      <experimental value="true"/>
      <date value="2025-09-29T21:16:55-07:00"/>
      <publisher value="HL7 International - [Some] Work Group"/>
      <contact>
        <telecom>
          <system value="url"/>
          <value value="http://hl7.org/Special/committees/[something]"/>
        </telecom>
      </contact>
      <description
                   value="Example measure illustrating a continuous variable measure calculating scores from multiple questionnaires"/>
      <jurisdiction>
        <coding>
          <system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
          <code value="001"/>
        </coding>
      </jurisdiction>
      <library
               value="http://somewhere.org/fhir/uv/mycontentig/Library/QuestionnaireMeasureExample"/>
      <scoring>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-scoring"/>
          <code value="continuous-variable"/>
          <display value="Continuous Variable"/>
        </coding>
      </scoring>
      <type>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/measure-type"/>
          <code value="process"/>
        </coding>
      </type>
      <improvementNotation>
        <coding>
          <system
                  value="http://terminology.hl7.org/CodeSystem/measure-improvement-notation"/>
          <code value="increase"/>
        </coding>
      </improvementNotation>
      <group id="group-1">
        <population id="8A48538B-80BB-4E8B-9716-559C657278FD">
          <code>
            <coding>
              <system
                      value="http://terminology.hl7.org/CodeSystem/measure-population"/>
              <code value="initial-population"/>
              <display value="Initial Population"/>
            </coding>
          </code>
          <criteria>
            <language value="text/cql-identifier"/>
            <expression value="Initial Population"/>
          </criteria>
        </population>
        <population id="8FBD6CFA-99E4-4108-B083-91067C55170E">
          <code>
            <coding>
              <system
                      value="http://terminology.hl7.org/CodeSystem/measure-population"/>
              <code value="measure-population"/>
              <display value="Measure Population"/>
            </coding>
          </code>
          <criteria>
            <language value="text/cql-identifier"/>
            <expression value="Measure Population"/>
          </criteria>
        </population>
        <population id="8B71AD15-47EB-4939-8318-1DF60CABCFD6">
          <extension
                     url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-aggregateMethod">
            <valueCode value="average"/>
          </extension>
          <extension
                     url="http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-criteriaReference">
            <valueString value="8FBD6CFA-99E4-4108-B083-91067C55170E"/>
          </extension>
          <code>
            <coding>
              <system
                      value="http://terminology.hl7.org/CodeSystem/measure-population"/>
              <code value="measure-observation"/>
              <display value="Measure Observation"/>
            </coding>
          </code>
          <criteria>
            <language value="text/cql-identifier"/>
            <expression value="MeasureObservation"/>
          </criteria>
        </population>
      </group>
    </Measure>