Using CQL With FHIR
2.1.0-cibuild - STU 2 International flag

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 2.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

Resource Profile: ELM JSON Library

Official URL: http://hl7.org/fhir/uv/cql/StructureDefinition/elm-json-library Version: 2.1.0-cibuild
Standards status: Trial-use Active as of 2025-12-04 Maturity Level: 3 Computable Name: ELMJSONLibrary
Other Identifiers: OID:2.16.840.1.113883.4.642.40.37.42.15

The ELM Library supports distributing a Clinical Quality Language (CQL) library compiled to Expression Logical Model (ELM) in JSON format

Usages:

You can also check for usages in the FHIR IG Statistics

Formal Views of Profile Content

Description Differentials, Snapshots, and other representations.

NameFlagsCard.TypeDescription & Constraints    Filter: Filtersdoco
.. Library C 0..* Library Represents a library of quality improvement components
Constraints: lib-0, ejl-1
... implicitRules ?!Σ 0..1 uri A set of rules under which this content was created
... Slices for extension Content/Rules for all slices
.... extension:cqlOptions S 0..1 (Complex) What options
URL: http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions
..... url 1..1 uri "http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions"
..... value[x] 1..1 Reference(CQL Options) Value of extension
... modifierExtension ?! 0..* Extension Extensions that cannot be ignored
... type Σ 1..1 CodeableConcept logic-library | model-definition | asset-collection | module-definition
Binding: LibraryType (extensible): The type of knowledge asset this library contains.
... content SΣC 1..* Attachment Contents of the library, either embedded or referenced
Constraints: ejl-2
.... contentType SΣC 1..1 code Mime type of the content, with charset etc.
Binding: Mime Types (required): The mime type of an attachment. Any valid mime type is allowed.
Example General: text/plain; charset=UTF-8, image/png
.... data SC 0..1 base64Binary Data inline, base64ed
.... url SΣC 0..1 url Uri where the data can be found
Example General: http://www.acme.com/logo-small.png

doco Documentation for this format

Terminology Bindings

Path Status Usage ValueSet Version Source
Library.status Base required PublicationStatus 📍4.0.1 FHIR Std.
Library.type Base extensible LibraryType 📍4.0.1 FHIR Std.
Library.content.contentType Base required MimeType 📍4.0.1 FHIR Std.

Constraints

Id Grade Path(s) Description Expression
dom-2 error Library If the resource is contained in another resource, it SHALL NOT contain nested Resources contained.contained.empty()
dom-3 error Library If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()
dom-4 error Library If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()
dom-5 error Library If a resource is contained in another resource, it SHALL NOT have a security label contained.meta.security.empty()
dom-6 best practice Library A resource should have narrative for robust management text.`div`.exists()
ejl-1 error Library ELM JSON libraries must one (and only one) content element that starts with 'application/elm+json' content.where(contentType.startsWith('application/elm+json')).count() = 1
ejl-2 error Library.content ELM libraries must have a content element with data or a url (or both) data.exists() or url.exists()
ele-1 error **ALL** elements All FHIR elements must have a @value or children hasValue() or (children().count() > id.count())
ext-1 error **ALL** extensions Must have either extensions or value[x], not both extension.exists() != value.exists()
lib-0 warning Library Name should be usable as an identifier for the module by machine processing applications such as code generation name.matches('[A-Z]([A-Za-z0-9_]){0,254}')

NameFlagsCard.TypeDescription & Constraints    Filter: Filtersdoco
.. Library C 0..* Library Represents a library of quality improvement components
Constraints: ejl-1
... Slices for extension Content/Rules for all slices
.... extension:cqlOptions S 0..1 (Complex) What options
URL: http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions
..... value[x] 1..1 Reference(CQL Options) Value of extension
... content SC 1..* Attachment Contents of the library, either embedded or referenced
Constraints: ejl-2
.... contentType SC 1..1 code Mime type of the content, with charset etc.
.... data SC 0..1 base64Binary Data inline, base64ed
.... url SC 0..1 url Uri where the data can be found

doco Documentation for this format

Constraints

