Data Exchange For Quality Measures Implementation Guide
1.0.0-ballot - STU 1 Ballot

Data Exchange For Quality Measures Implementation Guide - Downloaded Version 1.0.0-ballot See the Directory of published versions

## : Additional Supplemental Data Example - Artifact Bundle

Raw xml | Download

    <Bundle xmlns="http://hl7.org/fhir">
      <id value="sde-example-artifact-bundle"/>
      <language value="en"/>
      <type value="transaction"/>
      <entry>
        <fullUrl value="urn:uuid:31244296-3e84-4e17-94b1-4159d64e41db"/>
        <resource>
          <Library>
            <id value="FHIRHelpers"/>
            <language value="en"/>
            <text>
              <status value="extensions"/>
              <div xmlns="http://www.w3.org/1999/xhtml"><a name="Library_FHIRHelpers"> </a>
      <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">FHIR Helpers</td>

    </tr>

    <tr>

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

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

    <td class="content-container">
        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">/*
    @author: Bryn Rhodes
    @description: This library defines functions to convert between FHIR
     data types and CQL system-defined types, as well as functions to support
     FHIRPath implementation. For more information, see the FHIRHelpers wiki page:
     https://github.com/cqframework/clinical_quality_language/wiki/FHIRHelpers
    @allowFluent: true
    */
    library FHIRHelpers version '4.0.1'

    using FHIR version '4.0.1'

    define function ToInterval(period FHIR.Period):
        if period is null then
            null
        else
            if period.&quot;start&quot; is null then
                Interval(period.&quot;start&quot;.value, period.&quot;end&quot;.value]
            else
                Interval[period.&quot;start&quot;.value, period.&quot;end&quot;.value]

    define function ToCalendarUnit(unit System.String):
        case unit
            when 'ms' then 'millisecond'
            when 's' then 'second'
            when 'min' then 'minute'
            when 'h' then 'hour'
            when 'd' then 'day'
            when 'wk' then 'week'
            when 'mo' then 'month'
            when 'a' then 'year'
            else unit
        end

    define function ToQuantity(quantity FHIR.Quantity):
        case
            when quantity is null then null
            when quantity.value is null then null
            when quantity.comparator is not null then
                Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')
            when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'
                  or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then
                System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }
            else
                Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' &amp; quantity.unit.value &amp; ' (' &amp; quantity.system.value &amp; '|' &amp; quantity.code.value &amp; ')')
        end

    define function ToQuantityIgnoringComparator(quantity FHIR.Quantity):
        case
            when quantity is null then null
            when quantity.value is null then null
            when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'
                  or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then
                System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }
            else
                Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' &amp; quantity.unit.value &amp; ' (' &amp; quantity.system.value &amp; '|' &amp; quantity.code.value &amp; ')')
        end

    define function ToInterval(quantity FHIR.Quantity):
        if quantity is null then null else
            case quantity.comparator.value
                when '&lt;' then
                    Interval[
                        null,
                        ToQuantityIgnoringComparator(quantity)
                    )
                when '&lt;=' then
                    Interval[
                        null,
                        ToQuantityIgnoringComparator(quantity)
                    ]
                when '&gt;=' then
                    Interval[
                        ToQuantityIgnoringComparator(quantity),
                        null
                    ]
                when '&gt;' then
                    Interval(
                        ToQuantityIgnoringComparator(quantity),
                        null
                    ]
                else
                    Interval[ToQuantity(quantity), ToQuantity(quantity)]
            end

    define function ToRatio(ratio FHIR.Ratio):
        if ratio is null then
            null
        else
            System.Ratio { numerator: ToQuantity(ratio.numerator), denominator: ToQuantity(ratio.denominator) }

    define function ToInterval(range FHIR.Range):
        if range is null then
            null
        else
            Interval[ToQuantity(range.low), ToQuantity(range.high)]

    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
            }

    define function ToConcept(concept FHIR.CodeableConcept):
        if concept is null then
            null
        else
            System.Concept {
                codes: concept.coding C return ToCode(C),
                display: concept.text.value
            }

    define function reference(reference String):
        if reference is null then
            null
        else
            Reference { reference: string { value: reference } }

    define function resolve(reference String) returns Resource: external
    define function resolve(reference Reference) returns Resource: external
    define function reference(resource Resource) returns Reference: external
    define function extension(element Element, url String) returns List&lt;Element&gt;: external
    define function extension(resource Resource, url String) returns List&lt;Element&gt;: external
    define function hasValue(element Element) returns Boolean: external
    define function getValue(element Element) returns Any: external
    define function ofType(identifier String) returns List&lt;Any&gt;: external
    define function is(identifier String) returns Boolean: external
    define function as(identifier String) returns Any: external
    define function elementDefinition(element Element) returns ElementDefinition: external
    define function slice(element Element, url String, name String) returns List&lt;Element&gt;: external
    define function checkModifiers(resource Resource) returns Resource: external
    define function checkModifiers(resource Resource, modifier String) returns Resource: external
    define function checkModifiers(element Element) returns Element: external
    define function checkModifiers(element Element, modifier String) returns Element: external
    define function conformsTo(resource Resource, structure String) returns Boolean: external
    define function memberOf(code code, valueSet String) returns Boolean: external
    define function memberOf(coding Coding, valueSet String) returns Boolean: external
    define function memberOf(concept CodeableConcept, valueSet String) returns Boolean: external
    define function subsumes(coding Coding, subsumedCoding Coding) returns Boolean: external
    define function subsumes(concept CodeableConcept, subsumedConcept CodeableConcept) returns Boolean: external
    define function subsumedBy(coding Coding, subsumingCoding Coding) returns Boolean: external
    define function subsumedBy(concept CodeableConcept, subsumingConcept CodeableConcept) returns Boolean: external
    define function htmlChecks(element Element) returns Boolean: external

    define function ToString(value AccountStatus): value.value
    define function ToString(value ActionCardinalityBehavior): value.value
    define function ToString(value ActionConditionKind): value.value
    define function ToString(value ActionGroupingBehavior): value.value
    define function ToString(value ActionParticipantType): value.value
    define function ToString(value ActionPrecheckBehavior): value.value
    define function ToString(value ActionRelationshipType): value.value
    define function ToString(value ActionRequiredBehavior): value.value
    define function ToString(value ActionSelectionBehavior): value.value
    define function ToString(value ActivityDefinitionKind): value.value
    define function ToString(value ActivityParticipantType): value.value
    define function ToString(value AddressType): value.value
    define function ToString(value AddressUse): value.value
    define function ToString(value AdministrativeGender): value.value
    define function ToString(value AdverseEventActuality): value.value
    define function ToString(value AggregationMode): value.value
    define function ToString(value AllergyIntoleranceCategory): value.value
    define function ToString(value AllergyIntoleranceCriticality): value.value
    define function ToString(value AllergyIntoleranceSeverity): value.value
    define function ToString(value AllergyIntoleranceType): value.value
    define function ToString(value AppointmentStatus): value.value
    define function ToString(value AssertionDirectionType): value.value
    define function ToString(value AssertionOperatorType): value.value
    define function ToString(value AssertionResponseTypes): value.value
    define function ToString(value AuditEventAction): value.value
    define function ToString(value AuditEventAgentNetworkType): value.value
    define function ToString(value AuditEventOutcome): value.value
    define function ToString(value BindingStrength): value.value
    define function ToString(value BiologicallyDerivedProductCategory): value.value
    define function ToString(value BiologicallyDerivedProductStatus): value.value
    define function ToString(value BiologicallyDerivedProductStorageScale): value.value
    define function ToString(value BundleType): value.value
    define function ToString(value CapabilityStatementKind): value.value
    define function ToString(value CarePlanActivityKind): value.value
    define function ToString(value CarePlanActivityStatus): value.value
    define function ToString(value CarePlanIntent): value.value
    define function ToString(value CarePlanStatus): value.value
    define function ToString(value CareTeamStatus): value.value
    define function ToString(value CatalogEntryRelationType): value.value
    define function ToString(value ChargeItemDefinitionPriceComponentType): value.value
    define function ToString(value ChargeItemStatus): value.value
    define function ToString(value ClaimResponseStatus): value.value
    define function ToString(value ClaimStatus): value.value
    define function ToString(value ClinicalImpressionStatus): value.value
    define function ToString(value CodeSearchSupport): value.value
    define function ToString(value CodeSystemContentMode): value.value
    define function ToString(value CodeSystemHierarchyMeaning): value.value
    define function ToString(value CommunicationPriority): value.value
    define function ToString(value CommunicationRequestStatus): value.value
    define function ToString(value CommunicationStatus): value.value
    define function ToString(value CompartmentCode): value.value
    define function ToString(value CompartmentType): value.value
    define function ToString(value CompositionAttestationMode): value.value
    define function ToString(value CompositionStatus): value.value
    define function ToString(value ConceptMapEquivalence): value.value
    define function ToString(value ConceptMapGroupUnmappedMode): value.value
    define function ToString(value ConditionalDeleteStatus): value.value
    define function ToString(value ConditionalReadStatus): value.value
    define function ToString(value ConsentDataMeaning): value.value
    define function ToString(value ConsentProvisionType): value.value
    define function ToString(value ConsentState): value.value
    define function ToString(value ConstraintSeverity): value.value
    define function ToString(value ContactPointSystem): value.value
    define function ToString(value ContactPointUse): value.value
    define function ToString(value ContractPublicationStatus): value.value
    define function ToString(value ContractStatus): value.value
    define function ToString(value ContributorType): value.value
    define function ToString(value CoverageStatus): value.value
    define function ToString(value CurrencyCode): value.value
    define function ToString(value DayOfWeek): value.value
    define function ToString(value DaysOfWeek): value.value
    define function ToString(value DetectedIssueSeverity): value.value
    define function ToString(value DetectedIssueStatus): value.value
    define function ToString(value DeviceMetricCalibrationState): value.value
    define function ToString(value DeviceMetricCalibrationType): value.value
    define function ToString(value DeviceMetricCategory): value.value
    define function ToString(value DeviceMetricColor): value.value
    define function ToString(value DeviceMetricOperationalStatus): value.value
    define function ToString(value DeviceNameType): value.value
    define function ToString(value DeviceRequestStatus): value.value
    define function ToString(value DeviceUseStatementStatus): value.value
    define function ToString(value DiagnosticReportStatus): value.value
    define function ToString(value DiscriminatorType): value.value
    define function ToString(value DocumentConfidentiality): value.value
    define function ToString(value DocumentMode): value.value
    define function ToString(value DocumentReferenceStatus): value.value
    define function ToString(value DocumentRelationshipType): value.value
    define function ToString(value EligibilityRequestPurpose): value.value
    define function ToString(value EligibilityRequestStatus): value.value
    define function ToString(value EligibilityResponsePurpose): value.value
    define function ToString(value EligibilityResponseStatus): value.value
    define function ToString(value EnableWhenBehavior): value.value
    define function ToString(value EncounterLocationStatus): value.value
    define function ToString(value EncounterStatus): value.value
    define function ToString(value EndpointStatus): value.value
    define function ToString(value EnrollmentRequestStatus): value.value
    define function ToString(value EnrollmentResponseStatus): value.value
    define function ToString(value EpisodeOfCareStatus): value.value
    define function ToString(value EventCapabilityMode): value.value
    define function ToString(value EventTiming): value.value
    define function ToString(value EvidenceVariableType): value.value
    define function ToString(value ExampleScenarioActorType): value.value
    define function ToString(value ExplanationOfBenefitStatus): value.value
    define function ToString(value ExposureState): value.value
    define function ToString(value ExtensionContextType): value.value
    define function ToString(value FHIRAllTypes): value.value
    define function ToString(value FHIRDefinedType): value.value
    define function ToString(value FHIRDeviceStatus): value.value
    define function ToString(value FHIRResourceType): value.value
    define function ToString(value FHIRSubstanceStatus): value.value
    define function ToString(value FHIRVersion): value.value
    define function ToString(value FamilyHistoryStatus): value.value
    define function ToString(value FilterOperator): value.value
    define function ToString(value FlagStatus): value.value
    define function ToString(value GoalLifecycleStatus): value.value
    define function ToString(value GraphCompartmentRule): value.value
    define function ToString(value GraphCompartmentUse): value.value
    define function ToString(value GroupMeasure): value.value
    define function ToString(value GroupType): value.value
    define function ToString(value GuidanceResponseStatus): value.value
    define function ToString(value GuidePageGeneration): value.value
    define function ToString(value GuideParameterCode): value.value
    define function ToString(value HTTPVerb): value.value
    define function ToString(value IdentifierUse): value.value
    define function ToString(value IdentityAssuranceLevel): value.value
    define function ToString(value ImagingStudyStatus): value.value
    define function ToString(value ImmunizationEvaluationStatus): value.value
    define function ToString(value ImmunizationStatus): value.value
    define function ToString(value InvoicePriceComponentType): value.value
    define function ToString(value InvoiceStatus): value.value
    define function ToString(value IssueSeverity): value.value
    define function ToString(value IssueType): value.value
    define function ToString(value LinkType): value.value
    define function ToString(value LinkageType): value.value
    define function ToString(value ListMode): value.value
    define function ToString(value ListStatus): value.value
    define function ToString(value LocationMode): value.value
    define function ToString(value LocationStatus): value.value
    define function ToString(value MeasureReportStatus): value.value
    define function ToString(value MeasureReportType): value.value
    define function ToString(value MediaStatus): value.value
    define function ToString(value MedicationAdministrationStatus): value.value
    define function ToString(value MedicationDispenseStatus): value.value
    define function ToString(value MedicationKnowledgeStatus): value.value
    define function ToString(value MedicationRequestIntent): value.value
    define function ToString(value MedicationRequestPriority): value.value
    define function ToString(value MedicationRequestStatus): value.value
    define function ToString(value MedicationStatementStatus): value.value
    define function ToString(value MedicationStatus): value.value
    define function ToString(value MessageSignificanceCategory): value.value
    define function ToString(value Messageheader_Response_Request): value.value
    define function ToString(value MimeType): value.value
    define function ToString(value NameUse): value.value
    define function ToString(value NamingSystemIdentifierType): value.value
    define function ToString(value NamingSystemType): value.value
    define function ToString(value NarrativeStatus): value.value
    define function ToString(value NoteType): value.value
    define function ToString(value NutritiionOrderIntent): value.value
    define function ToString(value NutritionOrderStatus): value.value
    define function ToString(value ObservationDataType): value.value
    define function ToString(value ObservationRangeCategory): value.value
    define function ToString(value ObservationStatus): value.value
    define function ToString(value OperationKind): value.value
    define function ToString(value OperationParameterUse): value.value
    define function ToString(value OrientationType): value.value
    define function ToString(value ParameterUse): value.value
    define function ToString(value ParticipantRequired): value.value
    define function ToString(value ParticipantStatus): value.value
    define function ToString(value ParticipationStatus): value.value
    define function ToString(value PaymentNoticeStatus): value.value
    define function ToString(value PaymentReconciliationStatus): value.value
    define function ToString(value ProcedureStatus): value.value
    define function ToString(value PropertyRepresentation): value.value
    define function ToString(value PropertyType): value.value
    define function ToString(value ProvenanceEntityRole): value.value
    define function ToString(value PublicationStatus): value.value
    define function ToString(value QualityType): value.value
    define function ToString(value QuantityComparator): value.value
    define function ToString(value QuestionnaireItemOperator): value.value
    define function ToString(value QuestionnaireItemType): value.value
    define function ToString(value QuestionnaireResponseStatus): value.value
    define function ToString(value ReferenceHandlingPolicy): value.value
    define function ToString(value ReferenceVersionRules): value.value
    define function ToString(value ReferredDocumentStatus): value.value
    define function ToString(value RelatedArtifactType): value.value
    define function ToString(value RemittanceOutcome): value.value
    define function ToString(value RepositoryType): value.value
    define function ToString(value RequestIntent): value.value
    define function ToString(value RequestPriority): value.value
    define function ToString(value RequestStatus): value.value
    define function ToString(value ResearchElementType): value.value
    define function ToString(value ResearchStudyStatus): value.value
    define function ToString(value ResearchSubjectStatus): value.value
    define function ToString(value ResourceType): value.value
    define function ToString(value ResourceVersionPolicy): value.value
    define function ToString(value ResponseType): value.value
    define function ToString(value RestfulCapabilityMode): value.value
    define function ToString(value RiskAssessmentStatus): value.value
    define function ToString(value SPDXLicense): value.value
    define function ToString(value SearchComparator): value.value
    define function ToString(value SearchEntryMode): value.value
    define function ToString(value SearchModifierCode): value.value
    define function ToString(value SearchParamType): value.value
    define function ToString(value SectionMode): value.value
    define function ToString(value SequenceType): value.value
    define function ToString(value ServiceRequestIntent): value.value
    define function ToString(value ServiceRequestPriority): value.value
    define function ToString(value ServiceRequestStatus): value.value
    define function ToString(value SlicingRules): value.value
    define function ToString(value SlotStatus): value.value
    define function ToString(value SortDirection): value.value
    define function ToString(value SpecimenContainedPreference): value.value
    define function ToString(value SpecimenStatus): value.value
    define function ToString(value Status): value.value
    define function ToString(value StrandType): value.value
    define function ToString(value StructureDefinitionKind): value.value
    define function ToString(value StructureMapContextType): value.value
    define function ToString(value StructureMapGroupTypeMode): value.value
    define function ToString(value StructureMapInputMode): value.value
    define function ToString(value StructureMapModelMode): value.value
    define function ToString(value StructureMapSourceListMode): value.value
    define function ToString(value StructureMapTargetListMode): value.value
    define function ToString(value StructureMapTransform): value.value
    define function ToString(value SubscriptionChannelType): value.value
    define function ToString(value SubscriptionStatus): value.value
    define function ToString(value SupplyDeliveryStatus): value.value
    define function ToString(value SupplyRequestStatus): value.value
    define function ToString(value SystemRestfulInteraction): value.value
    define function ToString(value TaskIntent): value.value
    define function ToString(value TaskPriority): value.value
    define function ToString(value TaskStatus): value.value
    define function ToString(value TestReportActionResult): value.value
    define function ToString(value TestReportParticipantType): value.value
    define function ToString(value TestReportResult): value.value
    define function ToString(value TestReportStatus): value.value
    define function ToString(value TestScriptRequestMethodCode): value.value
    define function ToString(value TriggerType): value.value
    define function ToString(value TypeDerivationRule): value.value
    define function ToString(value TypeRestfulInteraction): value.value
    define function ToString(value UDIEntryType): value.value
    define function ToString(value UnitsOfTime): value.value
    define function ToString(value Use): value.value
    define function ToString(value VariableType): value.value
    define function ToString(value VisionBase): value.value
    define function ToString(value VisionEyes): value.value
    define function ToString(value VisionStatus): value.value
    define function ToString(value XPathUsageType): value.value
    define function ToString(value base64Binary): value.value
    define function ToBoolean(value boolean): value.value
    define function ToDate(value date): value.value
    define function ToDateTime(value dateTime): value.value
    define function ToDecimal(value decimal): value.value
    define function ToDateTime(value instant): value.value
    define function ToInteger(value integer): value.value
    define function ToString(value string): value.value
    define function ToTime(value time): value.value
    define function ToString(value uri): value.value
    define function ToString(value xhtml): value.value
    </code></pre>
          </td>
        </tr>

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

        </tbody>
      </table>
    </div>
            </text>
            <url value="http://fhir.org/guides/cqf/common/Library/FHIRHelpers"/>
            <version value="4.0.1"/>
            <name value="FHIRHelpers"/>
            <title value="FHIR Helpers"/>
            <status value="draft"/>
            <experimental value="true"/>
            <type>
              <coding>
                <system
                        value="http://terminology.hl7.org/CodeSystem/library-type"/>
                <code value="logic-library"/>
                <display value="Logic Library"/>
              </coding>
            </type>
            <content>
              <contentType value="text/cql"/>
              <data
                    value=" "/>
            </content>
          </Library>
        </resource>
        <request>
          <method value="PUT"/>
          <url value="Library/FHIRHelpers"/>
        </request>
      </entry>
      <entry>
        <fullUrl value="urn:uuid:aa99c584-12e5-46bb-8b30-ab10cfe26471"/>
        <resource>
          <Library>
            <id value="FHIRCommon"/>
            <language value="en"/>
            <text>
              <status value="extensions"/>
              <div xmlns="http://www.w3.org/1999/xhtml"><a name="Library_FHIRCommon"> </a>
      <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">FHIRCommon</td>

    </tr>

    <tr>

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

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

    <td class="content-container">
        Logic Library

    </td>

    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/6.5.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">Dependency</th>

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://hl7.org/fhir/R4/codesystem-snomedct.html">SNOMED CT (all versions)</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://snomed.info/sct</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-RoleCode.html">RoleCode</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-RoleCode</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.1.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>: Code system RequestIntent

        <br/>

        <em>Resource</em>: <a href="http://hl7.org/fhir/R4/codesystem-request-intent.html">RequestIntent</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://hl7.org/fhir/request-intent</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-medicationrequest-category.html">MedicationRequest Category Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/medicationrequest-category</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-condition-clinical.html">Condition Clinical Status Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-clinical</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-condition-ver-status.html">ConditionVerificationStatus</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-ver-status</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-allergyintolerance-clinical.html">AllergyIntolerance Clinical Status Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-allergyintolerance-verification.html">AllergyIntolerance Verification Status</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/allergyintolerance-verification</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>:

        <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>Patient</td>
              <td>Out</td>
              <td>0..1</td>
              <td>Patient</td>
              <td/>
            </tr>

          </tbody>
        </table>
      </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">/*
    @author: Bryn Rhodes
    @description: Common terminologies and functions used in FHIR-based CQL artifacts
    */
    library FHIRCommon version '4.0.1'

    using FHIR version '4.0.1'

    include FHIRHelpers version '4.0.1'

    codesystem &quot;LOINC&quot;: 'http://loinc.org'
    codesystem &quot;SNOMEDCT&quot;: 'http://snomed.info/sct'
    codesystem &quot;RoleCode&quot;: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode'
    codesystem &quot;Diagnosis Role&quot;: 'http://terminology.hl7.org/CodeSystem/diagnosis-role'
    codesystem &quot;RequestIntent&quot;: 'http://terminology.hl7.org/CodeSystem/request-intent'
    codesystem &quot;MedicationRequestCategory&quot;: 'http://terminology.hl7.org/CodeSystem/medicationrequest-category'
    codesystem &quot;ConditionClinicalStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/condition-clinical'
    codesystem &quot;ConditionVerificationStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/condition-ver-status'
    codesystem &quot;AllergyIntoleranceClinicalStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical'
    codesystem &quot;AllergyIntoleranceVerificationStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification'

    valueset &quot;Active Condition&quot;: 'http://fhir.org/guides/cqf/common/ValueSet/active-condition'
    valueset &quot;Inactive Condition&quot;: 'http://fhir.org/guides/cqf/common/ValueSet/inactive-condition'

    code &quot;Birthdate&quot;: '21112-8' from &quot;LOINC&quot; display 'Birth date'
    code &quot;Dead&quot;: '419099009' from &quot;SNOMEDCT&quot; display 'Dead'
    code &quot;ER&quot;: 'ER' from &quot;RoleCode&quot; display 'Emergency room'
    code &quot;ICU&quot;: 'ICU' from &quot;RoleCode&quot; display 'Intensive care unit'
    code &quot;Billing&quot;: 'billing' from &quot;Diagnosis Role&quot; display 'Billing'

    // Condition Clinical Status Codes - Consider value sets for these
    code &quot;active&quot;: 'active' from &quot;ConditionClinicalStatusCodes&quot;
    code &quot;recurrence&quot;: 'recurrence' from &quot;ConditionClinicalStatusCodes&quot;
    code &quot;relapse&quot;: 'relapse' from &quot;ConditionClinicalStatusCodes&quot;
    code &quot;inactive&quot;: 'inactive' from &quot;ConditionClinicalStatusCodes&quot;
    code &quot;remission&quot;: 'remission' from &quot;ConditionClinicalStatusCodes&quot;
    code &quot;resolved&quot;: 'resolved' from &quot;ConditionClinicalStatusCodes&quot;

    // Condition Verification Status Codes - Consider value sets for these
    code &quot;unconfirmed&quot;: 'unconfirmed' from ConditionVerificationStatusCodes
    code &quot;provisional&quot;: 'provisional' from ConditionVerificationStatusCodes
    code &quot;differential&quot;: 'differential' from ConditionVerificationStatusCodes
    code &quot;confirmed&quot;: 'confirmed' from ConditionVerificationStatusCodes
    code &quot;refuted&quot;: 'refuted' from ConditionVerificationStatusCodes
    code &quot;entered-in-error&quot;: 'entered-in-error' from ConditionVerificationStatusCodes

    code &quot;allergy-active&quot;: 'active' from &quot;AllergyIntoleranceClinicalStatusCodes&quot;
    code &quot;allergy-inactive&quot;: 'inactive' from &quot;AllergyIntoleranceClinicalStatusCodes&quot;
    code &quot;allergy-resolved&quot;: 'resolved' from &quot;AllergyIntoleranceClinicalStatusCodes&quot;

    // Allergy/Intolerance Verification Status Codes - Consider value sets for these
    code &quot;allergy-unconfirmed&quot;: 'unconfirmed' from AllergyIntoleranceVerificationStatusCodes
    code &quot;allergy-confirmed&quot;: 'confirmed' from AllergyIntoleranceVerificationStatusCodes
    code &quot;allergy-refuted&quot;: 'refuted' from AllergyIntoleranceVerificationStatusCodes

    // MedicationRequest Category Codes
    code &quot;Community&quot;: 'community' from &quot;MedicationRequestCategory&quot; display 'Community'
    code &quot;Discharge&quot;: 'discharge' from &quot;MedicationRequestCategory&quot; display 'Discharge'

    // Diagnosis Role Codes
    code &quot;AD&quot;: 'AD' from &quot;Diagnosis Role&quot; display 'Admission diagnosis'
    code &quot;DD&quot;: 'DD' from &quot;Diagnosis Role&quot; display 'Discharge diagnosis'
    code &quot;CC&quot;: 'CC' from &quot;Diagnosis Role&quot; display 'Chief complaint'
    code &quot;CM&quot;: 'CM' from &quot;Diagnosis Role&quot; display 'Comorbidity diagnosis'
    code &quot;pre-op&quot;: 'pre-op' from &quot;Diagnosis Role&quot; display 'pre-op diagnosis'
    code &quot;post-op&quot;: 'post-op' from &quot;Diagnosis Role&quot; display 'post-op diagnosis'
    code &quot;billing&quot;: 'billing' from &quot;Diagnosis Role&quot; display 'billing diagnosis'

    context Patient

    /*
    @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
    @comment: Normalizes a choice type of FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instance, FHIR.string, FHIR.Age, or FHIR.Range types
    to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
    representations for timing-valued elements in FHIR, allowing this function to be used across any resource. NOTE: Due to the
    complexity of determining a single interval from a Timing or String type, this function will throw a run-time exception if it is used
    with a Timing or String.
    */
    define function ToInterval(choice Choice&lt;FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range&gt;):
      case
    	  when choice is FHIR.dateTime then
        	Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
    		when choice is FHIR.Period then
      		FHIRHelpers.ToInterval(choice as FHIR.Period)
    		when choice is FHIR.instant then
    			Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
    		when choice is FHIR.Age then
    		  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
    			  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
    		when choice is FHIR.Range then
    		  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
    			  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
    		when choice is FHIR.Timing then
    		  Message(null as Interval&lt;DateTime&gt;, true, '1', 'Error', 'Cannot compute a single interval from a Timing type')
        when choice is FHIR.string then
          Message(null as Interval&lt;DateTime&gt;, true, '1', 'Error', 'Cannot compute an interval from a String value')
    		else
    			null as Interval&lt;DateTime&gt;
    	end

    /*
    @description: Returns an interval representing the normalized Abatement of a given Condition resource.
    @comment: NOTE: Due to the complexity of determining an interval from a String, this function will throw
    a run-time exception if used with a Condition instance that has a String as the abatement value.
    */
    define function ToAbatementInterval(condition Condition):
    	if condition.abatement is FHIR.dateTime then
    	  Interval[FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime), FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime)]
    	else if condition.abatement is FHIR.Period then
    	  FHIRHelpers.ToInterval(condition.abatement as FHIR.Period)
    	else if condition.abatement is FHIR.string then
        Message(null as Interval&lt;DateTime&gt;, true, '1', 'Error', 'Cannot compute an interval from a String value')
    	else if condition.abatement is FHIR.Age then
    		Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age),
    			FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age) + 1 year)
    	else if condition.abatement is FHIR.Range then
    	  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).low),
    		  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).high) + 1 year)
    	else if condition.abatement is FHIR.boolean then
    	  Interval[end of ToInterval(condition.onset), condition.recordedDate)
    	else null

    /*
    @description: Returns an interval representing the normalized prevalence period of a given Condition resource.
    @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
    onset to abatement as specified in the given Condition.
    */
    define function ToPrevalenceInterval(condition Condition):
    if condition.clinicalStatus ~ &quot;active&quot;
      or condition.clinicalStatus ~ &quot;recurrence&quot;
      or condition.clinicalStatus ~ &quot;relapse&quot; then
      Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]
    else
      Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))

    /*
    @description: Returns any extensions defined on the given resource with the specified url.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the
    CQL model info.
    */
    define function Extensions(domainResource DomainResource, url String):
      domainResource.extension E
    	  where E.url = url
    		return E

    /*
    @description: Returns the single extension (if present) on the given resource with the specified url.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.
    */
    define function Extension(domainResource DomainResource, url String):
      singleton from &quot;Extensions&quot;(domainResource, url)

    /*
    @description: Returns any extensions defined on the given element with the specified url.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the CQL model info.
    */
    define function Extensions(element Element, url String):
      element.extension E
    	  where E.url = url
    		return E

    /*
    @description: Returns the single extension (if present) on the given element with the specified url.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.
    */
    define function Extension(element Element, url String):
      singleton from Extensions(element, url)

    /*
    @description: Returns any modifier extensions defined on the given resource with the specified url.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the
    CQL model info.
    */
    define function ModifierExtensions(domainResource DomainResource, url String):
      domainResource.modifierExtension E
    	  where E.url = url
    		return E

    /*
    @description: Returns the single modifier extension (if present) on the given resource with the specified url.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.
    */
    define function ModifierExtension(domainResource DomainResource, url String):
      singleton from ModifierExtensions(domainResource, url)

    /*
    @description: Returns any modifier extensions defined on the given element with the specified url.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the CQL model info.
    */
    define function ModifierExtensions(element BackboneElement, url String):
      element.modifierExtension E
    	  where E.url = url
    		return E

    /*
    @description: Returns the single modifier extension (if present) on the given element with the specified url.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.
    */
    define function ModifierExtension(element BackboneElement, url String):
      singleton from ModifierExtensions(element, url)

    /*
    @description: Returns any base-FHIR extensions defined on the given resource with the specified id.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the CQL model info.
    */
    define function BaseExtensions(domainResource DomainResource, id String):
      domainResource.extension E
    	  where E.url = ('http://hl7.org/fhir/StructureDefinition/' + id)
    		return E

    /*
    @description: Returns the single base-FHIR extension (if present) on the given resource with the specified id.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.
    */
    define function BaseExtension(domainResource DomainResource, id String):
      singleton from BaseExtensions(domainResource, id)

    /*
    @description: Returns any base-FHIR extensions defined on the given element with the specified id.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the CQL model info.
    */
    define function BaseExtensions(element Element, id String):
      element.extension E
    	  where E.url = ('http://hl7.org/fhir/StructureDefinition/' + id)
    		return E

    /*
    @description: Returns the single base-FHIR extension (if present) on the given element with the specified id.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.
    */
    define function BaseExtension(element Element, id String):
      singleton from BaseExtensions(element, id)

    /*
    @description: Returns any base-FHIR modifier extensions defined on the given resource with the specified id.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the CQL model info.
    */
    define function BaseModifierExtensions(domainResource DomainResource, id String):
      domainResource.modifierExtension E
    	  where E.url = ('http://hl7.org/fhir/StructureDefinition/' + id)
    		return E

    /*
    @description: Returns the single base-FHIR modifier extension (if present) on the given resource with the specified id.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.
    */
    define function BaseModifierExtension(domainResource DomainResource, id String):
      singleton from BaseModifierExtensions(domainResource, id)

    /*
    @description: Returns any base-FHIR modifier extensions defined on the given element with the specified id.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the CQL model info.
    */
    define function BaseModifierExtensions(element BackboneElement, id String):
      element.modifierExtension E
    	  where E.url = ('http://hl7.org/fhir/StructureDefinition/' + id)
    		return E

    /*
    @description: Returns the single base-FHIR extension (if present) on the given element with the specified id.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.
    */
    define function BaseModifierExtension(element BackboneElement, id String):
      singleton from BaseModifierExtensions(element, id)
    </code></pre>
          </td>
        </tr>

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

        </tbody>
      </table>
    </div>
            </text>
            <url value="http://fhir.org/guides/cqf/Library/FHIRCommon"/>
            <version value="4.0.1"/>
            <name value="FHIRCommon"/>
            <title value="FHIRCommon"/>
            <status value="draft"/>
            <experimental value="true"/>
            <type>
              <coding>
                <system
                        value="http://terminology.hl7.org/CodeSystem/library-type"/>
                <code value="logic-library"/>
                <display value="Logic Library"/>
              </coding>
            </type>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system LOINC"/>
              <resource value="http://loinc.org"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system SNOMEDCT"/>
              <resource value="http://snomed.info/sct"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system RoleCode"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/v3-RoleCode"/>
            </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="Code system RequestIntent"/>
              <resource value="http://hl7.org/fhir/request-intent"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system MedicationRequestCategory"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/medicationrequest-category"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system ConditionClinicalStatusCodes"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system ConditionVerificationStatusCodes"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/condition-ver-status"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system AllergyIntoleranceClinicalStatusCodes"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display
                       value="Code system AllergyIntoleranceVerificationStatusCodes"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/allergyintolerance-verification"/>
            </relatedArtifact>
            <parameter>
              <name value="Patient"/>
              <use value="out"/>
              <min value="0"/>
              <max value="1"/>
              <type value="Patient"/>
            </parameter>
            <dataRequirement>
              <type value="Patient"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
            </dataRequirement>
            <content>
              <contentType value="text/cql"/>
              <data
                    value=" "/>
            </content>
          </Library>
        </resource>
        <request>
          <method value="PUT"/>
          <url value="Library/FHIRCommon"/>
        </request>
      </entry>
      <entry>
        <fullUrl value="urn:uuid:b3463968-f67d-42ef-8494-cd4ea42e87b9"/>
        <resource>
          <Library>
            <id value="MATGlobalCommonFunctionsFHIR4"/>
            <language value="en"/>
            <text>
              <status value="extensions"/>
              <div xmlns="http://www.w3.org/1999/xhtml"><a name="Library_MATGlobalCommonFunctionsFHIR4"> </a>
      <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">MAT Global Common Functions FHIRR4</td>

    </tr>

    <tr>

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

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

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

    </tr>

    <tr>

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

    <td class="content-container">
        Logic Library

    </td>

    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-condition-clinical.html">Condition Clinical Status Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-clinical</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-allergyintolerance-clinical.html">AllergyIntolerance Clinical Status Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-allergyintolerance-verification.html">AllergyIntolerance Verification Status</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/allergyintolerance-verification</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.1.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>: Code system LOINC

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/6.5.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">Dependency</th>

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-medicationrequest-category.html">MedicationRequest Category Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/medicationrequest-category</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-condition-ver-status.html">ConditionVerificationStatus</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-ver-status</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://hl7.org/fhir/R4/codesystem-snomedct.html">SNOMED CT (all versions)</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://snomed.info/sct</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-RoleCode.html">RoleCode</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-RoleCode</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://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">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 Encounter Inpatient

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion">Encounter Inpatient</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Observation Services

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion">Observation Services</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143</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>:

        <a href="http://hl7.org/fhir/R4/patient.html">Patient</a>
        <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>:

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

        <em>Must Support Elements</em>: type, status, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion">Encounter Inpatient</a>
        <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>:

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

        <em>Must Support Elements</em>: type, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion">Observation Services</a>
        <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>:

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

        <em>Must Support Elements</em>: type, status, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">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>Must Support Elements</em>: id
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: id
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: target
        <br/>

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

        <span class="tab-one"><em>Path</em>: target</span>
        <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>

          </tbody>
        </table>
      </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">library MATGlobalCommonFunctionsFHIR4 version '6.1.000'

    /*@update: BTR 2020-03-31 -&gt;
    Incremented version to 5.0.000
    Updated FHIR version to 4.0.1
    Changed timezone keyword to timezoneoffset for use with CQL 1.4
    Removed Normalize Onset in favor of more general Normalize Interval
    Updated CodeSystems for ConditionVerificationStatusCodes and RoleCodes

    @update: BTR 2021-05-13 -&gt;
    Added ActiveCondition Codes and Inactive Condition Codes value sets
    Added function documentation throughout
    Fixed EDVisit not using Last
    Updated prevalence period to use an inclusive boundary if the condition is active
    Added HasStart, HasEnd, Earliest, and Latest functions
    Removed ToDate and Age calculation functions

    @update: BTR 2021-06-25 -&gt;
    Added GetBaseExtension overloads for Element*/

    using FHIR version '4.0.1'

    include FHIRHelpers version '4.0.1' called FHIRHelpers

    codesystem &quot;ConditionClinicalStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/condition-clinical'
    codesystem &quot;AllergyIntoleranceClinicalStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical'
    codesystem &quot;AllergyIntoleranceVerificationStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/allergyintolerance-verification'
    codesystem &quot;Diagnosis Role&quot;: 'http://terminology.hl7.org/CodeSystem/diagnosis-role'
    codesystem &quot;LOINC&quot;: 'http://loinc.org'
    codesystem &quot;MedicationRequestCategory&quot;: 'http://terminology.hl7.org/CodeSystem/medicationrequest-category'
    codesystem &quot;ConditionVerificationStatusCodes&quot;: 'http://terminology.hl7.org/CodeSystem/condition-ver-status'
    codesystem &quot;SNOMEDCT&quot;: 'http://snomed.info/sct'
    codesystem &quot;RoleCode&quot;: 'http://terminology.hl7.org/CodeSystem/v3-RoleCode'

    valueset &quot;Emergency Department Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'
    valueset &quot;Encounter Inpatient&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'
    valueset &quot;Observation Services&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'

    code &quot;active&quot;: 'active' from &quot;ConditionClinicalStatusCodes&quot; display 'active'
    code &quot;allergy-active&quot;: 'active' from &quot;AllergyIntoleranceClinicalStatusCodes&quot; display 'allergy-active'
    code &quot;allergy-confirmed&quot;: 'confirmed' from &quot;AllergyIntoleranceVerificationStatusCodes&quot; display 'allergy-confirmed'
    code &quot;allergy-inactive&quot;: 'inactive' from &quot;AllergyIntoleranceClinicalStatusCodes&quot; display 'allergy-inactive'
    code &quot;allergy-refuted&quot;: 'refuted' from &quot;AllergyIntoleranceVerificationStatusCodes&quot; display 'allergy-refuted'
    code &quot;allergy-resolved&quot;: 'resolved' from &quot;AllergyIntoleranceClinicalStatusCodes&quot; display 'allergy-resolved'
    code &quot;allergy-unconfirmed&quot;: 'unconfirmed' from &quot;AllergyIntoleranceVerificationStatusCodes&quot; display 'allergy-unconfirmed'
    code &quot;Billing&quot;: 'billing' from &quot;Diagnosis Role&quot; display 'Billing'
    code &quot;Birthdate&quot;: '21112-8' from &quot;LOINC&quot; display 'Birth date'
    code &quot;Community&quot;: 'community' from &quot;MedicationRequestCategory&quot; display 'Community'
    code &quot;confirmed&quot;: 'confirmed' from &quot;ConditionVerificationStatusCodes&quot; display 'confirmed'
    code &quot;Dead&quot;: '419099009' from &quot;SNOMEDCT&quot; display 'Dead'
    code &quot;differential&quot;: 'differential' from &quot;ConditionVerificationStatusCodes&quot; display 'differential'
    code &quot;Discharge&quot;: 'discharge' from &quot;MedicationRequestCategory&quot; display 'Discharge'
    code &quot;entered-in-error&quot;: 'entered-in-error' from &quot;ConditionVerificationStatusCodes&quot; display 'entered-in-error'
    code &quot;ER&quot;: 'ER' from &quot;RoleCode&quot; display 'Emergency room'
    code &quot;ICU&quot;: 'ICU' from &quot;RoleCode&quot; display 'Intensive care unit'
    code &quot;inactive&quot;: 'inactive' from &quot;ConditionClinicalStatusCodes&quot; display 'inactive'
    code &quot;provisional&quot;: 'provisional' from &quot;ConditionVerificationStatusCodes&quot; display 'provisional'
    code &quot;recurrence&quot;: 'recurrence' from &quot;ConditionClinicalStatusCodes&quot; display 'recurrence'
    code &quot;refuted&quot;: 'refuted' from &quot;ConditionVerificationStatusCodes&quot; display 'refuted'
    code &quot;relapse&quot;: 'relapse' from &quot;ConditionClinicalStatusCodes&quot; display 'relapse'
    code &quot;remission&quot;: 'remission' from &quot;ConditionClinicalStatusCodes&quot; display 'remission'
    code &quot;resolved&quot;: 'resolved' from &quot;ConditionClinicalStatusCodes&quot; display 'resolved'
    code &quot;unconfirmed&quot;: 'unconfirmed' from &quot;ConditionVerificationStatusCodes&quot; display 'unconfirmed'

    parameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;
      default Interval[@2019-01-01T00:00:00.0, @2020-01-01T00:00:00.0)

    context Patient

    define &quot;Inpatient Encounter&quot;:
      [Encounter: &quot;Encounter Inpatient&quot;] EncounterInpatient
          		where EncounterInpatient.status = 'finished'
          		    and &quot;LengthInDays&quot;(EncounterInpatient.period) &lt;= 120
          			and EncounterInpatient.period ends during &quot;Measurement Period&quot;

    /*Calculates the difference in calendar days between the start and end of the given interval.*/
    define function &quot;LengthInDays&quot;(Value Interval&lt;DateTime&gt; ):
      difference in days between start of Value and end of Value

    /*Returns the most recent emergency department visit, if any, that occurs 1 hour or less prior to the given encounter.*/
    define function &quot;ED Visit&quot;(TheEncounter FHIR.Encounter ):
      Last(
        [Encounter: &quot;Emergency Department Visit&quot;] EDVisit
          where EDVisit.status = 'finished'
            and EDVisit.period ends 1 hour or less on or before start of FHIRHelpers.ToInterval(TheEncounter.period)
          sort by end of period
        )

    /*Hospitalization returns the total interval for admission to discharge for the given encounter, or for the admission of any immediately prior emergency department visit to the discharge of the given encounter.*/
    define function &quot;Hospitalization&quot;(TheEncounter FHIR.Encounter ):
      ( &quot;ED Visit&quot;(TheEncounter) ) X
        return
            if X is null then TheEncounter.period
            else Interval[start of FHIRHelpers.ToInterval(X.period), end of FHIRHelpers.ToInterval(TheEncounter.period)]

    /*Returns list of all locations within an encounter, including locations for immediately prior ED visit.*/
    define function &quot;Hospitalization Locations&quot;(TheEncounter FHIR.Encounter ):
      ( &quot;ED Visit&quot;(TheEncounter) ) EDEncounter
        return
            if EDEncounter is null then TheEncounter.location
            else flatten { EDEncounter.location, TheEncounter.location }

    /*Returns the length of stay in days (i.e. the number of days between admission and discharge) for the given encounter, or from the admission of any immediately prior emergency department visit to the discharge of the encounter*/
    define function &quot;Hospitalization Length of Stay&quot;(TheEncounter FHIR.Encounter ):
      LengthInDays(&quot;Hospitalization&quot;(TheEncounter))

    /*Returns admission time for an encounter or for immediately prior emergency department visit.*/
    define function &quot;Hospital Admission Time&quot;(TheEncounter FHIR.Encounter ):
      start of &quot;Hospitalization&quot;(TheEncounter)

    /*Hospital Discharge Time returns the discharge time for an encounter*/
    define function &quot;Hospital Discharge Time&quot;(TheEncounter FHIR.Encounter ):
      end of FHIRHelpers.ToInterval(TheEncounter.period)

    /*Returns earliest arrival time for an encounter including any prior ED visit.*/
    define function &quot;Hospital Arrival Time&quot;(TheEncounter FHIR.Encounter ):
      start of FHIRHelpers.ToInterval(First(
      	    ( &quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation
      			sort by start of FHIRHelpers.ToInterval(period)
      	).period)

      // TODO - fix these (must fetch Location resources and compare id to reference)
      /*Returns the latest departure time for encounter including any prior ED visit. */
      /*
      define function &quot;Hospital Departure Time&quot;(TheEncounter FHIR.Encounter):
      	end of FHIRHelpers.ToInterval(Last(
      	    ( &quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation
      			sort by start of FHIRHelpers.ToInterval(period)
      	).period)

      define function &quot;Emergency Department Arrival Time&quot;(TheEncounter FHIR.Encounter):
      	start of FHIRHelpers.ToInterval((
      	    singleton from (
      	        ( &quot;Hospitalization Locations&quot;(TheEncounter) ) HospitalLocation
      				where HospitalLocation.type ~ &quot;ER&quot;
      		)
      	).period)

      define function &quot;First Inpatient Intensive Care Unit&quot;(TheEncounter FHIR.Encounter):
      	First(
      	    ( TheEncounter.location ) HospitalLocation
      			where HospitalLocation.type ~ &quot;ICU&quot;
      				and HospitalLocation.period during TheEncounter.period
      			sort by start of FHIRHelpers.ToInterval(period)
      	)
      */

      /*Hospitalization with Observation and Outpatient Surgery Service returns the total interval from the start of any immediately prior emergency department visit, outpatient surgery visit or observation visit to the discharge of the given encounter.*/
      /* TODO:
      define function &quot;HospitalizationWithObservationAndOutpatientSurgeryService&quot;(Encounter &quot;Encounter, Performed&quot; ):
      Encounter Visit
      	let ObsVisit: Last([&quot;Encounter, Performed&quot;: &quot;Observation Services&quot;] LastObs
      			where LastObs.relevantPeriod ends 1 hour or less on or before start of Visit.relevantPeriod
      			sort by
      			end of relevantPeriod
      	),
      	VisitStart: Coalesce(start of ObsVisit.relevantPeriod, start of Visit.relevantPeriod),
      	EDVisit: Last([&quot;Encounter, Performed&quot;: &quot;Emergency Department Visit&quot;] LastED
      			where LastED.relevantPeriod ends 1 hour or less on or before VisitStart
      			sort by
      			end of relevantPeriod
      	),
      	VisitStartWithED: Coalesce(start of EDVisit.relevantPeriod, VisitStart),
      	OutpatientSurgeryVisit: Last([&quot;Encounter, Performed&quot;: &quot;Outpatient Surgery Service&quot;] LastSurgeryOP
      			where LastSurgeryOP.relevantPeriod ends 1 hour or less on or before VisitStartWithED
      			sort by
      			end of relevantPeriod
      	)
      	return Interval[Coalesce(start of OutpatientSurgeryVisit.relevantPeriod, VisitStartWithED),
      	end of Visit.relevantPeriod]
      */

    /*Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter*/
    define function &quot;HospitalizationWithObservation&quot;(TheEncounter FHIR.Encounter ):
      TheEncounter Visit
      		let ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs
      				where LastObs.period ends 1 hour or less on or before start of Visit.period
      				sort by end of period
      			),
      			VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
      			EDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED
      				where LastED.period ends 1 hour or less on or before VisitStart
      				sort by end of period
      			)
      		return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]

    /**
    * Normalizes the input argument to an interval representation.
    * The input can be provided as a dateTime, Period, Timing, instant, string, Age, or Range.
    * The intent of this function is to provide a clear and concise mechanism to treat single
    * elements that have multiple possible representations as intervals so that logic doesn't have to account
    * for the variability. More complex calculations (such as medication request period or dispense period
    * calculation) need specific guidance and consideration. That guidance may make use of this function, but
    * the focus of this function is on single element calculations where the semantics are unambiguous.
    * If the input is a dateTime, the result a DateTime Interval beginning and ending on that dateTime.
    * If the input is a Period, the result is a DateTime Interval.
    * If the input is a Timing, an error is raised indicating a single interval cannot be computed from a Timing.
    * If the input is an instant, the result is a DateTime Interval beginning and ending on that instant.
    * If the input is a string, an error is raised indicating a single interval cannot be computed from a string.
    * If the input is an Age, the result is a DateTime Interval beginning when the patient was the given Age,
    and ending immediately prior to when the patient was the given Age plus one year.
    * If the input is a Range, the result is a DateTime Interval beginning when the patient was the Age given
    by the low end of the Range, and ending immediately prior to when the patient was the Age given by the
    high end of the Range plus one year.*/
    define function &quot;Normalize Interval&quot;(choice Choice&lt;FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range&gt; ):
      case
      	  when choice is FHIR.dateTime then
      	Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
      		when choice is FHIR.Period then
      		FHIRHelpers.ToInterval(choice as FHIR.Period)
      		when choice is FHIR.instant then
      			Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
      		when choice is FHIR.Age then
      		  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
      			  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
      		when choice is FHIR.Range then
      		  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
      			  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
      		when choice is FHIR.Timing then
      		  Message(null as Interval&lt;DateTime&gt;, true, '1', 'Error', 'Cannot compute a single interval from a Timing type')
        when choice is FHIR.string then
          Message(null as Interval&lt;DateTime&gt;, true, '1', 'Error', 'Cannot compute an interval from a String value')
      		else
      			null as Interval&lt;DateTime&gt;
      	end

    /**
    * Returns an interval representing the abatement of the given condition, if an
    abatement element is present, null otherwise.
    This function uses the semantics of Normalize Interval to interpret the abatement
    element.*/
    define function &quot;Normalize Abatement&quot;(condition Condition ):
      if condition.abatement is FHIR.dateTime then
      	  Interval[FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime), FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime)]
      	else if condition.abatement is FHIR.Period then
      	  FHIRHelpers.ToInterval(condition.abatement as FHIR.Period)
      	else if condition.abatement is FHIR.string then
      Message(null as Interval&lt;DateTime&gt;, true, '1', 'Error', 'Cannot compute an interval from a String value')
      	else if condition.abatement is FHIR.Age then
      		Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age),
      			FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age) + 1 year)
      	else if condition.abatement is FHIR.Range then
      	  Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).low),
      		  FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).high) + 1 year)
      	else if condition.abatement is FHIR.boolean then
      	  Interval[end of &quot;Normalize Interval&quot;(condition.onset), condition.recordedDate)
      	else null

    /*Returns an interval representing the period during which the condition was prevalent (i.e. onset to abatement)
    If the condition is &quot;active&quot;, then abatement being unknown
    would indicate the condition is ongoing, and the ending boundary of the prevalence
    period is inclusive, otherwise, the abatement is considered unknown and the ending boundary
    of the prevalence period is exclusive.
    Note that when using this function it should be noted that many clinical systems
    do not actually capture abatement, so care should be taken when using this function
    to meet clinical intent.*/
    define function &quot;Prevalence Period&quot;(condition Condition ):
      if condition.clinicalStatus ~ &quot;active&quot;
        or condition.clinicalStatus ~ &quot;recurrence&quot;
        or condition.clinicalStatus ~ &quot;relapse&quot; then
        Interval[start of &quot;Normalize Interval&quot;(condition.onset), end of &quot;Normalize Abatement&quot;(condition)]
      else
        Interval[start of &quot;Normalize Interval&quot;(condition.onset), end of &quot;Normalize Abatement&quot;(condition))

    /*Returns the tail of the given uri (i.e. everything after the last slash in the URI).*/
    define function &quot;GetId&quot;(uri String ):
      Last(Split(uri, '/'))

    /*Returns the Condition resources referenced by the diagnosis element of the Encounter*/
    define function &quot;EncounterDiagnosis&quot;(Encounter Encounter ):
      Encounter.diagnosis D
        return singleton from ([Condition] C where C.id = &quot;GetId&quot;(D.condition.reference))

      // Returns the condition that is specified as the principal diagnosis for the encounter
      // TODO: BTR 2019-07-30: Shouldn't need the FHIRHelpers reference here, investigate

    define function &quot;PrincipalDiagnosis&quot;(Encounter Encounter ):
      (singleton from (Encounter.diagnosis D where FHIRHelpers.ToInteger(D.rank) = 1)) PD
      		return singleton from ([Condition] C where C.id = &quot;GetId&quot;(PD.condition.reference))
      // Returns the location for the given location reference

    /*Returns the Location resource specified by the given reference*/
    define function &quot;GetLocation&quot;(reference Reference ):
      singleton from (
        [Location] L where L.id = GetId(reference.reference)
      )

    /*NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the
    CQL model info.*/
    define function &quot;GetExtensions&quot;(domainResource DomainResource, url String ):
      domainResource.extension E
      	  where E.url = ('http://hl7.org/fhir/us/qicore/StructureDefinition/' + url)
      		return E

    define function &quot;GetExtension&quot;(domainResource DomainResource, url String ):
      singleton from &quot;GetExtensions&quot;(domainResource, url)

    /*NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the
    CQL model info.*/
    define function &quot;GetExtensions&quot;(element Element, url String ):
      element.extension E
      	  where E.url = (url)
      		return E

    define function &quot;GetExtension&quot;(element Element, url String ):
      singleton from &quot;GetExtensions&quot;(element, url)

    /*NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the
    CQL model info.*/
    define function &quot;GetBaseExtensions&quot;(domainResource DomainResource, url String ):
      domainResource.extension E
      	  where E.url = ('http://hl7.org/fhir/StructureDefinition/' + url)
      		return E

    define function &quot;GetBaseExtension&quot;(domainResource DomainResource, url String ):
      singleton from &quot;GetBaseExtensions&quot;(domainResource, url)

    /*@description: Returns any base-FHIR extensions defined on the given element with the specified id.
    @comment: NOTE: Extensions are not the preferred approach, but are used as a way to access
    content that is defined by extensions but not yet surfaced in the CQL model info.*/
    define function &quot;BaseExtensions&quot;(element Element, id String ):
      element.extension E
      	  where E.url = ('http://hl7.org/fhir/StructureDefinition/' + id)
      		return E

    /*@description: Returns the single base-FHIR extension (if present) on the given element with the specified id.
    @comment: This function uses singleton from to ensure that a run-time exception is thrown if there
    is more than one extension on the given resource with the specified url.*/
    define function &quot;BaseExtension&quot;(element Element, id String ):
      singleton from BaseExtensions(element, id)

    /*NOTE: Provenance is not the preferred approach, this is provided only as an illustration
    for what using Provenance could look like, and is not a tested pattern*/
    define function &quot;GetProvenance&quot;(resource Resource ):
      singleton from ([Provenance: target in resource.id])

    define function &quot;GetMedicationCode&quot;(request MedicationRequest ):
      if request.medication is CodeableConcept then
      	  request.medication as CodeableConcept
      	else
      	  (singleton from ([Medication] M where M.id = GetId((request.medication as Reference).reference))).code

    /*Given an interval, return true if the interval has a starting boundary specified (i.e. the start of the interval is not null and not the minimum DateTime value)*/
    define function &quot;HasStart&quot;(period Interval&lt;DateTime&gt; ):
      not ( start of period is null
          or start of period = minimum DateTime
      )

    /*Given an interval, return true if the interval has an ending boundary specified (i.e. the end of the interval is not null and not the maximum DateTime value)*/
    define function &quot;HasEnd&quot;(period Interval&lt;DateTime&gt; ):
      not (
        end of period is null
          or
          end of period = maximum DateTime
      )

    /*Given an interval, return the ending point if the interval has an ending boundary specified, otherwise, return the starting point*/
    define function &quot;Latest&quot;(choice Choice&lt;FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range&gt; ):
      (&quot;Normalize Interval&quot;(choice)) period
        return
          if ( HasEnd(period)) then end of period
          else start of period

    /*Given an interval, return the starting point if the interval has a starting boundary specified, otherwise, return the ending point*/
    define function &quot;Earliest&quot;(choice Choice&lt;FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range&gt; ):
      (&quot;Normalize Interval&quot;(choice)) period
        return
          if (HasStart(period)) then start of period
          else end of period

    </code></pre>
          </td>
        </tr>

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

        </tbody>
      </table>
    </div>
            </text>
            <url
                 value="http://fhir.org/guides/cqf/Library/MATGlobalCommonFunctionsFHIR4"/>
            <version value="6.1.000"/>
            <name value="MATGlobalCommonFunctionsFHIR4"/>
            <title value="MAT Global Common Functions FHIRR4"/>
            <status value="draft"/>
            <experimental value="true"/>
            <type>
              <coding>
                <system
                        value="http://terminology.hl7.org/CodeSystem/library-type"/>
                <code value="logic-library"/>
                <display value="Logic Library"/>
              </coding>
            </type>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system ConditionClinicalStatusCodes"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/condition-clinical"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system AllergyIntoleranceClinicalStatusCodes"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display
                       value="Code system AllergyIntoleranceVerificationStatusCodes"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/allergyintolerance-verification"/>
            </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="Code system LOINC"/>
              <resource value="http://loinc.org"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system MedicationRequestCategory"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/medicationrequest-category"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system ConditionVerificationStatusCodes"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/condition-ver-status"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system SNOMEDCT"/>
              <resource value="http://snomed.info/sct"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system RoleCode"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/v3-RoleCode"/>
            </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 Encounter Inpatient"/>
              <resource
                        value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Value set Observation Services"/>
              <resource
                        value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"/>
            </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>
            <dataRequirement>
              <type value="Patient"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Encounter"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
              <mustSupport value="type"/>
              <mustSupport value="status"/>
              <mustSupport value="period"/>
              <codeFilter>
                <path value="type"/>
                <valueSet
                          value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"/>
              </codeFilter>
            </dataRequirement>
            <dataRequirement>
              <type value="Encounter"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
              <mustSupport value="type"/>
              <mustSupport value="period"/>
              <codeFilter>
                <path value="type"/>
                <valueSet
                          value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"/>
              </codeFilter>
            </dataRequirement>
            <dataRequirement>
              <type value="Encounter"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
              <mustSupport value="type"/>
              <mustSupport value="status"/>
              <mustSupport value="period"/>
              <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"/>
              <mustSupport value="id"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Location"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Location"/>
              <mustSupport value="id"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Provenance"/>
              <profile
                       value="http://hl7.org/fhir/StructureDefinition/Provenance"/>
              <mustSupport value="target"/>
              <codeFilter>
                <path value="target"/>
              </codeFilter>
            </dataRequirement>
            <content>
              <contentType value="text/cql"/>
              <data
                    value=" "/>
            </content>
          </Library>
        </resource>
        <request>
          <method value="PUT"/>
          <url value="Library/MATGlobalCommonFunctionsFHIR4"/>
        </request>
      </entry>
      <entry>
        <fullUrl value="urn:uuid:c6098378-cb38-4ae2-a096-3a3cc5c620d5"/>
        <resource>
          <Library>
            <id value="SupplementalDataElementsFHIR4"/>
            <language value="en"/>
            <text>
              <status value="extensions"/>
              <div xmlns="http://www.w3.org/1999/xhtml"><a name="Library_SupplementalDataElementsFHIR4"> </a>
      <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">SupplementalDataElementsFHIR4</td>

    </tr>

    <tr>

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

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

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

    </tr>

    <tr>

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

    <td class="content-container">
        Logic Library

    </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://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.837/expansion">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 ONC Administrative Sex

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1/expansion">ONC Administrative Sex</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 Payer

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion">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">Dependency</th>

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.836/expansion">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">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/>

        <em>Must Support Elements</em>: url, extension, value
        <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>:

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

        <em>Must Support Elements</em>: type, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion">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>Patient</td>
              <td>Out</td>
              <td>0..1</td>
              <td>Patient</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>Any</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">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">library SupplementalDataElementsFHIR4 version '2.0.000'

    /*@update: @@BTR 2020-03-31 -&gt;
    Incremented version to 2.0.0
    Updated FHIR version to 4.0.1
    @@@*/

    using FHIR version '4.0.1'

    include FHIRHelpers version '4.0.1' called FHIRHelpers

    valueset &quot;Ethnicity&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837'
    valueset &quot;ONC Administrative Sex&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1'
    valueset &quot;Payer&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591'
    valueset &quot;Race&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836'

    context Patient

    define &quot;SDE Ethnicity&quot;:
      (flatten (
          Patient.extension Extension
            where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'
              return Extension.extension
        )) E
          where E.url = 'ombCategory'
            or E.url = 'detailed'
          return E.value as Coding

    define &quot;SDE Payer&quot;:
      [Coverage: type in &quot;Payer&quot;] Payer
            return {
              code: Payer.type,
              period: Payer.period
            }

    define &quot;SDE Race&quot;:
      (flatten (
          Patient.extension Extension
            where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'
              return Extension.extension
        )) E
          where E.url = 'ombCategory'
            or E.url = 'detailed'
          return E.value as Coding

    define &quot;SDE Sex&quot;:
      case
          when Patient.gender = 'male' then Code { code: 'M', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Male' }
          when Patient.gender = 'female' then Code { code: 'F', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Female' }
          else null
        end

    </code></pre>
          </td>
        </tr>

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

        </tbody>
      </table>
    </div>
            </text>
            <url
                 value="http://fhir.org/guides/cqf/Library/SupplementalDataElementsFHIR4"/>
            <version value="2.0.000"/>
            <name value="SupplementalDataElementsFHIR4"/>
            <title value="SupplementalDataElementsFHIR4"/>
            <status value="draft"/>
            <experimental value="true"/>
            <type>
              <coding>
                <system
                        value="http://terminology.hl7.org/CodeSystem/library-type"/>
                <code value="logic-library"/>
                <display value="Logic Library"/>
              </coding>
            </type>
            <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 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 Payer"/>
              <resource
                        value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
            </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>
            <parameter>
              <name value="Patient"/>
              <use value="out"/>
              <min value="0"/>
              <max value="1"/>
              <type value="Patient"/>
            </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="Any"/>
            </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>
              <type value="Patient"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
              <mustSupport value="url"/>
              <mustSupport value="extension"/>
              <mustSupport value="value"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Coverage"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Coverage"/>
              <mustSupport value="type"/>
              <mustSupport value="period"/>
              <codeFilter>
                <path value="type"/>
                <valueSet
                          value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
              </codeFilter>
            </dataRequirement>
            <content>
              <contentType value="text/cql"/>
              <data
                    value=" "/>
            </content>
          </Library>
        </resource>
        <request>
          <method value="PUT"/>
          <url value="Library/SupplementalDataElementsFHIR4"/>
        </request>
      </entry>
      <entry>
        <fullUrl value="urn:uuid:e3b78b9e-96ee-43fb-aeea-22a7681a1538"/>
        <resource>
          <Library>
            <id value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
            <language value="en"/>
            <text>
              <status value="extensions"/>
              <div xmlns="http://www.w3.org/1999/xhtml"><a name="Library_NHSNGlycemicControlHypoglycemicInitialPopulation"> </a>
      <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">NHSN Glycemic Control Hypoglycemic Initial Population</td>

    </tr>

    <tr>

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

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

    <td class="content-container">
        Logic Library

    </td>

    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Library SDE

        <br/>

        <em>Resource</em>: <a href="Bundle-sde-example-artifact-bundle.html">SupplementalDataElementsFHIR4</a> version: 2.0.000
        <br/>
        <em>Canonical URL</em>: <tt>http://fhir.org/guides/cqf/Library/SupplementalDataElementsFHIR4|2.0.000</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Library Global

        <br/>

        <em>Resource</em>: <a href="Bundle-sde-example-artifact-bundle.html">MAT Global Common Functions FHIRR4</a> version: 6.1.000
        <br/>
        <em>Canonical URL</em>: <tt>http://fhir.org/guides/cqf/Library/MATGlobalCommonFunctionsFHIR4|6.1.000</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html">ActCode</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-ActCode</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.1.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>: Code system Specimen Type

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v2-0487.html">specimenType</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/v2-0487</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Code system Observation Category

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-observation-category.html">Observation Category Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/observation-category</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Code system Condition Category

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-condition-category.html">Condition Category Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-category</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Blood Glucose Laboratory and Point of Care Tests

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1190.38/expansion">Blood Glucose Laboratory and Point of Care Tests</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Inpatient, Emergency, and Observation Locations

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1046.265/expansion">Inpatient, Emergency, and Observation Locations</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Discharge Disposition

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/ValueSet-encounter-discharge-disposition.html">Discharge disposition</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/ValueSet/encounter-discharge-disposition</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Antidiabetic Medications

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1190.58/expansion">Diabetes Medications</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.58</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://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">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 Encounter Inpatient

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion">Encounter Inpatient</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Value set Observation Services

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion">Observation Services</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143</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://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion">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>:

        <a href="http://hl7.org/fhir/R4/patient.html">Patient</a>
        <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>:

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

        <em>Must Support Elements</em>: class
        <br/>

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

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

        <span class="tab-one"><em>Code(s)</em>:

          <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html#v3-ActCode-IMP">ActCode: IMP</a> (inpatient encounter),

          <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html#v3-ActCode-ACUTE">ActCode: ACUTE</a> (inpatient acute),

          <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html#v3-ActCode-NONAC">ActCode: NONAC</a> (inpatient non-acute),

          <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html#v3-ActCode-SS">ActCode: SS</a> (short stay)

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

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

        <em>Must Support Elements</em>: type, status, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.666.5.307/expansion">Encounter Inpatient</a>
        <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>:

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

        <em>Must Support Elements</em>: location, period
        <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>:

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

        <em>Must Support Elements</em>: type, class, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1111.143/expansion">Observation Services</a>
        <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>:

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

        <em>Must Support Elements</em>: type, class, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.117.1.7.1.292/expansion">Emergency Department Visit</a>
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: id
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: id
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: medication, status, effective
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: medication, authoredOn
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: id, collection, collection.collected
        <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>Must Support Elements</em>: onset, category
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: code, effective, specimen, specimen.collection, specimen.collection.collected, category
        <br/>

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

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

        <span class="tab-one"><em>ValueSet</em>:</span> <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1190.38/expansion">Blood Glucose Laboratory and Point of Care Tests</a>
        <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>:

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

        <em>Must Support Elements</em>: type, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion">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>Patient Hospital Locations</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>Antidiabetic Drugs Administered or Ordered</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Any</td>
              <td/>
            </tr>

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

            <tr>
              <td>SDE Chief Complaint</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Condition</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Condition</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Condition during Encounter</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Condition</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Encounter Discharge Dispositions</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Encounter Locations</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Medication Administration</td>
              <td>Out</td>
              <td>0..*</td>
              <td>MedicationAdministration</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Medication Request</td>
              <td>Out</td>
              <td>0..*</td>
              <td>MedicationRequest</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Blood Glucose Observation</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Observation</td>
              <td/>
            </tr>

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

            <tr>
              <td>SDE Specimen</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Specimen</td>
              <td/>
            </tr>

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

            <tr>
              <td>SDE Minimal Medication Requests</td>
              <td>Out</td>
              <td>0..*</td>
              <td>MedicationRequest</td>
              <td/>
            </tr>

          </tbody>
        </table>
      </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">library NHSNGlycemicControlHypoglycemicInitialPopulation version '0.0.002'

    using FHIR version '4.0.1'

    include FHIRHelpers version '4.0.1' called FHIRHelpers
    include SupplementalDataElementsFHIR4 version '2.0.000' called SDE
    include MATGlobalCommonFunctionsFHIR4 version '6.1.000' called Global

    codesystem &quot;ActCode&quot;: 'http://terminology.hl7.org/CodeSystem/v3-ActCode'
    codesystem &quot;Diagnosis Role&quot;: 'http://terminology.hl7.org/CodeSystem/diagnosis-role'
    codesystem &quot;Specimen Type&quot;: 'http://terminology.hl7.org/CodeSystem/v2-0487'
    codesystem &quot;Observation Category&quot;: 'http://terminology.hl7.org/CodeSystem/observation-category'
    codesystem &quot;Condition Category&quot;: 'http://terminology.hl7.org/CodeSystem/condition-category'

    valueset &quot;Blood Glucose Laboratory and Point of Care Tests&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38'
    valueset &quot;Inpatient, Emergency, and Observation Locations&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265'
    valueset &quot;Discharge Disposition&quot;: 'http://terminology.hl7.org/ValueSet/encounter-discharge-disposition'
    valueset &quot;Antidiabetic Medications&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.58'
    valueset &quot;Emergency Department Visit&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'
    valueset &quot;Encounter Inpatient&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'
    valueset &quot;Observation Services&quot;: 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143'

    code &quot;Chief Complaint&quot;: 'CC' from &quot;Diagnosis Role&quot; display 'Chief complaint'
    code &quot;emergency&quot;: 'EMER' from &quot;ActCode&quot; display 'emergency'
    code &quot;inpatient acute&quot;: 'ACUTE' from &quot;ActCode&quot; display 'inpatient acute'
    code &quot;inpatient encounter&quot;: 'IMP' from &quot;ActCode&quot; display 'inpatient encounter'
    code &quot;inpatient non-acute&quot;: 'NONAC' from &quot;ActCode&quot; display 'inpatient non-acute'
    code &quot;observation encounter&quot;: 'OBSENC' from &quot;ActCode&quot; display 'observation encounter'
    code &quot;short stay&quot;: 'SS' from &quot;ActCode&quot; display 'short stay'
    code &quot;laboratory&quot;: 'laboratory' from &quot;Observation Category&quot; display 'Laboratory'
    code &quot;encounter-diagnosis&quot;: 'encounter-diagnosis' from &quot;Condition Category&quot; display'encounter-diagnosis'

    parameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;
     default Interval[@2022-01-01T00:00:00.0, @2022-01-31T00:00:00.0)

    context Patient

    define &quot;Initial Population&quot;:
      (&quot;Inpatient Encounter&quot;
      union &quot;Patient Hospital Locations&quot;) InpatientEncounters
      with &quot;Antidiabetic Drugs Administered or Ordered&quot; ADD
      such that Coalesce(start of Global.&quot;Normalize Interval&quot;(ADD.effective), ADD.authoredOn)
          during &quot;HospitalizationWithObservationOrEmergency&quot;(InpatientEncounters)
        and Coalesce(start of Global.&quot;Normalize Interval&quot;(ADD.effective), ADD.authoredOn) during &quot;Measurement Period&quot;

    define &quot;Inpatient Encounter&quot;:
      [Encounter: class in {&quot;inpatient encounter&quot;, &quot;inpatient acute&quot;, &quot;inpatient non-acute&quot;, &quot;short stay&quot;}]
        union [Encounter: &quot;Encounter Inpatient&quot;] Encounters
      where Encounters.status in {'in-progress', 'finished'}
        and Encounters.period overlaps &quot;Measurement Period&quot;

    define &quot;Patient Hospital Locations&quot;:
      [Encounter] Encounters
      where exists(
        Encounters.location EncounterLocation
        where Global.GetLocation(EncounterLocation.location).type in &quot;Inpatient, Emergency, and Observation Locations&quot;
          and EncounterLocation.period during Encounters.period
      )

    define &quot;Antidiabetic Drugs Administered or Ordered&quot;:
      ([MedicationAdministration] ADDMedAdmin
        where GetMedicationCode(ADDMedAdmin.medication) in &quot;Antidiabetic Medications&quot;
          and ADDMedAdmin.status ~ 'completed')
      union (
        [MedicationRequest] MedicationRequests
          where GetMedicationCode(MedicationRequests.medication) in &quot;Antidiabetic Medications&quot;
      )

    define function &quot;GetMedicationCode&quot;(choice Choice&lt;FHIR.CodeableConcept, FHIR.Reference&gt;):
      case
        when choice is FHIR.CodeableConcept then
          choice as FHIR.CodeableConcept
        when choice is FHIR.Reference then
          GetMedication(choice as FHIR.Reference).code
        else
          null as FHIR.CodeableConcept
      end

    define function &quot;GetMedication&quot;(reference Reference ):
      singleton from (
        [Medication] M where M.id = Global.GetId(reference.reference)
      )

    define function &quot;HospitalizationWithObservationOrEmergency&quot;(TheEncounter FHIR.Encounter ):
      TheEncounter Visit
        let ObsVisit: Last([Encounter: &quot;Observation Services&quot;] LastObs
            where LastObs.class ~ &quot;observation encounter&quot;
              and LastObs.period ends 1 hour or less on or before start of Visit.period
      				sort by end of period
        ),
        VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
        EDVisit: Last([Encounter: &quot;Emergency Department Visit&quot;] LastED
            where LastED.class ~ &quot;emergency&quot;
              and LastED.period ends 1 hour or less on or before start of Visit.period
      				sort by end of period
        )
        return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]

    define function &quot;GetSpecimen&quot;(reference Reference):
      singleton from (
        [Specimen] S where S.id = Global.GetId(reference.reference)
      )

    define function &quot;GetPatientExtensions&quot;(domainResource DomainResource):
      domainResource.extension E
        where E.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'
          or E.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'
          or E.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex'
          or E.url = 'https://hl7.org/fhir/us/core/StructureDefinition-us-core-genderIdentity'
        return E

    define function &quot;GetPatientAddress&quot;(addresses List&lt;FHIR.Address&gt;):
      addresses address
      return FHIR.Address{
        postalCode: address.postalCode
      }

    define function &quot;MedicationRequestResource&quot;(medicationRequest MedicationRequest):
      medicationRequest m
      return MedicationRequest{
        id: FHIR.id {value: 'new-' + m.id},
        medication: GetMedicationCode(m.medication),
        dosageInstruction: m.dosageInstruction
      }

    //Supplement Data Elements
    define &quot;SDE Chief Complaint&quot;:
      &quot;Initial Population&quot; IP
      with IP.diagnosis InitialPopulationDiagnosis
      such that InitialPopulationDiagnosis.use ~ &quot;Chief Complaint&quot;

    define &quot;SDE Condition&quot;:
      [Condition] Conditions
      with &quot;Initial Population&quot; InitialPopulation
      such that Global.&quot;Normalize Interval&quot;(Conditions.onset) overlaps InitialPopulation.period

    define &quot;SDE Condition during Encounter&quot;:
      [Condition] ConditionEncounterDiagnosis
      with ConditionEncounterDiagnosis.category Category
      such that Category ~ &quot;encounter-diagnosis&quot;
        and exists(&quot;Initial Population&quot;)

    define &quot;SDE Encounter Discharge Dispositions&quot;:
    	&quot;Initial Population&quot; DischargeDispositions
      where DischargeDispositions.hospitalization.dischargeDisposition in &quot;Discharge Disposition&quot;

    define &quot;SDE Encounter Locations&quot;:
      &quot;Initial Population&quot; InitialPopulation
      where exists (
        InitialPopulation.location InitialPopulationLocation
        where (Global.GetLocation(InitialPopulationLocation.location).type in &quot;Inpatient, Emergency, and Observation Locations&quot;
          and InitialPopulationLocation.period during InitialPopulation.period)
      )

    define &quot;SDE Medication Administration&quot;:
    	[MedicationAdministration] MedicationAdministrations
      with &quot;Initial Population&quot; InitialPopulation
      such that start of Global.&quot;Normalize Interval&quot;(MedicationAdministrations.effective) during &quot;HospitalizationWithObservationOrEmergency&quot;(InitialPopulation)
        and start of Global.&quot;Normalize Interval&quot;(MedicationAdministrations.effective) during &quot;Measurement Period&quot;

    define &quot;SDE Medication Request&quot;:
    	[MedicationRequest] MedicationRequests
      with &quot;Initial Population&quot; InitialPopulation
    	such that MedicationRequests.authoredOn during &quot;HospitalizationWithObservationOrEmergency&quot;(InitialPopulation)
        and MedicationRequests.authoredOn during &quot;Measurement Period&quot;

    define &quot;SDE Blood Glucose Observation&quot;:
    	[Observation: &quot;Blood Glucose Laboratory and Point of Care Tests&quot;] Observations
      with &quot;Initial Population&quot; InitialPopulation
      such that start of Global.&quot;Normalize Interval&quot;(Observations.effective) during InitialPopulation.period
        or Global.&quot;Normalize Interval&quot;(GetSpecimen(Observations.specimen).collection.collected) during InitialPopulation.period
      with Observations.category category
      such that category ~ &quot;laboratory&quot;

    define &quot;SDE Payer&quot;:
    	SDE.&quot;SDE Payer&quot; Payer
      with &quot;Initial Population&quot; InitialPopulation
      such that start of Payer.period before end of InitialPopulation.period

    define &quot;SDE Specimen&quot;:
      [Specimen] Specimen
      with &quot;Initial Population&quot; InitialPopulation
      such that Global.&quot;Normalize Interval&quot;(Specimen.collection.collected) during InitialPopulation.period

    //Change on CQF ruler happened on 8/12. Check to make sure CQF-Ruler version is dated at or after (version 2.0.0).
    //Wait 2-3 days before the changes are actually applied to the CQF-Ruler.
    define &quot;SDE Minimal Patient&quot;:
      Patient{
        id: Patient.id,
        extension: GetPatientExtensions(Patient),
        identifier: Patient.identifier,
        gender: Patient.gender,
        birthDate: Patient.birthDate,
        deceased: Patient.deceased,
        address: GetPatientAddress(Patient.address)
      }

    define &quot;SDE Minimal Medication Requests&quot;:
      [MedicationRequest] MedicationRequests
      return MedicationRequestResource(MedicationRequests)

    /*define &quot;SDE Resource Construction Test Inlib&quot;:
      FHIR.Observation
      {
        id: FHIR.id { value: 'observation-sdetestinlib-' + ToString(Now()) },
        status: FHIR.ObservationStatus { value: 'final' },
        code: FHIR.CodeableConcept { coding: { FHIR.Coding { code: FHIR.code { value: 'days-since-appointment' } } } },
        subject: FHIR.Reference { reference: FHIR.string { value: Patient.id.value }}
        //value: FHIR.integer { value: Abs(difference in days between end of SDE.&quot;Last Appointment&quot;.period and ToDateTime(Today())) }
      }*/

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

      define &quot;SDE Race Coding&quot;:
        SDE.&quot;SDE Race&quot;</code></pre>
          </td>
        </tr>

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

        </tbody>
      </table>
    </div>
            </text>
            <url
                 value="http://fhir.org/guides/cqf/Library/NHSNGlycemicControlHypoglycemicInitialPopulation"/>
            <version value="0.0.002"/>
            <name value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
            <title value="NHSN Glycemic Control Hypoglycemic Initial Population"/>
            <status value="draft"/>
            <experimental value="true"/>
            <type>
              <coding>
                <system
                        value="http://terminology.hl7.org/CodeSystem/library-type"/>
                <code value="logic-library"/>
                <display value="Logic Library"/>
              </coding>
            </type>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Library SDE"/>
              <resource
                        value="http://fhir.org/guides/cqf/Library/SupplementalDataElementsFHIR4|2.0.000"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Library Global"/>
              <resource
                        value="http://fhir.org/guides/cqf/Library/MATGlobalCommonFunctionsFHIR4|6.1.000"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system ActCode"/>
              <resource value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
            </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="Code system Specimen Type"/>
              <resource value="http://terminology.hl7.org/CodeSystem/v2-0487"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system Observation Category"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/observation-category"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Code system Condition Category"/>
              <resource
                        value="http://terminology.hl7.org/CodeSystem/condition-category"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display
                       value="Value set Blood Glucose Laboratory and Point of Care Tests"/>
              <resource
                        value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display
                       value="Value set Inpatient, Emergency, and Observation Locations"/>
              <resource
                        value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Value set Discharge Disposition"/>
              <resource
                        value="http://terminology.hl7.org/ValueSet/encounter-discharge-disposition"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Value set Antidiabetic Medications"/>
              <resource
                        value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.58"/>
            </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 Encounter Inpatient"/>
              <resource
                        value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"/>
            </relatedArtifact>
            <relatedArtifact>
              <type value="depends-on"/>
              <display value="Value set Observation Services"/>
              <resource
                        value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"/>
            </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="Patient Hospital Locations"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Encounter"/>
            </parameter>
            <parameter>
              <name value="Antidiabetic Drugs Administered or Ordered"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Any"/>
            </parameter>
            <parameter>
              <name value="Initial Population"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Encounter"/>
            </parameter>
            <parameter>
              <name value="SDE Chief Complaint"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Encounter"/>
            </parameter>
            <parameter>
              <name value="SDE Condition"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Condition"/>
            </parameter>
            <parameter>
              <name value="SDE Condition during Encounter"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Condition"/>
            </parameter>
            <parameter>
              <name value="SDE Encounter Discharge Dispositions"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Encounter"/>
            </parameter>
            <parameter>
              <name value="SDE Encounter Locations"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Encounter"/>
            </parameter>
            <parameter>
              <name value="SDE Medication Administration"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="MedicationAdministration"/>
            </parameter>
            <parameter>
              <name value="SDE Medication Request"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="MedicationRequest"/>
            </parameter>
            <parameter>
              <name value="SDE Blood Glucose Observation"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Observation"/>
            </parameter>
            <parameter>
              <name value="SDE Payer"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Any"/>
            </parameter>
            <parameter>
              <name value="SDE Specimen"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="Specimen"/>
            </parameter>
            <parameter>
              <name value="SDE Minimal Patient"/>
              <use value="out"/>
              <min value="0"/>
              <max value="1"/>
              <type value="Patient"/>
            </parameter>
            <parameter>
              <name value="SDE Minimal Medication Requests"/>
              <use value="out"/>
              <min value="0"/>
              <max value="*"/>
              <type value="MedicationRequest"/>
            </parameter>
            <dataRequirement>
              <type value="Patient"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Patient"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Encounter"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
              <mustSupport value="class"/>
              <codeFilter>
                <path value="class"/>
                <code>
                  <system
                          value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                  <code value="IMP"/>
                  <display value="inpatient encounter"/>
                </code>
                <code>
                  <system
                          value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                  <code value="ACUTE"/>
                  <display value="inpatient acute"/>
                </code>
                <code>
                  <system
                          value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                  <code value="NONAC"/>
                  <display value="inpatient non-acute"/>
                </code>
                <code>
                  <system
                          value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                  <code value="SS"/>
                  <display value="short stay"/>
                </code>
              </codeFilter>
            </dataRequirement>
            <dataRequirement>
              <type value="Encounter"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
              <mustSupport value="type"/>
              <mustSupport value="status"/>
              <mustSupport value="period"/>
              <codeFilter>
                <path value="type"/>
                <valueSet
                          value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"/>
              </codeFilter>
            </dataRequirement>
            <dataRequirement>
              <type value="Encounter"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
              <mustSupport value="location"/>
              <mustSupport value="period"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Encounter"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
              <mustSupport value="type"/>
              <mustSupport value="class"/>
              <mustSupport value="period"/>
              <codeFilter>
                <path value="type"/>
                <valueSet
                          value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"/>
              </codeFilter>
            </dataRequirement>
            <dataRequirement>
              <type value="Encounter"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
              <mustSupport value="type"/>
              <mustSupport value="class"/>
              <mustSupport value="period"/>
              <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="Location"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Location"/>
              <mustSupport value="id"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Medication"/>
              <profile
                       value="http://hl7.org/fhir/StructureDefinition/Medication"/>
              <mustSupport value="id"/>
            </dataRequirement>
            <dataRequirement>
              <type value="MedicationAdministration"/>
              <profile
                       value="http://hl7.org/fhir/StructureDefinition/MedicationAdministration"/>
              <mustSupport value="medication"/>
              <mustSupport value="status"/>
              <mustSupport value="effective"/>
            </dataRequirement>
            <dataRequirement>
              <type value="MedicationRequest"/>
              <profile
                       value="http://hl7.org/fhir/StructureDefinition/MedicationRequest"/>
              <mustSupport value="medication"/>
              <mustSupport value="authoredOn"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Specimen"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Specimen"/>
              <mustSupport value="id"/>
              <mustSupport value="collection"/>
              <mustSupport value="collection.collected"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Condition"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Condition"/>
              <mustSupport value="onset"/>
              <mustSupport value="category"/>
            </dataRequirement>
            <dataRequirement>
              <type value="Observation"/>
              <profile
                       value="http://hl7.org/fhir/StructureDefinition/Observation"/>
              <mustSupport value="code"/>
              <mustSupport value="effective"/>
              <mustSupport value="specimen"/>
              <mustSupport value="specimen.collection"/>
              <mustSupport value="specimen.collection.collected"/>
              <mustSupport value="category"/>
              <codeFilter>
                <path value="code"/>
                <valueSet
                          value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38"/>
              </codeFilter>
            </dataRequirement>
            <dataRequirement>
              <type value="Coverage"/>
              <profile value="http://hl7.org/fhir/StructureDefinition/Coverage"/>
              <mustSupport value="type"/>
              <mustSupport value="period"/>
              <codeFilter>
                <path value="type"/>
                <valueSet
                          value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
              </codeFilter>
            </dataRequirement>
            <content>
              <contentType value="text/cql"/>
              <data
                    value=" "/>
            </content>
          </Library>
        </resource>
        <request>
          <method value="PUT"/>
          <url value="Library/NHSNGlycemicControlHypoglycemicInitialPopulation"/>
        </request>
      </entry>
      <entry>
        <fullUrl value="urn:uuid:61d3ae55-c7b7-484f-96df-4f3ef8c080c0"/>
        <resource>
          <Measure>
            <id value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
            <language value="en"/>
            <text>
              <status value="extensions"/>
              <div xmlns="http://www.w3.org/1999/xhtml"><a name="Measure_NHSNGlycemicControlHypoglycemicInitialPopulation"> </a>
      <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">NHSN Glycemic Control, Hypoglycemia Initial Population</td>

    </tr>

    <tr>

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

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

    </tr>

    <tr>

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

    <td class="content-container">nhsnglycemiccontrolhypoglycemicinitialpopulation</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">Steward (Publisher)</th>

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

    </tr>

    <tr>

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

    <td class="content-container"><div><p>All inpatient encounters (including ED/Observation visits that end within 1 hour of the start of the inpatient encounter) for patients of all ages where at least one ADD was ordered or administered during the encounter that is during the measurement period.</p>
    </div></td>

    </tr>

    <tr>

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

    <td class="content-container"><div><p>The primary purpose of this site is to provide CDC’s NHSN with access to view measure specification content in the dQMs under development by Lantana Consulting Group. Please note, this site is draft and undergoes constant revision and is not intended to serve as an implementation guide.</p>
    </div></td>

    </tr>

    <tr>

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

    <td class="content-container"><div><p>This measure and specifications are subject to further revisions.      This performance measure is not a clinical guideline, does not establish a standard of medical care and has not been tested for all potential applications.        THE MEASURES AND SPECIFICATIONS ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND.</p>
    </div></td>

    </tr>

    <tr>

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

    <td class="content-container">
        Cohort

    </td>

    </tr>

    <tr>

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

    <td class="content-container">
        Outcome

    </td>

    </tr>

    <tr>

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

    <td class="content-container"><div><p>The NHSN Glycemic Control, Hypoglycemia module provides a mechanism for facilities to report inpatient medication-related hypoglycemia events, and to provide analytic reports based on these data to inform glycemic control quality improvement efforts and patient safety events. The primary objective of the NHSN Glycemic Control, Hypoglycemia module is to facilitate measurement and benchmarking of medication-related hypoglycemia events within a facility. As additional data are collected by NHSN, an additional objective will be to facilitate inter-facility benchmarking and evaluate national-level trends of medication-related hypoglycemia over time. The IP dQM provides the initial population and FHIR line-level data necessary for calculating the module metrics.</p>
    </div></td>

    </tr>

        <tr>

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

    </tr>

      <tr>

    <th colspan="2" scope="row" class="row-header">Supplemental Data Elements</th>

    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-chief-complaint

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-chief-complaint">SDE Chief Complaint</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-condition

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-condition">SDE Condition</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-condition-during-encounter

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-condition-during-encounter">SDE Condition during Encounter</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-encounter-discharge-dispositions

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-encounter-discharge-dispositions">SDE Encounter Discharge Dispositions</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-encounter-locations

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-encounter-locations">SDE Encounter Locations</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-medication-administration

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-medication-administration">SDE Medication Administration</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-medication-request

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-medication-request">SDE Medication Request</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-blood-glucose-observation

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-blood-glucose-observation">SDE Blood Glucose Observation</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-payer

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-payer">SDE Payer</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-specimen

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-specimen">SDE Specimen</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-minimal-patient

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-minimal-patient">SDE Minimal Patient</a>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Supplemental Data Element</th>

      <td class="content-container">

          <em>ID</em>: sde-minimal-medication-requests

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

            <br/>

              <em>Logic Definition</em>: <a href="#nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-minimal-medication-requests">SDE Minimal Medication Requests</a>

      </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="Bundle-sde-example-artifact-bundle.html">NHSN Glycemic Control Hypoglycemic Initial Population</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)</th>

    </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> SupplementalDataElementsFHIR4</td>

    </tr>
    <tr>

      <td>

          <a name="supplementaldataelementsfhir4-sde-payer"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Payer&quot;:   [Coverage: type in &quot;Payer&quot;] Payer         return {           code: Payer.type,           period: Payer.period         }</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-inpatient-encounter"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Inpatient Encounter&quot;:   [Encounter: class in {&quot;inpatient encounter&quot;, &quot;inpatient acute&quot;, &quot;inpatient non-acute&quot;, &quot;short stay&quot;}] Encounters   where Encounters.status in {'in-progress', 'finished'}   and Encounters.period overlaps &quot;Measurement Period&quot;</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-antidiabetic-drugs-administered-or-ordered"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Antidiabetic Drugs Administered or Ordered&quot;:   ([MedicationAdministration] ADDMedAdmin     where GetMedicationCode(ADDMedAdmin.medication) in &quot;Antidiabetic Medications&quot;       and ADDMedAdmin.status ~ 'completed')   union (     [MedicationRequest] MedicationRequests       where GetMedicationCode(MedicationRequests.medication) in &quot;Antidiabetic Medications&quot;   )</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

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

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;Initial Population&quot;:   &quot;Inpatient Encounter&quot; InpatientEncounters   with &quot;Antidiabetic Drugs Administered or Ordered&quot; ADD   such that Coalesce(start of Global.&quot;Normalize Interval&quot;(ADD.effective), ADD.authoredOn)       during &quot;HospitalizationWithObservationOrEmergency&quot;(InpatientEncounters)     and Coalesce(start of Global.&quot;Normalize Interval&quot;(ADD.effective), ADD.authoredOn) during &quot;Measurement Period&quot;</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-medication-request"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Medication Request&quot;:  [MedicationRequest] MedicationRequests   with &quot;Initial Population&quot; InitialPopulation  such that MedicationRequests.authoredOn during &quot;HospitalizationWithObservationOrEmergency&quot;(InitialPopulation)     and MedicationRequests.authoredOn during &quot;Measurement Period&quot;</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-encounter-locations"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Encounter Locations&quot;:   &quot;Initial Population&quot; InitialPopulation    where exists (      InitialPopulation.location InitialPopulationLocation     where (Global.GetLocation(InitialPopulationLocation.location).type in &quot;Inpatient, Emergency, and Observation Locations&quot;          or Global.GetLocation(InitialPopulationLocation.location).physicalType in &quot;Inpatient, Emergency, and Observation Locations&quot;)       and InitialPopulationLocation.period during InitialPopulation.period   )</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-minimal-medication-requests"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Minimal Medication Requests&quot;:   [MedicationRequest] MedicationRequests   return MedicationRequest{     id: MedicationRequests.id,     medication: GetMedicationCode(MedicationRequests.medication),     dosageInstruction: MedicationRequests.dosageInstruction   }</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-condition-during-encounter"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Condition during Encounter&quot;:   [Condition] ConditionEncounterDiagnosis   with ConditionEncounterDiagnosis.category Category   such that Category ~ &quot;encounter-diagnosis&quot;     and exists(&quot;Initial Population&quot;)</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-medication-administration"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Medication Administration&quot;:  [MedicationAdministration] MedicationAdministrations   with &quot;Initial Population&quot; InitialPopulation   such that start of Global.&quot;Normalize Interval&quot;(MedicationAdministrations.effective) during &quot;HospitalizationWithObservationOrEmergency&quot;(InitialPopulation)     and start of Global.&quot;Normalize Interval&quot;(MedicationAdministrations.effective) during &quot;Measurement Period&quot;</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-blood-glucose-observation"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Blood Glucose Observation&quot;:  [Observation: &quot;Blood Glucose Laboratory and Point of Care Tests&quot;] Observations    with &quot;Initial Population&quot; InitialPopulation   such that start of Global.&quot;Normalize Interval&quot;(Observations.effective) during InitialPopulation.period     or Global.&quot;Normalize Interval&quot;(GetSpecimen(Observations.specimen).collection.collected) during InitialPopulation.period   with Observations.category category   such that category ~ &quot;laboratory&quot;</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-condition"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Condition&quot;:   [Condition] Conditions   with &quot;Initial Population&quot; InitialPopulation   such that Global.&quot;Normalize Interval&quot;(Conditions.onset) overlaps InitialPopulation.period</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-payer"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Payer&quot;:   SDE.&quot;SDE Payer&quot; Payer   with &quot;Initial Population&quot; InitialPopulation   such that start of Payer.period before end of InitialPopulation.period</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-encounter-discharge-dispositions"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Encounter Discharge Dispositions&quot;:  &quot;Initial Population&quot; DischargeDispositions    where DischargeDispositions.hospitalization.dischargeDisposition in &quot;Discharge Disposition&quot;</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-minimal-patient"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">//Change on CQF ruler happened on 8/12. Check to make sure CQF-Ruler version is dated at or after define &quot;SDE Minimal Patient&quot;:   Patient{     id: Patient.id,     gender: Patient.gender,     birthDate: Patient.birthDate   }</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-specimen"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">define &quot;SDE Specimen&quot;:   [Specimen] Specimen   with &quot;Initial Population&quot; InitialPopulation   such that Global.&quot;Normalize Interval&quot;(Specimen.collection.collected) during InitialPopulation.period</code></pre>
      </td>

    </tr>

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

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

    </tr>
    <tr>

      <td>

          <a name="nhsnglycemiccontrolhypoglycemicinitialpopulation-sde-chief-complaint"> </a>

        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">//Supplement Data Elements define &quot;SDE Chief Complaint&quot;:   &quot;Initial Population&quot; InitialPopulation   with InitialPopulation.diagnosis InitialPopulationDiagnosis   such that InitialPopulationDiagnosis.use ~ &quot;Chief Complaint&quot;</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 ActCode

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html">ActCode</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-ActCode</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Code system Condition Category

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-condition-category.html">Condition Category Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-category</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Code system Observation Category

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-observation-category.html">Observation Category Codes</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/CodeSystem/observation-category</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.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">Value Set</th>

      <td class="content-container">

        <em>Description</em>: Value set Antidiabetic Medications

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1190.58/expansion">Diabetes Medications</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.58</tt>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Value Set</th>

      <td class="content-container">

        <em>Description</em>: Value set Inpatient, Emergency, and Observation Locations

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1046.265/expansion">Inpatient, Emergency, and Observation Locations</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265</tt>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Value Set</th>

      <td class="content-container">

        <em>Description</em>: Value set Blood Glucose Laboratory and Point of Care Tests

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1190.38/expansion">Blood Glucose Laboratory and Point of Care Tests</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38</tt>

      </td>
    </tr>

    <tr>

    <th scope="row" class="row-header">Value Set</th>

      <td class="content-container">

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

        <br/>

        <em>Resource</em>: <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion">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">Value Set</th>

      <td class="content-container">

        <em>Description</em>: Value set Discharge Disposition

        <br/>

        <em>Resource</em>: <a href="http://terminology.hl7.org/7.1.0/ValueSet-encounter-discharge-disposition.html">Discharge disposition</a>
        <br/>
        <em>Canonical URL</em>: <tt>http://terminology.hl7.org/ValueSet/encounter-discharge-disposition</tt>

      </td>
    </tr>

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

            <em>Display</em>: inpatient encounter
            <br/>

          <em>Code</em>: IMP
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-ActCode</tt>
        </td>
      </tr>

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

            <em>Display</em>: inpatient acute
            <br/>

          <em>Code</em>: ACUTE
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-ActCode</tt>
        </td>
      </tr>

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

            <em>Display</em>: inpatient non-acute
            <br/>

          <em>Code</em>: NONAC
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-ActCode</tt>
        </td>
      </tr>

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

            <em>Display</em>: short stay
            <br/>

          <em>Code</em>: SS
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-ActCode</tt>
        </td>
      </tr>

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

            <em>Display</em>: observation encounter
            <br/>

          <em>Code</em>: OBSENC
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-ActCode</tt>
        </td>
      </tr>

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

            <em>Display</em>: emergency
            <br/>

          <em>Code</em>: EMER
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/v3-ActCode</tt>
        </td>
      </tr>

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

            <em>Display</em>: Encounter Diagnosis
            <br/>

          <em>Code</em>: encounter-diagnosis
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/condition-category</tt>
        </td>
      </tr>

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

            <em>Display</em>: Laboratory
            <br/>

          <em>Code</em>: laboratory
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/observation-category</tt>
        </td>
      </tr>

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

            <em>Display</em>: Chief complaint
            <br/>

          <em>Code</em>: CC
          <br/>
          <em>System</em>: <tt>http://terminology.hl7.org/CodeSystem/diagnosis-role</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 FHIRHelpers

        <br/>

        <em>Resource</em>: <a href="Bundle-sde-example-artifact-bundle.html">FHIR Helpers</a> version: 4.0.1
        <br/>
        <em>Canonical URL</em>: <tt>http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Library Global

        <br/>

        <em>Resource</em>: <a href="Bundle-sde-example-artifact-bundle.html">MAT Global Common Functions FHIRR4</a> version: 6.1.000
        <br/>
        <em>Canonical URL</em>: <tt>http://fhir.org/guides/cqf/Library/MATGlobalCommonFunctionsFHIR4|6.1.000</tt>

      </td>
    </tr>

    <tr>

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

      <td class="content-container">

        <em>Description</em>: Library SDE

        <br/>

        <em>Resource</em>: <a href="Bundle-sde-example-artifact-bundle.html">SupplementalDataElementsFHIR4</a> version: 2.0.000
        <br/>
        <em>Canonical URL</em>: <tt>http://fhir.org/guides/cqf/Library/SupplementalDataElementsFHIR4|2.0.000</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>: Encounter
        <br/>

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

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

        <em>Must Support Elements</em>: class, period
        <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>:

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

        <em>Must Support Elements</em>: class, status, period
        <br/>

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

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

        <span class="tab-one"><em>Code(s)</em>:

          <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html#v3-ActCode-IMP">ActCode: IMP</a> (inpatient encounter),

          <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html#v3-ActCode-ACUTE">ActCode: ACUTE</a> (inpatient acute),

          <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html#v3-ActCode-NONAC">ActCode: NONAC</a> (inpatient non-acute),

          <a href="http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html#v3-ActCode-SS">ActCode: SS</a> (short stay)

        </span>
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: id
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: medication, status, effective
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: medication, authoredOn, id, dosageInstruction
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: id
        <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>Must Support Elements</em>: category, onset
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: id, collection, collection.collected
        <br/>

      </td>
    </tr>

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

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

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

        <em>Must Support Elements</em>: code, effective, specimen, specimen.collection, specimen.collection.collected, category
        <br/>

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

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

        <span class="tab-one"><em>ValueSet</em>:</span> <a href="https://vsac.nlm.nih.gov/valueset/2.16.840.1.113762.1.4.1190.38/expansion">Blood Glucose Laboratory and Point of Care Tests</a>
        <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>:

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

        <em>Must Support Elements</em>: type, period
        <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://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion">Payer Type</a>
        <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>Measurement Period</td>
              <td>In</td>
              <td>0..1</td>
              <td>Period</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Medication Request</td>
              <td>Out</td>
              <td>0..*</td>
              <td>MedicationRequest</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Encounter Locations</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Minimal Medication Requests</td>
              <td>Out</td>
              <td>0..*</td>
              <td>MedicationRequest</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Condition during Encounter</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Condition</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Medication Administration</td>
              <td>Out</td>
              <td>0..*</td>
              <td>MedicationAdministration</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Blood Glucose Observation</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Observation</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Condition</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Condition</td>
              <td/>
            </tr>

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

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

            <tr>
              <td>SDE Encounter Discharge Dispositions</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

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

            <tr>
              <td>SDE Specimen</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Specimen</td>
              <td/>
            </tr>

            <tr>
              <td>SDE Chief Complaint</td>
              <td>Out</td>
              <td>0..*</td>
              <td>Encounter</td>
              <td/>
            </tr>

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

    <tr>
      <th colspan="2" scope="row" class="row-header">Generated using version 0.5.4-cibuild 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://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                    <code value="IMP"/>
                    <display value="inpatient encounter"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
                  <valueCoding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                    <code value="ACUTE"/>
                    <display value="inpatient acute"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
                  <valueCoding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                    <code value="NONAC"/>
                    <display value="inpatient non-acute"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
                  <valueCoding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                    <code value="SS"/>
                    <display value="short stay"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
                  <valueCoding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                    <code value="OBSENC"/>
                    <display value="observation encounter"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
                  <valueCoding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                    <code value="EMER"/>
                    <display value="emergency"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
                  <valueCoding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/condition-category"/>
                    <code value="encounter-diagnosis"/>
                    <display value="Encounter Diagnosis"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
                  <valueCoding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                    <code value="laboratory"/>
                    <display value="Laboratory"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode">
                  <valueCoding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/diagnosis-role"/>
                    <code value="CC"/>
                    <display value="Chief complaint"/>
                  </valueCoding>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="Inpatient Encounter"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;Inpatient Encounter&quot;:   [Encounter: class in {&quot;inpatient encounter&quot;, &quot;inpatient acute&quot;, &quot;inpatient non-acute&quot;, &quot;short stay&quot;}] Encounters   where Encounters.status in {'in-progress', 'finished'}   and Encounters.period overlaps &quot;Measurement Period&quot;"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="0"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString
                                 value="Antidiabetic Drugs Administered or Ordered"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;Antidiabetic Drugs Administered or Ordered&quot;:   ([MedicationAdministration] ADDMedAdmin     where GetMedicationCode(ADDMedAdmin.medication) in &quot;Antidiabetic Medications&quot;       and ADDMedAdmin.status ~ 'completed')   union (     [MedicationRequest] MedicationRequests       where GetMedicationCode(MedicationRequests.medication) in &quot;Antidiabetic Medications&quot;   )"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="1"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="Initial Population"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;Initial Population&quot;:   &quot;Inpatient Encounter&quot; InpatientEncounters   with &quot;Antidiabetic Drugs Administered or Ordered&quot; ADD   such that Coalesce(start of Global.&quot;Normalize Interval&quot;(ADD.effective), ADD.authoredOn)       during &quot;HospitalizationWithObservationOrEmergency&quot;(InpatientEncounters)     and Coalesce(start of Global.&quot;Normalize Interval&quot;(ADD.effective), ADD.authoredOn) during &quot;Measurement Period&quot;"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="2"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Medication Request"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Medication Request&quot;:  [MedicationRequest] MedicationRequests   with &quot;Initial Population&quot; InitialPopulation  such that MedicationRequests.authoredOn during &quot;HospitalizationWithObservationOrEmergency&quot;(InitialPopulation)     and MedicationRequests.authoredOn during &quot;Measurement Period&quot;"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="3"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Encounter Locations"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Encounter Locations&quot;:   &quot;Initial Population&quot; InitialPopulation    where exists (      InitialPopulation.location InitialPopulationLocation     where (Global.GetLocation(InitialPopulationLocation.location).type in &quot;Inpatient, Emergency, and Observation Locations&quot;          or Global.GetLocation(InitialPopulationLocation.location).physicalType in &quot;Inpatient, Emergency, and Observation Locations&quot;)       and InitialPopulationLocation.period during InitialPopulation.period   )"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="4"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Minimal Medication Requests"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Minimal Medication Requests&quot;:   [MedicationRequest] MedicationRequests   return MedicationRequest{     id: MedicationRequests.id,     medication: GetMedicationCode(MedicationRequests.medication),     dosageInstruction: MedicationRequests.dosageInstruction   }"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="5"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Condition during Encounter"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Condition during Encounter&quot;:   [Condition] ConditionEncounterDiagnosis   with ConditionEncounterDiagnosis.category Category   such that Category ~ &quot;encounter-diagnosis&quot;     and exists(&quot;Initial Population&quot;)"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="6"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Medication Administration"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Medication Administration&quot;:  [MedicationAdministration] MedicationAdministrations   with &quot;Initial Population&quot; InitialPopulation   such that start of Global.&quot;Normalize Interval&quot;(MedicationAdministrations.effective) during &quot;HospitalizationWithObservationOrEmergency&quot;(InitialPopulation)     and start of Global.&quot;Normalize Interval&quot;(MedicationAdministrations.effective) during &quot;Measurement Period&quot;"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="7"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Blood Glucose Observation"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Blood Glucose Observation&quot;:  [Observation: &quot;Blood Glucose Laboratory and Point of Care Tests&quot;] Observations    with &quot;Initial Population&quot; InitialPopulation   such that start of Global.&quot;Normalize Interval&quot;(Observations.effective) during InitialPopulation.period     or Global.&quot;Normalize Interval&quot;(GetSpecimen(Observations.specimen).collection.collected) during InitialPopulation.period   with Observations.category category   such that category ~ &quot;laboratory&quot;"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="8"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Condition"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Condition&quot;:   [Condition] Conditions   with &quot;Initial Population&quot; InitialPopulation   such that Global.&quot;Normalize Interval&quot;(Conditions.onset) overlaps InitialPopulation.period"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="9"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString value="SupplementalDataElementsFHIR4"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Payer"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Payer&quot;:   [Coverage: type in &quot;Payer&quot;] Payer         return {           code: Payer.type,           period: Payer.period         }"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="10"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Payer"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Payer&quot;:   SDE.&quot;SDE Payer&quot; Payer   with &quot;Initial Population&quot; InitialPopulation   such that start of Payer.period before end of InitialPopulation.period"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="11"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Encounter Discharge Dispositions"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Encounter Discharge Dispositions&quot;:  &quot;Initial Population&quot; DischargeDispositions    where DischargeDispositions.hospitalization.dischargeDisposition in &quot;Discharge Disposition&quot;"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="12"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Minimal Patient"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="//Change on CQF ruler happened on 8/12. Check to make sure CQF-Ruler version is dated at or after define &quot;SDE Minimal Patient&quot;:   Patient{     id: Patient.id,     gender: Patient.gender,     birthDate: Patient.birthDate   }"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="13"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Specimen"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="define &quot;SDE Specimen&quot;:   [Specimen] Specimen   with &quot;Initial Population&quot; InitialPopulation   such that Global.&quot;Normalize Interval&quot;(Specimen.collection.collected) during InitialPopulation.period"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="14"/>
                  </extension>
                </extension>
                <extension
                           url="http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition">
                  <extension url="libraryName">
                    <valueString
                                 value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
                  </extension>
                  <extension url="name">
                    <valueString value="SDE Chief Complaint"/>
                  </extension>
                  <extension url="statement">
                    <valueString
                                 value="//Supplement Data Elements define &quot;SDE Chief Complaint&quot;:   &quot;Initial Population&quot; InitialPopulation   with InitialPopulation.diagnosis InitialPopulationDiagnosis   such that InitialPopulationDiagnosis.use ~ &quot;Chief Complaint&quot;"/>
                  </extension>
                  <extension url="displaySequence">
                    <valueInteger value="15"/>
                  </extension>
                </extension>
                <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 FHIRHelpers"/>
                  <resource
                            value="http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1"/>
                </relatedArtifact>
                <relatedArtifact>
                  <type value="depends-on"/>
                  <display value="Library Global"/>
                  <resource
                            value="http://fhir.org/guides/cqf/Library/MATGlobalCommonFunctionsFHIR4|6.1.000"/>
                </relatedArtifact>
                <relatedArtifact>
                  <type value="depends-on"/>
                  <display value="Library SDE"/>
                  <resource
                            value="http://fhir.org/guides/cqf/Library/SupplementalDataElementsFHIR4|2.0.000"/>
                </relatedArtifact>
                <relatedArtifact>
                  <type value="depends-on"/>
                  <display value="Code system ActCode"/>
                  <resource
                            value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                </relatedArtifact>
                <relatedArtifact>
                  <type value="depends-on"/>
                  <display value="Code system Condition Category"/>
                  <resource
                            value="http://terminology.hl7.org/CodeSystem/condition-category"/>
                </relatedArtifact>
                <relatedArtifact>
                  <type value="depends-on"/>
                  <display value="Code system Observation Category"/>
                  <resource
                            value="http://terminology.hl7.org/CodeSystem/observation-category"/>
                </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 Antidiabetic Medications"/>
                  <resource
                            value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.58"/>
                </relatedArtifact>
                <relatedArtifact>
                  <type value="depends-on"/>
                  <display
                           value="Value set Inpatient, Emergency, and Observation Locations"/>
                  <resource
                            value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265"/>
                </relatedArtifact>
                <relatedArtifact>
                  <type value="depends-on"/>
                  <display
                           value="Value set Blood Glucose Laboratory and Point of Care Tests"/>
                  <resource
                            value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38"/>
                </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>
                <relatedArtifact>
                  <type value="depends-on"/>
                  <display value="Value set Discharge Disposition"/>
                  <resource
                            value="http://terminology.hl7.org/ValueSet/encounter-discharge-disposition"/>
                </relatedArtifact>
                <parameter>
                  <name value="Measurement Period"/>
                  <use value="in"/>
                  <min value="0"/>
                  <max value="1"/>
                  <type value="Period"/>
                </parameter>
                <parameter>
                  <name value="SDE Medication Request"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="MedicationRequest"/>
                </parameter>
                <parameter>
                  <name value="SDE Encounter Locations"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Encounter"/>
                </parameter>
                <parameter>
                  <name value="SDE Minimal Medication Requests"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="MedicationRequest"/>
                </parameter>
                <parameter>
                  <name value="SDE Condition during Encounter"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Condition"/>
                </parameter>
                <parameter>
                  <name value="SDE Medication Administration"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="MedicationAdministration"/>
                </parameter>
                <parameter>
                  <name value="SDE Blood Glucose Observation"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Observation"/>
                </parameter>
                <parameter>
                  <name value="SDE Condition"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Condition"/>
                </parameter>
                <parameter>
                  <name value="SDE Payer"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Any"/>
                </parameter>
                <parameter>
                  <name value="Initial Population"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Encounter"/>
                </parameter>
                <parameter>
                  <name value="SDE Encounter Discharge Dispositions"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Encounter"/>
                </parameter>
                <parameter>
                  <name value="SDE Minimal Patient"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="1"/>
                  <type value="Patient"/>
                </parameter>
                <parameter>
                  <name value="SDE Specimen"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Specimen"/>
                </parameter>
                <parameter>
                  <name value="SDE Chief Complaint"/>
                  <use value="out"/>
                  <min value="0"/>
                  <max value="*"/>
                  <type value="Encounter"/>
                </parameter>
                <dataRequirement>
                  <type value="Encounter"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
                  <mustSupport value="class"/>
                  <mustSupport value="status"/>
                  <mustSupport value="period"/>
                  <codeFilter>
                    <path value="class"/>
                    <code>
                      <system
                              value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                      <code value="IMP"/>
                      <display value="inpatient encounter"/>
                    </code>
                    <code>
                      <system
                              value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                      <code value="ACUTE"/>
                      <display value="inpatient acute"/>
                    </code>
                    <code>
                      <system
                              value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                      <code value="NONAC"/>
                      <display value="inpatient non-acute"/>
                    </code>
                    <code>
                      <system
                              value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                      <code value="SS"/>
                      <display value="short stay"/>
                    </code>
                  </codeFilter>
                </dataRequirement>
                <dataRequirement>
                  <type value="Encounter"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
                  <mustSupport value="class"/>
                  <mustSupport value="period"/>
                </dataRequirement>
                <dataRequirement>
                  <type value="Encounter"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Encounter"/>
                  <mustSupport value="class"/>
                  <mustSupport value="status"/>
                  <mustSupport value="period"/>
                  <codeFilter>
                    <path value="class"/>
                    <code>
                      <system
                              value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                      <code value="IMP"/>
                      <display value="inpatient encounter"/>
                    </code>
                    <code>
                      <system
                              value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                      <code value="ACUTE"/>
                      <display value="inpatient acute"/>
                    </code>
                    <code>
                      <system
                              value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                      <code value="NONAC"/>
                      <display value="inpatient non-acute"/>
                    </code>
                    <code>
                      <system
                              value="http://terminology.hl7.org/CodeSystem/v3-ActCode"/>
                      <code value="SS"/>
                      <display value="short stay"/>
                    </code>
                  </codeFilter>
                </dataRequirement>
                <dataRequirement>
                  <type value="Medication"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Medication"/>
                  <mustSupport value="id"/>
                </dataRequirement>
                <dataRequirement>
                  <type value="MedicationAdministration"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/MedicationAdministration"/>
                  <mustSupport value="medication"/>
                  <mustSupport value="status"/>
                  <mustSupport value="effective"/>
                </dataRequirement>
                <dataRequirement>
                  <type value="MedicationRequest"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/MedicationRequest"/>
                  <mustSupport value="medication"/>
                  <mustSupport value="authoredOn"/>
                  <mustSupport value="id"/>
                  <mustSupport value="dosageInstruction"/>
                </dataRequirement>
                <dataRequirement>
                  <type value="Location"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Location"/>
                  <mustSupport value="id"/>
                </dataRequirement>
                <dataRequirement>
                  <type value="Condition"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Condition"/>
                  <mustSupport value="category"/>
                  <mustSupport value="onset"/>
                </dataRequirement>
                <dataRequirement>
                  <type value="Specimen"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Specimen"/>
                  <mustSupport value="id"/>
                  <mustSupport value="collection"/>
                  <mustSupport value="collection.collected"/>
                </dataRequirement>
                <dataRequirement>
                  <type value="Observation"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Observation"/>
                  <mustSupport value="code"/>
                  <mustSupport value="effective"/>
                  <mustSupport value="specimen"/>
                  <mustSupport value="specimen.collection"/>
                  <mustSupport value="specimen.collection.collected"/>
                  <mustSupport value="category"/>
                  <codeFilter>
                    <path value="code"/>
                    <valueSet
                              value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38"/>
                  </codeFilter>
                </dataRequirement>
                <dataRequirement>
                  <type value="Coverage"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Coverage"/>
                  <mustSupport value="type"/>
                  <mustSupport value="period"/>
                  <codeFilter>
                    <path value="type"/>
                    <valueSet
                              value="http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"/>
                  </codeFilter>
                </dataRequirement>
                <dataRequirement>
                  <type value="Patient"/>
                  <profile
                           value="http://hl7.org/fhir/StructureDefinition/Patient"/>
                </dataRequirement>
              </Library>
            </contained>
            <extension
                       url="http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements" id="effective-data-requirements">
              <valueCanonical value="#effective-data-requirements"/>
            </extension>
            <url
                 value="http://nhsnlink.org/fhir/Measure/NHSNGlycemicControlHypoglycemicInitialPopulation"/>
            <identifier>
              <system value="https://nhsnlink.org"/>
              <value value="nhsnglycemiccontrolhypoglycemicinitialpopulation"/>
            </identifier>
            <version value="0.000.01"/>
            <name value="NHSNGlycemicControlHypoglycemicInitialPopulation"/>
            <title
                   value="NHSN Glycemic Control, Hypoglycemia Initial Population"/>
            <status value="draft"/>
            <experimental value="true"/>
            <date value="2022-08-29T12:53:08-08:00"/>
            <publisher value="NHSN"/>
            <description
                         value="All inpatient encounters (including ED/Observation visits that end within 1 hour of the start of the inpatient encounter) for patients of all ages where at least one ADD was ordered or administered during the encounter that is during the measurement period."/>
            <purpose
                     value="The primary purpose of this site is to provide CDC’s NHSN with access to view measure specification content in the dQMs under development by Lantana Consulting Group. Please note, this site is draft and undergoes constant revision and is not intended to serve as an implementation guide."/>
            <copyright
                       value="This measure and specifications are subject to further revisions.      This performance measure is not a clinical guideline, does not establish a standard of medical care and has not been tested for all potential applications.        THE MEASURES AND SPECIFICATIONS ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND."/>
            <library
                     value="http://fhir.org/guides/cqf/Library/NHSNGlycemicControlHypoglycemicInitialPopulation"/>
            <scoring>
              <coding>
                <system
                        value="http://terminology.hl7.org/CodeSystem/measure-scoring"/>
                <code value="cohort"/>
                <display value="Cohort"/>
              </coding>
            </scoring>
            <type>
              <coding>
                <system
                        value="http://terminology.hl7.org/CodeSystem/measure-type"/>
                <code value="outcome"/>
                <display value="Outcome"/>
              </coding>
            </type>
            <rationale
                       value="The NHSN Glycemic Control, Hypoglycemia module provides a mechanism for facilities to report inpatient medication-related hypoglycemia events, and to provide analytic reports based on these data to inform glycemic control quality improvement efforts and patient safety events. The primary objective of the NHSN Glycemic Control, Hypoglycemia module is to facilitate measurement and benchmarking of medication-related hypoglycemia events within a facility. As additional data are collected by NHSN, an additional objective will be to facilitate inter-facility benchmarking and evaluate national-level trends of medication-related hypoglycemia over time. The IP dQM provides the initial population and FHIR line-level data necessary for calculating the module metrics."/>
            <definition
                        value="Antidiabetic Drug Days (ADD): Aggregate number of inpatient encounter days within the facility in which at least one injectable or oral ADD was received. All patients who received ADDs during the hospitalization contribute to the initial population regardless of whether the patient experienced a hypoglycemic event."/>
            <definition
                        value="Emergency Department (ED) or Observation (OBS) encounters: ED or observation encounters that ended within an hour of the inpatient admission are included when calculating the start and stop times of the hospitalization. Only Metric 1 includes ED  and OBS encounters."/>
            <definition
                        value="Hypoglycemia Day: An inpatient day with at least one documented hypoglycemia event."/>
            <definition
                        value="Hypoglycemia Event includes the following during an inpatient hospitalization: A hypoglycemic blood glucose (BG) result during the encounter and ADD administered within 24 hours prior to the start of the hypoglycemic BG result and no subsequent test for blood glucose with a result ≥80 mg/dL within five minutes of the start of the initial low blood glucose test."/>
            <definition
                        value="Inpatient Encounter: A hospitalization in any inpatient facility that meets the criteria for reporting to the NHSN Glycemic Control Hypoglycemia Module (refer to CDC Locations and Descriptions manual)."/>
            <definition
                        value="Measurement Period: From the first day of each calendar month through the last day of that calendar month. Mild hypoglycemia: Blood glucose 54 mg/dL to 69 mg/dL as identified on central laboratory device (CLD) or prescription point-of-care (POC) device."/>
            <definition
                        value="Moderate hypoglycemia: Blood glucose 40 mg/dL to 53 mg/dL as identified on CLD or prescription POC device."/>
            <definition
                        value="Severe hypoglycemia Blood glucose &lt; 40 mg/dL as identified on CLD or prescription POC device."/>
            <group>
              <population id="initial-population-01">
                <code>
                  <coding>
                    <system
                            value="http://terminology.hl7.org/CodeSystem/measure-population"/>
                    <code value="initial-population"/>
                    <display value="Initial Population"/>
                  </coding>
                </code>
                <description
                             value="All inpatient encounters, as well as ED and OBS encounters that end within 1 hour of the start of the inpatient encounter, for patients of all ages where at least one antidiabetic drug (ADD) was ordered or administered during the encounter that is during the measurement period."/>
                <criteria>
                  <language value="text/cql.identifier"/>
                  <expression value="Initial Population"/>
                </criteria>
              </population>
            </group>
            <supplementalData id="sde-chief-complaint">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Chief Complaint"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-condition">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Condition"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-condition-during-encounter">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Condition during Encounter"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-encounter-discharge-dispositions">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Encounter Discharge Dispositions"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-encounter-locations">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Encounter Locations"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-medication-administration">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Medication Administration"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-medication-request">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Medication Request"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-blood-glucose-observation">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Blood Glucose Observation"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-payer">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Payer"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-specimen">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Specimen"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-minimal-patient">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Minimal Patient"/>
              </criteria>
            </supplementalData>
            <supplementalData id="sde-minimal-medication-requests">
              <criteria>
                <language value="text/cql.identifier"/>
                <expression value="SDE Minimal Medication Requests"/>
              </criteria>
            </supplementalData>
          </Measure>
        </resource>
        <request>
          <method value="PUT"/>
          <url value="Measure/NHSNGlycemicControlHypoglycemicInitialPopulation"/>
        </request>
      </entry>
    </Bundle>