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

2022 CDC Clinical Practice Guideline - Quick Start

This section provides a quick start guide to getting up and running quickly with the Clinical Quality Framework reference implementation functioning as a CDS Hooks service. This quick start focuses on recommendation #10, slightly modified to work on a "patient-view" hook.

Overall Approach

This quick start will focus on standing up an instance of a CDS Hooks service that can run the guidance artifacts published in this implementation guide. In other words, the "Clinical Reasoning Implementation" depicted in the diagram below:

API Requests/Responses Via HTTP Client

Throughout the Quick Start you will be required to upload/retrieve data and initiate execution of the recommendations via HTTP requests. Requests can be submitted via any tool or client that allows you to interact with an HTTP API. One popular client is Postman, available here. Postman is an application that provides a user-friendly GUI for constructing and submitting HTTP requests to APIs and viewing responses in an easy-to-read format.

CDS Hooks Service

The first step is to stand up an instance of the CQF Ruler, a reference implementation of the FHIR Clinical Reasoning module and CDS Hooks. Follow the instructions on the Deployment page of the CQF Ruler wiki to start a local CQF Ruler service.

This service is a HAPI FHIR Server with some additional plug-ins to support the Clinical Reasoning module. To verify the service is running, issue a couple basic queries:

  GET http://localhost:8080/cqf-ruler-r4/fhir/Library

  GET http://localhost:8080/cqf-ruler-r4/fhir/PlanDefinition
    

For a newly instantiated CQF Ruler, both of these queries should return 0 results, indicating there is no content currently loaded.

In addition to the FHIR Server functionality, the CQF Ruler implements a CDS Hooks service. To view the discovery endpoint, issue the following query:

  GET http://localhost:8080/cqf-ruler-r4/cds-services
    

For a newly instantiated CQF Ruler, this will also return an empty list, indicating there are no services configured.

  {
      "services": []
  }
    

Loading Content

The next step is to load the content, i.e., the artifacts published in this implementation guide that define the recommendation. For convenience, the resources for recommendation #10, patient-view have all been added to the 'opioidcds-rec10-patientview-bundle'. The test data for this particular quick start test case consists of two Medication resources that also need to be posted to the FHIR server. These represent the patient's Medication history, the 'quickstart-medications-bundle' contains those resources. These two bundles should be POSTed to the base URL of the server:

ResourceTypeDescription
opioidcds-10-patient-view-bundleBundleAll Required Content for Recommendation #10
  POST http://localhost:8080/cqf-ruler-r4/fhir
    

Following normal FHIR server transaction processing, this will post all the content resources as a single transaction.

The resources contained in these bundles are:

ResourceTypeDescription
PlanDefinition_Recommendation_10_Patient_View (v0.1.0)PlanDefinitionOpioid Recommendation #10 (Patient View Version) PlanDefinition
ActivityDefinition_Urine_Screening_ProcedureRequestActivityDefinitionActivityDefinition - Urine Screening ProcedureRequest
OpioidCDS_REC_10_Patient_ViewLibraryOpioid Recommendation #10 (Patient View Version) Library
OpioidCDS_CommonLibraryOpioid Common Library
OpioidCDS_RoutinesLibraryOpioid Routines Library
OMTKLogicLibraryOpioid Management Terminology Knowledge (OMTK) Logic Library
OMTKDataLibraryOpioid Management Terminology Knowledge (OMTK) Data Library
TerminologiesValueSetValue sets referenced by the CQL in the Opioid Logic recommendations

Because this content is published as FHIR resources, each of the resources can be loaded individually rather than as part of the bundles above by POSTing or PUTing them to the FHIR server, just like any other FHIR resource:

  PUT http://localhost:8080/cqf-ruler-r4/fhir/PlanDefinition/opioidcds-10-patient-view
    

With the body of the PUT request set to be the XML (or JSON) for the resource.

