Using CQL with FHIR, published by HL7 International / Clinical Decision Support. This guide is not an authorized publication; it is the continuous build for version 1.1.0-cibuild built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/cql-ig/ and changes regularly. See the Directory of published versions
Page standards status: Trial-use | Maturity Level: 3 |
<OperationDefinition xmlns="http://hl7.org/fhir">
<id value="cql-cql"/>
<text>
<status value="extensions"/>
<div xmlns="http://www.w3.org/1999/xhtml"><p>URL: [base]/$cql</p><p>Parameters</p><table class="grid"><tr><td><b>Use</b></td><td><b>Name</b></td><td><b>Scope</b></td><td><b>Cardinality</b></td><td><b>Type</b></td><td><b>Binding</b></td><td><b>Documentation</b></td></tr><tr><td>IN</td><td>subject</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#string">string</a><br/>(<a href="http://hl7.org/fhir/R4/search.html#reference">reference</a>)</td><td/><td><div><p>Subject for which the expression will be evaluated. This corresponds to the context in which the expression will be evaluated and is represented as a relative FHIR id (e.g. Patient/123), which establishes both the context and context value for the evaluation</p>
</div></td></tr><tr><td>IN</td><td>expression</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#string">string</a></td><td/><td><div><p>Expression to be evaluated. Note that this is an expression of CQL, not the text of a library with definition statements.</p>
</div></td></tr><tr><td>IN</td><td>parameters</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/parameters.html">Parameters</a></td><td/><td><div><p>Any input parameters for the expression. Parameters defined in this input will be made available by name to the CQL expression. Parameter types are mapped to CQL as specified in the Using CQL section of this implementation guide. If a parameter appears more than once in the input Parameters resource, it is represented with a List in the input CQL. If a parameter has parts, it is represented as a Tuple in the input CQL.</p>
</div></td></tr><tr><td>IN</td><td>library</td><td/><td>0..*</td><td></td><td/><td><div><p>A library to be included. The library is resolved by url and made available by name within the expression to be evaluated.</p>
</div></td></tr><tr><td>IN</td><td>library.url</td><td/><td>1..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#canonical">canonical</a></td><td/><td><div><p>The canonical url (with optional version) of the library to be included</p>
</div></td></tr><tr><td>IN</td><td>library.name</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#string">string</a></td><td/><td><div><p>The name of the library to be used to reference the library within the CQL expression. If no name is provided, the name of the library will be used</p>
</div></td></tr><tr><td>IN</td><td>useServerData</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#boolean">boolean</a></td><td/><td><div><p>Whether to use data from the server performing the evaluation. If this parameter is true (the default), then the operation will use data first from any bundles provided as parameters (through the data and prefetch parameters), second data from the server performing the operation, and third, data from the dataEndpoint parameter (if provided). If this parameter is false, the operation will use data first from the bundles provided in the data or prefetch parameters, and second from the dataEndpoint parameter (if provided).</p>
</div></td></tr><tr><td>IN</td><td>data</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/bundle.html">Bundle</a></td><td/><td><div><p>Data to be made available to the library evaluation. This parameter is exclusive with the prefetchData parameter (i.e. either provide all data as a single bundle, or provide data using multiple bundles with prefetch descriptions).</p>
</div></td></tr><tr><td>IN</td><td>prefetchData</td><td/><td>0..*</td><td></td><td/><td><div><p>Data to be made available to the library evaluation, organized as prefetch response bundles. Each prefetchData parameter specifies either the name of the prefetchKey it is satisfying, a DataRequirement describing the prefetch, or both.</p>
</div></td></tr><tr><td>IN</td><td>prefetchData.key</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/datatypes.html#string">string</a></td><td/><td><div><p>The key of the prefetch item. When using this operation as part of a CDS Hooks implementation, this SHALL be the name of a prefetch item in a CDS Hooks discovery response. Prefetch data SHALL be made available to retrieve statements in the CQL and SHOULD NOT be provided as the value of any CQL parameters in the library being evaluated to avoid confusion between context parameters and retrieve data.</p>
</div></td></tr><tr><td>IN</td><td>prefetchData.descriptor</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/metadatatypes.html#DataRequirement">DataRequirement</a></td><td/><td><div><p>A DataRequirement describing the content of the prefetch item.</p>
</div></td></tr><tr><td>IN</td><td>prefetchData.data</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/bundle.html">Bundle</a></td><td/><td><div><p>The prefetch data as a Bundle. If this part is missing, it indicates there is no data associated with this prefetch item.</p>
</div></td></tr><tr><td>IN</td><td>dataEndpoint</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/endpoint.html">Endpoint</a></td><td/><td><div><p>An endpoint to use to access data referenced by retrieve operations in the library. If provided, this endpoint is used after the data or prefetchData bundles, and the server, if the useServerData parameter is true.</p>
</div></td></tr><tr><td>IN</td><td>contentEndpoint</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/endpoint.html">Endpoint</a></td><td/><td><div><p>An endpoint to use to access content (i.e. libraries) referenced by the library. If no content endpoint is supplied, the evaluation will attempt to retrieve content from the server on which the operation is being performed.</p>
</div></td></tr><tr><td>IN</td><td>terminologyEndpoint</td><td/><td>0..1</td><td><a href="http://hl7.org/fhir/R4/endpoint.html">Endpoint</a></td><td/><td><div><p>An endpoint to use to access terminology (i.e. valuesets, codesystems, and membership testing) referenced by the library. If no terminology endpoint is supplied, the evaluation will attempt to use the server on which the operation is being performed as the terminology server.</p>
</div></td></tr><tr><td>OUT</td><td>return</td><td/><td>1..*</td><td><a href="http://hl7.org/fhir/R4/resource.html">Resource</a></td><td/><td><div><p>The result of evaluating the given expression, returned as a FHIR Type following the mapping from <a href="conformance.html#fhir-type-mapping">CQL to FHIR</a> types. If the result is a list, the parameter will be repeated for each element in the list, with the special case that an empty list is represented with a parameter with a cqf-cqlType extension indicating the type of the result (e.g. List<Integer>) and the cqf-isEmptyList extension</p>
<p>Because the cardinality of the return parameter is 1..*, the result of the $cql evaluate will always be a Parameters resource.</p>
</div></td></tr></table></div>
</text>
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
<valueInteger value="3"/>
</extension>
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
<valueCode value="cds"/>
</extension>
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
<valueCode value="trial-use"/>
</extension>
<url value="http://hl7.org/fhir/uv/cql/OperationDefinition/cql-cql"/>
<version value="1.1.0-cibuild"/>
<name value="CQLCQL"/>
<title value="CQL CQL"/>
<status value="active"/>
<kind value="operation"/>
<experimental value="false"/>
<date value="2023-11-27T16:26:11+00:00"/>
<publisher value="HL7 International / Clinical Decision Support"/>
<contact>
<telecom>
<system value="url"/>
<value value="http://www.hl7.org/Special/committees/dss"/>
</telecom>
</contact>
<description
value="The $cql operation evaluates a CQL expression and returns the result. The operation has a single return parameter that can be of any type to accommodate the possible result types of a CQL expression."/>
<jurisdiction>
<coding>
<system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
<code value="001"/>
<display value="World"/>
</coding>
</jurisdiction>
<purpose
value="This operation is defined to support evaluating CQL expressions directly via an operation"/>
<affectsState value="false"/>
<code value="cql"/>
<system value="true"/>
<type value="false"/>
<instance value="false"/>
<parameter>
<name value="subject"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="Subject for which the expression will be evaluated. This corresponds to the context in which the expression will be evaluated and is represented as a relative FHIR id (e.g. Patient/123), which establishes both the context and context value for the evaluation"/>
<type value="string"/>
<searchType value="reference"/>
</parameter>
<parameter>
<name value="expression"/>
<use value="in"/>
<min value="1"/>
<max value="1"/>
<documentation
value="Expression to be evaluated. Note that this is an expression of CQL, not the text of a library with definition statements."/>
<type value="string"/>
</parameter>
<parameter>
<name value="parameters"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="Any input parameters for the expression. Parameters defined in this input will be made available by name to the CQL expression. Parameter types are mapped to CQL as specified in the Using CQL section of this implementation guide. If a parameter appears more than once in the input Parameters resource, it is represented with a List in the input CQL. If a parameter has parts, it is represented as a Tuple in the input CQL."/>
<type value="Parameters"/>
</parameter>
<parameter>
<name value="library"/>
<use value="in"/>
<min value="0"/>
<max value="*"/>
<documentation
value="A library to be included. The library is resolved by url and made available by name within the expression to be evaluated."/>
<part>
<name value="url"/>
<use value="in"/>
<min value="1"/>
<max value="1"/>
<documentation
value="The canonical url (with optional version) of the library to be included"/>
<type value="canonical"/>
</part>
<part>
<name value="name"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="The name of the library to be used to reference the library within the CQL expression. If no name is provided, the name of the library will be used"/>
<type value="string"/>
</part>
</parameter>
<parameter>
<name value="useServerData"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="Whether to use data from the server performing the evaluation. If this parameter is true (the default), then the operation will use data first from any bundles provided as parameters (through the data and prefetch parameters), second data from the server performing the operation, and third, data from the dataEndpoint parameter (if provided). If this parameter is false, the operation will use data first from the bundles provided in the data or prefetch parameters, and second from the dataEndpoint parameter (if provided)."/>
<type value="boolean"/>
</parameter>
<parameter>
<name value="data"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="Data to be made available to the library evaluation. This parameter is exclusive with the prefetchData parameter (i.e. either provide all data as a single bundle, or provide data using multiple bundles with prefetch descriptions)."/>
<type value="Bundle"/>
</parameter>
<parameter>
<name value="prefetchData"/>
<use value="in"/>
<min value="0"/>
<max value="*"/>
<documentation
value="Data to be made available to the library evaluation, organized as prefetch response bundles. Each prefetchData parameter specifies either the name of the prefetchKey it is satisfying, a DataRequirement describing the prefetch, or both."/>
<part>
<name value="key"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="The key of the prefetch item. When using this operation as part of a CDS Hooks implementation, this SHALL be the name of a prefetch item in a CDS Hooks discovery response. Prefetch data SHALL be made available to retrieve statements in the CQL and SHOULD NOT be provided as the value of any CQL parameters in the library being evaluated to avoid confusion between context parameters and retrieve data."/>
<type value="string"/>
</part>
<part>
<name value="descriptor"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="A DataRequirement describing the content of the prefetch item."/>
<type value="DataRequirement"/>
</part>
<part>
<name value="data"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="The prefetch data as a Bundle. If this part is missing, it indicates there is no data associated with this prefetch item."/>
<type value="Bundle"/>
</part>
</parameter>
<parameter>
<name value="dataEndpoint"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="An endpoint to use to access data referenced by retrieve operations in the library. If provided, this endpoint is used after the data or prefetchData bundles, and the server, if the useServerData parameter is true."/>
<type value="Endpoint"/>
</parameter>
<parameter>
<name value="contentEndpoint"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="An endpoint to use to access content (i.e. libraries) referenced by the library. If no content endpoint is supplied, the evaluation will attempt to retrieve content from the server on which the operation is being performed."/>
<type value="Endpoint"/>
</parameter>
<parameter>
<name value="terminologyEndpoint"/>
<use value="in"/>
<min value="0"/>
<max value="1"/>
<documentation
value="An endpoint to use to access terminology (i.e. valuesets, codesystems, and membership testing) referenced by the library. If no terminology endpoint is supplied, the evaluation will attempt to use the server on which the operation is being performed as the terminology server."/>
<type value="Endpoint"/>
</parameter>
<parameter>
<name value="return"/>
<use value="out"/>
<min value="1"/>
<max value="*"/>
<documentation
value="The result of evaluating the given expression, returned as a FHIR Type following the mapping from [CQL to FHIR](conformance.html#fhir-type-mapping) types. If the result is a list, the parameter will be repeated for each element in the list, with the special case that an empty list is represented with a parameter with a cqf-cqlType extension indicating the type of the result (e.g. List<Integer>) and the cqf-isEmptyList extension
Because the cardinality of the return parameter is 1..*, the result of the $cql evaluate will always be a Parameters resource."/>
<type value="Resource"/>
</parameter>
</OperationDefinition>