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
<?xml version="1.0" encoding="UTF-8"?>
<library xmlns="urn:hl7-org:elm:r1" xmlns:t="urn:hl7-org:elm-types:r1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fhir="http://hl7.org/fhir" xmlns:a="urn:hl7-org:cql-annotations:r1">
<annotation message="List-valued expression was demoted to a singleton." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
<annotation message="List-valued expression was demoted to a singleton." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
<annotation message="List-valued expression was demoted to a singleton." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
<annotation message="List-valued expression was demoted to a singleton." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
<identifier id="ChlamydiaScreening_CQM" version="2"/>
<schemaIdentifier id="urn:hl7-org:elm" version="r1"/>
<usings>
<def localIdentifier="System" uri="urn:hl7-org:elm-types:r1"/>
<def localIdentifier="QUICK" uri="http://hl7.org/fhir"/>
</usings>
<parameters>
<def name="MeasurementPeriod" accessLevel="Public">
<default lowClosed="true" highClosed="false" xsi:type="Interval">
<low xsi:type="DateTime">
<year valueType="t:Integer" value="2013" xsi:type="Literal"/>
<month valueType="t:Integer" value="1" xsi:type="Literal"/>
<day valueType="t:Integer" value="1" xsi:type="Literal"/>
<hour valueType="t:Integer" value="0" xsi:type="Literal"/>
<minute valueType="t:Integer" value="0" xsi:type="Literal"/>
<second valueType="t:Integer" value="0" xsi:type="Literal"/>
<millisecond valueType="t:Integer" value="0" xsi:type="Literal"/>
</low>
<high xsi:type="DateTime">
<year valueType="t:Integer" value="2014" xsi:type="Literal"/>
<month valueType="t:Integer" value="1" xsi:type="Literal"/>
<day valueType="t:Integer" value="1" xsi:type="Literal"/>
<hour valueType="t:Integer" value="0" xsi:type="Literal"/>
<minute valueType="t:Integer" value="0" xsi:type="Literal"/>
<second valueType="t:Integer" value="0" xsi:type="Literal"/>
<millisecond valueType="t:Integer" value="0" xsi:type="Literal"/>
</high>
</default>
</def>
</parameters>
<valueSets>
<def name="Female Administrative Sex" id="2.16.840.1.113883.3.560.100.2" accessLevel="Public"/>
<def name="Other Female Reproductive Conditions" id="2.16.840.1.113883.3.464.1003.111.12.1006" accessLevel="Public"/>
<def name="Genital Herpes" id="2.16.840.1.113883.3.464.1003.110.12.1049" accessLevel="Public"/>
<def name="Genococcal Infections and Venereal Diseases" id="2.16.840.1.113883.3.464.1003.112.12.1001" accessLevel="Public"/>
<def name="Inflammatory Diseases of Female Reproductive Organs" id="2.16.840.1.113883.3.464.1003.112.12.1004" accessLevel="Public"/>
<def name="Chlamydia" id="2.16.840.1.113883.3.464.1003.112.12.1003" accessLevel="Public"/>
<def name="HIV" id="2.16.840.1.113883.3.464.1003.120.12.1003" accessLevel="Public"/>
<def name="Syphilis" id="2.16.840.1.113883.3.464.1003.112.12.1002" accessLevel="Public"/>
<def name="Complications of Pregnancy, Childbirth and the Puerperium" id="2.16.840.1.113883.3.464.1003.111.12.1012" accessLevel="Public"/>
<def name="Pregnancy Test" id="2.16.840.1.113883.3.464.1003.111.12.1011" accessLevel="Public"/>
<def name="Pap Test" id="2.16.840.1.113883.3.464.1003.108.12.1017" accessLevel="Public"/>
<def name="Lab Tests During Pregnancy" id="2.16.840.1.113883.3.464.1003.111.12.1007" accessLevel="Public"/>
<def name="Lab Tests for Sexually Transmitted Infections" id="2.16.840.1.113883.3.464.1003.110.12.1051" accessLevel="Public"/>
<def name="Chlamydia Screening" id="2.16.840.1.113883.3.464.1003.110.12.1052" accessLevel="Public"/>
</valueSets>
<statements>
<def name="Patient" context="Patient">
<expression xsi:type="SingletonFrom">
<operand dataType="fhir:Patient" templateId="patient-qicore-qicore-patient" xsi:type="Retrieve"/>
</expression>
</def>
<def name="InDemographic" context="Patient" accessLevel="Public">
<expression xsi:type="And">
<operand xsi:type="And">
<operand xsi:type="GreaterOrEqual">
<operand precision="Year" xsi:type="CalculateAgeAt">
<operand path="birthDate" xsi:type="Property">
<source name="Patient" xsi:type="ExpressionRef"/>
</operand>
<operand xsi:type="Start">
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</operand>
</operand>
<operand valueType="t:Integer" value="16" xsi:type="Literal"/>
</operand>
<operand xsi:type="Less">
<operand precision="Year" xsi:type="CalculateAgeAt">
<operand path="birthDate" xsi:type="Property">
<source name="Patient" xsi:type="ExpressionRef"/>
</operand>
<operand xsi:type="Start">
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</operand>
</operand>
<operand valueType="t:Integer" value="24" xsi:type="Literal"/>
</operand>
</operand>
<operand xsi:type="InValueSet">
<code path="gender" xsi:type="Property">
<source name="Patient" xsi:type="ExpressionRef"/>
</code>
<valueset name="Female Administrative Sex"/>
</operand>
</expression>
</def>
<def name="SexuallyActive" context="Patient" accessLevel="Public">
<expression xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Or">
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression dataType="fhir:Condition" templateId="condition-qicore-qicore-condition" codeProperty="code" xsi:type="Retrieve">
<codes name="Other Female Reproductive Conditions" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="Overlaps">
<operand lowClosed="true" highClosed="true" xsi:type="Interval">
<low path="onsetDateTime" scope="C" xsi:type="Property"/>
<high path="abatementDate" scope="C" xsi:type="Property"/>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression dataType="fhir:Condition" templateId="condition-qicore-qicore-condition" codeProperty="code" xsi:type="Retrieve">
<codes name="Genital Herpes" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="Overlaps">
<operand lowClosed="true" highClosed="true" xsi:type="Interval">
<low path="onsetDateTime" scope="C" xsi:type="Property"/>
<high path="abatementDate" scope="C" xsi:type="Property"/>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression dataType="fhir:Condition" templateId="condition-qicore-qicore-condition" codeProperty="code" xsi:type="Retrieve">
<codes name="Genococcal Infections and Venereal Diseases" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="Overlaps">
<operand lowClosed="true" highClosed="true" xsi:type="Interval">
<low path="onsetDateTime" scope="C" xsi:type="Property"/>
<high path="abatementDate" scope="C" xsi:type="Property"/>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression dataType="fhir:Condition" templateId="condition-qicore-qicore-condition" codeProperty="code" xsi:type="Retrieve">
<codes name="Inflammatory Diseases of Female Reproductive Organs" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="Overlaps">
<operand lowClosed="true" highClosed="true" xsi:type="Interval">
<low path="onsetDateTime" scope="C" xsi:type="Property"/>
<high path="abatementDate" scope="C" xsi:type="Property"/>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression dataType="fhir:Condition" templateId="condition-qicore-qicore-condition" codeProperty="code" xsi:type="Retrieve">
<codes name="Chlamydia" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="Overlaps">
<operand lowClosed="true" highClosed="true" xsi:type="Interval">
<low path="onsetDateTime" scope="C" xsi:type="Property"/>
<high path="abatementDate" scope="C" xsi:type="Property"/>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression dataType="fhir:Condition" templateId="condition-qicore-qicore-condition" codeProperty="code" xsi:type="Retrieve">
<codes name="HIV" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="Overlaps">
<operand lowClosed="true" highClosed="true" xsi:type="Interval">
<low path="onsetDateTime" scope="C" xsi:type="Property"/>
<high path="abatementDate" scope="C" xsi:type="Property"/>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression dataType="fhir:Condition" templateId="condition-qicore-qicore-condition" codeProperty="code" xsi:type="Retrieve">
<codes name="Syphilis" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="Overlaps">
<operand lowClosed="true" highClosed="true" xsi:type="Interval">
<low path="onsetDateTime" scope="C" xsi:type="Property"/>
<high path="abatementDate" scope="C" xsi:type="Property"/>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression dataType="fhir:Condition" templateId="condition-qicore-qicore-condition" codeProperty="code" xsi:type="Retrieve">
<codes name="Complications of Pregnancy, Childbirth and the Puerperium" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="Overlaps">
<operand lowClosed="true" highClosed="true" xsi:type="Interval">
<low path="onsetDateTime" scope="C" xsi:type="Property"/>
<high path="abatementDate" scope="C" xsi:type="Property"/>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="O">
<expression dataType="fhir:DiagnosticOrder" templateId="diagnosticorder-qicore-qicore-diagnosticorder" codeProperty="item.code" xsi:type="Retrieve">
<codes name="Pregnancy Test" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="In">
<operand path="dateTime" xsi:type="Property">
<source xsi:type="Last">
<source xsi:type="Query">
<source alias="E">
<expression path="event" scope="O" xsi:type="Property"/>
</source>
<where xsi:type="Equal">
<operand path="status" scope="E" xsi:type="Property"/>
<operand valueType="t:String" value="completed" xsi:type="Literal"/>
</where>
<sort>
<by direction="asc" xsi:type="ByExpression">
<expression path="dateTime" scope="E" xsi:type="Property"/>
</by>
</sort>
</source>
</source>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="O">
<expression dataType="fhir:DiagnosticOrder" templateId="diagnosticorder-qicore-qicore-diagnosticorder" codeProperty="item.code" xsi:type="Retrieve">
<codes name="Pap Test" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="In">
<operand path="dateTime" xsi:type="Property">
<source xsi:type="Last">
<source xsi:type="Query">
<source alias="E">
<expression path="event" scope="O" xsi:type="Property"/>
</source>
<where xsi:type="Equal">
<operand path="status" scope="E" xsi:type="Property"/>
<operand valueType="t:String" value="completed" xsi:type="Literal"/>
</where>
<sort>
<by direction="asc" xsi:type="ByExpression">
<expression path="dateTime" scope="E" xsi:type="Property"/>
</by>
</sort>
</source>
</source>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="O">
<expression dataType="fhir:DiagnosticOrder" templateId="diagnosticorder-qicore-qicore-diagnosticorder" codeProperty="item.code" xsi:type="Retrieve">
<codes name="Lab Tests During Pregnancy" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="In">
<operand path="dateTime" xsi:type="Property">
<source xsi:type="Last">
<source xsi:type="Query">
<source alias="E">
<expression path="event" scope="O" xsi:type="Property"/>
</source>
<where xsi:type="Equal">
<operand path="status" scope="E" xsi:type="Property"/>
<operand valueType="t:String" value="completed" xsi:type="Literal"/>
</where>
</source>
</source>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</operand>
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="O">
<expression dataType="fhir:DiagnosticOrder" templateId="diagnosticorder-qicore-qicore-diagnosticorder" codeProperty="item.code" xsi:type="Retrieve">
<codes name="Lab Tests for Sexually Transmitted Infections" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="In">
<operand path="dateTime" xsi:type="Property">
<source xsi:type="Last">
<source xsi:type="Query">
<source alias="E">
<expression path="event" scope="O" xsi:type="Property"/>
</source>
<where xsi:type="Equal">
<operand path="status" scope="E" xsi:type="Property"/>
<operand valueType="t:String" value="completed" xsi:type="Literal"/>
</where>
</source>
</source>
</operand>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</operand>
</expression>
</def>
<def name="InInitialPopulation" context="Patient" accessLevel="Public">
<expression xsi:type="And">
<operand name="InDemographic" xsi:type="ExpressionRef"/>
<operand name="SexuallyActive" xsi:type="ExpressionRef"/>
</expression>
</def>
<def name="InDenominator" context="Patient" accessLevel="Public">
<expression valueType="t:Boolean" value="true" xsi:type="Literal"/>
</def>
<def name="InNumerator" context="Patient" accessLevel="Public">
<expression xsi:type="Exists">
<operand xsi:type="Query">
<source alias="R">
<expression dataType="fhir:DiagnosticReport" templateId="diagnosticreport-qicore-qicore-diagnosticreport" codeProperty="name" xsi:type="Retrieve">
<codes name="Chlamydia Screening" xsi:type="ValueSetRef"/>
</expression>
</source>
<where xsi:type="And">
<operand xsi:type="In">
<operand path="issued" scope="R" xsi:type="Property"/>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</operand>
<operand xsi:type="Not">
<operand xsi:type="IsNull">
<operand path="result" scope="R" xsi:type="Property"/>
</operand>
</operand>
</where>
</operand>
</expression>
</def>
<def name="MeasureScore" context="Population" accessLevel="Public">
<expression xsi:type="Multiply">
<operand xsi:type="Divide">
<operand xsi:type="ToDecimal">
<operand xsi:type="Count">
<source xsi:type="Query">
<source alias="P">
<expression name="Patient" xsi:type="ExpressionRef"/>
</source>
<where xsi:type="And">
<operand xsi:type="And">
<operand name="InInitialPopulation" xsi:type="ExpressionRef"/>
<operand name="InDenominator" xsi:type="ExpressionRef"/>
</operand>
<operand name="InNumerator" xsi:type="ExpressionRef"/>
</where>
</source>
</operand>
</operand>
<operand xsi:type="ToDecimal">
<operand xsi:type="Count">
<source xsi:type="Query">
<source alias="P">
<expression name="Patient" xsi:type="ExpressionRef"/>
</source>
<where xsi:type="And">
<operand name="InInitialPopulation" xsi:type="ExpressionRef"/>
<operand name="InDenominator" xsi:type="ExpressionRef"/>
</where>
</source>
</operand>
</operand>
</operand>
<operand xsi:type="ToDecimal">
<operand valueType="t:Integer" value="100" xsi:type="Literal"/>
</operand>
</expression>
</def>
</statements>
</library>