Group

Expressions

The core expression grammar covering all value-producing constructs including queries, retrieves, timing operators, and arithmetic.

alias

A local name bound to a query source within a query. The alias is an identifier that shadows the source expression and is used to refer to individual elements in subsequent query clauses.

aliasedQuerySource

A query source paired with an alias. The alias introduces a local name that can be used to reference elements of the source within the query's clauses, such as where and return.

caseExpressionItem

A single when/then branch within a case expression. The when expression is evaluated; if true (or equal to the case operand in a selected-case form), the then expression is returned as the result.

codeComparator

The comparison operator used to match a code path against a terminology in a retrieve expression. in tests value set membership, = tests code equality, and ~ tests equivalent matching.

codePath

A path expression identifying the element within the retrieved type that holds the code value. Used in retrieve expressions to navigate to the coding property of a clinical resource before comparing against terminology.

contextIdentifier

Specifies the evaluation context for a retrieve expression. When present, the retrieve is scoped to the specified context, such as a Patient or Practitioner, before the arrow operator narrows to the named type.

dateTimePrecision

A keyword identifying a singular date/time precision unit. Used in duration calculations, component extraction, and interval operator phrases to specify the granularity of a temporal operation.

dateTimeComponent

A keyword used with the from operator to extract a specific component from a date/time value. Includes all dateTimePrecision values plus date, time, timezoneoffset, and the deprecated timezone.

expression

The core expression grammar. Expressions encompass all value-producing constructs in CQL, from simple term references to complex timing and interval operations. Operator precedence is embedded in the grammar structure via the ordering of alternatives.

expressionTerm

An expression term is a basic unit of expression: a term (literal, identifier, function call, selector), optionally followed by member access, indexing, conversion, arithmetic, or conditional operators.

pluralDateTimePrecision

A keyword identifying a plural date/time precision unit. Used in duration between, difference between, expand, and collapse expressions where the plural form is grammatically required.

query

A query is the primary data retrieval and transformation construct in CQL. It includes a source clause, optional let clause, optional inclusion clauses (with/without), optional where clause, optional aggregate or return clause, and an optional sort clause.

queryInclusionClause

A with or without clause that joins or anti-joins an additional aliased query source into the query. Multiple inclusion clauses may appear in a single query.

querySource

The data source for a query. May be a retrieve expression, a qualified identifier referencing a previously defined expression, or a parenthesized expression. Forms the basis of an aliased query source.

retrieve

A retrieve expression queries the data source for clinical data of a specified type. An optional code path and terminology restrict the results. An optional context specifier narrows retrieval to a specific evaluation context.

terminology

The terminology value used in a retrieve expression to filter retrieved resources. May be a qualified identifier referencing a declared value set, code system, or code, or any expression that evaluates to a terminology value.

withoutClause

An anti-join inclusion clause that restricts the primary query to rows for which no row from the secondary source satisfies the such that condition. Equivalent to a semi-anti-join.

withClause

A join-style inclusion clause that restricts the primary query to rows for which at least one row from the secondary source satisfies the such that condition. Equivalent to a semi-join.