OHSU Hypertension Implementation Guide
0.1.0 - CI Build Unknown region code '840'

OHSU Hypertension Implementation Guide, published by Oregon Health and Science University. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/OHSUCMP/htnu18ig/ and changes regularly. See the Directory of published versions

Library: BPTimeInRange

Official URL: http://fhir.org/guides/ohsuhypertensionig/Library/BPTimeInRange Version: 0.1.0
Draft as of 2026-04-24 Computable Name: BPTimeInRange

Copyright/Legal: Published by OHSU under an Apache 2.0 License

Metadata
Version 0.1.0
Status Draft
Jurisdiction 840 from http://unstats.un.org/unsd/methods/m49/m49.htm
Steward (Publisher) Oregon Health and Science University
Steward Contact Oregon Health and Science University
Copyright

Published by OHSU under an Apache 2.0 License

Dependency Description: FHIR model information
Resource: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
Canonical URL: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
Dependency Description: Library FHIRHelpers
Resource: http://fhir.org/guides/ohsuhypertensionig/Library/FHIRHelpers|4.0.1
Canonical URL: http://fhir.org/guides/ohsuhypertensionig/Library/FHIRHelpers|4.0.1
Dependency Description: Library Common
Resource: Common Logic version: 0.1.0
Canonical URL: http://fhir.org/guides/ohsuhypertensionig/Library/OHSUHTNCommon|0.1
Dependency Description: Code system LOINC
Resource: LOINC
Canonical URL: http://loinc.org
Dependency Description: Code system ConditionVerificationStatusCodes
Resource: ConditionVerificationStatus
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-ver-status
Dependency Description: Value set End Stage Renal Disease
Resource: End Stage Renal Disease
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.2.590
Dependency Description: Value set Pregnancy
Resource: Pregnancy
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.378
Dependency Description: Value set Systolic Blood Pressure
Resource: Systolic blood pressure
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1104.2
Dependency Description: Value set Diastolic Blood Pressure
Resource: Diastolic Blood Pressure
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.2.1045
Dependency Description: Value set Blood Pressure Measured
Resource: Blood Pressure Measured
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.2012
Data Requirement Type: Patient
Profile(s): Patient
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, status, effective, component
Code Filter(s):
Path: code
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code
Parameters
Name Use Card. Type Documentation
Measurement Period In 0..1 Period
Systolic Target In 0..1 decimal
Diastolic Target In 0..1 decimal
Patient Out 0..1 Patient
Info Out 0..1 string
Warning Out 0..1 string
Critical Out 0..1 string
Errors Out 0..1 Resource
Meets Inclusion Criteria Out 0..1 boolean
Meets Exclusion Criteria Out 0..1 boolean
In Population Out 0..1 boolean
Provide Recommendation Out 0..1 boolean
Recommendation Out 0..1 string
Valid BP Observations Out 0..* Observation
BP Readings Out 0..* Resource
Total Readings Count Out 0..1 integer
Readings In Range Out 0..* Resource
In Range Count Out 0..1 integer
Percentage Time In Range Out 0..1 decimal
Rationale Out 0..1 string
Suggestions Out 0..1 string
Selection Behavior Out 0..1 string
Links Out 0..1 string
Rationale Combined Data Out 0..1 string
Indicator Status Out 0..1 string
Library Content
CQL Content
library BPTimeInRange version '1.0.0'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include OHSUHTNCommon version '0.1' called Common

codesystem "LOINC": 'http://loinc.org'

// -- Panel Concepts --
code "Office BP Panel": '85354-9' from "LOINC" display 'Blood pressure panel with all children optional'
code "Home BP Panel": '55284-4' from "LOINC" display 'Blood pressure systolic & diastolic - cardiovascular device'

concept "All BP Panels": { "Office BP Panel", "Home BP Panel" } display 'All Blood Pressure Panels'

