Metadata
Title | NHSN Glycemic Control Hypoglycemia Initial Population
Version | 0.0.003
Short Name | NHSNHypoglycemia
GUID (Version Independent) | urn:uuid:0d555fb6-f654-418c-a2b3-2dd0c3f0e7b4
GUID (Version Specific) | urn:uuid:dc9459ed-48ca-45f3-923e-3352d9547461
Effective Period | 2026-01-01 through 2026-12-31
Use Context | org.hl7.fhir.r5.model.UsageContext@b756dae
Steward (Publisher) | Centers for Disease Control and Prevention (CDC)
Developer | Lantana Consulting Group
Description | 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 diabetes medication was ordered or administered during the encounter that is during the measurement period.
Purpose | The primary objective of the NHSN Glycemic Control module is to measure and benchmark medication-related hypoglycemia and hyperglycemia events within a facility. NHSN uses line-level data on medications and blood glucose reported by facilities to provide analytic reports to inform quality-improvement efforts for glycemic control and track patient safety events. As NHSN collects additional data, an additional objective will be to allow inter-facility benchmarking and evaluate national-level trends of medication-related hypoglycemia over time.
Copyright | Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets.
Disclaimer | Disclaimer 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. This measure and specifications are subject to further revisions.
Rationale | The NHSN Glycemic Control module supports an electronic health record (EHR)- and vendor-neutral standard for reporting patient-level, linked medication and blood glucose data for inpatients. These data support calculation of inpatient medication-related hypoglycemia events by the NHSN application, which are then returned as reports to the facility.
Clinical Recommendation Statement | Inpatient hypoglycemia can be severe and life-threatening and is associated with longer hospital stays and increased medical costs (Wexler et al., 2007; Curkendall et al., 2009; Cook et al., 2009; Turchin et al., 2009; Egi et al., 2010). The prevalence of inpatient hypoglycemia varies with patient, hospital unit, timing of episodes, and glycemic threshold. Severe hypoglycemia (<40 mg/dL) occurs in 2%–5% of hospitalized patients with diabetes mellitus (DM), while hypoglycemia <70 mg/dL has been reported in up to 10% of all patients in the intensive care unit (Finfer et al., 2012). Patients with DM comprise more than 25% of all U.S. inpatient stays and medication-related hypoglycemia events are common causes of adverse drug events (ADEs) that occur in inpatient settings (Bates et al., 2023; Spector et al., 2017). Rates of severe hypoglycemia vary across hospitals, suggesting opportunities for improvement in glycemic-control quality of care (Hulkower et al., 2014; ADA, 2013; Cook et al., 2009). Inpatient hyperglycemia can increase morbidity, prolong hospital stays, and increase the risk of mortality (Maynard et al., 2014; SHM, n.d.; Umpierrez et al., 2002; Kyi et al., 2019; Pratiwi et al., 2021). The prevalence of inpatient hyperglycemia varies depending upon glycemic threshold and setting, but blood glucose >140 mg/dL likely occurs in approximately one-eighth to one-quarter of hospitalized patients (Pratiwi et al., 2021; Seisa et al., 2022; Barmanray et al., 2024). Tracking patient blood-glucose levels and implementing appropriate interventions may reduce complications associated with both hyperglycemia and hypoglycemia (ADA, 2013; Cook et al., 2009; Korytkowski et al., 2022; Moghissi et al., 2009).
Citation | American Diabetes Association. Economic costs of diabetes in the U.S. in 2012. Diabetes Care 2013;36:1033–46.
Citation | Bates, D. W., Levine, D. M., Salmasian, H., et al. (2023). The safety of inpatient health care. New England Journal of Medicine, 388(12), 142–153.
Citation | Classen, D. C., Resar, R., Griffin, F., et al. (2011). 'Global trigger tool' shows that adverse events in hospitals may be ten times greater than previously measured. Health Affairs, 30(4), 581–589.
Citation | Cook, C. B., Kongable, G. L., Potter, D. J., et al. (2009). Inpatient glucose control: A glycemic survey of 126 U.S. hospitals. Journal of Hospital Medicine, 4(E7), E7–E14.
Citation | Curkendall, S. M., Natoli, J. L., Alexander, C. M., et al. (2009). Economic and clinical impact of inpatient diabetic hypoglycemia. Endocrine Practice, 15(3), 302–312.
Citation | Egi, M., Bellomo, R., Stachowski, E., et al. (2010). Hypoglycemia and outcome in critically ill patients. Mayo Clinic Proceedings, 85(3), 217–224.
Citation | Finfer, S., Liu, B., Chittock, D. R., et al. (2012). Hypoglycemia and risk of death in critically ill patients. New England Journal of Medicine, 367, 1108–1118.
Citation | Gates, P. J., Meyerson, S. A., Baysari, M. T., et al. (2018). Preventable adverse drug events among inpatients: A systematic review. Pediatrics, 142, e20180805.
Citation | Hulkower RD, Pollack RM, Zonszein J. Understanding hypoglycemia in hospitalized patients. Diabetes Manag (Lond) 2014;4:165-76.
Citation | Maynard, G., et al. (2014). How sweet is it? The use of benchmarking to optimize inpatient glycemic control. Diabetes Spectrum, 27, 212–217.
Citation | Moghissi ES, Korytkowski MT, DiNardo M. American Association of Clinical Endocrinologists and American Diabetes Association consensus statement on inpatient glycemic control. Endocr Pract 2009;15:353-69.
Citation | Society of Hospital Medicine. Glycemic Control for Hospitalists. Optimizing Care, Preventing Hypoglycemia. Available at: https://www.hospitalmedicine.org/clinical-topics/glycemic-control.
Citation | Spector, W. D., Limcangco, R., Furukawa, M. F., Encinosa, W. E. (2017). The marginal costs of adverse drug events associated with exposures to anticoagulants and hypoglycemic agents during hospitalization. Medical Care, 55(8), 856–863.
Citation | Turchin, A., Matheny, M. E., Shubina, M., et al. (2009). Hypoglycemia and clinical outcomes in patients with diabetes hospitalized in the general ward. Diabetes Care, 32(7), 1153–1157.
Citation | Umpierrez, G. E., Isaacs, S. D., Bazargan, N., et al. (2002). Hyperglycemia: An independent marker of in-hospital mortality in patients with undiagnosed diabetes. Journal of Clinical Endocrinology & Metabolism, 87(3), 978–982.
Citation | Wexler, D. J., et al. (2007). Prevalence of hyper- and hypoglycemia among inpatients with diabetes: A national survey of 44 U.S. hospitals. Diabetes Care, 30(2), 367–369.
Definition | Blood glucose: Blood-glucose data refers to data from random, periprandial, or fasting tests; from capillary, serum, plasma, interstitial fluid, or whole-blood sources; using central laboratory device (CLD) or point-of-care (POC) testing. Data from continuous glucose monitoring (CGM) systems can only be captured if they are integrated into the EHR and exposed in the corresponding FHIR resources. Post-glucose administration tests are excluded. Events are based on the day/time the laboratory test was collected (drawn). If day/time collected is not available, the day/time the lab was ordered is used.
Definition | Emergency department (ED)/Observation (Obs) encounter: Any patient visit to an ED or observation location. One (1) patient visit equals one (1) encounter. ED/Observation encounters are considered outpatient locations.
Definition | Hypoglycemic medication: All currently and previously commercially available oral or injectable hypoglycemic medications in the United States.
Definition | Inpatient encounter: Includes all encounters in inpatient locations.
Definition | Mild hypoglycemia event: Blood glucose 54.0 mg/dL to 69.9 mg/dL as identified on CLD or prescription POC device with no subsequent repeat test for blood glucose with a result > 80 mg/dL within 5 minutes of the start of the initial low blood glucose test.
Definition | Moderate hypoglycemia event: Blood glucose 40.0 mg/dL to 53.9 mg/dL as identified on CLD or prescription POC device with no subsequent repeat test for blood glucose with a result > 80 mg/dL within 5 minutes of the start of the initial low blood glucose test.
Definition | Severe hypoglycemia event: Blood glucose < 40.0 mg/dL as identified on CLD or prescription POC device with no subsequent repeat test for blood glucose with a result > 80 mg/dL within 5 minutes of the start of the initial low blood glucose test.
Guidance (Usage) | All participating inpatient facilities reporting data to the NHSN Glycemic Control module must be able to report data electronically in adherence to HL7 FHIR US Core FHIR R4.0.1 data standards and specifications and NHSN instructions for reporting dQMs, including the HL7 NHSN dQM Reporting Implementation Guide (https://build.fhir.org/ig/HL7/nhsn-dqm/).
Measure Group (Rate) (ID: Group_1)
Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#cohort: 'Cohort']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#process: 'Process']
Initial Population | ID: InitialPopulation_1 Description: 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 diabetes medication was ordered or administered during the encounter that is during the measurement period. Logic Definition: Initial Population
Supplemental Data Guidance | Supplemental Data
Supplemental Data Elements
Supplemental Data Element | ID: sde-encounter-locations Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Encounter Locations Logic Definition: SDE Encounter Locations
Supplemental Data Element | ID: sde-location Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Location Logic Definition: SDE Location
Supplemental Data Element | ID: sde-medication Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Medication Logic Definition: SDE Medication
Supplemental Data Element | ID: sde-blood-glucose-observation Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Blood Glucose Observation Logic Definition: SDE Blood Glucose Observation
Supplemental Data Element | ID: sde-chief-complaint Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Chief Complaint Logic Definition: SDE Chief Complaint
Supplemental Data Element | ID: sde-condition Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Condition Logic Definition: SDE Condition
Supplemental Data Element | ID: sde-coverage Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Coverage Logic Definition: SDE Coverage
Supplemental Data Element | ID: sde-initial-population-encounters Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Initial Population Encounters Logic Definition: SDE Initial Population Encounters
Supplemental Data Element | ID: sde-medication-administration Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Medication Administration Logic Definition: SDE Medication Administration
Supplemental Data Element | ID: sde-medication-request Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Medication Request Logic Definition: SDE Medication Request
Supplemental Data Element | ID: sde-minimal-patient Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Minimal Patient Logic Definition: SDE Minimal Patient
Supplemental Data Element | ID: sde-service-request Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Service Request Logic Definition: SDE Service Request
Supplemental Data Element | ID: sde-ethnicity Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Ethnicity Logic Definition: SDE Ethnicity
Supplemental Data Element | ID: sde-payer Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Payer Logic Definition: SDE Payer
Supplemental Data Element | ID: sde-race Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Race Logic Definition: SDE Race
Supplemental Data Element | ID: sde-sex Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Sex Logic Definition: SDE Sex
Measure Logic
Primary Library | https://madie.cms.gov/Library/NHSNGlycemicControlHypoglycemiaInitialPopulation
Contents | Population Criteria Logic Definitions Terminology Dependencies Data Requirements
Population Criteria
Measure Group (Rate) (ID: Group_1)
Initial Population
    // Initial Population

    define "Initial Population":
      ( "Inpatient Encounters During Measurement Period"
        union "Encounters with Patient Hospital Locations" ) InpatientEncounters
        with "Antidiabetic Drugs Administered or Ordered" ADD
          such that Coalesce(start of ADD.effective.toInterval(), ADD.authoredOn) during InpatientEncounters."hospitalizationWithObservation" ( )
        where ( InpatientEncounters.status = 'finished'
            or InpatientEncounters.status = 'in-progress'
            or InpatientEncounters.status = 'triaged'
            or InpatientEncounters.status = 'onleave'
            or InpatientEncounters.status = 'entered-in-error'
        )
Logic Definitions
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Race":
      Patient.race R
        return Tuple {
          codes: R.ombCategory union R.detailed,
          display: R.text
        }
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Sex":
      case
        when Patient.sex = '248153007' then "Male (finding)"
        when Patient.sex = '248152002' then "Female (finding)"
        else null
      end
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Payer":
      [Coverage: type in "Payer Type"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Ethnicity":
      Patient.ethnicity E
        return Tuple {
          codes: { E.ombCategory } union E.detailed,
          display: E.text
        }
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the Location resource specified by the given reference.
    */
    define fluent function getLocation(reference Reference):
      singleton from (
        [Location] L where reference.references(L)
      )
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the medication code for the given MedicationRequest
    */
    define fluent function getMedicationCode(request MedicationRequest):
      if request.medication is Concept then
      	  request.medication as Concept
      	else
      	  (singleton from ([Medication] M where request.medication.references(M))).code
Logic Definition | Library Name: CQMCommon
    /*
    @description: 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 fluent function hospitalizationWithObservation(TheEncounter Encounter ):
      TheEncounter Visit
      		let ObsVisit: Last([Encounter: "Observation Services"] LastObs
      				where LastObs.status = 'finished'
                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: "Emergency Department Visit"] LastED
      				where LastED.status = 'finished'
                and 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]
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
    value to a CQL DateTime Interval
    @comment: If the start value of the given period is unspecified, the starting
    boundary of the resulting interval will be open (meaning the start of the interval
    is unknown, as opposed to interpreted as the beginning of time).
    */
    define function ToInterval(period FHIR.Period):
        if period is null then
            null
        else
            if period."start" is null then
                Interval(period."start".value, period."end".value]
            else
                Interval[period."start".value, period."end".value]
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
    */
    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
            }
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
    */
    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
            }
