Common CQL Artifacts for FHIR (US-Based)
2.0.0 - Informative 2 United States of America flag

Common CQL Artifacts for FHIR (US-Based), published by HL7 International / Clinical Decision Support. This guide is not an authorized publication; it is the continuous build for version 2.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/us-cql-ig/ and changes regularly. See the Directory of published versions

Library: QI Core Common Tests (Experimental)

Official URL: http://hl7.org/fhir/us/cql/Library/QICoreCommonTests Version: 2.0.0
Standards status: Informative Maturity Level: 3 Computable Name: QICoreCommonTests
Other Identifiers: OID:2.16.840.1.113883.4.642.40.86.28.19

Tests for the expressions and functions defined in the QI Core Common library.

Metadata
Title QI Core Common Tests
Version 2.0.0
Identifier urn:oid:2.16.840.1.113883.4.642.40.86.28.19
Experimental true
Jurisdiction United States of America
Topic FHIR
Topic CQL
Topic Unit Tests
Steward (Publisher) HL7 International / Clinical Decision Support
Description

Tests for the expressions and functions defined in the QI Core Common library.

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Dependency Description: Library QICoreCommon
Resource: QI Core Common
Canonical URL: http://hl7.org/fhir/us/cql/Library/QICoreCommon
Dependency Description: Code System Marital Status Codes
Resource: MaritalStatus
Canonical URL: http://terminology.hl7.org/CodeSystem/v3-MaritalStatus
Dependency Description: Code System CDC Race and Ethnicity Codes
Resource: CDC Race and Ethnicity
Canonical URL: urn:oid:2.16.840.1.113883.6.238
Dependency Description: Code System CommunicationCategoryCodeSystem
Resource: CommunicationCategory
Canonical URL: http://terminology.hl7.org/CodeSystem/communication-category
Dependency Description: Code System SNOMED-CT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
Dependency Description: Code System CVX
Resource: Vaccine Administered Code Set (CVX)
Canonical URL: http://hl7.org/fhir/sid/cvx
Dependency Description: Code System LOINC
Resource: Logical Observation Identifiers, Names and Codes (LOINC)
Canonical URL: http://loinc.org
Dependency Description: Code System TaskCodeSystem
Resource: Task Codes
Canonical URL: http://hl7.org/fhir/CodeSystem/task-code
Dependency Description: Value Set Marital Status
Resource: MaritalStatus
Canonical URL: http://hl7.org/fhir/ValueSet/marital-status
Dependency Description: Value Set CommunicationCodes
Resource: CommunicationCategory
Canonical URL: http://hl7.org/fhir/ValueSet/communication-category
Dependency Description: Value Set DeviceCodes
Resource: http://example.org/fhir/ValueSet/device-codes
Canonical URL: http://example.org/fhir/ValueSet/device-codes
Dependency Description: Value Set ImmunizationCodes
Resource: http://example.org/fhir/ValueSet/immunization-codes
Canonical URL: http://example.org/fhir/ValueSet/immunization-codes
Dependency Description: Value Set MedicationCodes
Resource: http://example.org/fhir/ValueSet/medication-codes
Canonical URL: http://example.org/fhir/ValueSet/medication-codes
Dependency Description: Value Set ObservationCodes
Resource: http://example.org/fhir/ValueSet/observation-codes
Canonical URL: http://example.org/fhir/ValueSet/observation-codes
Dependency Description: Value Set ProcedureCodes
Resource: http://example.org/fhir/ValueSet/procedure-codes
Canonical URL: http://example.org/fhir/ValueSet/procedure-codes
Dependency Description: Value Set TaskCodes
Resource: Task Codes
Canonical URL: http://hl7.org/fhir/ValueSet/task-code
Parameters
Name Use Card. Type Documentation
Patient Out 0..1 Resource
TestAdverseEvent Out 0..* Resource
TestAllergyIntolerance Out 0..* Resource
TestBodyStructure Out 0..* Resource
TestCarePlan Out 0..* Resource
TestCareTeam Out 0..* Resource
TestClaim Out 0..* Resource
TestClaimResponse Out 0..* Resource
TestCommunication Out 0..* Resource
TestCommunicationNotDone Out 0..* Resource
TestCommunicationRequest Out 0..* Resource
TestConditionEncounterDiagnosis Out 0..* Resource
TestConditionProblemsHealthConcerns Out 0..* Resource
TestCoverage Out 0..* Resource
TestDevice Out 0..* Resource
TestDeviceNotRequested Out 0..* Resource
TestDeviceRequest Out 0..* Resource
TestDeviceUseStatement Out 0..* Resource
TestDiagnosticReportLab Out 0..* Resource
TestDiagnosticReportNote Out 0..* Resource
TestEncounter Out 0..* Resource
TestFamilyMemberHistory Out 0..* Resource
TestFlag Out 0..* Resource
TestGoal Out 0..* Resource
TestImagingStudy Out 0..* Resource
TestImmunization Out 0..* Resource
TestImmunizationEvaluation Out 0..* Resource
TestImmunizationNotDone Out 0..* Resource
TestImmunizationRecommendation Out 0..* Resource
TestLaboratoryResultObservation Out 0..* Resource
TestLocation Out 0..* Resource
TestMedication Out 0..* Resource
TestMedicationAdministration Out 0..* Resource
TestMedicationAdministrationNotDone Out 0..* Resource
TestMedicationDispense Out 0..* Resource
TestMedicationDispenseDeclined Out 0..* Resource
TestMedicationNotRequested Out 0..* Resource
TestMedicationRequest Out 0..* Resource
TestMedicationStatement Out 0..* Resource
TestObservation Out 0..* Resource
TestObservationCancelled Out 0..* Resource
TestObservationClinicalTestResult Out 0..* Resource
TestObservationImagingResult Out 0..* Resource
TestObservationSurvey Out 0..* Resource
TestOrganization Out 0..* Resource
TestPatient Out 0..* Resource
TestVitalsPanel Out 0..* Resource
TestRespRate Out 0..* Resource
TestHeartRate Out 0..* Resource
TestBodyTemp Out 0..* Resource
TestBodyHeight Out 0..* Resource
TestHeadCircum Out 0..* Resource
TestBodyWeight Out 0..* Resource
TestBMI Out 0..* Resource
TestBP Out 0..* Resource
TestPractitioner Out 0..* Resource
TestPractitionerRole Out 0..* Resource
TestProcedure Out 0..* Resource
TestProcedureNotDone Out 0..* Resource
TestRelatedPerson Out 0..* Resource
TestServiceNotRequested Out 0..* Resource
TestServiceRequest Out 0..* Resource
TestSubstance Out 0..* Resource
TestTask Out 0..* Resource
TestTaskRejected Out 0..* Resource
TestUSCoreImplantableDevice Out 0..* Resource
TestUSCoreSmokingStatus Out 0..* Resource
TestUSCorePulseOximetry Out 0..* Resource
TestUSCorePediatricBMIForAge Out 0..* Resource
TestUSCorePediatricWeightForHeight Out 0..* Resource
TestUSCorePediatricHeadOccipitalFrontalCircumferencePercentileProfile Out 0..* Resource
TestUSCoreObservationSexualOrientationProfile Out 0..* Resource
TestEncounterDiagnosisCardinality Out 0..1 boolean
TestProcedureNotDoneElements Out 0..* Resource
TestSpecificCommunicationNotDone Out 0..* Resource
TestSpecificCommunicationNotDoneExplicit Out 0..* Resource
TestGeneralCommunicationNotDone Out 0..* Resource
TestGeneralCommunicationNotDoneActual Out 0..* Resource
TestGeneralCommunicationNotDoneExplicit Out 0..* Resource
TestSpecificDeviceNotRequested Out 0..* Resource
TestSpecificDeviceNotRequestedExplicit Out 0..* Resource
TestGeneralDeviceNotRequested Out 0..* Resource
TestGeneralDeviceNotRequestedActual Out 0..* Resource
TestGeneralDeviceNotRequestedExplicit Out 0..* Resource
TestGeneralDeviceNotRequestedCodeExplicit Out 0..* Resource
TestGeneralDeviceNotRequestedValueSetExplicit Out 0..* Resource
TestSpecificImmunizationNotDone Out 0..* Resource
TestSpecificImmunizationNotDoneExplicit Out 0..* Resource
TestGeneralImmunizationNotDone Out 0..* Resource
TestGeneralImmunizationNotDoneActual Out 0..* Resource
TestGeneralImmunizationNotDoneExplicit Out 0..* Resource
TestSpecificMedicationAdministrationNotDone Out 0..* Resource
TestSpecificMedicationAdministrationNotDoneExplicit Out 0..* Resource
TestGeneralMedicationAdministrationNotDone Out 0..* Resource
TestGeneralMedicationAdministrationNotDoneActual Out 0..* Resource
TestGeneralMedicationAdministrationNotDoneExplicit Out 0..* Resource
TestSpecificMedicationDispenseDeclined Out 0..* Resource
TestSpecificMedicationDispenseDeclinedExplicit Out 0..* Resource
TestGeneralMedicationDispenseDeclined Out 0..* Resource
TestGeneralMedicationDispenseDeclinedActual Out 0..* Resource
TestGeneralMedicationDispenseDeclinedExplicit Out 0..* Resource
TestSpecificMedicationNotRequested Out 0..* Resource
TestSpecificMedicationNotRequestedExplicit Out 0..* Resource
TestGeneralMedicationNotRequested Out 0..* Resource
TestGeneralMedicationNotRequestedActual Out 0..* Resource
TestGeneralMedicationNotRequestedExplicit Out 0..* Resource
TestSpecificObservationCancelled Out 0..* Resource
TestSpecificObservationCancelledExplicit Out 0..* Resource
TestGeneralObservationCancelled Out 0..* Resource
TestGeneralObservationCancelledActual Out 0..* Resource
TestGeneralObservationCancelledExplicit Out 0..* Resource
TestSpecificProcedureNotDone Out 0..* Resource
TestSpecificProcedureNotDoneExplicit Out 0..* Resource
TestGeneralProcedureNotDone Out 0..* Resource
TestGeneralProcedureNotDoneActual Out 0..* Resource
TestGeneralProcedureNotDoneExplicit Out 0..* Resource
TestSpecificServiceNotRequested Out 0..* Resource
TestSpecificServiceNotRequestedExplicit Out 0..* Resource
TestGeneralServiceNotRequested Out 0..* Resource
TestGeneralServiceNotRequestedActual Out 0..* Resource
TestGeneralServiceNotRequestedExplicit Out 0..* Resource
TestSpecificTaskRejected Out 0..* Resource
TestSpecificTaskNotDoneExplicit Out 0..* Resource
TestGeneralTaskRejected Out 0..* Resource
TestGeneralTaskRejectedActual Out 0..* Resource
TestGeneralTaskRejectedExplicit Out 0..* Resource
Library Content
CQL Content
library QICoreCommonTests version '0.5.0'

