PatientCommon
type: Library
node role: treeRoot
id:
  v: PatientCommon
text:
  status:
    v: extensions
  div:
    v: Metadata Title Patient Common Version 2026.1.0 Topic FHIR Topic CQL Description PatientCommon logic. Type logic-library from http://terminology.hl7.org/CodeSystem/library-type Parameter Name: Patient Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: Patient Library Content CQL Content /* @description: Common patient fluent functions @comment: These are currently in the CI Build of US CQL, reproduced here for ease of reference */ library PatientCommon using FHIR version '4.0.1' include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' include hl7.fhir.uv.cql.FHIRCommon version '2.0.0' context Patient /* @description: Returns the age in days of the patient as of the given date, using birth time if known @comment: This function returns the number of whole days between the patient birth date and the asOf date. If the patient has a birthTime, the calculation is performed using the birthDateTime, and the time component of the asOf parameter is considered. Note that when the birth time is known, timezone offset normalization will be used. */ define fluent function ageInDaysAt(patient Patient, asOf DateTime): if patient.birthTime() is not null then CalculateAgeInDaysAt(Patient.birthDateTime(), asOf) else CalculateAgeInDaysAt(Patient.birthDate, date from asOf) /* @description: Returns the current age in days of the patient, using birth time if known @comment: This function returns the number of whole days between the patient birth date and the current date. If the patient has a birthTime, the calculation is performed using the birthDateTime and Now(), otherwise the calculation is performed using Today(). Note that when the birth time is known, timezone offset normalization will be used. */ define fluent function ageInDays(patient Patient): if patient.birthTime() is not null then CalculateAgeInDaysAt(Patient.birthDateTime(), Now()) else CalculateAgeInDaysAt(Patient.birthDate, Today()) /* @description: Returns the age in months of the patient as of the given date, using birth tim…
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm
  value: integer
    v: 1
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/structuredefinition-wg
  value: code
    v: cds
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status
  value: code
    v: informative
url:
  v: https://madie.cms.gov/Library/PatientCommon
version:
  v: 2026.1.0
name:
  v: PatientCommon
title:
  v: Patient Common
status:
  v: active
experimental:
  v: false
type:
  coding:
    system:
      v: http://terminology.hl7.org/CodeSystem/library-type
    code:
      v: logic-library
date:
  v: 2026-06-16T17:19:32+00:00
description:
  v: PatientCommon logic.
topic:
  text:
    v: FHIR
topic:
  text:
    v: CQL
related artifact:
  type:
    v: depends-on
  display:
    v: Library FHIRHelpers
  resource:
    v: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
    link: 4.0
    link: .1
related artifact:
  type:
    v: depends-on
  display:
    v: Library FHIRCommon
  resource:
    v: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0
    link: 2.0
    link: .0
parameter:
  name:
    v: Patient
  use:
    v: out
  min:
    v: 0
  max:
    v: 1
  type:
    v: Patient
content:
  content type:
    v: text/cql
content:
  content type:
    v: application/elm+xml
content:
  content type:
    v: application/elm+json