Skip to content

Well Known CQL Documentation Tags

Bryn Rhodes edited this page Sep 1, 2022 · 11 revisions

Well-known CQL Documentation Tags:

This list documents well-known CQL documentation tags, with the intent of standardizing these among implementations to provide consistent usage. See the Tags feature of CQL 1.5 for more information.

Example

/*
@author: Ludwig van Beethoven
@description: Determines the cumulative duration of a list of intervals
@comment: This function collapses the input intervals prior to determining the cumulative duration
to ensure overlapping intervals do not contribute multiple times to the result
 */
define function "CumulativeDuration"(Intervals List<Interval<DateTime>>):
  Sum((collapse Intervals) X return all duration in days of X)

Tag Index

allowFluent

true or false, indicates whether functions defined in the library are allowed to be accessed as "fluent" functions (i.e. invoked as object-oriented style methods with the first argument applied as the target of the invocation). This tag is used in the FHIRHelpers library to provide support for externally implemented FHIRPath functions that must be backwards compatible with the 1.4 translator, where fluent invocation of FHIRPath functions was implicit.

NOTE: This tag is only required for backwards-compatibility applications. It is not required to be present to make use of fluent functions in a 1.5 library and should NOT be used in those cases, as it is effectively enabling the 1.5 feature of fluent functions in 1.4 CQL.

Applicable on: library

author

Describes the author of the construct.

Applicable on: any top-level element

code

A code that provides meaning for the construct.

/*
@code: http://snomed.info/sct#12345
*/

On whether to use a slash, a hash, or a pipe, note that using a pipe is the mechanism used in code-valued parameters in FHIR search strings, however, hash is the mechanism used in this proposal, as well as FHIR Shorthand, and avoids the issue of ambiguous meaning of the pipe qualified value (canonical artifact version or code in the code system?)

Discussed on CDS committee, maybe hash is more appropriate? (Not ambiguous)

Applicable on: any top-level element

comment

A longer comment.

Applicable on: any top-level element

deprecated

Indicates that the declaration on which it appears is deprecated and will be removed from a future version of the library.

The tag can be used without a value as a simple indicator that the declaration is deprecated. If a value is present for the tag, it is a message that should be included in the deprecation warning that any tooling creates to provide documentation for the intended replacement, if any.

/*
@deprecated
*/
define function GetCondition(conditionId String)
  ...
/*
@deprecated: Use the fluent function `getCondition` instead
*/
define function GetCondition(conditionId String)
  ...

Applicable on: any top-level element

description

A short description of the construct.

Applicable on: any top-level element

extension

A canonical url (typically version-independent) that specifies the extension that this function is provided access to. Typically used on fluent functions to provide documentation of the extension being surfaced.

/*
@description: Surfaces the [birthsex](http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex) extension defined in USCore.
@comment: This function returns the value of the birthsex extension as a code
@extension: http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex
*/
define fluent function birthsex(patient Patient):
  FC.Extension(patient, 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex').value as code

Applicable on: function definitions

profile

A canonical url (typically version-independent) that specifies the profile that this expression is referencing. Typically used on expression definitions to provide documentation of the intended profile being referenced (in the absence of a derived model info file).

// QICoreMedicationRequest
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest
define MedicationRequest:
  [MedicationRequest] R
    where R.status in { 'active', 'on-hold', 'completed', 'draft' }
      and R.doNotPerform is not true

// QICoreMedicationNotRequested
// @profile: http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-mednotrequested
define MedicationNotRequested:
  [MedicationRequest] R
    where R.status = 'completed'
      and R.doNotPerform is true

Applicable on: expression definitions

seealso

A link to additional documentation for the element.

/*
@seealso: [Cumulative MedicationDuration](http://https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/blob/master/Source/Libraries/CumulativeMedicationDuration-1.0.000.md)
*/

Applicable on: any top-level element