Id Grade Path(s) Description Expression
ejl-1 error Library ELM JSON libraries must one (and only one) content element that starts with 'application/elm+json' content.where(contentType.startsWith('application/elm+json')).count() = 1
ejl-2 error Library.content ELM libraries must have a content element with data or a url (or both) data.exists() or url.exists()
NameFlagsCard.TypeDescription & Constraints    Filter: Filtersdoco
.. Library C 0..* Library Represents a library of quality improvement components
Constraints: lib-0, ejl-1
... id Σ 0..1 id Logical id of this artifact
... meta Σ 0..1 Meta Metadata about the resource
... implicitRules ?!Σ 0..1 uri A set of rules under which this content was created
... language 0..1 code Language of the resource content
Binding: CommonLanguages (preferred): A human language.
Additional BindingsPurpose
AllLanguages Max Binding
... text 0..1 Narrative Text summary of the resource, for human interpretation
This profile does not constrain the narrative in regard to content, language, or traceability to data elements
... contained 0..* Resource Contained, inline Resources
... Slices for extension 0..* Extension Extension
Slice: Unordered, Open by value:url
.... extension:cqlOptions S 0..1 (Complex) What options
URL: http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions
..... id 0..1 string Unique id for inter-element referencing
..... extension 0..* Extension Additional content defined by implementations
Slice: Unordered, Open by value:url
..... url 1..1 uri "http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions"
..... value[x] 1..1 Reference(CQL Options) Value of extension
... modifierExtension ?! 0..* Extension Extensions that cannot be ignored
... url Σ 0..1 uri Canonical identifier for this library, represented as a URI (globally unique)
... identifier Σ 0..* Identifier Additional identifier for the library
... version Σ 0..1 string Business version of the library
... name ΣC 0..1 string Name for this library (computer friendly)
... title Σ 0..1 string Name for this library (human friendly)
... subtitle 0..1 string Subordinate title of the library
... status ?!Σ 1..1 code draft | active | retired | unknown
Binding: PublicationStatus (required): The lifecycle status of an artifact.
... experimental Σ 0..1 boolean For testing purposes, not real usage
... type Σ 1..1 CodeableConcept logic-library | model-definition | asset-collection | module-definition
Binding: LibraryType (extensible): The type of knowledge asset this library contains.
... subject[x] 0..1 Type of individual the library content is focused on
Binding: SubjectType (extensible): The possible types of subjects for a library (E.g. Patient, Practitioner, Organization, Location, etc.).
.... subjectCodeableConcept CodeableConcept
.... subjectReference Reference(Group)
... date Σ 0..1 dateTime Date last changed
... publisher Σ 0..1 string Name of the publisher (organization or individual)
... contact Σ 0..* ContactDetail Contact details for the publisher
... description Σ 0..1 markdown Natural language description of the library
... useContext Σ 0..* UsageContext The context that the content is intended to support
... jurisdiction Σ 0..* CodeableConcept Intended jurisdiction for library (if applicable)
Binding: Jurisdiction ValueSet (extensible): Countries and regions within which this artifact is targeted for use.
... purpose 0..1 markdown Why this library is defined
... usage 0..1 string Describes the clinical usage of the library
... copyright 0..1 markdown Use and/or publishing restrictions
... approvalDate 0..1 date When the library was approved by publisher
... lastReviewDate 0..1 date When the library was last reviewed
... effectivePeriod Σ 0..1 Period When the library is expected to be used
... topic 0..* CodeableConcept E.g. Education, Treatment, Assessment, etc.
Binding: DefinitionTopic (example): High-level categorization of the definition, used for searching, sorting, and filtering.
... author 0..* ContactDetail Who authored the content
... editor 0..* ContactDetail Who edited the content
... reviewer 0..* ContactDetail Who reviewed the content
... endorser 0..* ContactDetail Who endorsed the content
... relatedArtifact 0..* RelatedArtifact Additional documentation, citations, etc.
... parameter 0..* ParameterDefinition Parameters defined by the library
... dataRequirement 0..* DataRequirement What data is referenced by this library
... content SΣC 1..* Attachment Contents of the library, either embedded or referenced
Constraints: ejl-2
.... id 0..1 string Unique id for inter-element referencing
.... extension 0..* Extension Additional content defined by implementations
Slice: Unordered, Open by value:url
.... contentType SΣC 1..1 code Mime type of the content, with charset etc.
Binding: Mime Types (required): The mime type of an attachment. Any valid mime type is allowed.
Example General: text/plain; charset=UTF-8, image/png
.... language Σ 0..1 code Human language of the content (BCP-47)
Binding: CommonLanguages (preferred): A human language.
Additional BindingsPurpose
AllLanguages Max Binding

