dQM CMS Content Implementation Guide
2026.1.0 - CI Build

dQM CMS Content Implementation Guide, published by cqframework. This guide is not an authorized publication; it is the continuous build for version 2026.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/dqm-content-cms-2026/ and changes regularly. See the Directory of published versions

Library: ImagingStudyFeasibilityTest

Official URL: https://research.balgrist.ch/Library/ImagingStudyFeasibilityTest Version: 1.0.0
Active as of 2024-05-15 Responsible: Balgrist Computable Name: ImagingStudyFeasibilityTest

Imaging Study Feasibility Test

Metadata
Title ImagingStudyFeasibilityTest
Version 1.0.0
Topic FHIR
Topic CQL
Steward (Publisher) Balgrist
Description

Imaging Study Feasibility Test

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Parameter Name: ModalityCode
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Manufacturer
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: SeriesDescriptionText
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: MinNumberOfSeries
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: integer
Parameter Name: Patient
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Patient
Parameter Name: AllImagingStudies
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: ImagingStudy
Parameter Name: StudiesWithModality
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: ImagingStudy
Parameter Name: HasStudyWithModality
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: CTImagingStudies
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: ImagingStudy
Parameter Name: HasCTImagingStudies
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: StudiesWithManufacturer
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: ImagingStudy
Parameter Name: HasStudyWithManufacturer
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: StudiesWithSeriesDescription
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: ImagingStudy
Parameter Name: HasStudyWithSeriesDescription
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: StudiesWithMinSeries
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: ImagingStudy
Parameter Name: HasStudyWithMinSeries
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: HasAnyMatch
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: HasAllMatchSearchDefault
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: HasAllMatchSearchCustom
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: HasAllMatchNoSearch
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: InitialPopulation
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Data Requirement Type: ImagingStudy
Profile(s): ImagingStudy
Data Requirement Type: ImagingStudy
Profile(s): ImagingStudy
Code Filter(s):
Path: modality
Data Requirement Type: ImagingStudy
Profile(s): ImagingStudy
Code Filter(s):
Path: modality
ValueSet: https://research.balgrist.ch/ValueSet/CTImagingModality
Library Content
CQL Content
library ImagingStudyFeasibilityTest version '1.0.0'

using FHIR version '4.0.1'

include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1'

codesystem DICOM: 'http://dicom.nema.org/resources/ontology/DCM'

code CT: 'CT' from DICOM display 'Computed Tomography'
code MR: 'MR' from DICOM display 'Magnetic Resonance'
code US: 'US' from DICOM display 'Ultrasound'
code XR: 'XR' from DICOM display 'X-Ray Radiography'
code MG: 'MG' from DICOM display 'Mammography'
code NM: 'NM' from DICOM display 'Nuclear Medicine'
code PT: 'PT' from DICOM display 'Positron Emission Tomography'
code DX: 'DX' from DICOM display 'Digital Radiography'

valueset CTImagingModality: 'https://research.balgrist.ch/ValueSet/CTImagingModality'

parameter ModalityCode String
parameter Manufacturer String
parameter SeriesDescriptionText String
parameter MinNumberOfSeries Integer

context Patient

define "AllImagingStudies":
  [ImagingStudy]

// =============================================================================
// TEST 1: Default Search Param (modality - study level)
// =============================================================================
define "StudiesWithModality":
  [ImagingStudy: modality ~ ModalityCode]
//  "AllImagingStudies" S
//    where exists (
//      S.modality M
//        where M.code.value = ModalityCode
//    )

define "HasStudyWithModality":
  exists "StudiesWithModality"

/*
@description: Returns ImagingStudy resources with a modality in the CTImagingModality value set
@comment: This item is marked selective to indicate it can be used as a narrowing filter in 
determining the set of subjects on which to run. For the purposes of this demonstration this
tag is added manually to the data requirements for the measure post processing. In the future
this step will be performed by tooling.
@isSelective
*/
define "CTImagingStudies":
  [ImagingStudy: modality in CTImagingModality]

define "HasCTImagingStudies":
  exists "CTImagingStudies"

// =============================================================================
// TEST 2: Custom Search Param (manufacturer - series level extension)
// =============================================================================
define "StudiesWithManufacturer":
//  [ImagingStudy: manufacturer ~ Manufacturer]
  "AllImagingStudies" S
    where exists (
      S.series Serie
        where exists (
          Serie.extension E
            where E.url = 'http://example.org/fhir/StructureDefinition/dicom-equipment-manufacturer'
              and (E.value as FHIR.string).value = Manufacturer
        )
    )

define "HasStudyWithManufacturer":
  exists "StudiesWithManufacturer"

// =============================================================================
// TEST 3a: Non-Search-Param - Text (series.description)
// =============================================================================
define "StudiesWithSeriesDescription":
  "AllImagingStudies" S
    where exists (
      S.series Serie
        where PositionOf(Lower(SeriesDescriptionText), Lower(Serie.description.value)) >= 0
    )

define "HasStudyWithSeriesDescription":
  exists "StudiesWithSeriesDescription"

// =============================================================================
// TEST 3b: Non-Search-Param - Numeric (numberOfSeries)
// =============================================================================
define "StudiesWithMinSeries":
  "AllImagingStudies" S
    where S.numberOfSeries.value >= MinNumberOfSeries

define "HasStudyWithMinSeries":
  exists "StudiesWithMinSeries"

// =============================================================================
// Combined: ANY match (OR logic)
// =============================================================================
define "HasAnyMatch":
  "HasStudyWithModality"
    or "HasStudyWithManufacturer"
    or "HasStudyWithSeriesDescription"
    or "HasStudyWithMinSeries"

// =============================================================================
// Combined: ALL match (AND logic) Default Search Parameter First
// =============================================================================
define "HasAllMatchSearchDefault":
  "HasStudyWithModality"
    and "HasStudyWithManufacturer"
    and "HasStudyWithSeriesDescription"

// =============================================================================
// Combined: ALL match (AND logic) Custom Search Parameter First
// =============================================================================
define "HasAllMatchSearchCustom":
  "HasStudyWithManufacturer"
  and "HasStudyWithModality"
    and "HasStudyWithSeriesDescription"

// =============================================================================
// Combined: ALL match (AND logic) No Search Parameter First
// =============================================================================
define "HasAllMatchNoSearch":
  "HasStudyWithSeriesDescription"
  and "HasStudyWithModality"
    and "HasStudyWithManufacturer"

// =============================================================================
// Initial Population (default to any match)
// =============================================================================
define "InitialPopulation":
  "HasAnyMatch"
ELM XML Content
Encoded data (63232 characters)
ELM JSON Content
Encoded data (111452 characters)
Generated using version 0.5.0 of the sample-content-ig Liquid templates