Using CQL With FHIR
3.0.0-ballot - STU 3 Ballot International flag

This page is part of the Using CQL with FHIR Implementation Guide (v3.0.0-ballot: STU 3 Ballot) based on FHIR (HL7® FHIR® Standard) R4. This version is a pre-release. The current official version is 2.0.0. For a full list of available versions, see the Directory of published versions

Library: CQL Example (Experimental)

Official URL: http://hl7.org/fhir/uv/cql/Library/CQLExample Version: 3.0.0-ballot
Standards status: Informative Computable Name: CQLExample
Other Identifiers: OID:2.16.840.1.113883.4.642.40.37.28.2

Example CQL Library illustrating the CQL Profile (a Library with only text/cql content)

Metadata
Title CQL Example
Version 3.0.0-ballot
Identifier urn:oid:2.16.840.1.113883.4.642.40.37.28.2
Experimental true
Jurisdiction World
Steward (Publisher) HL7 International / Clinical Decision Support
Description

Example CQL Library illustrating the CQL Profile (a Library with only text/cql content)

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Dependency Description: Library FHIRHelpers
Resource: FHIR Helpers version: 4.0.2-ballot
Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.2-ballot
Dependency Description: Code System LOINC
Resource: LOINC
Canonical URL: http://loinc.org
Data Requirement Type: Observation
Profile(s): Observation
Code Filter(s):
Path: code
Code(s): LOINC: 2339-0 (Glucose Bld-mCnc)
Parameters
Name Use Card. Type Documentation
GlucoseThreshold In 0..1 Quantity
Patient Out 0..1 Patient
Blood Glucose Observations Out 0..* Observation
Patient Interpreter Required (refined) Out 0..1 Patient
Library Content
CQL Content
library CQLExample

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.2-ballot'

codesystem LOINC: 'http://loinc.org'
code "Blood Glucose": '2339-0' from LOINC display 'Glucose Bld-mCnc'

parameter GlucoseThreshold Quantity

context Patient

define "Blood Glucose Observations":
  [Observation: "Blood Glucose"] BG
    where BG.value > GlucoseThreshold

define fluent function interpreterRequired(patient Patient):
  (singleton from (
    patient.extension E where E.url = 'http://hl7.org/fhir/StructureDefinition/patient-interpreterRequired'
  )).value as FHIR.boolean

define "Patient Interpreter Required (refined)":
  Patient P
    where P.interpreterRequired() is true
ELM JSON Content
Encoded data 
Generated using version 0.5.6-cibuild of the sample-content-ig Liquid templates