Example General: en-AU
.... data SC 0..1 base64Binary Data inline, base64ed
.... url SΣC 0..1 url Uri where the data can be found
Example General: http://www.acme.com/logo-small.png
.... size Σ 0..1 unsignedInt Number of bytes of content (if url provided)
.... hash Σ 0..1 base64Binary Hash of the data (sha-1, base64ed)
.... title Σ 0..1 string Label to display in place of the data
Example General: Official Corporate Logo
.... creation Σ 0..1 dateTime Date attachment was first created

doco Documentation for this format

Terminology Bindings

Path Status Usage ValueSet Version Source
Library.language Base preferred Common Languages 📍4.0.1 FHIR Std.
Library.status Base required PublicationStatus 📍4.0.1 FHIR Std.
Library.type Base extensible LibraryType 📍4.0.1 FHIR Std.
Library.subject[x] Base extensible Subject type 📍4.0.1 FHIR Std.
Library.jurisdiction Base extensible Jurisdiction 📍4.0.1 FHIR Std.
Library.topic Base example DefinitionTopic 📍4.0.1 FHIR Std.
Library.content.contentType Base required MimeType 📍4.0.1 FHIR Std.
Library.content.language Base preferred Common Languages 📍4.0.1 FHIR Std.

Constraints

Id Grade Path(s) Description Expression
dom-2 error Library If the resource is contained in another resource, it SHALL NOT contain nested Resources contained.contained.empty()
dom-3 error Library If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()
dom-4 error Library If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()
dom-5 error Library If a resource is contained in another resource, it SHALL NOT have a security label contained.meta.security.empty()
dom-6 best practice Library A resource should have narrative for robust management text.`div`.exists()
ejl-1 error Library ELM JSON libraries must one (and only one) content element that starts with 'application/elm+json' content.where(contentType.startsWith('application/elm+json')).count() = 1
ejl-2 error Library.content ELM libraries must have a content element with data or a url (or both) data.exists() or url.exists()
ele-1 error **ALL** elements All FHIR elements must have a @value or children hasValue() or (children().count() > id.count())
ext-1 error **ALL** extensions Must have either extensions or value[x], not both extension.exists() != value.exists()
lib-0 warning Library Name should be usable as an identifier for the module by machine processing applications such as code generation name.matches('[A-Z]([A-Za-z0-9_]){0,254}')

Summary

Mandatory: 2 elements(1 nested mandatory element)
Must-Support: 5 elements

Structures

This structure refers to these other structures:

Extensions

This structure refers to these extensions:

Maturity: 3

Key Elements View

NameFlagsCard.TypeDescription & Constraints    Filter: Filtersdoco
.. Library C 0..* Library Represents a library of quality improvement components
Constraints: lib-0, ejl-1
... implicitRules ?!Σ 0..1 uri A set of rules under which this content was created
... Slices for extension Content/Rules for all slices
.... extension:cqlOptions S 0..1 (Complex) What options
URL: http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions
..... url 1..1 uri "http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions"
..... value[x] 1..1 Reference(CQL Options) Value of extension
... modifierExtension ?! 0..* Extension Extensions that cannot be ignored
... type Σ 1..1 CodeableConcept logic-library | model-definition | asset-collection | module-definition
Binding: LibraryType (extensible): The type of knowledge asset this library contains.
... content SΣC 1..* Attachment Contents of the library, either embedded or referenced
Constraints: ejl-2
.... contentType SΣC 1..1 code Mime type of the content, with charset etc.
Binding: Mime Types (required): The mime type of an attachment. Any valid mime type is allowed.
Example General: text/plain; charset=UTF-8, image/png
.... data SC 0..1 base64Binary Data inline, base64ed
.... url SΣC 0..1 url Uri where the data can be found
Example General: http://www.acme.com/logo-small.png

doco Documentation for this format

Terminology Bindings

Path Status Usage ValueSet Version Source
Library.status Base required PublicationStatus 📍4.0.1 FHIR Std.
Library.type Base extensible LibraryType 📍4.0.1 FHIR Std.
Library.content.contentType Base required MimeType 📍4.0.1 FHIR Std.

Constraints

