Breast Cancer Screening and Management (BCSM) Clinical Decision Support (CDS) Implementation Guide
1.0.0 - ci-build

Breast Cancer Screening and Management (BCSM) Clinical Decision Support (CDS) Implementation Guide - Local Development build (v1.0.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Library: High Risk Referral

Official URL: http://cancerscreeningcds.github.io/bcsm-cds/Library/HighRiskReferral Version: 1.0.0
Draft as of 2025-02-28 Computable Name: HighRiskReferral
Title: High Risk Referral
Id: HighRiskReferral
Version: 1.0.0
Url: High Risk Referral
Status: draft
Type:

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

code: logic-library

Date: 2025-02-28 23:16:14+0000
Publisher: MITRE
Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
PatientPatient01Out
MostRecentAgeValuedecimal01Out
inc-AgeAtLeast18boolean01Out
inc-assignedfemaleatbirthortransfemaleboolean01Out
IsIncludedboolean01Out
exc-hxbrcaboolean01Out
Excludedboolean01Out
IsIncludedAndNotExcludedboolean01Out
CheckIsIncludedAndNotExcludedboolean01Out
HighRiskReferralGeneticResource01Out
HighRiskReferralChestXRTResource01Out
eve-atypicalbxpopboolean01Out
HighRiskReferralAtypicalBiopsyResource01Out
HighRiskReferral5YRiskHighResource01Out
HighRiskReferral5YRiskHigherThanAverageResource01Out
HighRiskReferralResource01Out
ConsiderLifeExpectancyResource01Out
HighRiskAssessmentResource0*Out
flow-HighRiskReferralResource0*Out
ExistsHighRiskReferralGeneticboolean01Out
ExistsHighRiskReferralChestXRTboolean01Out
ExistsHighRiskReferralAtypicalBiopsyboolean01Out
ExistsHighRiskReferral5YRiskHighboolean01Out
ExistsHighRiskReferral5YRiskHigherThanAverageboolean01Out
HighRiskReferralCodeCoding01Out
HighRiskReferralReasonCoding01Out
ExistsConsiderLifeExpectancyboolean01Out
ConsiderLifeExpectancyCodeCoding01Out
ConsiderLifeExpectancyReasonResource01Out
ExistsHighRiskAssessmentboolean01Out
HighRiskAssessmentToolCodeCoding01Out
HighRiskAssessmentToolReasonCoding01Out
HighRiskAssessmentCodeCoding01Out
HighRiskAssessmentReasonCoding01Out
Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/StructureDefinition/Patient ;;;
Observation http://hl7.org/fhir/StructureDefinition/Observation ;;;;; code filter:
path: code

system: http://loinc.org

code: 30525-0

display: Age

code filter:
path: value.unit

code: years

Observation http://hl7.org/fhir/StructureDefinition/Observation ;;;; code filter:
path: code

system: http://loinc.org

code: 76691-5

display: Gender identity

Observation http://hl7.org/fhir/StructureDefinition/Observation ;;;; code filter:
path: code

system: http://loinc.org

code: 66110-8

display: Breast Pathology biopsy report

Condition http://hl7.org/fhir/StructureDefinition/Condition ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1032.367 code filter:
path: clinicalStatus code filter:
path: clinicalStatus code filter:
path: clinicalStatus
Condition http://hl7.org/fhir/StructureDefinition/Condition ;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1032.383
Condition http://hl7.org/fhir/StructureDefinition/Condition ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1032.367
Condition http://hl7.org/fhir/StructureDefinition/Condition ;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1032.383 code filter:
path: clinicalStatus
Condition http://hl7.org/fhir/StructureDefinition/Condition ;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1032.392
DiagnosticReport http://hl7.org/fhir/StructureDefinition/DiagnosticReport ;;;
DiagnosticReport http://hl7.org/fhir/StructureDefinition/DiagnosticReport ;;;; code filter:
path: code

system: http://loinc.org

code: 66110-8

display: Breast Pathology biopsy report

Content: text/cql
/*  
  Author: CMS Alliance to Modernize Healthcare, operated by THE MITRE Corporation.

  (C) 2024 The MITRE Corporation. All Rights Reserved. 
  Approved for Public Release: 24-2711. 
  Distribution Unlimited.

  Unless otherwise noted, this work is available under an Apache 2.0 license. 
  It was produced by the MITRE Corporation for the Division of Cancer Prevention 
  and Control, Centers for Disease Control and Prevention in accordance with the 
  Statement of Work, contract number 75FCMC18D0047, task order number 75D30123F17931.
*/

library HighRiskReferral version '1.0.0'

using FHIR version '4.0.1'
include FHIRHelpers  version '4.0.1' called FHIRHelpers

include HighRiskReferralEvents version '1.0.0' called Events
include HighRiskReferralActions version '1.0.0' called Actions
include DataElements version '1.0.0' called DataElements

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

// Standard codes
code "Age": '30525-0' from "LOINC" display 'Age'

context Patient

//------------------------------------------------------------------------------
// INCLUSIONS/EXCLUSIONS
//------------------------------------------------------------------------------

define CheckIsIncludedAndNotExcluded:
  Message(IsIncludedAndNotExcluded, IsIncludedAndNotExcluded is false,
    'http://example.org/CodeSystem/plan-definition-action-reason-code-system/excludedornotincluded',
    'Error', 
    'Excluded or not included')

define IsIncludedAndNotExcluded:
  IsIncluded and not Excluded

// INCLUSIONS
define IsIncluded:
  "inc-AgeAtLeast18" and "inc-assignedfemaleatbirthortransfemale"

// Age 18 years and older, only use MostRecentAgeValue if no birthdate  
define "inc-AgeAtLeast18":
  (AgeInYears() is not null and AgeInYears() >= 18) or (AgeInYears() is null and MostRecentAgeValue >= 18)

define MostRecentAgeValue:
  First(
    [Observation: "Age"] O
      where O.value.unit = 'years'
      sort by effective desc
  ).value.value.value

define "inc-assignedfemaleatbirthortransfemale":
  DataElements."de-female" or DataElements."TransgenderFemale"

// EXCLUSIONS
define Excluded:
  "exc-hxbrca"

define "exc-hxbrca": //Previous diagnosis of breast cancer
  exists DataElements."de-breastca" or exists DataElements."de-hxbreastca"

//------------------------------------------------------------------------------
// RECOMMENDATIONS
//------------------------------------------------------------------------------

define "flow-HighRiskReferral":
  {
    HighRiskReferral,
    ConsiderLifeExpectancy,
    HighRiskAssessment
  }
  except { null, {} }

define ConsiderLifeExpectancy:
  if HighRiskReferral is not null and Events."eve-LifeExp" is true
  then Actions."act-estlifexpectancy" else null

define HighRiskReferral: 
  Coalesce(
    HighRiskReferralGenetic,
    HighRiskReferralChestXRT,
    HighRiskReferralAtypicalBiopsy,
    HighRiskReferral5YRiskHigh,
    HighRiskReferral5YRiskHigherThanAverage
  )

define HighRiskReferralGenetic:  
  if Events."eve-ageAny" and Events."eve-geneticriskpop"    
  then Actions."act-HighRiskReferralGenetic" else null

define HighRiskReferralChestXRT:  
  if Events."eve-ageAny" and Events."eve-chestxrtpop"
  then Actions."act-HighRiskReferralChestXRT" else null

define HighRiskReferralAtypicalBiopsy:  
  if Events."eve-ageAny" and "eve-atypicalbxpop"
  then Actions."act-HighRiskReferralAtypicalBiopsy" else null

define HighRiskReferral5YRiskHigh:
  if Events."eve-ageAtLeast35" and Events."eve-fiveyrriskpop"
    and Events.ValidMostRecent5YrRiskAssessment    
  then Actions."act-HighRiskReferral" else null

define HighRiskReferral5YRiskHigherThanAverage:
  if Events."eve-ageAtLeast35" and Events."eve-fiveyrrisklowpop"   
    and Events.ValidMostRecent5YrRiskAssessment     
  then Actions."act-ConsiderHighRiskReferral" else null

define HighRiskAssessment:
  if HighRiskReferral is null and 
    Events."eve-ageAtLeast35" 
    and (Events."eve-fhxbrca" or Events."eve-personalriskfactors")
    and Events.ValidMostRecent5YrRiskAssessment is false
  then {Actions."act-5YRiskAssessment",Actions."act-5YRiskAssessmentTool"} else null   

//------------------------------------------------------------------------------
// ERRORS
//------------------------------------------------------------------------------     

define "eve-atypicalbxpop":  
  Message(Events."eve-atypicalbxpop", 
    DataElements.BiopsyDiagnosticReportsWithNoConclusionCodes,
    'http://example.org/CodeSystem/plan-definition-action-reason-code-system/missingresultcode',
    'Warning', 
    'A laboratory test was found without a result. Please review patient record to resolve.')    

//------------------------------------------------------------------------------
// DYNAMIC VALUES
//------------------------------------------------------------------------------  

define ExistsHighRiskReferralGenetic:
  HighRiskReferralGenetic is not null

define ExistsHighRiskReferralChestXRT:
  HighRiskReferralChestXRT is not null    

define ExistsHighRiskReferralAtypicalBiopsy:
  HighRiskReferralAtypicalBiopsy is not null  

define ExistsHighRiskReferral5YRiskHigh:
  HighRiskReferral5YRiskHigh is not null 

define ExistsHighRiskReferral5YRiskHigherThanAverage:
  HighRiskReferral5YRiskHigherThanAverage is not null     

define HighRiskReferralCode:
  HighRiskReferral.code

define HighRiskReferralReason:
  HighRiskReferral.reason 

define ExistsConsiderLifeExpectancy:
  ConsiderLifeExpectancy is not null  

define ConsiderLifeExpectancyCode:
  ConsiderLifeExpectancy.code  

define ConsiderLifeExpectancyReason:
  ConsiderLifeExpectancy.reason    

define ExistsHighRiskAssessment:
  HighRiskAssessment is not null  

define HighRiskAssessmentToolCode:
  (Actions."act-5YRiskAssessmentTool").code  

define HighRiskAssessmentToolReason:
  (Actions."act-5YRiskAssessmentTool").reason     

define HighRiskAssessmentCode:
  (Actions."act-5YRiskAssessment").code  

define HighRiskAssessmentReason:
  (Actions."act-5YRiskAssessment").reason    
Content: application/elm+xml
Encoded data (98072 characters)
Content: application/elm+json
Encoded data (177224 characters)