FHIRHelpers
type: Library
node role: treeRoot
id:
  v: FHIRHelpers
text:
  status:
    v: extensions
  div:
    v: Id: FHIRHelpers Url: FHIRHelpers R4 Logic Version: 0.1.0 Name: FHIRHelpers Title: FHIRHelpers R4 Logic Status: draft Date: 2026-02-19 22:08:15+0000 Publisher: Oregon Health and Science University Description: FHIRHelpers R4 conversion logic library Jurisdiction: 840 Copyright: Published by OHSU under an Apache 2.0 License Related Artifacts: Type Resource depends-on http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1 Content: text/cql library FHIRHelpers version '4.0.1'#xD; #xD; using FHIR version '4.0.1'#xD; #xD; define function ToInterval(period FHIR.Period):#xD; if period is null then#xD; null#xD; else#xD; if period."start" is null then#xD; Interval(period."start".value, period."end".value]#xD; else#xD; Interval[period."start".value, period."end".value]#xD; #xD; define function ToCalendarUnit(unit System.String):#xD; case unit#xD; when 'ms' then 'millisecond'#xD; when 's' then 'second'#xD; when 'min' then 'minute'#xD; when 'h' then 'hour'#xD; when 'd' then 'day'#xD; when 'wk' then 'week'#xD; when 'mo' then 'month'#xD; when 'a' then 'year'#xD; else unit#xD; end#xD; #xD; define function ToQuantity(quantity FHIR.Quantity):#xD; case#xD; when quantity is null then null#xD; when quantity.value is null then null#xD; when quantity.comparator is not null then#xD; Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')#xD; when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'#xD; or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then#xD; System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }#xD; else#xD; Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')')#xD; end#xD; #xD; def…
extension:
  url:
    v: http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem
    l: cqfm-softwaresystem
  value: Reference
    l: cqf-tooling
    reference:
      v: Device/cqf-tooling
url:
  v: http://hl7.org/fhir/Library/FHIRHelpers
  l: FHIRHelpers
version:
  v: 0.1.0
name:
  v: FHIRHelpers
title:
  v: FHIRHelpers R4 Logic
status:
  v: draft
date:
  v: 2026-02-19T22:08:15+00:00
publisher:
  v: Oregon Health and Science University
contact:
  name:
    v: Oregon Health and Science University
  telecom:
    system:
      v: url
    value:
      v: https://www.ohsu.edu/
description:
  v: FHIRHelpers R4 conversion logic library
jurisdiction:
  coding:
    system:
      v: http://unstats.un.org/unsd/methods/m49/m49.htm
      l: m49.htm
    code:
      v: 840
copyright:
  v: Published by OHSU under an Apache 2.0 License
related artifact:
  type:
    v: depends-on
  display:
    v: FHIR model information
  resource:
    v: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
    l: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo
content:
  content type:
    v: text/cql
content:
  content type:
    v: application/elm+xml
content:
  content type:
    v: application/elm+json