8.1.0 CDC Opioid Prescribing 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 recommendations #10 and #11, both slightly modified to work on a "patient-view" hook.

8.1.1 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:

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

8.2.0 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-dstu3/fhir/Library

GET http://localhost:8080/cqf-ruler-dstu3/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-dstu3/cds-services
  

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

{
    "services": []
}
  

8.3.0 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:

ResourceTypeDescription
opioid-cds-terminology-bundleBundleAll Value Sets Referenced by the Opioid Content
opioid-cds-content-bundleBundleAll Required Content for Recommendations #10 and #11
  POST http://localhost:8080/cqf-ruler-dstu3/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
OMTKDataLibraryOpioid Management Terminology Knowledge (OMTK) Data Library
OMTKLogicLibraryOpioid Management Terminology Knowledge (OMTK) Logic Library
OpioidCDS_STU3_CommonLibraryOpioid Common Library
OpioidCDS_REC_10_Patient_ViewLibraryOpioid Recommendation #10 (Patient View Version) Library
OpioidCDS_REC_11_Patient_ViewLibraryOpioid Recommendation #11 (Patient View Version) Library
PlanDefinition_Recommendation_10_Patient_ViewPlanDefinitionOpioid Recommendation #10 (Patient View Version) PlanDefinition
PlanDefinition_Recommendation_11_Patient_viewPlanDefinitionOpioid Recommendation #11 (Patient View Version) PlanDefinition
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-dstu3/fhir/Library/library-OMTKData2019
  

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-dstu3/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=",
                "item3": "Observation?patient=&code=http%3A%2F%2Floinc.org|12478-4,http%3A%2F%2Floinc.org|78813-3,snipped for brevity",
                "item4": "Observation?patient=&component-code=http%3A%2F%2Floinc.org|50542-0,http%3A%2F%2Floinc.org|19487-8,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="
            }
        }
    ]
}
  

8.3.1 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-dstu3/cds-services/opioidcds-10-patient-view
  
Example Recommendation #10 patient-view Request
{
  "hookInstance": "a172a2ce-38e7-4a21-a411-522cf481d5d1",
  "fhirServer": "http://localhost:8080/cqf-ruler-dstu3/fhir",
  "hook": "patient-view",
  "applyCql": true,
  "context": {
    "user": "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": {}
        }
    ]
}  

8.4.0 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-dstu3/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-dstu3/cds-services. If you're not prompted for this at startup, 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 POST that to the FHIR server created above.

POST http://localhost:8080/cqf-ruler-dstu3/fhir/Patient
  

The patient resource JSON:

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

The response to that POST request will contain the posted Patient including the ID that was assigned to it. Copy that ID so that you can set the Patient context in the sandbox to it. To set the Patient context in the CDS Hooks Sandbox go to Settings and then select ‘Change Patient’. Paste in the new ID that you copied from the Patient resource posted above.