Id Grade Path(s) Description Expression
dom-2 error Library If the resource is contained in another resource, it SHALL NOT contain nested Resources contained.contained.empty()
dom-3 error Library If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()
dom-4 error Library If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()
dom-5 error Library If a resource is contained in another resource, it SHALL NOT have a security label contained.meta.security.empty()
dom-6 best practice Library A resource should have narrative for robust management text.`div`.exists()
ejl-1 error Library ELM JSON libraries must one (and only one) content element that starts with 'application/elm+json' content.where(contentType.startsWith('application/elm+json')).count() = 1
ejl-2 error Library.content ELM libraries must have a content element with data or a url (or both) data.exists() or url.exists()
ele-1 error **ALL** elements All FHIR elements must have a @value or children hasValue() or (children().count() > id.count())
ext-1 error **ALL** extensions Must have either extensions or value[x], not both extension.exists() != value.exists()
lib-0 warning Library Name should be usable as an identifier for the module by machine processing applications such as code generation name.matches('[A-Z]([A-Za-z0-9_]){0,254}')

Differential View

NameFlagsCard.TypeDescription & Constraints    Filter: Filtersdoco
.. Library C 0..* Library Represents a library of quality improvement components
Constraints: ejl-1
... Slices for extension Content/Rules for all slices
.... extension:cqlOptions S 0..1 (Complex) What options
URL: http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions
..... value[x] 1..1 Reference(CQL Options) Value of extension
... content SC 1..* Attachment Contents of the library, either embedded or referenced
Constraints: ejl-2
.... contentType SC 1..1 code Mime type of the content, with charset etc.
.... data SC 0..1 base64Binary Data inline, base64ed
.... url SC 0..1 url Uri where the data can be found

doco Documentation for this format

Constraints

Id Grade Path(s) Description Expression
ejl-1 error Library ELM JSON libraries must one (and only one) content element that starts with 'application/elm+json' content.where(contentType.startsWith('application/elm+json')).count() = 1
ejl-2 error Library.content ELM libraries must have a content element with data or a url (or both) data.exists() or url.exists()

Snapshot ViewView

NameFlagsCard.TypeDescription & Constraints    Filter: Filtersdoco
.. Library C 0..* Library Represents a library of quality improvement components
Constraints: lib-0, ejl-1
... id Σ 0..1 id Logical id of this artifact
... meta Σ 0..1 Meta Metadata about the resource
... implicitRules ?!Σ 0..1 uri A set of rules under which this content was created
... language 0..1 code Language of the resource content
Binding: CommonLanguages (preferred): A human language.
Additional BindingsPurpose
AllLanguages Max Binding
... text 0..1 Narrative Text summary of the resource, for human interpretation
This profile does not constrain the narrative in regard to content, language, or traceability to data elements
... contained 0..* Resource Contained, inline Resources
... Slices for extension 0..* Extension Extension
Slice: Unordered, Open by value:url
.... extension:cqlOptions S 0..1 (Complex) What options
URL: http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions
..... id 0..1 string Unique id for inter-element referencing
..... extension 0..* Extension Additional content defined by implementations
Slice: Unordered, Open by value:url
..... url 1..1 uri "http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions"
..... value[x] 1..1 Reference(CQL Options) Value of extension
... modifierExtension ?! 0..* Extension Extensions that cannot be ignored
... url Σ 0..1 uri Canonical identifier for this library, represented as a URI (globally unique)
... identifier Σ 0..* Identifier Additional identifier for the library
... version Σ 0..1 string Business version of the library
... name ΣC 0..1 string Name for this library (computer friendly)
... title Σ 0..1 string Name for this library (human friendly)
... subtitle 0..1 string Subordinate title of the library
... status ?!Σ 1..1 code draft | active | retired | unknown
Binding: PublicationStatus (required): The lifecycle status of an artifact.
... experimental Σ 0..1 boolean For testing purposes, not real usage
... type Σ 1..1 CodeableConcept logic-library | model-definition | asset-collection | module-definition
Binding: LibraryType (extensible): The type of knowledge asset this library contains.
... subject[x] 0..1 Type of individual the library content is focused on
Binding: SubjectType (extensible): The possible types of subjects for a library (E.g. Patient, Practitioner, Organization, Location, etc.).
.... subjectCodeableConcept CodeableConcept
.... subjectReference Reference(Group)
... date Σ 0..1 dateTime Date last changed
... publisher Σ 0..1 string Name of the publisher (organization or individual)
... contact Σ 0..* ContactDetail Contact details for the publisher
... description Σ 0..1 markdown Natural language description of the library
... useContext Σ 0..* UsageContext The context that the content is intended to support
... jurisdiction Σ 0..* CodeableConcept Intended jurisdiction for library (if applicable)
Binding: Jurisdiction ValueSet (extensible): Countries and regions within which this artifact is targeted for use.
... purpose 0..1 markdown Why this library is defined
... usage 0..1 string Describes the clinical usage of the library
... copyright 0..1 markdown Use and/or publishing restrictions
... approvalDate 0..1 date When the library was approved by publisher
... lastReviewDate 0..1 date When the library was last reviewed
... effectivePeriod Σ 0..1 Period When the library is expected to be used
... topic 0..* CodeableConcept E.g. Education, Treatment, Assessment, etc.
Binding: DefinitionTopic (example): High-level categorization of the definition, used for searching, sorting, and filtering.
... author 0..* ContactDetail Who authored the content
... editor 0..* ContactDetail Who edited the content
... reviewer 0..* ContactDetail Who reviewed the content
... endorser 0..* ContactDetail Who endorsed the content
... relatedArtifact 0..* RelatedArtifact Additional documentation, citations, etc.
... parameter 0..* ParameterDefinition Parameters defined by the library
... dataRequirement 0..* DataRequirement What data is referenced by this library
... content SΣC 1..* Attachment Contents of the library, either embedded or referenced
Constraints: ejl-2
.... id 0..1 string Unique id for inter-element referencing
.... extension 0..* Extension Additional content defined by implementations
Slice: Unordered, Open by value:url
.... contentType SΣC 1..1 code Mime type of the content, with charset etc.
Binding: Mime Types (required): The mime type of an attachment. Any valid mime type is allowed.
Example General: text/plain; charset=UTF-8, image/png
.... language Σ 0..1 code Human language of the content (BCP-47)
Binding: CommonLanguages (preferred): A human language.
Additional BindingsPurpose
AllLanguages Max Binding

