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: Screening Eligible

Official URL: http://cancerscreeningcds.github.io/bcsm-cds/Library/ScreeningEligible Version: 1.0.0
Draft as of 2025-02-28 Computable Name: ScreeningEligible
Title: Screening Eligible
Id: ScreeningEligible
Version: 1.0.0
Url: Screening Eligible
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
MissingAgeOrBirthdateboolean01Out
ErrorMissingAgeOrBirthdateboolean01Out
IsIncludedAndNotExcludedErrorsHaveOccurredboolean01Out
inc-AgeAtLeast18boolean01Out
inc-assignedfemaleatbirthortransfemaleboolean01Out
IsIncludedboolean01Out
Excludedboolean01Out
IsIncludedAndNotExcludedboolean01Out
CheckIsIncludedAndNotExcludedboolean01Out
NotEligibleNotAssignedFemaleAtBirthResource01Out
NotEligibleCurrentBreastCancerResource01Out
NotEligibleBilateralMastectomyResource01Out
NotEligibleBreastSymptomsOrFindingsResource01Out
EligibleResource01Out
flow-ScreeningEligibleResource0*Out
IsScreeningEligibleboolean01Out
IsNotScreeningEligibleboolean01Out
ExistsNotEligibleNotAssignedFemaleAtBirthboolean01Out
ExistsNotEligibleCurrentBreastCancerboolean01Out
ExistsNotEligibleBilateralMastectomyboolean01Out
ExistsNotEligibleBreastSymptomsOrFindingsboolean01Out
ScreeningEligibleCodeCoding01Out
ScreeningEligibleReasonCoding01Out
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

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 ScreeningEligible version '1.0.0'

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

include ScreeningEligibleEvents version '1.0.0' called Events
include ScreeningEligibleActions version '1.0.0' called Actions
include DataElements version '1.0.0' called DataElements

//------------------------------------------------------------------------------
// CODE SYSTEMS, VALUE SETS, AND CODES
//------------------------------------------------------------------------------

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

codesystem "ActCode": 'http://example.org/CodeSystem/plan-definition-action-code-system'
codesystem "ReasonCode": 'http://example.org/CodeSystem/plan-definition-action-reason-code-system'

// Act Codes
code "Error": 'error' from "ActCode"
// Reason Codes
code "Missing age or birth date": 'missingageorbirthdate' from "ReasonCode"

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

context Patient

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

define CheckIsIncludedAndNotExcluded:
  IsIncludedAndNotExcludedErrorsHaveOccurred is not true 
    and 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":
  Events."eve-female" or DataElements."TransgenderFemale"

// EXCLUSIONS
define Excluded:
  false

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

define "flow-ScreeningEligible":
  { 
    Coalesce(
      NotEligibleNotAssignedFemaleAtBirth,
      NotEligibleCurrentBreastCancer,
      NotEligibleBilateralMastectomy,
      NotEligibleBreastSymptomsOrFindings,
      Eligible
    )
  }
  except { null }

define NotEligibleNotAssignedFemaleAtBirth:
  if Events."eve-female" is not true
  then Actions."end-noteligible-notassignedfemaleatbirth" else null

define NotEligibleCurrentBreastCancer:
  if Events."eve-breastca" is true
  then Actions."end-noteligible-currentbreastcancer" else null

define NotEligibleBilateralMastectomy:
  if Events."eve-mastectomy" is true
  then Actions."end-noteligible-bilatmastectomy" else null  

define NotEligibleBreastSymptomsOrFindings:
  if Events."eve-breastsymptoms" is true or Events."eve-breastfindings" is true
  then Actions."act-dxtesting" else null  

define Eligible:
  if Coalesce(
      NotEligibleNotAssignedFemaleAtBirth,
      NotEligibleCurrentBreastCancer,
      NotEligibleBilateralMastectomy,
      NotEligibleBreastSymptomsOrFindings) is null
  then Actions."act-eligible" else null

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

define IsScreeningEligible:
  Eligible is not null

define IsNotScreeningEligible:
  Eligible is null

define ExistsNotEligibleNotAssignedFemaleAtBirth:
  NotEligibleNotAssignedFemaleAtBirth is not null  

define ExistsNotEligibleCurrentBreastCancer:
  NotEligibleCurrentBreastCancer is not null  

define ExistsNotEligibleBilateralMastectomy:
  NotEligibleBilateralMastectomy is not null  

define ExistsNotEligibleBreastSymptomsOrFindings:
  NotEligibleBreastSymptomsOrFindings is not null  

define ScreeningEligibleCode:
  First("flow-ScreeningEligible").code

define ScreeningEligibleReason:
  First("flow-ScreeningEligible").reason    

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

define IsIncludedAndNotExcludedErrorsHaveOccurred:
  ErrorMissingAgeOrBirthdate

define MissingAgeOrBirthdate:
  AgeInYears() is null and MostRecentAgeValue is null

define ErrorMissingAgeOrBirthdate:
  if MissingAgeOrBirthdate
  then Message(true, true,
    'http://example.org/CodeSystem/plan-definition-action-reason-code-system/missingageorbirthdate',
    'Warning', 
    'Missing age or birth date')
  else false
Content: application/elm+xml
Encoded data (79396 characters)
Content: application/elm+json
Encoded data (143768 characters)