Opioid Prescribing Support Implementation Guide
2016.4.0 - CI Build

Opioid Prescribing Support 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 2016.4.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

2016 CDC 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/fhir/Library 
GET http://localhost:8080/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/cds-services 

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

{
  "services": []
}

Loading Logic Content

The next step is to load the content, i.e., the artifacts published in this implementation guide that define the recommendation. After running the _refresh[.bat or .sh] script (located at the base of this project repository) for this implementation guide, a bundle containing the resources and requests for all required artifacts is created and can be found as a generated bundle in bundles/plandefinition/opioidcds-10-patient-view/opioidcds-10-patient-view-bundle.json. This Bundle can be POSTed to the base URL of the FHIR server. Following normal FHIR server transaction processing, this will post all the content resources including the required terminology as a single transaction.

POST http://localhost:8080/fhir 

The following resources that are required for this example are all contained in generated bundle above:

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

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/cds-services 
{
  "services": [
    {
      "hook": "patient-view",
      "name": "PlanDefinition_Recommendation_10_Patient_View",
      "title": "PlanDefinition - CDC 2016 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=Patient/{{context.patientId}}",
        "item2": "MedicationRequest?subject=Patient/{{context.patientId}}",
        "item3": "Condition?patient=Patient/{{context.patientId}}&category=http://terminology.hl7.org/CodeSystem/condition-category|encounter-diagnosis",
        "item4": "Condition?patient=Patient/{{context.patientId}}&category=http://terminology.hl7.org/CodeSystem/condition-category|problem-list-item",
        "item5": "Condition?patient=Patient/{{context.patientId}}&category=http://hl7.org/fhir/us/core/CodeSystem/condition-category|health-concern",
        "item6": "ServiceRequest?patient=Patient/{{context.patientId}}",
        "item7": "Observation?subject=Patient/{{context.patientId}}&category=http://terminology.hl7.org/CodeSystem/observation-category|laboratory",
        "item8": "Procedure?patient=Patient/{{context.patientId}}&code=http://snomed.info/sct|306205009,http://snomed.info/sct|305336008,http://snomed.info/sct|183919006,http://snomed.info/sct|428371000124100,http://snomed.info/sct|183920000,http://snomed.info/sct|183921001",
        "item9": "Encounter?patient=Patient/{{context.patientId}}"
      }
    }
  ]
}

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/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/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",
      "detail": "Patients on opioid therapy should have a urine drug test performed every 12 months.",
      "indicator": "warning",
      "source": {
        "label": "CDC 2016 Guideline for prescribing opioids for chronic pain",
        "uri": "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",
        "icon": "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"
      },
      "links": []
    }
  ]
}

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.

As a first step, we will need to set up our FHIR server with some test data. As a minmal example, a Patient with two MedicationRequest resources will be posted to the server.

PUT http://localhost:8080/fhir/Patient/example-rec-10-patient-view-no-screenings 

The Patient resource JSON

PUT http://localhost:8080/fhir/MedicationRequest/example-rec-10-patient-view-no-screenings-context 

The context MedicationRequest resource JSON

PUT http://localhost:8080/fhir/MedicationRequest/example-rec-10-patient-view-no-screenings-prefetch 

The preftech MedicationRequest resource JSON

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

Set the Discovery Endpoint URL to http://localhost:8080/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.

Set the FHIR Server URL to http://localhost:8080/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.

The next step is to query a Patient resource via the Sandbox. For that, set the Patient context in the sandbox to our new patient. If not prompted as part of adding the FHIR server, go to Settings and then select "Change Patient" and set the ID to "example-rec-10-patient-view-no-screenings".

Please note, that for a basic set up of local servers, the window to the CDS sandbox might need to be opened with CORS disabled for all functions to work properly.