CumulativeMedicationDurationTests
type: Library
node role: treeRoot
id:
  v: CumulativeMedicationDurationTests
text:
  status:
    v: extensions
  div:
    v: Metadata Title Cumulative Medication Duration Tests Version 2.0.0-ballot Experimental true Jurisdiction United States of America Topic FHIR Topic CQL Topic Medication Topic Cumulative Medication Duration Topic Unit Tests Steward (Publisher) HL7 International / Clinical Decision Support Description This library provides tests for the cumulative medication duration calculation logic for use with FHIR medication prescription, administration, and dispensing resources. Type logic-library from http://terminology.hl7.org/CodeSystem/library-type Dependency Description: Library FHIRHelpers Resource: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1 Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1 Dependency Description: Library CMD Resource: Cumulative Medication Durationversion: null2.0.0-ballot) Canonical URL: http://hl7.org/fhir/us/cql/Library/CumulativeMedicationDuration|2.0.0-ballot Data Requirement Type: MedicationRequest Profile(s): MedicationRequest Data Requirement Type: MedicationDispense Profile(s): MedicationDispense Parameters Name Use Card. Type Documentation Patient Out 0..1 Patient Prescriptions Out 0..* MedicationRequest Dispenses Out 0..* MedicationDispense PrescriptionPeriods Out 0..* Period DispensePeriods Out 0..* Period CumulativeDuration Out 0..1 integer CumulativeMedicationDuration Out 0..1 integer Library Content CQL Content library CumulativeMedicationDurationTests version '2.0.0-ballot' using FHIR version '4.0.1' include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' include CumulativeMedicationDuration version '2.0.0-ballot' called CMD context Patient /* # Example 1: MedicationRequest 2 tabs 3x/day #180/2 * dosage = 2 * frequency = 3x /day (i.e., repeats / period = day) * supply = 180 * daysSupplied = 30 days * refills = 2 derived daysSupplied = [supply (180) / ((dosage (2) x frequency (3))] = 30 daysSuppliedWithRefills = [supply (180) x (1 + refills (2)) / ((dosage (2) x frequency (3))] = 30 x 3 = 90 days */ /* ## Example 1a - …
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm
    l: structuredefinition-fmm
  value: Integer
    v: 3
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/structuredefinition-wg
    l: structuredefinition-wg
  value: Code
    v: cds
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status
    l: structuredefinition-standards-status
  value: Code
    v: informative
url:
  v: http://hl7.org/fhir/us/cql/Library/CumulativeMedicationDurationTests
  l: CumulativeMedicationDurationTests
version:
  v: 2.0.0-ballot
name:
  v: CumulativeMedicationDurationTests
title:
  v: Cumulative Medication Duration Tests
status:
  v: active
experimental:
  v: true
type:
  coding:
    system:
      v: http://terminology.hl7.org/CodeSystem/library-type
      l: library-type
    code:
      v: logic-library
date:
  v: 2026-04-03T00:32:37+11:00
publisher:
  v: HL7 International / Clinical Decision Support
contact:
  telecom:
    system:
      v: url
    value:
      v: http://www.hl7.org/Special/committees/dss
description:
  v: This library provides tests for the cumulative medication duration calculation logic for use with FHIR medication prescription, administration, and dispensing resources.
jurisdiction:
  coding:
    system:
      v: urn:iso:std:iso:3166
      l: 3166
    code:
      v: US
    display:
      v: United States of America
topic:
  text:
    v: FHIR
topic:
  text:
    v: CQL
topic:
  text:
    v: Medication
topic:
  text:
    v: Cumulative Medication Duration
topic:
  text:
    v: Unit Tests
related artifact:
  type:
    v: depends-on
  display:
    v: Library FHIRHelpers
  resource:
    v: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
    l: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers
related artifact:
  type:
    v: depends-on
  display:
    v: Library CMD
  resource:
    v: http://hl7.org/fhir/us/cql/Library/CumulativeMedicationDuration|2.0.0-ballot
    l: http://hl7.org/fhir/us/cql/Library/CumulativeMedicationDuration
parameter:
  name:
    v: Patient
  use:
    v: out
  min:
    v: 0
  max:
    v: 1
  type:
    v: Patient
parameter:
  name:
    v: Prescriptions
  use:
    v: out
  min:
    v: 0
  max:
    v: *
  type:
    v: MedicationRequest
parameter:
  name:
    v: Dispenses
  use:
    v: out
  min:
    v: 0
  max:
    v: *
  type:
    v: MedicationDispense
parameter:
  name:
    v: PrescriptionPeriods
  use:
    v: out
  min:
    v: 0
  max:
    v: *
  type:
    v: Period
parameter:
  name:
    v: DispensePeriods
  use:
    v: out
  min:
    v: 0
  max:
    v: *
  type:
    v: Period
parameter:
  name:
    v: CumulativeDuration
  use:
    v: out
  min:
    v: 0
  max:
    v: 1
  type:
    v: integer
parameter:
  name:
    v: CumulativeMedicationDuration
  use:
    v: out
  min:
    v: 0
  max:
    v: 1
  type:
    v: integer
data requirement:
  type:
    v: MedicationRequest
  profile:
    v: http://hl7.org/fhir/StructureDefinition/MedicationRequest
    l: MedicationRequest
data requirement:
  type:
    v: MedicationDispense
  profile:
    v: http://hl7.org/fhir/StructureDefinition/MedicationDispense
    l: MedicationDispense
content:
  content type:
    v: text/cql
content:
  content type:
    v: application/elm+xml
content:
  content type:
    v: application/elm+json