Clinical Quality Language Specification, published by Clinical Decision Support WG. This guide is not an authorized publication; it is the continuous build for version 1.5.3 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/cql/ and changes regularly. See the Directory of published versions
{
"library" : {
"identifier" : {
"id" : "CMS146_QDM",
"version" : "2"
},
"schemaIdentifier" : {
"id" : "urn:hl7-org:elm",
"version" : "r1"
},
"usings" : {
"def" : [ {
"localIdentifier" : "System",
"uri" : "urn:hl7-org:elm-types:r1"
}, {
"localIdentifier" : "QDM",
"uri" : "urn:healthit-gov:qdm:v5_0_1_draft",
"version" : "5.0.2"
} ]
},
"parameters" : {
"def" : [ {
"name" : "MeasurementPeriod",
"accessLevel" : "Public",
"parameterTypeSpecifier" : {
"type" : "IntervalTypeSpecifier",
"pointType" : {
"name" : "{urn:hl7-org:elm-types:r1}DateTime",
"type" : "NamedTypeSpecifier"
}
}
} ]
},
"valueSets" : {
"def" : [ {
"name" : "Acute Pharyngitis",
"id" : "2.16.840.1.113883.3.464.1003.102.12.1011",
"accessLevel" : "Public"
}, {
"name" : "Acute Tonsillitis",
"id" : "2.16.840.1.113883.3.464.1003.102.12.1012",
"accessLevel" : "Public"
}, {
"name" : "Ambulatory/ED Visit",
"id" : "2.16.840.1.113883.3.464.1003.101.12.1061",
"accessLevel" : "Public"
}, {
"name" : "Antibiotic Medications",
"id" : "2.16.840.1.113883.3.464.1003.196.12.1001",
"accessLevel" : "Public"
}, {
"name" : "Group A Streptococcus Test",
"id" : "2.16.840.1.113883.3.464.1003.198.12.1012",
"accessLevel" : "Public"
} ]
},
"statements" : {
"def" : [ {
"name" : "Patient",
"context" : "Patient",
"expression" : {
"type" : "SingletonFrom",
"operand" : {
"dataType" : "{urn:healthit-gov:qdm:v5_0_1_draft}Patient",
"templateId" : "Patient",
"type" : "Retrieve"
}
}
}, {
"name" : "InDemographic",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "And",
"operand" : [ {
"type" : "GreaterOrEqual",
"operand" : [ {
"precision" : "Year",
"type" : "CalculateAgeAt",
"operand" : [ {
"path" : "birthDatetime",
"type" : "Property",
"source" : {
"name" : "Patient",
"type" : "ExpressionRef"
}
}, {
"type" : "Start",
"operand" : {
"name" : "MeasurementPeriod",
"type" : "ParameterRef"
}
} ]
}, {
"valueType" : "{urn:hl7-org:elm-types:r1}Integer",
"value" : "2",
"type" : "Literal"
} ]
}, {
"type" : "Less",
"operand" : [ {
"precision" : "Year",
"type" : "CalculateAgeAt",
"operand" : [ {
"path" : "birthDatetime",
"type" : "Property",
"source" : {
"name" : "Patient",
"type" : "ExpressionRef"
}
}, {
"type" : "Start",
"operand" : {
"name" : "MeasurementPeriod",
"type" : "ParameterRef"
}
} ]
}, {
"valueType" : "{urn:hl7-org:elm-types:r1}Integer",
"value" : "18",
"type" : "Literal"
} ]
} ]
}
}, {
"name" : "Pharyngitis",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Union",
"operand" : [ {
"dataType" : "{urn:healthit-gov:qdm:v5_0_1_draft}Diagnosis",
"type" : "Retrieve",
"codes" : {
"name" : "Acute Pharyngitis",
"type" : "ValueSetRef"
}
}, {
"dataType" : "{urn:healthit-gov:qdm:v5_0_1_draft}Diagnosis",
"type" : "Retrieve",
"codes" : {
"name" : "Acute Tonsillitis",
"type" : "ValueSetRef"
}
} ]
}
}, {
"name" : "Antibiotics",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Query",
"source" : [ {
"alias" : "M",
"expression" : {
"dataType" : "{urn:healthit-gov:qdm:v5_0_1_draft}MedicationOrder",
"templateId" : "PositiveMedicationOrder",
"codeProperty" : "code",
"type" : "Retrieve",
"codes" : {
"name" : "Antibiotic Medications",
"type" : "ValueSetRef"
}
}
} ],
"relationship" : [ ]
}
}, {
"name" : "isRelated",
"context" : "Patient",
"accessLevel" : "Public",
"type" : "FunctionDef",
"expression" : {
"type" : "Or",
"operand" : [ {
"type" : "Includes",
"operand" : [ {
"path" : "prevalencePeriod",
"type" : "Property",
"source" : {
"name" : "P",
"type" : "OperandRef"
}
}, {
"path" : "relevantPeriod",
"type" : "Property",
"source" : {
"name" : "E",
"type" : "OperandRef"
}
} ]
}, {
"type" : "In",
"operand" : [ {
"type" : "Start",
"operand" : {
"path" : "prevalencePeriod",
"type" : "Property",
"source" : {
"name" : "P",
"type" : "OperandRef"
}
}
}, {
"path" : "relevantPeriod",
"type" : "Property",
"source" : {
"name" : "E",
"type" : "OperandRef"
}
} ]
} ]
},
"operand" : [ {
"name" : "P",
"operandTypeSpecifier" : {
"name" : "{urn:healthit-gov:qdm:v5_0_1_draft}Diagnosis",
"type" : "NamedTypeSpecifier"
}
}, {
"name" : "E",
"operandTypeSpecifier" : {
"name" : "{urn:healthit-gov:qdm:v5_0_1_draft}EncounterPerformed",
"type" : "NamedTypeSpecifier"
}
} ]
}, {
"name" : "MeasurementPeriodEncounters",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Query",
"source" : [ {
"alias" : "E",
"expression" : {
"dataType" : "{urn:healthit-gov:qdm:v5_0_1_draft}EncounterPerformed",
"templateId" : "PositiveEncounterPerformed",
"codeProperty" : "code",
"type" : "Retrieve",
"codes" : {
"name" : "Ambulatory/ED Visit",
"type" : "ValueSetRef"
}
}
} ],
"relationship" : [ ],
"where" : {
"type" : "And",
"operand" : [ {
"name" : "InDemographic",
"type" : "ExpressionRef"
}, {
"type" : "IncludedIn",
"operand" : [ {
"path" : "relevantPeriod",
"scope" : "E",
"type" : "Property"
}, {
"name" : "MeasurementPeriod",
"type" : "ParameterRef"
} ]
} ]
}
}
}, {
"name" : "PharyngitisEncounters",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Query",
"source" : [ {
"alias" : "E",
"expression" : {
"name" : "MeasurementPeriodEncounters",
"type" : "ExpressionRef"
}
} ],
"relationship" : [ {
"alias" : "P",
"type" : "With",
"expression" : {
"name" : "Pharyngitis",
"type" : "ExpressionRef"
},
"suchThat" : {
"name" : "isRelated",
"type" : "FunctionRef",
"operand" : [ {
"name" : "P",
"type" : "AliasRef"
}, {
"name" : "E",
"type" : "AliasRef"
} ]
}
}, {
"alias" : "A",
"type" : "With",
"expression" : {
"name" : "Antibiotics",
"type" : "ExpressionRef"
},
"suchThat" : {
"type" : "In",
"operand" : [ {
"path" : "authorDatetime",
"scope" : "A",
"type" : "Property"
}, {
"lowClosed" : false,
"highClosed" : true,
"type" : "Interval",
"low" : {
"type" : "Start",
"operand" : {
"path" : "relevantPeriod",
"scope" : "E",
"type" : "Property"
}
},
"high" : {
"type" : "Add",
"operand" : [ {
"type" : "Start",
"operand" : {
"path" : "relevantPeriod",
"scope" : "E",
"type" : "Property"
}
}, {
"value" : 3,
"unit" : "days",
"type" : "Quantity"
} ]
}
} ]
}
} ]
}
}, {
"name" : "PharyngitisWithPriorAntibiotics",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Query",
"source" : [ {
"alias" : "P",
"expression" : {
"name" : "Pharyngitis",
"type" : "ExpressionRef"
}
} ],
"relationship" : [ {
"alias" : "A",
"type" : "With",
"expression" : {
"name" : "Antibiotics",
"type" : "ExpressionRef"
},
"suchThat" : {
"type" : "In",
"operand" : [ {
"path" : "authorDatetime",
"scope" : "A",
"type" : "Property"
}, {
"lowClosed" : true,
"highClosed" : false,
"type" : "Interval",
"low" : {
"type" : "Subtract",
"operand" : [ {
"type" : "Start",
"operand" : {
"path" : "prevalencePeriod",
"scope" : "P",
"type" : "Property"
}
}, {
"value" : 30,
"unit" : "days",
"type" : "Quantity"
} ]
},
"high" : {
"type" : "Start",
"operand" : {
"path" : "prevalencePeriod",
"scope" : "P",
"type" : "Property"
}
}
} ]
}
} ]
}
}, {
"name" : "ExcludedEncounters",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Query",
"source" : [ {
"alias" : "E",
"expression" : {
"name" : "PharyngitisEncounters",
"type" : "ExpressionRef"
}
} ],
"relationship" : [ {
"alias" : "P",
"type" : "With",
"expression" : {
"name" : "PharyngitisWithPriorAntibiotics",
"type" : "ExpressionRef"
},
"suchThat" : {
"name" : "isRelated",
"type" : "FunctionRef",
"operand" : [ {
"name" : "P",
"type" : "AliasRef"
}, {
"name" : "E",
"type" : "AliasRef"
} ]
}
} ]
}
}, {
"name" : "StrepTestEncounters",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Query",
"source" : [ {
"alias" : "E",
"expression" : {
"name" : "PharyngitisEncounters",
"type" : "ExpressionRef"
}
} ],
"relationship" : [ {
"alias" : "T",
"type" : "With",
"expression" : {
"dataType" : "{urn:healthit-gov:qdm:v5_0_1_draft}LaboratoryTestPerformed",
"templateId" : "PositiveLaboratoryTestPerformed",
"codeProperty" : "code",
"type" : "Retrieve",
"codes" : {
"name" : "Group A Streptococcus Test",
"type" : "ValueSetRef"
}
},
"suchThat" : {
"type" : "And",
"operand" : [ {
"type" : "Not",
"operand" : {
"type" : "IsNull",
"operand" : {
"path" : "result",
"scope" : "T",
"type" : "Property"
}
}
}, {
"type" : "In",
"operand" : [ {
"type" : "Start",
"operand" : {
"path" : "relevantPeriod",
"scope" : "T",
"type" : "Property"
}
}, {
"lowClosed" : true,
"highClosed" : true,
"type" : "Interval",
"low" : {
"type" : "Subtract",
"operand" : [ {
"type" : "Start",
"operand" : {
"path" : "relevantPeriod",
"scope" : "E",
"type" : "Property"
}
}, {
"value" : 3,
"unit" : "days",
"type" : "Quantity"
} ]
},
"high" : {
"type" : "Add",
"operand" : [ {
"type" : "End",
"operand" : {
"path" : "relevantPeriod",
"scope" : "E",
"type" : "Property"
}
}, {
"value" : 3,
"unit" : "days",
"type" : "Quantity"
} ]
}
} ]
} ]
}
} ]
}
}, {
"name" : "IPPCount",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Count",
"source" : {
"name" : "PharyngitisEncounters",
"type" : "ExpressionRef"
}
}
}, {
"name" : "DenominatorCount",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"name" : "IPPCount",
"type" : "ExpressionRef"
}
}, {
"name" : "DenominatorExclusionsCount",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Count",
"source" : {
"name" : "ExcludedEncounters",
"type" : "ExpressionRef"
}
}
}, {
"name" : "NumeratorCount",
"context" : "Patient",
"accessLevel" : "Public",
"expression" : {
"type" : "Count",
"source" : {
"type" : "Except",
"operand" : [ {
"name" : "StrepTestEncounters",
"type" : "ExpressionRef"
}, {
"name" : "ExcludedEncounters",
"type" : "ExpressionRef"
} ]
}
}
} ]
}
}
}