using QICore version '6.0.0-derived'
using USCore version '6.1.0-derived'
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include QICoreCommon

codesystem "Marital Status Codes": 'http://terminology.hl7.org/CodeSystem/v3-MaritalStatus'
codesystem "CDC Race and Ethnicity Codes": 'urn:oid:2.16.840.1.113883.6.238'
codesystem "CommunicationCategoryCodeSystem": 'http://terminology.hl7.org/CodeSystem/communication-category'
codesystem "SNOMED-CT": 'http://snomed.info/sct'
codesystem "CVX": 'http://hl7.org/fhir/sid/cvx'
codesystem "LOINC": 'http://loinc.org'
codesystem "TaskCodeSystem": 'http://hl7.org/fhir/CodeSystem/task-code'

valueset "Marital Status": 'http://hl7.org/fhir/ValueSet/marital-status'
valueset "CommunicationCodes": 'http://hl7.org/fhir/ValueSet/communication-category'
valueset "DeviceCodes": 'http://example.org/fhir/ValueSet/device-codes' // Random set of device codes from 'http://hl7.org/fhir/ValueSet/device-type'
valueset "ImmunizationCodes": 'http://example.org/fhir/ValueSet/immunization-codes' // Random set of immunization codes from 'http://hl7.org/fhir/us/core/ValueSet/us-core-vaccines-cvx'
valueset "MedicationCodes": 'http://example.org/fhir/ValueSet/medication-codes' // Random set of medication codes from 'http://hl7.org/fhir/ValueSet/medication-codes'
valueset "ObservationCodes": 'http://example.org/fhir/ValueSet/observation-codes' // Random set of observation codes from 'http://hl7.org/fhir/ValueSet/observation-codes'
valueset "ProcedureCodes": 'http://example.org/fhir/ValueSet/procedure-codes' // Random set of procedure codes from 'http://hl7.org/fhir/us/core/ValueSet/us-core-procedure-code'
valueset "TaskCodes": 'http://hl7.org/fhir/ValueSet/task-code'
//valueset "NegationReasonCodes": 'http://hl7.org/fhir/us/qicore/ValueSet/qicore-negation-reason'