Logic Definition | Library Name: FHIRHelpers
    define function ToString(value uri): value.value
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "Inpatient Encounters During Measurement Period":
      [Encounter: "Encounter Inpatient"] InpatientEncounters
        where InpatientEncounters.period ends during day of "Measurement Period"
          and ( InpatientEncounters.class ~ QICoreCommon."inpatient non-acute"
              or InpatientEncounters.class ~ QICoreCommon."inpatient non-acute"
              or InpatientEncounters.class ~ QICoreCommon."short stay"
              or InpatientEncounters.class ~ QICoreCommon."inpatient acute"
              or InpatientEncounters.class ~ QICoreCommon."inpatient encounter"
          )
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "Encounters with Patient Hospital Locations":
      "Inpatient Encounters During Measurement Period" InpatientEncounter
        where exists ( InpatientEncounter.location HospitalLocation
            where HospitalLocation.location.getLocation ( ).type in "Inpatient, Emergency, and Observation Locations"
              and HospitalLocation.period during day of InpatientEncounter.period
        )
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "MedicationRequests":
      [MedicationRequest]
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "MedicationAdministrations":
      [MedicationAdministration]
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "Antidiabetic Drugs Administered or Ordered":
      ( "MedicationRequests"
        union "MedicationAdministrations" ) MedReqOrAdmin
        where Coalesce(MedReqOrAdmin.getMedicationCode(), MedReqOrAdmin.getMedicationAdministrationCode()) in "Diabetes Medications"
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    // Initial Population

    define "Initial Population":
      ( "Inpatient Encounters During Measurement Period"
        union "Encounters with Patient Hospital Locations" ) InpatientEncounters
        with "Antidiabetic Drugs Administered or Ordered" ADD
          such that Coalesce(start of ADD.effective.toInterval(), ADD.authoredOn) during InpatientEncounters."hospitalizationWithObservation" ( )
        where ( InpatientEncounters.status = 'finished'
            or InpatientEncounters.status = 'in-progress'
            or InpatientEncounters.status = 'triaged'
            or InpatientEncounters.status = 'onleave'
            or InpatientEncounters.status = 'entered-in-error'
        )
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Coverage":
      [Coverage] Coverages
        where exists ( "Initial Population" IP
            where Coverages.period starts before or on day of IP.period
              and end of Coverages.period on or after day of end of IP.period
        )
        return { Coverages.id, Coverages.meta, Coverages.status, Coverages.type, Coverages.policyHolder, Coverages.subscriber, Coverages.subscriberId, Coverages.beneficiary, Coverages.dependent, Coverages.relationship, Coverages.period, Coverages.payor, Coverages.class, Coverages.order, Coverages.network, Coverages.subrogation, Coverages.contract }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Medication Request":
      "MedicationRequests" MedRequests
        where exists ( "Initial Population" InitialPopulation
            where MedRequests.authoredOn during InitialPopulation."hospitalizationWithObservation" ( )
        )
        return { MedRequests.id, MedRequests.meta, MedRequests.status, MedRequests.statusReason, MedRequests.intent, MedRequests.category, MedRequests.priority, MedRequests.doNotPerform, MedRequests.reported, MedRequests.medication, MedRequests.subject, MedRequests.encounter, MedRequests.authoredOn, MedRequests.requester, MedRequests.recorder, MedRequests.reasonCode, MedRequests.reasonReference, MedRequests.instantiatesCanonical, MedRequests.instantiatesUri, MedRequests.courseOfTherapyType, MedRequests.dosageInstruction }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Encounter Locations":
      "Initial Population" IP
        where exists ( IP.location InitialPopulationLocation
            let types: ( InitialPopulationLocation.location ).getLocation ( ).type
            where exists ( types type
                where type in "Inpatient, Emergency, and Observation Locations"
            )
              and InitialPopulationLocation.period during IP.period
        )
        return { IP.id, IP.meta, IP.identifier, IP.status, IP.statusHistory, IP.class, IP.classHistory, IP.type, IP.serviceType, IP.priority, IP.subject, IP.period, IP.length, IP.reasonCode, IP.reasonReference, IP.diagnosis, IP.account, IP.hospitalization, IP.location, IP.partOf }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Race":
      SDE."SDE Race"
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Medication Administration":
      "MedicationAdministrations" MedAdministrations
        where exists ( "Initial Population" InitialPopulation
            where MedAdministrations.effective.toInterval ( ) overlaps InitialPopulation."hospitalizationWithObservation" ( )
        )
        return { MedAdministrations.id, MedAdministrations.meta, MedAdministrations.instantiates, MedAdministrations.partOf, MedAdministrations.status, MedAdministrations.statusReason, MedAdministrations.category, MedAdministrations.medication, MedAdministrations.subject, MedAdministrations.context, MedAdministrations.supportingInformation, MedAdministrations.effective, MedAdministrations.performer, MedAdministrations.reasonCode, MedAdministrations.reasonReference, MedAdministrations.request, MedAdministrations.device, MedAdministrations.note, MedAdministrations.dosage }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Sex":
      SDE."SDE Sex"
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Initial Population Encounters":
      "Initial Population" IP
        return { IP.id, IP.meta, IP.identifier, IP.status, IP.statusHistory, IP.class, IP.classHistory, IP.type, IP.serviceType, IP.priority, IP.subject, IP.period, IP.length, IP.reasonCode, IP.reasonReference, IP.diagnosis, IP.account, IP.hospitalization, IP.location, IP.partOf }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    //Supplemental Data Elements

    define "SDE Blood Glucose Observation":
      ( ["LaboratoryResultObservation": "Blood Glucose Laboratory and Point of Care Tests"] GlucoseTest
          where exists ( "Initial Population" InitialPopulation
              where start of GlucoseTest.effective.toInterval ( ) during day of InitialPopulation.period
                or GlucoseTest.issued during day of InitialPopulation.period
          )
          return { GlucoseTest.id, GlucoseTest.extension, GlucoseTest.text, GlucoseTest.referenceRange, GlucoseTest.component, GlucoseTest.basedOn, GlucoseTest.partOf, GlucoseTest.category, GlucoseTest.status, GlucoseTest.subject, GlucoseTest.focus, GlucoseTest.encounter, GlucoseTest.effective, GlucoseTest.issued, GlucoseTest.performer, GlucoseTest.value, GlucoseTest.dataAbsentReason, GlucoseTest.interpretation, GlucoseTest.note, GlucoseTest.bodySite, GlucoseTest.method, GlucoseTest.specimen, GlucoseTest.device, GlucoseTest.hasMember, GlucoseTest.derivedFrom }
      )
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Condition":
      ["ConditionProblemsHealthConcerns"] Diagnosis
        where exists ( "Initial Population" IP
            where Diagnosis.prevalenceInterval ( ) overlaps day of IP.period
        )
        return { Diagnosis.id, Diagnosis.meta, Diagnosis.clinicalStatus, Diagnosis.verificationStatus, Diagnosis.category, Diagnosis.severity, Diagnosis.code, Diagnosis.bodySite, Diagnosis.subject, Diagnosis.encounter.reference.getId ( ), Diagnosis.onset, Diagnosis.stage, Diagnosis.evidence, Diagnosis.note }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Payer":
      SDE."SDE Payer"
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "Get Locations from Initial Population":
      flatten ( "Initial Population" IP
          let locationElements: IP.location
          return locationElements LE
            let locationReference: LE.location
            return ( locationReference.getLocation ( ) )
      )
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Location":
      "Get Locations from Initial Population" Locations
        where exists "Initial Population"
          and Locations is not null
        return { Locations.id, Locations.meta, Locations.extension, Locations.status, Locations.operationalStatus, Locations.name, Locations.alias, Locations.description, Locations.mode, Locations.type, Locations.telecom, Locations.address, Locations.physicalType, Locations.position, Locations.managingOrganization, Locations.partOf, Locations.hoursOfOperation, Locations.availabilityExceptions, Locations.endpoint }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Service Request":
      [ServiceRequest] ServiceRequests
        where exists ( "Initial Population" InitialPopulation
            where ServiceRequests.authoredOn during InitialPopulation.period
        )
        return { ServiceRequests.id, ServiceRequests.meta, ServiceRequests.instantiatesCanonical, ServiceRequests.instantiatesUri, ServiceRequests.basedOn, ServiceRequests.replaces, ServiceRequests.requisition, ServiceRequests.status, ServiceRequests.intent, ServiceRequests.category, ServiceRequests.priority, ServiceRequests.doNotPerform, ServiceRequests.code, ServiceRequests.orderDetail, ServiceRequests.quantity, ServiceRequests.subject, ServiceRequests.encounter, ServiceRequests.occurrence, ServiceRequests.asNeeded, ServiceRequests.authoredOn, ServiceRequests.requester, ServiceRequests.performerType, ServiceRequests.performer, ServiceRequests.locationCode, ServiceRequests.reasonCode, ServiceRequests.reasonReference, ServiceRequests.insurance, ServiceRequests.bodySite, ServiceRequests.note, ServiceRequests.patientInstruction }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Minimal Patient":
      [Patient] MinPt
        where exists "Initial Population"
        return { MinPt.id, MinPt.meta, MinPt.extension, MinPt.identifier, MinPt.active, MinPt.name, MinPt.telecom, MinPt.gender, MinPt.birthDate, MinPt.deceased, MinPt.address, MinPt.maritalStatus, MinPt.multipleBirth, MinPt.photo, MinPt.contact, MinPt.communication, MinPt.generalPractitioner, MinPt.managingOrganization, MinPt.link }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Medication":
      ( "MedicationRequests"
        union "MedicationAdministrations" ) MedReqOrAdmin
        let medication: GetMedication(MedReqOrAdmin.medication as Reference)
        where medication is not null
          and exists ( "Initial Population" IP
              where Coalesce(MedReqOrAdmin.effective.toInterval(), MedReqOrAdmin.authoredOn.toInterval()) overlaps IP."hospitalizationWithObservation" ( )
          )
        return { medication.id, medication.meta, medication.code, medication.status, medication.manufacturer, medication.form, medication.amount, medication.ingredient, medication.batch }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define "SDE Chief Complaint":
      "Initial Population" IP
        where exists ( IP.diagnosis InitialPopulationDiagnosis
            where InitialPopulationDiagnosis.use ~ QICoreCommon."CC"
        )
        return { IP.id, IP.meta, IP.identifier, IP.status, IP.statusHistory, IP.class, IP.classHistory, IP.type, IP.serviceType, IP.priority, IP.subject, IP.period, IP.length, IP.reasonCode, IP.reasonReference, IP.diagnosis, IP.account, IP.hospitalization, IP.location, IP.partOf }
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define fluent function getMedicationAdministrationCode(admin MedicationAdministration):
      if admin.medication is Concept then admin.medication as Concept
        else ( singleton from ( [Medication] M
            where admin.medication.references ( M )
        )
      ).code