// -- Component Codes --
code "Office Systolic": '8480-6' from "LOINC" display 'Systolic blood pressure'
code "Home Systolic": '8459-0' from "LOINC" display 'Systolic blood pressure - Home'
code "Office Diastolic": '8462-4' from "LOINC" display 'Diastolic blood pressure'
code "Home Diastolic": '8453-3' from "LOINC" display 'Diastolic blood pressure - Home'

concept "Systolic BP Components": { "Office Systolic", "Home Systolic" } display 'Systolic BP'
concept "Diastolic BP Components": { "Office Diastolic", "Home Diastolic" } display 'Diastolic BP'

// -- Parameters --
parameter "Measurement Period" Interval<DateTime>
  default Interval[Now() - 3 months, Now()]

// Target Thresholds (Customizable based on clinical guidelines)
parameter "Systolic Target" Decimal default 130.0
parameter "Diastolic Target" Decimal default 80.0

context Patient

// -- Logic --

define "Info":
  'info'

define "Warning":
  'warning'

define "Critical":
  'critical'

define "Errors":
  null

define "Meets Inclusion Criteria":
 true

define "Meets Exclusion Criteria":
  Common."Patient Under Age 18"
    or Common."Patient Over Age 100"
    or exists Common."Condition Indicating End Stage Renal Disease"
    or exists Common."Condition Indicating Pregnancy"
    or Common."HTN Crisis"

define "In Population":
  // Preserve this ordering so excluded patients fail fast
  not "Meets Exclusion Criteria" and "Meets Inclusion Criteria"

define "Provide Recommendation":
  "In Population"

define "Recommendation":
  if not "Provide Recommendation" then 'None'
  else 'Blood Pressure Time-in-Range'

define "Rationale Combined Data":
  "Rationale" + '|' + "Suggestions" + '|' + "Selection Behavior" + '|' + "Links"

define "Rationale":
  if not "Provide Recommendation" then ''
  else if "Total Readings Count" > 0 then
    '{{#patient}}Your blood pressure was in range for '
      + ToString(Round("Percentage Time In Range", 1))
      + '% of recorded readings during the measurement period (most recent 3 months).{{/patient}}'
      + '{{#careTeam}}Patient blood pressure was in range for '
      + ToString(Round("Percentage Time In Range", 1))
      + '% of recorded readings during the measurement period (most recent 3 months).{{/careTeam}}'
  else 'Consider obtaining additional blood pressure measurements.'

define "Indicator Status":
  "Info"

define "Suggestions":
  ''

define "Selection Behavior":
  'at-most-one'

define "Links":
  ''

// 1. Retrieve valid BP observations within the last 3 months
define "Valid BP Observations":
  [Observation: "All BP Panels"] BP
    where BP.status in { 'final', 'amended', 'corrected' }
      and BP.effective as dateTime in "Measurement Period"

// 2. Extract components and structure the data
define "BP Readings":
  "Valid BP Observations" BP
    let
      SysComp: singleton from (BP.component C where FHIRHelpers.ToConcept(C.code) ~ "Systolic BP Components"),
      DiaComp: singleton from (BP.component C where FHIRHelpers.ToConcept(C.code) ~ "Diastolic BP Components"),
      SysValue: SysComp.value as Quantity,
      DiaValue: DiaComp.value as Quantity
    where SysValue is not null and DiaValue is not null
    return {
      Date: BP.effective as dateTime,
      Systolic: SysValue.value,
      Diastolic: DiaValue.value
    }

// 3. Filter for readings within the target range
define "Readings In Range":
  "BP Readings" R
    where R.Systolic < "Systolic Target"
      and R.Diastolic < "Diastolic Target"

// 4. Calculate aggregates
define "Total Readings Count":
  Count("BP Readings")

define "In Range Count":
  Count("Readings In Range")

// 5. Generate Time in Range percentage
define "Percentage Time In Range":
  if "Total Readings Count" > 0 then
    ("In Range Count" * 100.0) / "Total Readings Count"
  else
    null
ELM XML Content
Encoded data 
ELM JSON Content
Encoded data 
Generated using version 0.5.4 of the sample-content-ig Liquid templates