# Opioid Collection

GitHub release (opens new window)

This is a collection of KOs for KGrid that can be used to identify and report on certain features of opioid prescribing. Each KO in this collection uses patient prescription data for its input and provides information about patient prescriptions as its output.

# Table of Contents

# Getting Started

These instructions will allow you to test drive one or more of the KOs in the MOpen Opioid-related Knowledge Object Collection on our sandbox at Herokuapp.com here. To check if the sandbox is working, you can click here: KGrid Activator (opens new window).

Below in this documentation, find each KO's API documentation in the OpenAPI 3.0 specification format. By clicking on the API Documentation link for each KO, the API documentation will be displayed in a Swagger UI tool. Utilizing the example curl or the Swagger UI tool you can test out the interation using each KO.

# Knowledge Object Collection

# 1️⃣ Opioid Use Detector

This KO scans a patient's medication regimen, which is presented to the KO as a list of RxNorm Semantic Clinical Drug codes, for the presence of an opioid prescription. This KO has many potential uses, including one use as a filtering or screening mechanism when applied in the context of health information exchange.

Example API Usage with curl

curl -X POST \
  http://kgrid-activator.herokuapp.com/99999/10101/opioidDetector \
  -H 'Content-Type: application/json' \
  -d '{"rxcuis":"106500,200240,856917,994226,197446,801958"}'

Example API Response

{
    "result": {
        "condition_satisfied": true,
        "summary": {
            "opioid": true
        },
        "detail": {
            "106500": {
                "opioid": true
            },
            "197446": {
                "opioid": false
            },
            "200240": {
                "opioid": false
            },
            "801958": {
                "opioid": false
            },
            "856917": {
                "opioid": false
            },
            "994226": {
                "opioid": true
            }
        }
    },
    "info": {
        "ko": "99999/10101",
        "inputs": {
            "rxcuis": "106500,200240,856917,994226,197446,801958"
        }
    }
}

Additional API documentation can be found in the Swagger UI (opens new window) visualisation of the OpenAPI specification.

# 2️⃣ Opioid and Benzodiazepine Detector

This KO scans a list of a patient's prescriptions, which are presented to the KO as a list of RxNorm Semantic Clinical Drug codes, and determines if they are being exposed simultaneously to a known risky combination of an opioid and a benzodiazepine.

Example API Usage with curl

curl -X POST \
  http://kgrid-activator.herokuapp.com/99999/10102/opioidbzdDetector \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{"rxcuis":"106500,200240,856917,994226,197446,801958"}'

Additional API documentation can be found in the Swagger UI (opens new window) visualisation of the OpenAPI specification.

# 3️⃣ Respiratory Depression Risk Indicator

This KO scans a list of a patient's prescriptions, which are presented to the KO as a list or RxNorm Semantic Clinical Drug Codes, and determines if they are at higher risk for drug-induced respiratory depression because of being exposed simultaneously to a combination of an opioid, a benzodiazepine, and a muscle relaxant.

Example API Usage with curl

curl -X POST \
  http://kgrid-activator.herokuapp.com/99999/10103/tripleThreatDetector \
  -H 'Content-Type: application/json' \
  -d '{"rxcuis":"106500,200240,856917,994226,197446,801958"}'

Additional API documentation can be found in the Swagger UI (opens new window) visualisation of the OpenAPI specification.

# 4️⃣ MHA Opioid Detector

This KO scans a patient's medication regimen, which is presented to the KO as a list of RxNorm Semantic Clinical Drug codes, for the presence of an opioid prescription. This KO has many potential uses, including one use as a filtering or screening mechanism when applied in the context of health information exchange.

Example API Usage with curl

curl -X POST \
  http://kgrid-activator.herokuapp.com/99999/10104/mhaOpiateDetector \
  -H 'Content-Type: application/json' \
  -d '{"rxcuis":"106500,200240,856917,994226,197446,801958"}'

Additional API documentation can be found in the Swagger UI (opens new window) visualisation of the OpenAPI specification.

# 6️⃣ Opioid Advisor

