2022 CDC Clinical Practice Guideline for Prescribing Opioids Implementation Guide
2022.1.0 - CI Build

2022 CDC Clinical Practice Guideline for Prescribing Opioids Implementation Guide, published by Centers for Disease Control and Prevention (CDC). This guide is not an authorized publication; it is the continuous build for version 2022.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/opioid-cds-r4/ and changes regularly. See the Directory of published versions

Library: OpioidCDSREC12PatientViewLibrary (Experimental)

Official URL: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSREC12PatientView Version: 2022.1.0
Active as of 2024-03-17 Computable Name: OpioidCDSREC12PatientView
Id: library-OpioidCDSREC12PatientView
Type: logic-library
Version: 2022.1.0
Status: active
Related:

type: depends-on

Resource:
http://fhir.org/guides/cdc/opioid-cds/Library/FHIRHelpers

type: depends-on

Resource:
http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSCommon

type: depends-on

Resource:
http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSCommonConfig

Data Requirements:

type: MedicationRequest

code filter:
path: medication
valueset: http://fhir.org/guides/cdc/opioid-cds/ValueSet/buprenorphine-and-methadone-medications

type: Procedure

code filter:
path: code
valueset: http://fhir.org/guides/cdc/opioid-cds/ValueSet/substance-misuse-behavioral-counseling

type: Condition

code filter:
path: category
valueset: http://hl7.org/fhir/us/core/ValueSet/us-core-condition-category

Content: type: text/cql
library OpioidCDSREC12PatientView version '2022.1.0'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1' called FHIRHelpers
include OpioidCDSCommon version '2022.1.0' called Common
include OpioidCDSCommonConfig version '2022.1.0' called Config

/*
**
**  Recommendation #12
**    Clinicians should offer or arrange evidence-based treatment (usually
**    medication-assisted treatment with buprenorphine or methadone in combination
**    with behavioral therapies) for patients with opioid use disorder
**    (recommendation category: A, evidence type: 2)
**
**  When
**    Patient is 18 years and older and not receiving evidence-based treatment for
**      opioid use disorder, which may include medication treatment with buprenorphine
**      or methadone, or opioid-specific behavioral counseling
**    Patient has a diagnosis of opioid use disorder in the past 90 days
**  Then
**    Recommend opioid agonist or partial agonist treatment with methadone maintenance
**    therapy, buprenorphine therapy, and/or behavioral therapy. Potential actions include:
**      Order methadone or buprenorphine
**      Refer to qualified treatment provider (i.e. substance disorder specialist)
**      N/A - see comment; snooze 3 months
**
*/

// META: PlanDefinition: http://fhir.org/guides/cdc/opioid-cds-r4/PlanDefinition/plandefinition-OpioidCDSREC12PatientView

context Patient

define "Opioid Use Disorder Lookback Period":
  Interval[Today() - 90 days, Today()]

define "Is Recommendation Applicable?":
  "Inclusion Criteria"
    and not "Exclusion Criteria"

define "Inclusion Criteria":
  "Patient 18 or Older?"
    and "Not Receiving Evidence-Based Treatment for Opioid Use Disorder"
    and "Presence of Diagnosis of Opioid Use Disorder"
    and "Positive Result from Opioid Use Disorder Evaluation Tool"

define "Exclusion Criteria":
  false

define "Patient 18 or Older?":
  Config."Age Less than 18 Years Is Enabled"
    and AgeInYears() >= 18

define "Not Receiving Evidence-Based Treatment for Opioid Use Disorder":
  Config."Evidence Based Treatment Criteria For Opioid Use Disorder"
    and not (
      exists (
        [MedicationRequest: Common."Buprenorphine and methadone medications"] MR
          where MR.status in { 'active', 'completed' }
            and date from MR.authoredOn during day of "Opioid Use Disorder Lookback Period"
      )
      or exists (
        [Procedure: Common."Substance misuse behavioral counseling"] P
          where P.status ~ 'completed'
            and (
              case
                when P.performed is FHIR.dateTime then
                  Interval[FHIRHelpers.ToDateTime(P.performed as FHIR.dateTime), FHIRHelpers.ToDateTime(P.performed as FHIR.dateTime)]
                when P.performed is FHIR.Period then
                  FHIRHelpers.ToInterval(P.performed as FHIR.Period)
                else
                  null as Interval<DateTime>
                end
            ) during day of "Opioid Use Disorder Lookback Period"
      )
    )

define "Presence of Diagnosis of Opioid Use Disorder":
  exists (
    [Condition: category in Common."US Core Condition Category Codes"] C
      where C.code in Common."Opioid misuse disorders"
        and exists (
          C.clinicalStatus.coding Coding
            where FHIRHelpers.ToCode(Coding) ~ Common."Active Condition"
        )
        and date from C.recordedDate during day of "Opioid Use Disorder Lookback Period"
    )

define "Positive Result from Opioid Use Disorder Evaluation Tool":
  true

define "Get Indicator":
  if "Is Recommendation Applicable?"
    then 'warning'
  else null

define "Get Summary":
  if "Is Recommendation Applicable?"
    then 'Recommend opioid agonist or partial agonist treatment with methadone maintenance therapy or buprenorphine and/or behavioral therapy'
  else null

define "Get Detail":
  if "Is Recommendation Applicable?"
    then null
  else null