This page is part of the Using CQL with FHIR Implementation Guide (v1.0.0-snapshot: STU1 Draft) based on FHIR (HL7® FHIR® Standard) R4. . For a full list of available versions, see the Directory of published versions
Official URL: http://hl7.org/fhir/uv/cql/OperationDefinition/cql-cql | Version: 1.0.0-snapshot | |||
Standards status: Trial-use | Maturity Level: 3 | Computable Name: CQLCQL | ||
Other Identifiers: OID:2.16.840.1.113883.4.642.40.37.33.1 |
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.
This operation is defined to support evaluating CQL expressions directly via an operation
URL: [base]/$cql
Parameters
Use | Name | Scope | Cardinality | Type | Binding | Documentation |
IN | subject | 0..1 | string (reference) | 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 | ||
IN | expression | 1..1 | string | Expression to be evaluated. Note that this is an expression of CQL, not the text of a library with definition statements. | ||
IN | parameters | 0..1 | Parameters | 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. | ||
IN | library | 0..* | A library to be included. The library is resolved by url and made available by name within the expression to be evaluated. | |||
IN | library.url | 1..1 | canonical | The canonical url (with optional version) of the library to be included | ||
IN | library.name | 0..1 | string | 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 | ||
IN | useServerData | 0..1 | boolean | 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). | ||
IN | data | 0..1 | Bundle | 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). | ||
IN | prefetchData | 0..* | 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. | |||
IN | prefetchData.key | 0..1 | string | 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. | ||
IN | prefetchData.descriptor | 0..1 | DataRequirement | A DataRequirement describing the content of the prefetch item. | ||
IN | prefetchData.data | 0..1 | Bundle | The prefetch data as a Bundle. If this part is missing, it indicates there is no data associated with this prefetch item. | ||
IN | dataEndpoint | 0..1 | Endpoint | 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. | ||
IN | contentEndpoint | 0..1 | Endpoint | 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. | ||
IN | terminologyEndpoint | 0..1 | Endpoint | 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. | ||
OUT | return | 1..* | Resource | The result of evaluating the given expression, returned as a FHIR Type following the mapping from CQL to FHIR types (link to mapping). 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 no value but a cqlType extension indicating the type of the result (e.g. List<Integer>) and the cqf-isEmptyList extension (as defined in https://jira.hl7.org/browse/FHIR-43795) Because the cardinality of the return parameter is 1..*, this means the result of the $cql evaluate will always be a Parameters resource. |