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: Chlamydia Screening Quality Measure (using Common) ELM in JSON

    
{
   "library" : {
      "identifier" : {
         "id" : "ChlamydiaScreening_CQM_UsingCommon",
         "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"
         } ]
      },
      "includes" : {
         "def" : [ {
            "localIdentifier" : "Common",
            "path" : "ChlamydiaScreening_Common",
            "version" : "2"
         } ]
      },
      "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"
                  }
               }
            }
         } ]
      },
      "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" : "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" : "16",
                        "type" : "Literal"
                     } ]
                  }, {
                     "type" : "Less",
                     "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" : "24",
                        "type" : "Literal"
                     } ]
                  } ]
               }, {
                  "type" : "InValueSet",
                  "code" : {
                     "path" : "gender",
                     "type" : "Property",
                     "source" : {
                        "name" : "Patient",
                        "type" : "ExpressionRef"
                     }
                  },
                  "valueset" : {
                     "name" : "Female Administrative Sex",
                     "libraryName" : "Common"
                  }
               } ]
            }
         }, {
            "name" : "Sexually Active",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "Or",
               "operand" : [ {
                  "type" : "Exists",
                  "operand" : {
                     "type" : "Query",
                     "source" : [ {
                        "alias" : "C",
                        "expression" : {
                           "name" : "Conditions Indicating Sexual Activity",
                           "libraryName" : "Common",
                           "type" : "ExpressionRef"
                        }
                     } ],
                     "relationship" : [ ],
                     "where" : {
                        "type" : "Overlaps",
                        "operand" : [ {
                           "lowClosed" : true,
                           "highClosed" : true,
                           "type" : "Interval",
                           "low" : {
                              "path" : "onsetDateTime",
                              "scope" : "C",
                              "type" : "Property"
                           },
                           "high" : {
                              "path" : "abatementDate",
                              "scope" : "C",
                              "type" : "Property"
                           }
                        }, {
                           "name" : "MeasurementPeriod",
                           "type" : "ParameterRef"
                        } ]
                     }
                  }
               }, {
                  "type" : "Exists",
                  "operand" : {
                     "type" : "Query",
                     "source" : [ {
                        "alias" : "O",
                        "expression" : {
                           "name" : "Laboratory Tests Indicating Sexual Activity",
                           "libraryName" : "Common",
                           "type" : "ExpressionRef"
                        }
                     } ],
                     "relationship" : [ ],
                     "where" : {
                        "type" : "In",
                        "operand" : [ {
                           "path" : "dateTime",
                           "type" : "Property",
                           "source" : {
                              "type" : "Last",
                              "source" : {
                                 "type" : "Query",
                                 "source" : [ {
                                    "alias" : "E",
                                    "expression" : {
                                       "path" : "event",
                                       "scope" : "O",
                                       "type" : "Property"
                                    }
                                 } ],
                                 "relationship" : [ ],
                                 "where" : {
                                    "type" : "Equal",
                                    "operand" : [ {
                                       "path" : "status",
                                       "scope" : "E",
                                       "type" : "Property"
                                    }, {
                                       "valueType" : "{urn:hl7-org:elm-types:r1}String",
                                       "value" : "completed",
                                       "type" : "Literal"
                                    } ]
                                 },
                                 "sort" : {
                                    "by" : [ {
                                       "direction" : "asc",
                                       "type" : "ByExpression",
                                       "expression" : {
                                          "path" : "dateTime",
                                          "scope" : "E",
                                          "type" : "Property"
                                       }
                                    } ]
                                 }
                              }
                           }
                        }, {
                           "name" : "MeasurementPeriod",
                           "type" : "ParameterRef"
                        } ]
                     }
                  }
               } ]
            }
         }, {
            "name" : "In Initial Population",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "And",
               "operand" : [ {
                  "name" : "In Demographic",
                  "type" : "ExpressionRef"
               }, {
                  "name" : "Sexually Active",
                  "type" : "ExpressionRef"
               } ]
            }
         }, {
            "name" : "In Denominator",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "valueType" : "{urn:hl7-org:elm-types:r1}Boolean",
               "value" : "true",
               "type" : "Literal"
            }
         }, {
            "name" : "In Numerator",
            "context" : "Patient",
            "accessLevel" : "Public",
            "expression" : {
               "type" : "Exists",
               "operand" : {
                  "type" : "Query",
                  "source" : [ {
                     "alias" : "S",
                     "expression" : {
                        "name" : "Results Present For Chlamydia Screening",
                        "libraryName" : "Common",
                        "type" : "ExpressionRef"
                     }
                  } ],
                  "relationship" : [ ],
                  "where" : {
                     "type" : "In",
                     "operand" : [ {
                        "path" : "issued",
                        "scope" : "S",
                        "type" : "Property"
                     }, {
                        "name" : "MeasurementPeriod",
                        "type" : "ParameterRef"
                     } ]
                  }
               }
            }
         } ]
      }
   }
}