Quality Measure Implementation Guide

This page is part of the Quality Measure STU2 for FHIR R4 Implementation Guide (v0.1.0: STU 1 Ballot 1) based on FHIR R3. The current version which supercedes this version is 3.0.0. For a full list of available versions, see the Directory of published versions

Library-library-supplemental-data-elements-FHIR

Formats: XML, JSON, Turtle

Id: Library/library-supplemental-data-elements-FHIR
Type: system: http://hl7.org/fhir/library-type
code: logic-library
Identifier: system: http://example.org/fhir/cqi/ecqm/Library/Identifier
value: SupplementalDataElements_FHIR
Version: 1.0.0
Title: Supplemental Data Elements FHIR
Status: active
Description: This library is used as an example in the FHIR Quality Measure Implementation Guide
Related:

type: depends-on

Resource:
reference: Library/library-fhir-helpers

Data Requirements:

type: Coverage

code filter:
path: type
valueset: https://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591

Content: type: text/cql
library SupplementalDataElements_FHIR version '1.0.0'

using FHIR version '3.0.0'

include FHIRHelpers version '3.0.0' called FHIRHelpers

valueset "ONC Administrative Sex": 'https://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1'
valueset "Race": 'https://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836'
valueset "Ethnicity": 'https://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837'
valueset "Payer": 'https://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591'

context Patient

define "SDE Ethnicity":
  ( 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 "SDE Payer":
  [Coverage: type in "Payer"] Payer
    return {
      code: Payer.type,
      period: Payer.period
    }

define "SDE Race":
  ( 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 "SDE Sex":
  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