3 min read

Get Your Clinical Decision Support in an EHR in 10 mins

Get Your Clinical Decision Support in an EHR in 10 mins
Learn to make a CDS Hook!
CDS Hooks

CDS Hooks official website

Looking to get your great calculator, insight, or decision support to appear in an EHR? Looking to know when a certain medication is ordered, or when a chart is opened in an EHR? Well then, CDS Hooks might be what you are looking for.

CDS hooks take EHR events (like when a provider opens a chart/views a patient, when an order is selected or signed, when a visit starts or ends, ...) and notify arbitrary web services that anyone can create. These services can give "card" data back to the EHR to display to the provider.

Think of the following:

  1. You create a cost estimator card for when a provider selects an MRI order.
  2. You create a service that suggest a different medication for a doctor when they are about to prescribe something.
  3. You create a service that makes CME appear inside the EHR when a patient has certain characteristics.
  4. ....

To get you started, we are going to build #3, because, well, it is super interesting.

It's called "CME-ster" and it makes the following card surface in an EHR when a provider opens a chart and the patient has a history of dementia.

The link is to the awesome Curbsider's podcast which internal medicine doctors/hospitalist love

#268 Dementia Made Simple with Dr. Josh Uy - The Curbsiders
A memorable dive into office evaluation and management Transcript-The-Curbsiders-268-Dementia-Made-SImpleDownload Dust off your dementia playbook and re-evaluate your approach as Dr. Josh Uy walks us through this common (yet perplexing) condition. Dr. Uy (@joshuy) is the geriatric fellowship directoโ€ฆ

Two get CDS Hooks to work you need two things:

  1. Somewhere you serve your code for "CME-ster"
  2. an EHR to show these cards in

Server Part

For the server part, I like repl.it, and I have some code there you can sign up for a free account and fork it at


Once you fork it click "Run"

You will notice you magically have your own url serving code at the upper right

In fact if you hit the button with the box and an arrow coming out of it, you will see your code being served

Simulate an Electronic Health Record

To simulate an EHR, go to the CDS Hooks Sandbox at

CDS Hooks Sandbox

Click on the gear in the upper right

Click Add CDS Service

Enter your repl url with /cds-services added to the end like this:

Magically you will see this card appear in the "EHR"

Try changing the code (like the image or the "details" of the json for the card). Hit Stop on your repl, then run, then reload the CDS Hooks Sandbox.

Check out more FHIR tutorials at www.patient.dev