Metadata Title Example Computable Library Version 2.0.0 Identifier EXMComputableLogic Identifier urn:oid:2.16.840.1.113883.4.642.40.61.28.15 Approval Date 2019-08-03 Last Review Date 2019-08-03 Experimental true Jurisdiction Global (Whole world) Steward (Publisher) HL7 International / Clinical Quality Information Description This library is used as an example in the FHIR Quality Measure Implementation Guide Type Logic Library Parameter Name: Measurement Period Use: In Min Cardinality: 0 Max Cardinality: 1 Type: Period Parameter Name: Patient Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: Patient Parameter Name: Inpatient Encounter Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: Initial Population Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: Measure Population Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: Stratifier 1 Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: Stratifier 2 Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: Stratifier 3 Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: Stratifier 4 Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter Parameter Name: SDE Ethnicity Use: Out Min Cardinality: 0 Max Cardinality: * Type: Coding Parameter Name: SDE Payer Use: Out Min Cardinality: 0 Max Cardinality: * Type: Resource Parameter Name: SDE Race Use: Out Min Cardinality: 0 Max Cardinality: * Type: Coding Parameter Name: SDE Sex Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: Coding Data Requirement Type: Patient Profile(s): Patient Must Support Elements: url, extension, value Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: type, status, period, use, rank, rank.value, condition, condition.reference Code Filter(s): Path: type ValueSet: Emergency Department Visit Data Requirement Type: Encounter Profile(s): Encounter Must Support Elements: period, use, rank, rank.value, condition, condition.reference Data Requirement Type: Condition Profile(s): Condition Must Support Elements: id Code Filter(s): Path: id Data Requirement Type: Coverage Profile(s): Coverage Must Support Elements: type, period Code Filter(s): Path: type ValueSet: Payer Type Library Content CQL Content /*#xD; This example is purely for illustration purposes to show how all the elements of a#xD; FHIR-based quality measure are represented. It is intentionally simplified to show#xD; specific aspects of a measure, and is not intended as an example of a clinically#xD; meaningful measure.#xD; #xD; NOTE: This is the same library as EXMLogic, being used to illustrate the different flavors of profiles:#xD; * Computable: Focusing on computable/design-time aspects#xD; * Executable: Focusing on run-time aspects#xD; * Publishable: Focusing on knowledge management aspects#xD; */#xD; library EXMComputableLibrary version '2.0.0'#xD; #xD; using FHIR version '4.0.1'#xD; #xD; include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' called FHIRHelpers#xD; #xD; codesystem "Diagnosis Role": 'http://terminology.hl7.org/CodeSystem/diagnosis-role'#xD; #xD; valueset "Emergency Department Visit" : 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'#xD; valueset "Psychiatric/Mental Health Patient" : 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.299'#xD; valueset "Hospital Settings" : 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.126'#xD; #xD; valueset "ONC Administrative Sex": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1'#xD; valueset "Race": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.836'#xD; valueset "Ethnicity": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.837'#xD; valueset "Payer": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591'#xD; #xD; code "Billing": 'billing' from "Diagnosis Role" display 'Billing'#xD; #xD; parameter "Measurement Period" Interval<DateTime>#xD; #xD; context Patient#xD; #xD; define "Initial Population" :#xD; "Inpatient Encounter" Encounter#xD; #xD; define "Measure Population" :#xD; "Initial Population"#xD; #xD; define function "Measure Observation" (Encounter "Encounter" ) :#xD; duration in minutes of "Related ED Visit"(Encounter).period#xD; #xD; define "Stratifier 1" :#xD; "Inpatient Encounter" Encounter#xD; where not (PrincipalDiagnosis(Encounter).code in "Psychiatric/Mental Health Patient")#xD; #xD; define "Stratifier 2" :#xD; "Inpatient Encounter" Encounter#xD; where PrincipalDiagnosis(Encounter).code in "Psychiatric/Mental Health Patient"#xD; #xD; define "Stratifier 3" :#xD; "Inpatient Encounter" Encounter#xD; where PrincipalDiagnosis(Encounter) is null#xD; #xD; define "Stratifier 4" :#xD; "Inpatient Encounter" Encounter#xD; where PrincipalDiagnosis(Encounter) is null#xD; #xD; define "Inpatient Encounter" :#xD; ["Encounter"] Encounter#xD; where LengthInDays(Encounter.period) <= 120#xD; and Encounter.period ends during "Measurement Period"#xD; #xD; define function "PrincipalDiagnosis"(Encounter Encounter):#xD; (singleton from (Encounter.diagnosis D where D.use ~ ToConcept("Billing") and D.rank.value = 1)) PD#xD; return singleton from ([Condition: id in "GetId"(PD.condition.reference)])#xD; #xD; define function "LengthInDays"(Value Interval<DateTime>):#xD; difference in days between start of Value and end of Value#xD; #xD; define function "GetId"(uri String):#xD; Last(Split(uri, '/'))#xD; #xD; //Measure Observation#xD; define function "Related ED Visit" (Encounter "Encounter" ) :#xD; Last(["Encounter" : "Emergency Department Visit"] ED#xD; where ED.status = 'finished'#xD; and ED.period ends 1 hour or less before start of Encounter.period#xD; sort by start of period )#xD; #xD; define "SDE Ethnicity":#xD; (flatten (#xD; Patient.extension Extension#xD; where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'#xD; return Extension.extension#xD; )) E#xD; where E.url = 'ombCategory'#xD; or E.url = 'detailed'#xD; return E.value as Coding#xD; #xD; define "SDE Payer":#xD; [Coverage: type in "Payer"] Payer#xD; return {#xD; code: Payer.type,#xD; period: Payer.period#xD; }#xD; #xD; define "SDE Race":#xD; (flatten (#xD; Patient.extension Extension#xD; where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'#xD; return Extension.extension#xD; )) E#xD; where E.url = 'ombCategory'#xD; or E.url = 'detailed'#xD; return E.value as Coding#xD; #xD; define "SDE Sex":#xD; case#xD; when Patient.gender = 'male' then Code { code: 'M', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Male' }#xD; when Patient.gender = 'female' then Code { code: 'F', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Female' }#xD; else null#xD; end#xD; ELM XML Content Encoded data (118716 characters) ELM JSON Content Encoded data (210892 characters) Generated using version 0.4.9 of the sample-content-ig Liquid templates
HL7 International / Clinical Quality Information
This library is used as an example in the FHIR Quality Measure Implementation Guide
Value set Psychiatric/Mental Health Patient