-
Notifications
You must be signed in to change notification settings - Fork 49
CDS Hooks Request Processing
The CDS Hooks API offers a standardized request pattern to invoke clinical decision support.
The cqf-ruler currently supports the following hooks:
- Discovery url:
http://measure.eval.kanvix.com/cqf-ruler/cds-services
- CDS Request:
http://measure.eval.kanvix.com/cqf-ruler/cds-services/{user defined cds service name}
In previous implementations for CDS Hooks request resolution, standardized CQL expressions were used to populate the CDS Card elements. That approach does not scale for more complex operations where multiple cards are returned. In an effort to provide more robust support for CDS Hooks requests, the request's PlanDefinition will go through a specialized $apply operation, which predominately uses the RequestGroup reference within a CarePlan to store CDS Card elements. The table below identifies which elements from the PlanDefinition are mapped to CDS Card elements, some of which may be dynamically resolved using dynamicValues (use the path value in the right-most column to specify which element to resolve) or an $apply operation.
* For CarePlan: activity.reference == RequestGroup
PlanDefinition | CarePlan | CDS Card | Dynamic | Path |
---|---|---|---|---|
action.title | RequestGroup.action.title | summary | No | N/A |
action.dynamicValue | RequestGroup.action.title | summary | Yes | action.title |
action.description | RequestGroup.action.description | detail | No | N/A |
action.dynamicValue | RequestGroup.action.description | detail | Yes | action.description |
action.dynamicValue | RequestGroup.action.extension.valueString | indicator | Yes | action.extension |
action.documentation.display | RequestGroup.action.documentation.display | source.label | No | N/A |
action.documentation.url | RequestGroup.action.documentation.url | source.url | No | N/A |
action.documentation.document.url | RequestGroup.action.documentation.document.url | source.label | No | N/A |
action.label | RequestGroup.action.label | suggestions.label | No | N/A |
TODO | TODO | suggestions.uuid | No | N/A |
action.type | RequestGroup.action.type | suggestions.actions.type | No | N/A |
action.definition -> ActivityDefinition.description | RequestGroup.action.resource.display | suggestions.actions.description | No | N/A |
action.definition -> ActivityDefinition $apply | RequestGroup.action.resource.reference | suggestions.actions.resource | Yes | N/A |
relatedArtifact.display | RequestGroup.extension.valueAttachment.title | links.label | No | N/A |
relatedArtifact.url | RequestGroup.extension.valueAttachment.url | links.url | No | N/A |
relatedArtifact.extension.valueString | RequestGroup.extension.valueAttachment.extension.valueString | links.type | No | N/A |
Load the following Bundle into your local Ruler instance. Let's look at the PlanDefinition that guides the diabetes management use case:
{
"resourceType": "PlanDefinition",
"id": "diabetes-management",
"status": "draft",
"library": {
"reference": "Library/patient-view"
},
"action": [
{
"condition": [
{
"kind": "applicability",
"language": "text/cql",
"expression": "Has Diabetes"
}
],
"action": [
{
"condition": [
{
"kind": "applicability",
"language": "text/cql",
"expression": "Has Abnormal Creatinine"
}
],
"dynamicValue": [
{
"path": "action.title",
"expression": "AbnormalCreatinineSummary"
},
{
"path": "action.description",
"expression": "AbnormalCreatinineDetail"
},
{
"path": "activity.extension",
"expression": "AbnormalCreatinineIndicator"
}
]
},
{
"condition": [
{
"kind": "applicability",
"language": "text/cql",
"expression": "Has Abnormal HbA1C"
}
],
"dynamicValue": [
{
"path": "action.title",
"expression": "AbnormalHbA1CSummary"
},
{
"path": "action.description",
"expression": "AbnormalHbA1CDetail"
},
{
"path": "activity.extension",
"expression": "AbnormalHbA1CIndicator"
}
]
},
{
"condition": [
{
"kind": "applicability",
"language": "text/cql",
"expression": "Has Abnormal LDL"
}
],
"dynamicValue": [
{
"path": "action.title",
"expression": "AbnormalLDLSummary"
},
{
"path": "action.description",
"expression": "AbnormalLDLDetail"
},
{
"path": "activity.extension",
"expression": "AbnormalLDLIndicator"
}
]
},
{
"condition": [
{
"kind": "applicability",
"language": "text/cql",
"expression": "Has Abnormal MicroalbCr"
}
],
"dynamicValue": [
{
"path": "action.title",
"expression": "AbnormalMicroalbCrSummary"
},
{
"path": "action.description",
"expression": "AbnormalMicroalbCrDetail"
},
{
"path": "activity.extension",
"expression": "AbnormalMicroalbCrIndicator"
}
]
},
{
"condition": [
{
"kind": "applicability",
"language": "text/cql",
"expression": "Has Abnormal Foot Exam"
}
],
"dynamicValue": [
{
"path": "action.title",
"expression": "AbnormalFootExamSummary"
},
{
"path": "action.description",
"expression": "AbnormalFootExamDetail"
},
{
"path": "activity.extension",
"expression": "AbnormalFootExamIndicator"
}
]
},
{
"condition": [
{
"kind": "applicability",
"language": "text/cql",
"expression": "Has Abnormal Eye Exam"
}
],
"dynamicValue": [
{
"path": "action.title",
"expression": "AbnormalEyeExamSummary"
},
{
"path": "action.description",
"expression": "AbnormalEyeExamDetail"
},
{
"path": "activity.extension",
"expression": "AbnormalEyeExamIndicator"
}
]
}
]
}
]
}
This example is simply checking for an abnormal result for several common diabetes tests and procedures and reporting the details dynamically. Use the following request:
POST
{
"hookInstance": "d1577c69-dfbe-44ad-ba6d-3e05e953b2ea",
"fhirServer": "http://localhost:8080/cqf-ruler/baseDstu3",
"hook": "patient-view",
"user": "Practitioner/example",
"context": [],
"patient": "Patient/Patient-276",
"prefetch": {}
}
Which should result in the following response:
{
"cards": [
{
"summary": "Abnormal Creatinine level detected in most recent lab results",
"indicator": "warning",
"detail": "The Creatinine level of 122umol/L in the most recent lab is considered abnormal"
},
{
"summary": "Abnormal HbA1C level detected in most recent lab results",
"indicator": "warning",
"detail": "The HbA1C level of 15.2mmol/L in the most recent lab is considered abnormal"
},
{
"summary": "Abnormal LDL cholesterol level detected in most recent lab results",
"indicator": "warning",
"detail": "The LDL cholesterol level of 189mg/dL in the most recent lab is considered abnormal"
},
{
"summary": "Abnormal Microalbumin/Creatinine ratio detected in most recent lab results",
"indicator": "warning",
"detail": "The Microalbumin/Creatinine ratio of 35mcg/mg in the most recent lab is considered abnormal"
},
{
"summary": "Abnormal Foot Exam detected in most recent lab results",
"indicator": "warning",
"detail": "The Foot Exam resulted in the following abnormality: Non-pressure chronic ulcer of other part of unspecified foot with unspecified severity"
},
{
"summary": "Abnormal Eye Exam detected in most recent lab results",
"indicator": "warning",
"detail": "The Eye Exam resulted in the following abnormality: Type 2 diabetes mellitus with mild nonproliferative diabetic retinopathy without macular edema, left eye"
}
]
}
- Visit http://sandbox.cds-hooks.org
- Change Patient to Patient-12214
- If the Patient is not present in the default FHIR Server, you'll need to load it.
- PUT the following Patient and MedicationOrder in the default FHIR Server
{ "resourceType": "Patient", "id": "Patient-12214", "meta": { "versionId": "1", "lastUpdated": "2017-07-17T16:34:10.814+00:00" }, "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\">2 <b>N GERIATRIC </b>Jr</div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>7f3672feb3b54789953e012d8aef5246</td></tr><tr><td>Address</td><td><span>202 Burlington Rd. </span><br/><span>Bedford </span><span>MA </span></td></tr><tr><td>Date of birth</td><td><span>07 May 1946</span></td></tr></tbody></table></div>" }, "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/us-core-race", "valueCodeableConcept": { "coding": [ { "system": "http://hl7.org/fhir/v3/Race", "code": "2106-3", "display": "White" } ] } }, { "url": "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity", "valueCodeableConcept": { "coding": [ { "system": "http://hl7.org/fhir/v3/Ethnicity", "code": "2186-5", "display": "Not Hispanic or Latino" } ] } }, { "url": "http://hl7.org/fhir/StructureDefinition/us-core-religion", "valueCodeableConcept": { "coding": [ { "system": "http://hl7.org/fhir/v3/ReligiousAffiliation", "code": "1007", "display": "Atheism" } ] } } ], "identifier": [ { "use": "official", "type": { "coding": [ { "system": "http://hl7.org/fhir/identifier-type", "code": "SB", "display": "Social Beneficiary Identifier" } ], "text": "Michigan Common Key Service Identifier" }, "system": "http://mihin.org/fhir/cks", "value": "7f3672feb3b54789953e012d8aef5246" } ], "active": false, "name": [ { "family": "N Geriatric", "given": [ "2" ], "suffix": [ "Jr" ] } ], "telecom": [ { "system": "phone", "value": "586-555-7576", "use": "home" }, { "system": "phone", "value": "586-555-0297", "use": "work" }, { "extension": [ { "url": "http://hl7.org/fhir/StructureDefinition/us-core-direct", "valueBoolean": true } ], "system": "email", "value": "[email protected]", "use": "home" } ], "gender": "male", "birthDate": "1946-05-07", "address": [ { "line": [ "202 Burlington Rd." ], "city": "Bedford", "state": "MA", "postalCode": "01730" } ] }
{ "resourceType": "MedicationOrder", "id": "medrx001", "dateWritten": "2017-05-05", "status": "draft", "patient": { "reference": "Patient/Patient-12214" }, "medicationCodeableConcept": { "coding": [ { "system": "http://www.nlm.nih.gov/research/umls/rxnorm", "code": "197696" } ] }, "dosageInstruction": [ { "text": "Take 40mg three times daily", "timing": { "repeat": { "frequency": 3, "frequencyMax": 3, "period": 1, "unit": "d" } }, "asNeededBoolean": false, "doseQuantity": { "value": 40, "unit": "mg", "system": "http://unitsofmeasure.org", "code": "mg" } } ], "dispenseRequest": { "quantity": { "value": 3000, "unit": "mg", "system": "http://unitsofmeasure.org", "code": "mg" } } }
- Click Add CDS Service from the CDS Services dropdown
- Use the following discovery endpoint:
http://measure.eval.kanvix.com/cqf-ruler/cds-services
- Use the following discovery endpoint:
- Click the Rx View button
- If not already selected, click on the
cdc-opioid-guidance
service in the CDS Service Exchange view - Select a medication in the Rx View
- Try Oxycodone Hydrochloride 10 mg for a warning or Oxycodone Hydrochloride 5 mg for success.