Evaluates a list of a patient's prescriptions and determines Opioid risk. This KO is a mashup of three existing KOs Opioid Use Detector, Opioid and Benzodiazepine Detector and Respiratory Depression Risk Detector

Example API Usage with curl

curl -X POST \
  http://kgrid-activator.herokuapp.com/99999/10106/opioidadvisor \
  -H 'Content-Type: application/json' \
  -d ' {
      "id": "PA-01011",
      "prescriptions": [
        {
          "rxnorm": "106500"
        },
        {
          "rxnorm": "197446"
        },
        {
          "rxnorm": "801958"
        }
      ]
   }'

Additional API documentation can be found in the Swagger UI (opens new window) visualization of the OpenAPI specification.

# 7️⃣ Medication Regimen Complexity Index Calculator

Calculates Medication Regimen Complexity Index (MRCI) of a patient's prescription regimen. This KO is a modified implementation of the MRCI computation model from the paper Development and Validation of the Medication Regimen Complexity Index (opens new window).

Example API Usage with curl

curl -X POST \
  http://kgrid-activator.herokuapp.com/99999/mrci/mrci \
  -H 'Content-Type: application/json' \
  -d ' {
    "id": "MRCI-0C",
    "prescriptions": [
    {
      "rxnorm": "309362",
      "medicationname": "CLOPIDOGREL 75 MG TABLET",
      "genericname": "CLOPIDOGREL BISULFATE",
      "strength":"75 mg",
      "form": "Tablet",
      "route": "Oral",
      "sig": "75 MG ONCE DAILY"
    }
  ]
  }'

Additional API documentation can be found in the Swagger UI (opens new window) visualization of the OpenAPI specification.

# Install KOs on KGrid Activator

In order to use the MOpen Opioid Knowledge Object Collection you need to have an instance of the KGrid Activator up and running. To do this, refer to KGrid Activator (opens new window) deployment details. Once you have KGrid Activator (opens new window) up and running you will need to add the MOpen Opioid (opens new window) KOs to the existing shelf.

  1. Download the released MOpen Opiod KOs from github MOpen-Opioid Collection (opens new window)
  2. Place the zip files into the shelf directory unzip.
  3. You must activate those KOs in the activator running the activate endpoint.

Directory structure should look similar to the following

 ├── shelf
     └── 99999-10103
     └── 99999-10102
     └── 99999-10101
     └── 99999-10104
     └── 99999-10105
     └── .kgrid
         └── kgrid-activator-1.1.5.jar

Go to the /health endpoint to see that the KOs are activated You should receive a list of the activated endpoints similar to the following

{
    "status": "UP",
    "details": {...},
        "activationService": {
            "status": "UP",
            "details": {
                "Adapters loaded": [
                    "JAVASCRIPT"
                ],
                "Endpoints loaded": [
                    "99999-10101/opioidDetector",
                    "99999-10103/tripleThreatDetector",
                    "99999-10104/mhaOpiateDetector",
                    "99999-10105/mhaALTODetector",
                    "99999-10102/opioidbzdDetector"
                ]
            }
        },
    }
}

# Opioid Collection Testing

# Prerequisites

There are testing and packaging features in this project that require npm, npm is installed with Node.js npm (opens new window). Once npm is installed run npm install at the root of this project.

NPM test will run both unit and integration tests.

npm test

# Unit Tests

The KO Unit Test are located in the tests directory. These tests utilize Jest (opens new window)

npm run test:unit

# Integration Tests

We test the Opioid KO endpoints in a KGrid Activator instance using Postman (opens new window) and Newman (opens new window). The Opioid Collection integration tests are defined in the opioid.postman_collection.json. The integration script uses the start server and test (opens new window).
The integration test does the following:

  1. downloads the latest KGrid Activator
  2. runs the activator with the Opioid KOs
  3. runs the Opioid collection defined as the Opioid test/integration
npm run test:integration

Tricks

You can start a local activator pointing to the Opioid collection

npm run start
Last Updated: 7/31/2020, 8:25:13 PM