Example General: en-AU
.... data SC 0..1 base64Binary Data inline, base64ed
.... url SΣC 0..1 url Uri where the data can be found
Example General: http://www.acme.com/logo-small.png
.... size Σ 0..1 unsignedInt Number of bytes of content (if url provided)
.... hash Σ 0..1 base64Binary Hash of the data (sha-1, base64ed)
.... title Σ 0..1 string Label to display in place of the data
Example General: Official Corporate Logo
.... creation Σ 0..1 dateTime Date attachment was first created

doco Documentation for this format

Terminology Bindings

Path Status Usage ValueSet Version Source
Library.language Base preferred Common Languages 📍4.0.1 FHIR Std.
Library.status Base required PublicationStatus 📍4.0.1 FHIR Std.
Library.type Base extensible LibraryType 📍4.0.1 FHIR Std.
Library.subject[x] Base extensible Subject type 📍4.0.1 FHIR Std.
Library.jurisdiction Base extensible Jurisdiction 📍4.0.1 FHIR Std.
Library.topic Base example DefinitionTopic 📍4.0.1 FHIR Std.
Library.content.contentType Base required MimeType 📍4.0.1 FHIR Std.
Library.content.language Base preferred Common Languages 📍4.0.1 FHIR Std.

Constraints

Id Grade Path(s) Description Expression
dom-2 error Library If the resource is contained in another resource, it SHALL NOT contain nested Resources contained.contained.empty()
dom-3 error Library If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()
dom-4 error Library If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()
dom-5 error Library If a resource is contained in another resource, it SHALL NOT have a security label contained.meta.security.empty()
dom-6 best practice Library A resource should have narrative for robust management text.`div`.exists()
ejl-1 error Library ELM JSON libraries must one (and only one) content element that starts with 'application/elm+json' content.where(contentType.startsWith('application/elm+json')).count() = 1
ejl-2 error Library.content ELM libraries must have a content element with data or a url (or both) data.exists() or url.exists()
ele-1 error **ALL** elements All FHIR elements must have a @value or children hasValue() or (children().count() > id.count())
ext-1 error **ALL** extensions Must have either extensions or value[x], not both extension.exists() != value.exists()
lib-0 warning Library Name should be usable as an identifier for the module by machine processing applications such as code generation name.matches('[A-Z]([A-Za-z0-9_]){0,254}')

Summary

Mandatory: 2 elements(1 nested mandatory element)
Must-Support: 5 elements

Structures

This structure refers to these other structures:

Extensions

This structure refers to these extensions:

Maturity: 3

 

Other representations of profile: CSV, Excel, Schematron