Clinical Quality Language Specification
1.5.3 - Release 1 Errata 2

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

Binary: Example CMS26v2 Quality Measure ELM in JSON

    
{
   "library" : {
      "identifier" : {
         "id" : "CMS26",
         "version" : "2"
      },
      "schemaIdentifier" : {
         "id" : "urn:hl7-org:elm",
         "version" : "r1"
      },
      "usings" : {
         "def" : [ {
            "localIdentifier" : "System",
            "uri" : "urn:hl7-org:elm-types:r1"
         }, {
            "localIdentifier" : "QUICK",
            "uri" : "http://hl7.org/fhir"
         } ]
      },
      "parameters" : {
         "def" : [ {
            "name" : "MeasurementPeriod",
            "accessLevel" : "Public",
            "default" : {
               "lowClosed" : true,
               "highClosed" : false,
               "type" : "Interval",
               "low" : {
                  "type" : "DateTime",
                  "year" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "2013",
                     "type" : "Literal"
                  },
                  "month" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "1",
                     "type" : "Literal"
                  },
                  "day" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "1",
                     "type" : "Literal"
                  },
                  "hour" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "0",
                     "type" : "Literal"
                  },
                  "minute" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "0",
                     "type" : "Literal"
                  },
                  "second" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "0",
                     "type" : "Literal"
                  },
                  "millisecond" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "0",
                     "type" : "Literal"
                  }
               },
               "high" : {
                  "type" : "DateTime",
                  "year" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "2014",
                     "type" : "Literal"
                  },
                  "month" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "1",
                     "type" : "Literal"
                  },
                  "day" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "1",
                     "type" : "Literal"
                  },
                  "hour" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "0",
                     "type" : "Literal"
                  },
                  "minute" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "0",
                     "type" : "Literal"
                  },
                  "second" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "0",
                     "type" : "Literal"
                  },
                  "millisecond" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "0",
                     "type" : "Literal"
                  }
               }
            }
         } ]
      },
      "valueSets" : {
         "def" : [ {
            "name" : "Asthma",
            "id" : "2.16.840.1.113883.3.117.1.7.1.271",
            "accessLevel" : "Public"
         }, {
            "name" : "Asthma Management Plan",
            "id" : "2.16.840.1.113883.3.117.1.7.1.131",
            "accessLevel" : "Public"
         }, {
            "name" : "Home Discharge Disposition",
            "id" : "TBD",
            "accessLevel" : "Public"
         }, {
            "name" : "Doctor",
            "id" : "TBD",
            "accessLevel" : "Public"
         } ]
      },
      "statements" : {
         "def" : [ {
            "name" : "Patient",
            "context" : "Patient",
            "expression" : {
               "type" : "SingletonFrom",
               "operand" : {
                  "dataType" : "{http://hl7.org/fhir}Patient",
                  "templateId" : "patient-qicore-qicore-patient",
                  "type" : "Retrieve"
               }
            }
         }, {
            "name" : "In Demographic",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "And",
               "operand" : [ {
                  "type" : "GreaterOrEqual",
                  "operand" : [ {
                     "precision" : "Year",
                     "type" : "CalculateAgeAt",
                     "operand" : [ {
                        "path" : "birthDate",
                        "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" : "LessOrEqual",
                  "operand" : [ {
                     "precision" : "Year",
                     "type" : "CalculateAgeAt",
                     "operand" : [ {
                        "path" : "birthDate",
                        "type" : "Property",
                        "source" : {
                           "name" : "Patient",
                           "type" : "ExpressionRef"
                        }
                     }, {
                        "type" : "Start",
                        "operand" : {
                           "name" : "MeasurementPeriod",
                           "type" : "ParameterRef"
                        }
                     } ]
                  }, {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "17",
                     "type" : "Literal"
                  } ]
               } ]
            }
         }, {
            "name" : "Asthma Encounters",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "Query",
               "source" : [ {
                  "alias" : "E",
                  "expression" : {
                     "dataType" : "{http://hl7.org/fhir}Encounter",
                     "templateId" : "encounter-qicore-qicore-encounter",
                     "codeProperty" : "type",
                     "type" : "Retrieve",
                     "codes" : {
                        "name" : "Asthma",
                        "type" : "ValueSetRef"
                     }
                  }
               } ],
               "relationship" : [ ],
               "where" : {
                  "type" : "And",
                  "operand" : [ {
                     "type" : "And",
                     "operand" : [ {
                        "type" : "And",
                        "operand" : [ {
                           "type" : "Equal",
                           "operand" : [ {
                              "path" : "class",
                              "scope" : "E",
                              "type" : "Property"
                           }, {
                              "valueType" : "{urn:hl7-org:elm-types:r1}String",
                              "value" : "inpatient",
                              "type" : "Literal"
                           } ]
                        }, {
                           "type" : "LessOrEqual",
                           "operand" : [ {
                              "path" : "length",
                              "scope" : "E",
                              "type" : "Property"
                           }, {
                              "value" : 120,
                              "unit" : "days",
                              "type" : "Quantity"
                           } ]
                        } ]
                     }, {
                        "type" : "InValueSet",
                        "code" : {
                           "path" : "dischargeDisposition",
                           "type" : "Property",
                           "source" : {
                              "path" : "hospitalization",
                              "scope" : "E",
                              "type" : "Property"
                           }
                        },
                        "valueset" : {
                           "name" : "Home Discharge Disposition"
                        }
                     } ]
                  }, {
                     "type" : "In",
                     "operand" : [ {
                        "type" : "End",
                        "operand" : {
                           "path" : "period",
                           "scope" : "E",
                           "type" : "Property"
                        }
                     }, {
                        "name" : "MeasurementPeriod",
                        "type" : "ParameterRef"
                     } ]
                  } ]
               }
            }
         }, {
            "name" : "Asthma Encounters with Plan",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "Query",
               "source" : [ {
                  "alias" : "E",
                  "expression" : {
                     "name" : "Asthma Encounters",
                     "type" : "ExpressionRef"
                  }
               } ],
               "relationship" : [ {
                  "alias" : "C",
                  "type" : "With",
                  "expression" : {
                     "dataType" : "{http://hl7.org/fhir}CommunicationRequest",
                     "templateId" : "communicationrequest-qicore-qicore-communicationrequest",
                     "type" : "Retrieve"
                  },
                  "suchThat" : {
                     "type" : "And",
                     "operand" : [ {
                        "type" : "And",
                        "operand" : [ {
                           "type" : "And",
                           "operand" : [ {
                              "type" : "Equal",
                              "operand" : [ {
                                 "path" : "id",
                                 "type" : "Property",
                                 "source" : {
                                    "strict" : false,
                                    "type" : "As",
                                    "operand" : {
                                       "path" : "encounter",
                                       "scope" : "C",
                                       "type" : "Property"
                                    },
                                    "asTypeSpecifier" : {
                                       "name" : "{http://hl7.org/fhir}Encounter",
                                       "type" : "NamedTypeSpecifier"
                                    }
                                 }
                              }, {
                                 "path" : "id",
                                 "scope" : "E",
                                 "type" : "Property"
                              } ]
                           }, {
                              "type" : "Exists",
                              "operand" : {
                                 "type" : "Query",
                                 "source" : [ {
                                    "alias" : "R",
                                    "expression" : {
                                       "path" : "reason",
                                       "scope" : "C",
                                       "type" : "Property"
                                    }
                                 } ],
                                 "relationship" : [ ],
                                 "where" : {
                                    "type" : "InValueSet",
                                    "code" : {
                                       "name" : "R",
                                       "type" : "AliasRef"
                                    },
                                    "valueset" : {
                                       "name" : "Asthma Management Plan"
                                    }
                                 }
                              }
                           } ]
                        }, {
                           "type" : "Exists",
                           "operand" : {
                              "type" : "Query",
                              "source" : [ {
                                 "alias" : "R",
                                 "expression" : {
                                    "path" : "practitionerRole",
                                    "type" : "Property",
                                    "source" : {
                                       "strict" : false,
                                       "type" : "As",
                                       "operand" : {
                                          "path" : "sender",
                                          "scope" : "C",
                                          "type" : "Property"
                                       },
                                       "asTypeSpecifier" : {
                                          "name" : "{http://hl7.org/fhir}Practitioner",
                                          "type" : "NamedTypeSpecifier"
                                       }
                                    }
                                 }
                              } ],
                              "relationship" : [ ],
                              "where" : {
                                 "type" : "InValueSet",
                                 "code" : {
                                    "path" : "role",
                                    "scope" : "R",
                                    "type" : "Property"
                                 },
                                 "valueset" : {
                                    "name" : "Doctor"
                                 }
                              }
                           }
                        } ]
                     }, {
                        "type" : "Equal",
                        "operand" : [ {
                           "path" : "id",
                           "type" : "Property",
                           "source" : {
                              "strict" : false,
                              "type" : "As",
                              "operand" : {
                                 "type" : "First",
                                 "source" : {
                                    "path" : "recipient",
                                    "scope" : "C",
                                    "type" : "Property"
                                 }
                              },
                              "asTypeSpecifier" : {
                                 "name" : "{http://hl7.org/fhir}Patient",
                                 "type" : "NamedTypeSpecifier"
                              }
                           }
                        }, {
                           "path" : "id",
                           "type" : "Property",
                           "source" : {
                              "strict" : false,
                              "type" : "As",
                              "operand" : {
                                 "path" : "subject",
                                 "scope" : "C",
                                 "type" : "Property"
                              },
                              "asTypeSpecifier" : {
                                 "name" : "{http://hl7.org/fhir}Patient",
                                 "type" : "NamedTypeSpecifier"
                              }
                           }
                        } ]
                     } ]
                  }
               } ]
            }
         }, {
            "name" : "In Initial Patient Population",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "And",
               "operand" : [ {
                  "name" : "In Demographic",
                  "type" : "ExpressionRef"
               }, {
                  "type" : "Exists",
                  "operand" : {
                     "name" : "Asthma Encounters",
                     "type" : "ExpressionRef"
                  }
               } ]
            }
         }, {
            "name" : "Denominator",
            "context" : "Population",
            "accessLevel" : "Public",
            "expression" : {
               "name" : "Asthma Encounters",
               "type" : "ExpressionRef"
            }
         }, {
            "name" : "Numerator",
            "context" : "Population",
            "accessLevel" : "Public",
            "expression" : {
               "name" : "Asthma Encounters with Plan",
               "type" : "ExpressionRef"
            }
         } ]
      }
   }
}