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">
<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"/>
<def localIdentifier="QUICK" uri="http://hl7.org/fhir"/>
</usings>
<includes>
<def localIdentifier="Common" path="ChlamydiaScreening_Common" version="2"/>
</includes>
<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>
<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="In Demographic" 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" libraryName="Common"/>
</operand>
</expression>
</def>
<def name="Sexually Active" context="Patient" accessLevel="Public">
<expression xsi:type="Or">
<operand xsi:type="Exists">
<operand xsi:type="Query">
<source alias="C">
<expression name="Conditions Indicating Sexual Activity" libraryName="Common" xsi:type="ExpressionRef"/>
</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="O">
<expression name="Laboratory Tests Indicating Sexual Activity" libraryName="Common" xsi:type="ExpressionRef"/>
</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>
</expression>
</def>
<def name="In Initial Population" context="Patient" accessLevel="Public">
<expression xsi:type="And">
<operand name="In Demographic" xsi:type="ExpressionRef"/>
<operand name="Sexually Active" xsi:type="ExpressionRef"/>
</expression>
</def>
<def name="In Denominator" context="Patient" accessLevel="Public">
<expression valueType="t:Boolean" value="true" xsi:type="Literal"/>
</def>
<def name="In Numerator" context="Patient" accessLevel="Public">
<expression xsi:type="Exists">
<operand xsi:type="Query">
<source alias="S">
<expression name="Results Present For Chlamydia Screening" libraryName="Common" xsi:type="ExpressionRef"/>
</source>
<where xsi:type="In">
<operand path="issued" scope="S" xsi:type="Property"/>
<operand name="MeasurementPeriod" xsi:type="ParameterRef"/>
</where>
</operand>
</expression>
</def>
</statements>
</library>