Logic Definition | Library Name: NHSNGlycemicControlHypoglycemiaInitialPopulation
    define function "GetMedication"(reference Reference):
      singleton from ( [Medication] Medication
          where reference.references ( Medication )
      )
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if the given reference is to the given resource
    @comment: Returns true if the `id` element of the given resource exactly equals the tail of the given reference.
    NOTE: This function assumes resources from the same source server.
    */
    define fluent function references(reference Reference, resource Resource):
      resource.id = Last(Split(reference.reference, '/'))
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns an interval representing the normalized prevalence period of a given Condition.
    @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
    onset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting
    interval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary.
    */
    define fluent function prevalenceInterval(condition Choice<"ConditionEncounterDiagnosis", "ConditionProblemsHealthConcerns">):
    if condition.clinicalStatus ~ "active"
      or condition.clinicalStatus ~ "recurrence"
      or condition.clinicalStatus ~ "relapse" then
      Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
    else
        (end of condition.abatementInterval()) abatementDate
        return if abatementDate is null then
          Interval[start of condition.onset.toInterval(), abatementDate)
        else
          Interval[start of condition.onset.toInterval(), abatementDate]
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns an interval representing the normalized abatement of a given Condition.
    @comment: If the abatement element of the Condition is represented as a DateTime, the result
    is an interval beginning and ending on that DateTime.
    If the abatement is represented as a Quantity, the quantity is expected to be a calendar-duration and is interpreted as the age of the patient. The
    result is an interval from the date the patient turned that age to immediately before one year later.
    If the abatement is represented as a Quantity Interval, the quantities are expected to be calendar-durations and are interpreted as an age range during
    which the abatement occurred. The result is an interval from the date the patient turned the starting age of the quantity interval, and ending immediately
    before one year later than the date the patient turned the ending age of the quantity interval.
    */
    define fluent function abatementInterval(condition Choice<"ConditionEncounterDiagnosis", "ConditionProblemsHealthConcerns">):
    	if condition.abatement is DateTime then
    	  Interval[condition.abatement as DateTime, condition.abatement as DateTime]
    	else if condition.abatement is Quantity then
    		Interval[Patient.birthDate + (condition.abatement as Quantity),
    			Patient.birthDate + (condition.abatement as Quantity) + 1 year)
    	else if condition.abatement is Interval<Quantity> then
    	  Interval[Patient.birthDate + (condition.abatement.low as Quantity),
    		  Patient.birthDate + (condition.abatement.high as Quantity) + 1 year)
    	else if condition.abatement is Interval<DateTime> then
    	  Interval[condition.abatement.low, condition.abatement.high)
    	else null as Interval<DateTime>
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).
    @comment: This function can be used to determine the logical id of a given resource. It can be used in
    a single-server environment to trace references. However, this function does not attempt to resolve
    or distinguish the base of the given url, and so cannot be used safely in multi-server environments.
    */
    define fluent function getId(uri String):
      Last(Split(uri, '/'))
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
    @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> 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 QICore, allowing this function to be used across any resource.
    The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>.
    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 Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,
    and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.
    If the input is a DateTime Interval, the result is the input.
    If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result
    is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending
    immediately before one year later than the date the patient turned the age given as the end of the quantity interval.
    If the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval
    */
    define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>, Timing>):
      case
    	  when choice is DateTime then
        	Interval[choice as DateTime, choice as DateTime]
    		when choice is Interval<DateTime> then
      		choice as Interval<DateTime>
    		when choice is Quantity then
    		  Interval[Patient.birthDate + (choice as Quantity),
    			  Patient.birthDate + (choice as Quantity) + 1 year)
    		when choice is Interval<Quantity> then
    		  Interval[Patient.birthDate + (choice.low as Quantity),
    			  Patient.birthDate + (choice.high as Quantity) + 1 year)
    		when choice is Timing then
          Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval<DateTime>
    		else
    			null as Interval<DateTime>
    	end
