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 CMS55v1 Quality Measure ELM in JSON

    
{
   "library" : {
      "identifier" : {
         "id" : "CMS55",
         "version" : "1"
      },
      "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" : "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"
                  }
               },
               "high" : {
                  "type" : "DateTime",
                  "year" : {
                     "valueType" : "{urn:hl7-org:elm-types:r1}Integer",
                     "value" : "2015",
                     "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" : "Inpatient",
            "id" : "2.16.840.1.113883.3.666.5.307",
            "accessLevel" : "Public"
         }, {
            "name" : "Emergency Department Visit",
            "id" : "2.16.840.1.113883.3.117.1.7.1.293",
            "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" : "InpatientEncounters",
            "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" : "Inpatient",
                        "type" : "ValueSetRef"
                     }
                  }
               } ],
               "relationship" : [ ],
               "where" : {
                  "type" : "And",
                  "operand" : [ {
                     "type" : "LessOrEqual",
                     "operand" : [ {
                        "path" : "length",
                        "scope" : "E",
                        "type" : "Property"
                     }, {
                        "value" : 120,
                        "unit" : "days",
                        "type" : "Quantity"
                     } ]
                  }, {
                     "type" : "In",
                     "operand" : [ {
                        "type" : "End",
                        "operand" : {
                           "path" : "period",
                           "scope" : "E",
                           "type" : "Property"
                        }
                     }, {
                        "name" : "MeasurementPeriod",
                        "type" : "ParameterRef"
                     } ]
                  } ]
               }
            }
         }, {
            "name" : "EDEncounters",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "Query",
               "source" : [ {
                  "alias" : "ED",
                  "expression" : {
                     "dataType" : "{http://hl7.org/fhir}Encounter",
                     "templateId" : "encounter-qicore-qicore-encounter",
                     "codeProperty" : "type",
                     "type" : "Retrieve",
                     "codes" : {
                        "name" : "Emergency Department Visit",
                        "type" : "ValueSetRef"
                     }
                  }
               } ],
               "relationship" : [ {
                  "alias" : "E",
                  "type" : "With",
                  "expression" : {
                     "name" : "InpatientEncounters",
                     "type" : "ExpressionRef"
                  },
                  "suchThat" : {
                     "type" : "In",
                     "operand" : [ {
                        "type" : "End",
                        "operand" : {
                           "path" : "period",
                           "scope" : "ED",
                           "type" : "Property"
                        }
                     }, {
                        "lowClosed" : true,
                        "highClosed" : false,
                        "type" : "Interval",
                        "low" : {
                           "type" : "Subtract",
                           "operand" : [ {
                              "type" : "Start",
                              "operand" : {
                                 "path" : "period",
                                 "scope" : "E",
                                 "type" : "Property"
                              }
                           }, {
                              "value" : 1,
                              "unit" : "hour",
                              "type" : "Quantity"
                           } ]
                        },
                        "high" : {
                           "type" : "Start",
                           "operand" : {
                              "path" : "period",
                              "scope" : "E",
                              "type" : "Property"
                           }
                        }
                     } ]
                  }
               } ]
            }
         }, {
            "name" : "MeasureObservation",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "Query",
               "source" : [ {
                  "alias" : "E",
                  "expression" : {
                     "name" : "EDEncounters",
                     "type" : "ExpressionRef"
                  }
               } ],
               "relationship" : [ ],
               "where" : {
                  "type" : "And",
                  "operand" : [ {
                     "type" : "Not",
                     "operand" : {
                        "type" : "IsNull",
                        "operand" : {
                           "type" : "Start",
                           "operand" : {
                              "path" : "period",
                              "scope" : "E",
                              "type" : "Property"
                           }
                        }
                     }
                  }, {
                     "type" : "Not",
                     "operand" : {
                        "type" : "IsNull",
                        "operand" : {
                           "type" : "End",
                           "operand" : {
                              "path" : "period",
                              "scope" : "E",
                              "type" : "Property"
                           }
                        }
                     }
                  } ]
               },
               "return" : {
                  "expression" : {
                     "precision" : "Minute",
                     "type" : "DurationBetween",
                     "operand" : [ {
                        "type" : "Start",
                        "operand" : {
                           "path" : "period",
                           "scope" : "E",
                           "type" : "Property"
                        }
                     }, {
                        "type" : "End",
                        "operand" : {
                           "path" : "period",
                           "scope" : "E",
                           "type" : "Property"
                        }
                     } ]
                  }
               }
            }
         }, {
            "name" : "MeasureScore",
            "context" : "Population",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "Median",
               "source" : {
                  "type" : "Query",
                  "source" : [ {
                     "alias" : "X",
                     "expression" : {
                        "name" : "MeasureObservation",
                        "type" : "ExpressionRef"
                     }
                  } ],
                  "return" : {
                     "distinct" : false,
                     "expression" : {
                        "type" : "ToDecimal",
                        "operand" : {
                           "name" : "X",
                           "type" : "AliasRef"
                        }
                     }
                  }
               }
            }
         } ]
      }
   }
}