Person-Centered Outcomes (PCO) Implementation Guide
1.0.0-ballot - STU 1 Ballot United States of America flag

This page is part of the Person-Centered Outcomes (PCO) Implementation Guide (v1.0.0-ballot: STU 1 Ballot 1) based on FHIR (HL7® FHIR® Standard) R4. No current official version has been published yet. For a full list of available versions, see the Directory of published versions

Library: WhatMattersLogic

Official URL: http://hl7.org/fhir/us/pco/Library/WhatMattersLogic Version: 1.0.0-ballot
Standards status: Draft Maturity Level: 2 Computable Name: WhatMattersLogic

CQL logic for What Matters concepts.

Id: WhatMattersLogic
Version: 1.0.0-ballot
Url: WhatMattersLogic
Status: draft
Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2025-03-28 21:02:54+0000
Publisher: HL7 International / Patient Care
Description:

CQL logic for What Matters concepts.

Jurisdiction: US
Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
Measurement PeriodPeriod01In
Follow-Up IntervalRange01In
PatientPatient01Out
Well-Being ObservationsObservation0*Out
Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/StructureDefinition/Patient
Observation http://hl7.org/fhir/StructureDefinition/Observation ;;;
Content: text/cql
library WhatMattersLogic version '0.1.0'

using FHIR version '4.0.1'

include FHIRHelpers version '4.4.000' called FHIRHelpers
include PCOCommon version '0.1.0' called PC

codesystem "Well-Being Concepts": 'http://hl7.org/fhir/us/pco/CodeSystem/pco-concepts'
valueset "Well-Being Categories": 'http://hl7.org/fhir/us/pco/ValueSet/pco-categories'
valueset "Well-Being Domains": 'http://hl7.org/fhir/us/pco/ValueSet/wellbeing-domains-example'

code "What Matters category": 'what-matters' from "Well-Being Concepts" display 'What Matters'

parameter "Measurement Period" Interval<DateTime>
    default Interval[@2024-01-01T00:00:00.000Z, @2024-12-31T23:59:59.999Z]

parameter "Follow-Up Interval" Interval<System.Quantity>
  default Interval[2 weeks, 26 weeks]

context Patient

define "Well-Being Observations":
  [Observation] obs
    where obs.category in "Well-Being Categories"
      or obs.code in "Well-Being Domains"

// Returns a list of what matters Observations this Goal addresses.
define fluent function whatMattersObservations(goal Goal):
  flatten( goal.addresses GA
      return [Observation] obs
        where obs.id = GA.reference.getId()
          and obs.isWhatMatters()
  )

define fluent function isWhatMatters(obs Observation):
  exists( "Well-Being Observations" obs
    where exists(obs.category cat where cat = "What Matters category")
  )
Content: application/elm+xml
Encoded data (35432 characters)
Content: application/elm+json
Encoded data (66124 characters)