Opioid Prescribing Support Implementation Guide
4.0.0 - CI Build

Opioid Prescribing Support Implementation Guide, published by Centers for Disease Control and Prevention (CDC). This is not an authorized publication; it is the continuous build for version 4.0.0). 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

CDC Opioid Prescribing Guidelines - 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 recommendations #10 and #11, both 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. A postman collection of requests required to complete this Quick Start can be downloaded here and imported into Postman.

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 recommendations. For convenience, the resources for recommendations #10 and #11, patient-view have all been added to the 'opioid-cds-content-bundle' and 'opioid-cds-terminology-bundle' transaction bundles below that can be POSTed to the base URL of the server:

Resource Type Description
opioid-cds-terminology-bundle Bundle All Value Sets Referenced by the Opioid Content
opioid-cds-content-bundle Bundle All Required Content for Recommendations #10 and #11
  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:

Resource Type Description
OMTKData (v0.0.2) Library Opioid Management Terminology Knowledge (OMTK) Data Library
OMTKLogic (v0.0.2) Library Opioid Management Terminology Knowledge (OMTK) Logic Library
OpioidCDS_Common (v0.1.0) Library Opioid Common Library
OpioidCDS_REC_10_Patient_View (v0.1.0) Library Opioid Recommendation #10 (Patient View Version) Library
OpioidCDS_REC_11_Patient_View (v0.1.0) Library Opioid Recommendation #11 (Patient View Version) Library
PlanDefinition_Recommendation_10_Patient_View (v0.1.0) PlanDefinition Opioid Recommendation #10 (Patient View Version) PlanDefinition
PlanDefinition_Recommendation_11_Patient_view (v0.1.0) PlanDefinition Opioid Recommendation #11 (Patient View Version) PlanDefinition
Terminologies ValueSet Value 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/Library/omtkdata
    

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 - CDC Opioid Prescribing Guideline Recommendation #10 (patient-view)",
        "description": "When prescribing opioids for 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"
        }
      },
      {
        "hook": "patient-view",
        "name": "PlanDefinition_Recommendation_11_Patient_View",
        "title": "PlanDefinition - CDC Opioid Prescribing Guideline Recommendation #11 (patient-view)",
        "description": "Concurrently prescribing opioid medications with benzodiazepines increases the risk of harm for the patient.",
        "id": "opioidcds-11-patient-view",
        "prefetch": {
          "item1": "Patient?_id=",
          "item2": "MedicationRequest?patient=&medication=http%3A%2F%2Fwww.nlm.nih.gov%2Fresearch%2Fumls%2Frxnorm|141927,snipped for brevity",
          "item3": "MedicationRequest?patient=&medication=http%3A%2F%2Fwww.nlm.nih.gov%2Fresearch%2Fumls%2Frxnorm|994277,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-illicit-drugs.json
  {
    "hookInstance": "31c74cfc-747c-4afc-82e4-bdd3b7a0a58c",
    "fhirServer": "http://localhost:8080/cqf-ruler-r4/fhir",
    "hook": "patient-view",
    "applyCql": true,
    "context": {
      "user": "Practitioner/example",
      "patientId": "Patient/example-rec-10-illicit-drugs",
      "encounterId": "Encounter/example-rec-10-illicit-drugs-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": "Illicit Drugs Found In Urine Screening",
              "indicator": "warning",
              "source": {
                  "label": "CDC guideline for prescribing opioids for chronic pain",
                  "url": "https://www.cdc.gov/mmwr/volumes/65/rr/rr6501e1.htm?CDC_AA_refVal=https%3A%2F%2Fwww.cdc.gov%2Fmmwr%2Fvolumes%2F65%2Frr%2Frr6501e1er.htm"
              }
          }
      ]
  }  

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-illicit-drugs
    

The patient resource JSON:

  {
    "resourceType": "Patient",
    "id": "example-rec-10-illicit-drugs",
    "gender": "female",
    "birthDate": "1982-01-07",
    "name": [
      {
        "family": "Smith",
        "given": [
          "John",
          "A."
        ]
      }
    ]
  }
    

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".