Once the content has been loaded, the CDS Hooks discovery endpoint will list the recommendations as available services to be called:

  GET http://localhost:8080/cqf-ruler-r4/cds-services
    
  {
    "services": [
      {
        "hook": "patient-view",
        "name": "PlanDefinition_Recommendation_10_Patient_View",
        "title": "PlanDefinition - 2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain: Recommendation #10 (patient-view)",
        "description": "When prescribing opioids for subacute or chronic pain, providers should use urine drug testing before starting opioid therapy and consider urine drug testing at least annually to assess for prescribed medications as well as other controlled prescription drugs and illicit drugs.",
        "id": "opioidcds-10-patient-view",
        "prefetch": {
          "item1": "Patient?_id=",
          "item2": "MedicationRequest?patient=&medication=http%3A%2F%2Fwww.nlm.nih.gov%2Fresearch%2Fumls%2Frxnorm|994277,snipped for brevity",
          "item3": "Observation?patient=&code=http%3A%2F%2Floinc.org|12478-4,snipped for brevity",
          "item4": "Observation?patient=&code=http%3A%2F%2Floinc.org|50542-0,snipped for brevity"
        }
      }
    ]
  }
    

Request and Response

Now that the content is loaded, the service will respond to CDS Hooks requests. For example, POST the following request to the recommendation #10 service:

  POST http://localhost:8080/cqf-ruler-r4/cds-services/opioidcds-10-patient-view
    
request-example-rec-10-patient-view-no-screenings.json
  {
    "hookInstance": "a172a2ce-38e7-4a21-a411-522cf481d5d1",
    "fhirServer": "http://localhost:8080/cqf-ruler-r4/fhir",
    "hook": "patient-view",
    "applyCql": true,
    "context": {
      "userId": "Practitioner/example",
      "patientId": "Patient/example-rec-10-no-screenings",
      "encounterId": "Encounter/example-rec-10-no-screenings-context"
    },
    "prefetch": {
      "item1": "snipped for brevity, see the full example at the above link",
      "item2": "snipped for brevity, see the full example at the above link"
    }
  }  

This POST results in the following CDS Hooks response:

      {
            "cards": [
                {
                    "summary": "Annual Urine Screening Check",
                    "indicator": "warning",
                    "detail": "Patients on opioid therapy should have a urine drug test performed every 12 months.",
                    "source": {
                        "label": "2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain",
                        "url": "https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm"
                    },
                    "suggestions": [
                        {
                            "label": "Order Urine Screening",
                            "actions": [
                                {
                                    "type": "create",
                                    "description": "Patients on opioid therapy should have a urine drug test performed every 12 months.",
                                    "resource": {
                                        "resourceType": "ProcedureRequest",
                                        "id": "29c794f0-b3e3-47d1-975c-ff0cd6de494b",
                                        "status": "draft",
                                        "intent": "order",
                                        "code": {
                                            "coding": [
                                                {
                                                    "system": "http://snomed.info/sct",
                                                    "code": "310627008",
                                                    "display": "Urine drug screening (procedure)"
                                                }
                                            ]
                                        },
                                        "subject": {
                                            "reference": "Patient/example-rec-10-no-screenings"
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            ]
        }  

CDS Hooks Sandbox

The CDS Hooks Sandbox is a web application that provides a user-friendly GUI for constructing, viewing and submitting CDS Hooks requests and viewing the responses both in raw JSON format and also in an html representation that is meant to be representative of how it might be presented in a consuming EHR system. The sandbox can be configured to run against the local CDS Hooks service instance created above.

To configure the sandbox to work with this local CDS Hooks service instance, the following settings need to be set:

Set the FHIR Server URL to http://localhost:8080/cqf-ruler-r4/fhir. If you're not prompted for this at startup, then in Settings go to Change FHIR Server and set the FHIR Server URL there.

Set the Discovery Endpoint URL to http://localhost:8080/cqf-ruler-r4/cds-services. If you're not prompted for this at startups, then in Settings go to Add CDS Services and set the Discovery Endpoint URL there.

Now the sandbox is configured to use the CDS Hooks service that you created above. The next step is to push a Patient resource to that service that we can then use to query via the Sandbox. To do this, you're going to want to copy the JSON representation of a Patient resource from the request-example-rec-10-patient-view-illicit-drugs.json file above and then PUT that to the FHIR server created above.

  PUT http://localhost:8080/cqf-ruler-r4/fhir/Patient/example-rec-10-no-screenings
    

The patient resource JSON:

      {
        "resourceType": "Patient",
        "id": "example-rec-10-no-screenings",
        "gender": "female",
        "birthDate": "1982-01-07"
      }
    

Now set the Patient context in the sandbox to this new patient. To set the Patient context in the CDS Hooks Sandbox go to Settings and then select "Change Patient" and set the ID to "example-rec-10-illicit-drugs".