Common CQL Artifacts for FHIR (US-Based)
2.0.0-ballot - Informative 2 Ballot

Common CQL Artifacts for FHIR (US-Based) - Downloaded Version null See the Directory of published versions

## Library: US Core Common Tests (Experimental)

Official URL: http://hl7.org/fhir/us/cql/Library/USCoreCommonTests | Version: 2.0.0-ballot | Highlight text changes?
Standards status: Informative Active as of 2026-04-03 | Maturity Level: 3 | Computable Name: USCoreCommonTests

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

Metadata
Title | US Core Common Tests
Version | 2.0.0-ballot
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 US Core Common library.
Type | logic-library from http://terminology.hl7.org/CodeSystem/library-type
Dependency | Description: Library UC Resource: US Core Commonversion: null2.0.0-ballot) Canonical URL: `http://hl7.org/fhir/us/cql/Library/USCoreCommon|2.0.0-ballot`
Parameters
Parameter | None
Library Content
CQL Content |
    library USCoreCommonTests version '2.0.0-ballot'

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

    include USCoreCommon version '2.0.0-ballot' called UC

    context Patient

    //* _01_ define fluent function race(patient Patient):
    define _01_TestRace: Patient.race()

    //* _02_ define fluent function ethnicity(patient Patient):
    define _02_TestEthnicity: Patient.ethnicity()

    //* _03_ define fluent function tribalAffiliation(patient Patient):
    define _03_TestTribalAffiliation: Patient.tribalAffiliation()

    //* _04_ define fluent function birthSex(patient Patient):
    define _04_TestBirthSex: Patient.birthSex()

    //* _05_ define fluent function systolic(bloodPressureProfile BloodPressureProfile):
    define _05_TestSystolic:
      [Observation] O
        return O.systolic()

    //* _06_ define fluent function diastolic(bloodPressureProfile BloodPressureProfile):
    define _06_TestDiastolic:
      [Observation] O
        return O.diastolic()

    //* _07_ define fluent function isHealthConcern(condition FHIR.Condition):
    define _07_TestIsHealthConcern:
      [Condition] C
        where C.isHealthConcern()

    /*
    TODO: These are really US Core tests...
    define TestAge:
      AgeInYears()

    define TestAgeAt:
      AgeInYearsAt(@2022-10-14)

    define TestPrimitives:
      Patient P
        where P.gender = 'male'
          and P.active is true
          and P.birthDate before Today()
          and P.maritalStatus in "Marital Status"
          and P.maritalStatus ~ "Marital Status - Married"

    define TestChoice:
      Patient P
        where P.deceased is false
          or P.deceased before Today()

    define TestSlices:
      ["USCore.BloodPressureProfile"] BP
        where BP.systolic().value < 140 'mm[Hg]'
          and BP.diastolic().value < 90 'mm[Hg]'

    define TestSimpleExtensions:
      Patient P
        where P.birthsex() = 'M'

    define TestComplexExtensions:
      Patient P
        where P.race().ombCategory contains "American Indian or Alaska Native"
          and P.race().detailed contains "Alaska Native"
    */
ELM XML Content |
    Encoded data
ELM JSON Content |
    Encoded data
Generated using version 0.5.3-cibuild of the sample-content-ig Liquid templates