Terminology
Code System | Description: Code system ActCode Resource: http://terminology.hl7.org/CodeSystem/v3-ActCode Canonical URL: `http://terminology.hl7.org/CodeSystem/v3-ActCode`
Code System | Description: Code system SNOMEDCT Resource: http://snomed.info/sct Canonical URL: `http://snomed.info/sct`
Code System | Description: Code system ConditionClinicalStatusCodes Resource: http://terminology.hl7.org/CodeSystem/condition-clinical Canonical URL: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Code System | Description: Code system Diagnosis Role Resource: http://terminology.hl7.org/CodeSystem/diagnosis-role Canonical URL: `http://terminology.hl7.org/CodeSystem/diagnosis-role`
Value Set | Description: Value set Encounter Inpatient Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307`
Value Set | Description: Value set Inpatient, Emergency, and Observation Locations Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1046.265`
Value Set | Description: Value set Diabetes Medications Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.58 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.58`
Value Set | Description: Value set Observation Services Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143`
Value Set | Description: Value set Emergency Department Visit Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292`
Value Set | Description: Value set Blood Glucose Laboratory and Point of Care Tests Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38`
Value Set | Description: Value set Payer Type Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591`
Direct Reference Code | Display: inpatient non-acute Code: NONAC System: `http://terminology.hl7.org/CodeSystem/v3-ActCode`
Direct Reference Code | Display: short stay Code: SS System: `http://terminology.hl7.org/CodeSystem/v3-ActCode`
Direct Reference Code | Display: inpatient acute Code: ACUTE System: `http://terminology.hl7.org/CodeSystem/v3-ActCode`
Direct Reference Code | Display: inpatient encounter Code: IMP System: `http://terminology.hl7.org/CodeSystem/v3-ActCode`
Direct Reference Code | Display: Male (finding) Code: 248153007 System: `http://snomed.info/sct`
Direct Reference Code | Display: Female (finding) Code: 248152002 System: `http://snomed.info/sct`
Direct Reference Code | Display: Active Code: active System: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Direct Reference Code | Display: Recurrence Code: recurrence System: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Direct Reference Code | Display: Relapse Code: relapse System: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Direct Reference Code | Display: Chief complaint Code: CC System: `http://terminology.hl7.org/CodeSystem/diagnosis-role`
Dependencies
Dependency | Description: QICore model information Resource: http://hl7.org/fhir/Library/QICore-ModelInfo Canonical URL: `http://hl7.org/fhir/Library/QICore-ModelInfo`
Dependency | Description: Library FHIRHelpers Resource: https://madie.cms.gov/Library/FHIRHelpers|4.4.000 Canonical URL: `https://madie.cms.gov/Library/FHIRHelpers|4.4.000`
Dependency | Description: Library QICoreCommon Resource: https://madie.cms.gov/Library/QICoreCommon|4.0.000 Canonical URL: `https://madie.cms.gov/Library/QICoreCommon|4.0.000`
Dependency | Description: Library CQMCommon Resource: https://madie.cms.gov/Library/CQMCommon|4.1.000 Canonical URL: `https://madie.cms.gov/Library/CQMCommon|4.1.000`
Dependency | Description: Library SDE Resource: https://madie.cms.gov/Library/SupplementalDataElements|5.1.000 Canonical URL: `https://madie.cms.gov/Library/SupplementalDataElements|5.1.000`
Data Requirements
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, status, status.value, period, location, id, id.value, meta, identifier, statusHistory, class, classHistory, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, partOf Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, status, status.value, period, location, id, id.value, meta, identifier, statusHistory, class, classHistory, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, partOf Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, period, class, status, status.value, location, id, id.value, meta, identifier, statusHistory, classHistory, serviceType, priority, subject, length, reasonCode, reasonReference, diagnosis, account, hospitalization, partOf Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Data Requirement | Type: Resource Profile(s): http://hl7.org/fhir/StructureDefinition/Resource Must Support Elements: id, id.value
Data Requirement | Type: Location Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-location Must Support Elements: id, id.value, meta, extension, status, status.value, operationalStatus, name, name.value, alias, description, description.value, mode, mode.value, type, telecom, address, physicalType, position, managingOrganization, partOf, hoursOfOperation, availabilityExceptions, availabilityExceptions.value, endpoint
Data Requirement | Type: MedicationRequest Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest Must Support Elements: medication, authoredOn, authoredOn.value, id, id.value, meta, status, status.value, statusReason, intent, intent.value, category, priority, priority.value, doNotPerform, doNotPerform.value, reported, subject, encounter, requester, recorder, reasonCode, reasonReference, instantiatesCanonical, instantiatesUri, courseOfTherapyType, dosageInstruction
Data Requirement | Type: MedicationAdministration Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration Must Support Elements: medication, effective, id, id.value, meta, instantiates, partOf, status, status.value, statusReason, category, subject, context, supportingInformation, performer, reasonCode, reasonReference, request, device, note, dosage
Data Requirement | Type: Medication Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication Must Support Elements: code
Data Requirement | Type: Coverage Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage Must Support Elements: period, id, id.value, meta, status, status.value, type, policyHolder, subscriber, subscriberId, subscriberId.value, beneficiary, dependent, dependent.value, relationship, payor, class, order, order.value, network, network.value, subrogation, subrogation.value, contract
Data Requirement | Type: Coverage Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage Must Support Elements: type, period Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Data Requirement | Type: Patient Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient Must Support Elements: url, extension, birthDate, birthDate.value, id, id.value, meta, identifier, active, active.value, name, telecom, gender, gender.value, deceased, address, maritalStatus, multipleBirth, photo, contact, communication, generalPractitioner, managingOrganization, link
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab Must Support Elements: code, effective, issued, issued.value, id, id.value, extension, text, referenceRange, component, basedOn, partOf, category, status, status.value, subject, focus, encounter, performer, value, dataAbsentReason, interpretation, note, bodySite, method, specimen, device, hasMember, derivedFrom Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1190.38
Data Requirement | Type: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns Must Support Elements: id, id.value, meta, clinicalStatus, verificationStatus, category, severity, code, bodySite, subject, encounter, encounter.reference, encounter.reference.value, onset, stage, evidence, note
Data Requirement | Type: ServiceRequest Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest Must Support Elements: authoredOn, authoredOn.value, id, id.value, meta, instantiatesCanonical, instantiatesUri, basedOn, replaces, requisition, status, status.value, intent, intent.value, category, priority, priority.value, doNotPerform, doNotPerform.value, code, orderDetail, quantity, subject, encounter, occurrence, asNeeded, requester, performerType, performer, locationCode, reasonCode, reasonReference, insurance, bodySite, note, patientInstruction, patientInstruction.value
Generated using version 0.4.8 of the sample-content-ig Liquid templates