code "Marital Status - Married": 'M' from "Marital Status Codes"
code "American Indian or Alaska Native": '1002-5' from "CDC Race and Ethnicity Codes"
code "Alaska Native": '1735-0' from "CDC Race and Ethnicity Codes"
code "CommunicationCode": 'alert' from "CommunicationCategoryCodeSystem" display 'Alert'
code "DeviceCode": '156009' from "SNOMED-CT" display 'Spine board'
code "ImmunizationCode": '01' from "CVX" display 'diphtheria, tetanus toxoids and pertussis vaccine'
code "MedicationCode": '26100' from "SNOMED-CT" display 'Codeine phosphate'
code "ObservationCode": '1-8' from "LOINC" display 'Acyclovir [Susceptibility]'
code "ProcedureCode": '7138802' from "SNOMED-CT" display 'Procedure'
code "TaskCode": 'approve' from "TaskCodeSystem" display 'Activate/approve the focal resource'

context Patient

define TestAdverseEvent: [QICore."AdverseEvent"]
define TestAllergyIntolerance: [QICore."AllergyIntolerance"]
define TestBodyStructure: [QICore."BodyStructure"]
define TestCarePlan: [QICore."CarePlan"]
define TestCareTeam: [QICore."CareTeam"]
define TestClaim: [QICore."Claim"]
define TestClaimResponse: [QICore."ClaimResponse"]
define TestCommunication: [QICore."Communication"]
define TestCommunicationNotDone: [QICore."CommunicationNotDone"]
define TestCommunicationRequest: [QICore."CommunicationRequest"]
define TestConditionEncounterDiagnosis: [QICore."ConditionEncounterDiagnosis"]
define TestConditionProblemsHealthConcerns: [QICore."ConditionProblemsHealthConcerns"]
define TestCoverage: [QICore."Coverage"]
define TestDevice: [QICore."Device"]
define TestDeviceNotRequested: [QICore."DeviceNotRequested"]
define TestDeviceRequest: [QICore."DeviceRequest"]
define TestDeviceUseStatement: [QICore."DeviceUseStatement"]
define TestDiagnosticReportLab: [QICore."DiagnosticReportLab"]
define TestDiagnosticReportNote: [QICore."DiagnosticReportNote"]
define TestEncounter: [QICore."Encounter"]
define TestFamilyMemberHistory: [QICore."FamilyMemberHistory"]
define TestFlag: [QICore."Flag"]
define TestGoal: [QICore."Goal"]
define TestImagingStudy: [QICore."ImagingStudy"]
define TestImmunization: [QICore."Immunization"]
define TestImmunizationEvaluation: [QICore."ImmunizationEvaluation"]
define TestImmunizationNotDone: [QICore."ImmunizationNotDone"]
define TestImmunizationRecommendation: [QICore."ImmunizationRecommendation"]
define TestLaboratoryResultObservation: [QICore."LaboratoryResultObservation"]
define TestLocation: [QICore."Location"]
define TestMedication: [QICore."Medication"]
define TestMedicationAdministration: [QICore."MedicationAdministration"]
define TestMedicationAdministrationNotDone: [QICore."MedicationAdministrationNotDone"]
define TestMedicationDispense: [QICore."MedicationDispense"]
define TestMedicationDispenseDeclined: [QICore."MedicationDispenseDeclined"]
define TestMedicationNotRequested: [QICore."MedicationNotRequested"]
define TestMedicationRequest: [QICore."MedicationRequest"]
define TestMedicationStatement: [QICore."MedicationStatement"]
define TestObservation: [QICore."SimpleObservation"]
define TestObservationCancelled: [QICore."ObservationCancelled"]
define TestObservationClinicalTestResult: [QICore."ObservationClinicalResult"]
define TestObservationImagingResult: [QICore."NonPatientObservation"]
define TestObservationSurvey: [QICore."ObservationScreeningAssessment"]
define TestOrganization: [QICore."Organization"]
define TestPatient: [QICore."Patient"]
define TestVitalsPanel: [USCore.VitalSignsProfile]
define TestRespRate: [USCore.RespiratoryRateProfile]
define TestHeartRate: [USCore.HeartRateProfile]
define TestBodyTemp: [USCore.BodyTemperatureProfile]
define TestBodyHeight: [USCore.BodyHeightProfile]
define TestHeadCircum: [USCore.HeadCircumferenceProfile]
define TestBodyWeight: [USCore.BodyWeightProfile]
define TestBMI: [USCore.BMIProfile]
define TestBP: [USCore.BloodPressureProfile]
define TestPractitioner: [QICore."Practitioner"]
define TestPractitionerRole: [QICore."PractitionerRole"]
define TestProcedure: [QICore."Procedure"]
define TestProcedureNotDone: [QICore."ProcedureNotDone"]
define TestRelatedPerson: [QICore."RelatedPerson"]
define TestServiceNotRequested: [QICore."ServiceNotRequested"]
define TestServiceRequest: [QICore."ServiceRequest"]
//define TestSpecimen: [QICore."Specimen"]
define TestSubstance: [QICore."Substance"]
define TestTask: [QICore."Task"]
define TestTaskRejected: [QICore."TaskRejected"]
define TestUSCoreImplantableDevice: [USCore.ImplantableDeviceProfile]
define TestUSCoreSmokingStatus: [USCore.SmokingStatusProfile]
define TestUSCorePulseOximetry: [USCore.PulseOximetryProfile]
define TestUSCorePediatricBMIForAge: [USCore.PediatricBMIforAgeObservationProfile]
define TestUSCorePediatricWeightForHeight: [USCore.PediatricWeightForHeightObservationProfile]
define TestUSCorePediatricHeadOccipitalFrontalCircumferencePercentileProfile: [USCore.PediatricHeadOccipitalFrontalCircumferencePercentileProfile]
//define TestUSCoreObservationSDOHAssessment: [USCore.ObservationSDOHAssessment]
//define TestUSCoreObservationSocialHistoryProfile: [USCore.ObservationSocialHistoryProfile]
define TestUSCoreObservationSexualOrientationProfile: [USCore.ObservationSexualOrientationProfile]

// Validate Encounter.diagnosis cardinality
define TestEncounterDiagnosisCardinality:
  exists (First([QICore.Encounter]).diagnosis)

// Validate ProcedureNotDone elements
define TestProcedureNotDoneElements:
  [ProcedureNotDone] P
    where P.recorded() on or before day of Today()
      and exists (P.identifier)
      and P.status = 'not-done'
      and P.statusReason is not null
      and P.category is not null
      and P.code is not null
      and P.performed is null

// Validate NotDone...

// CommunicationNotDone
define TestSpecificCommunicationNotDone:
  ["CommunicationNotDone": CommunicationCode]

// TODO: Support this case, need to introduce a terminology contains operator
// This operator is introduced in CQL R2
//define TestSpecificCommunicationNotDoneActual:
//    ["CommunicationNotDone": topic ~ CommunicationCode]
//      union ["CommunicationNotDone": topic ~contains CommunicationCode]

define TestSpecificCommunicationNotDoneExplicit:
  ["CommunicationNotDone"] C
    where C.topic() ~ CommunicationCode
      or CommunicationCode in C.topic()

define TestGeneralCommunicationNotDone:
  ["CommunicationNotDone": CommunicationCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralCommunicationNotDoneActual:
  ["CommunicationNotDone": topic in CommunicationCodes]
    union ["CommunicationNotDone": topic ~ CommunicationCodes]

define TestGeneralCommunicationNotDoneExplicit:
  ["CommunicationNotDone"] C
    where C.topic() in CommunicationCodes
      or C.topic() ~ CommunicationCodes

// DeviceNotRequested
define TestSpecificDeviceNotRequested:
  ["DeviceNotRequested": DeviceCode]

// TODO: Support this use case
//define TestSpecificDeviceNotRequestedActual:
//    ["DeviceNotRequested": code ~ DeviceCode]
//      union ["DeviceNotRequested": code ~contains DeviceCode]

define TestSpecificDeviceNotRequestedExplicit:
  [DeviceNotRequested] D
    where D.code() ~ DeviceCode
      or DeviceCode in D.code()

define TestGeneralDeviceNotRequested:
  ["DeviceNotRequested": DeviceCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralDeviceNotRequestedActual:
  ["DeviceNotRequested": code in DeviceCodes]
    union ["DeviceNotRequested": code ~ DeviceCodes]

define TestGeneralDeviceNotRequestedExplicit:
  ["DeviceNotRequested"] D
    where D.code() in DeviceCodes
      or D.code() ~ DeviceCodes

define TestGeneralDeviceNotRequestedCodeExplicit:
  ["DeviceNotRequested"] D
    where D.code() in DeviceCodes

define TestGeneralDeviceNotRequestedValueSetExplicit:
  ["DeviceNotRequested"] D
    where D.code() ~ DeviceCodes

// ImmunizationNotDone
define TestSpecificImmunizationNotDone:
  ["ImmunizationNotDone": ImmunizationCode]

// TODO: Support this use case
//define TestSpecificImmunizationNotDoneActual:
//    ["ImmunizationNotDone": vaccineCode ~ ImmunizationCode]
//      union ["ImmunizationNotDone": vaccineCode ~contains ImmunizationCode]

define TestSpecificImmunizationNotDoneExplicit:
  ["ImmunizationNotDone"] I
    where I.vaccineCode() ~ ImmunizationCode
      or ImmunizationCode in I.vaccineCode()

define TestGeneralImmunizationNotDone:
  ["ImmunizationNotDone": ImmunizationCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralImmunizationNotDoneActual:
  ["ImmunizationNotDone": vaccineCode in ImmunizationCodes]
    union ["ImmunizationNotDone": vaccineCode ~ ImmunizationCodes]

define TestGeneralImmunizationNotDoneExplicit:
  ["ImmunizationNotDone"] I
    where I.vaccineCode() in ImmunizationCodes
      or I.vaccineCode() ~ ImmunizationCodes

// MedicationAdministrationNotDone
define TestSpecificMedicationAdministrationNotDone:
  ["MedicationAdministrationNotDone": MedicationCode]

// TODO: Support this use case
//define TestSpecificMedicationAdministrationNotDoneActual:
//    ["MedicationAdministrationNotDone": medication ~ MedicationCode]
//      union ["MedicationAdministrationNotDone": medication ~contains MedicationCode]

define TestSpecificMedicationAdministrationNotDoneExplicit:
  ["MedicationAdministrationNotDone"] I
    where I.medication() ~ MedicationCode
      or MedicationCode in I.medication()

define TestGeneralMedicationAdministrationNotDone:
  ["MedicationAdministrationNotDone": MedicationCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralMedicationAdministrationNotDoneActual:
  ["MedicationAdministrationNotDone": medication in MedicationCodes]
    union ["MedicationAdministrationNotDone": medication ~ MedicationCodes]

define TestGeneralMedicationAdministrationNotDoneExplicit:
  ["MedicationAdministrationNotDone"] I
    where I.medication() in MedicationCodes
      or I.medication() ~ MedicationCodes

// MedicationDispenseDeclined
define TestSpecificMedicationDispenseDeclined:
  ["MedicationDispenseDeclined": MedicationCode]

// TODO: Support this use case
//define TestSpecificMedicationDispenseDeclinedActual:
//    ["MedicationDispenseDeclined": medication ~ MedicationCode]
//      union ["MedicationDispenseDeclined": medication ~contains MedicationCode]

define TestSpecificMedicationDispenseDeclinedExplicit:
  ["MedicationDispenseDeclined"] I
    where I.medication() ~ MedicationCode
      or MedicationCode in I.medication()

define TestGeneralMedicationDispenseDeclined:
  ["MedicationDispenseDeclined": MedicationCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralMedicationDispenseDeclinedActual:
  ["MedicationDispenseDeclined": medication in MedicationCodes]
    union ["MedicationDispenseDeclined": medication ~ MedicationCodes]

define TestGeneralMedicationDispenseDeclinedExplicit:
  ["MedicationDispenseDeclined"] I
    where I.medication() in MedicationCodes
      or I.medication() ~ MedicationCodes

// MedicationNotRequested
define TestSpecificMedicationNotRequested:
  ["MedicationNotRequested": MedicationCode]

// TODO: Support this use case
//define TestSpecificMedicationNotRequestedActual:
//    ["MedicationNotRequested": medication ~ MedicationCode]
//      union ["MedicationNotRequested": medication ~contains MedicationCode]

define TestSpecificMedicationNotRequestedExplicit:
  ["MedicationNotRequested"] I
    where I.medication() ~ MedicationCode
      or MedicationCode in I.medication()

define TestGeneralMedicationNotRequested:
  ["MedicationNotRequested": MedicationCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralMedicationNotRequestedActual:
  ["MedicationNotRequested": medication in MedicationCodes]
    union ["MedicationNotRequested": medication ~ MedicationCodes]

define TestGeneralMedicationNotRequestedExplicit:
  ["MedicationNotRequested"] I
    where I.medication() in MedicationCodes
      or I.medication() ~ MedicationCodes

// ObservationCancelled
define TestSpecificObservationCancelled:
  ["ObservationCancelled": ObservationCode]

// TODO: Support this use case
//define TestSpecificObservationCancelledActual:
//    ["ObservationCancelled": code ~ ObservationCode]
//      union ["ObservationCancelled": code contains ObservationCode]

define TestSpecificObservationCancelledExplicit:
  ["ObservationCancelled"] I
    where I.code() ~ ObservationCode
      or ObservationCode in I.code()

define TestGeneralObservationCancelled:
  ["ObservationCancelled": ObservationCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralObservationCancelledActual:
  ["ObservationCancelled": code in ObservationCodes]
    union ["ObservationCancelled": code ~ ObservationCodes]

define TestGeneralObservationCancelledExplicit:
  ["ObservationCancelled"] I
    where I.code() in ObservationCodes
      or I.code() ~ ObservationCodes

// ProcedureNotDone
define TestSpecificProcedureNotDone:
  ["ProcedureNotDone": ProcedureCode]

// TODO: Support this use case
//define TestSpecificProcedureNotDoneActual:
//    ["ProcedureNotDone": code ~ ProcedureCode]
//      union ["ProcedureNotDone": code ~contains ProcedureCode]

define TestSpecificProcedureNotDoneExplicit:
  ["ProcedureNotDone"] I
    where I.code() ~ ProcedureCode
      or ProcedureCode in I.code()

define TestGeneralProcedureNotDone:
  ["ProcedureNotDone": ProcedureCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralProcedureNotDoneActual:
  ["ProcedureNotDone": code in ProcedureCodes]
    union ["ProcedureNotDone": code ~ ProcedureCodes]

define TestGeneralProcedureNotDoneExplicit:
  ["ProcedureNotDone"] I
    where I.code() in ProcedureCodes
      or I.code() ~ ProcedureCodes

// ServiceNotRequested
define TestSpecificServiceNotRequested:
  ["ServiceNotRequested": ProcedureCode]

// TODO: Support this use case
//define TestSpecificServiceNotRequestedActual:
//    ["ServiceNotRequested": code ~ ProcedureCode]
//      union ["ServiceNotRequested": code ~contains ProcedureCode]

define TestSpecificServiceNotRequestedExplicit:
  ["ServiceNotRequested"] I
    where I.code() ~ ProcedureCode
      or ProcedureCode in I.code()

define TestGeneralServiceNotRequested:
  ["ServiceNotRequested": ProcedureCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralServiceNotRequestedActual:
  ["ServiceNotRequested": code in ProcedureCodes]
    union ["ServiceNotRequested": code ~ ProcedureCodes]

define TestGeneralServiceNotRequestedExplicit:
  ["ServiceNotRequested"] I
    where I.code() in ProcedureCodes
      or I.code() ~ ProcedureCodes

// TaskRejected
define TestSpecificTaskRejected:
  ["TaskRejected": TaskCode]

// TODO: Support this use case
//define TestSpecificTaskRejectedActual:
//    ["TaskRejected": code ~ TaskCode]
//      union ["TaskRejected": code contains TaskCode]

define TestSpecificTaskNotDoneExplicit:
  ["TaskRejected"] I
    where I.code() ~ TaskCode
      or TaskCode in I.code()

define TestGeneralTaskRejected:
  ["TaskRejected": TaskCodes]

// NOTE: This warning should not be happening, logged a translator issue to investigate: https://github.com/cqframework/clinical_quality_language/issues/1714
define TestGeneralTaskRejectedActual:
  ["TaskRejected": code in TaskCodes]
    union ["TaskRejected": code ~ TaskCodes]

define TestGeneralTaskRejectedExplicit:
  ["TaskRejected"] I
    where I.code() in TaskCodes
      or I.code() ~ TaskCodes
ELM XML Content
Encoded data 
ELM JSON Content
Encoded data 
Generated using version 0.5.6-cibuild of the sample-content-ig Liquid templates