Skip to content

Testing Your Services

Zach Plata edited this page May 11, 2018 · 5 revisions

Now that we have gone over the technical implementation of creating our CDS Services, we can begin to test them out on the Sandbox tool and see what using our CDS Services could look like from the prospective of the clinician using an EHR.

If you haven't already, you can start up your localhost server by navigating inside the project directory from a command prompt or terminal. Then, you can type the command npm run start-server to start the Express application and host the services over port 3000.

Once these services are up and running, you can navigate to the following URL:

http://sandbox.cds-hooks.org

Adding CDS Services

On page load, you should encounter what looks like a patient chart. If you look at the header, you should see that the Patient View toggle is highlighted, simulating invocation of the patient-view hook.

Next you should navigate to the upper-right corner and click on the gear/settings icon with a drop down menu. Click on "Add CDS Services" and a modal should appear requiring user input for the "Discovery Endpoint URL".

Try adding our discovery endpoint URL on your own (see the Discovery section of the tutorial if you don't remember what it is) and click "Save".

If you get a red error message, check your browser console tools to see why the connection failed. Close out the modal.

Patient View

At this point, you should see a new face-up card on the patient view with the textual response from our patient-view-example service. You should see the patient's first and last name on the card, and you should be able to click on the link to the CDS Hooks spec website. Congrats! You've now integrated your own CDS services into a mock EHR system that was able to display your responses in real-time.

Rx View

Try clicking on the Rx View toggle on the header to switch to the med prescribe view. You'll see that there are no cards appearing at first. Recall that the medication-prescribe hook only gets invoked on a provider authoring a medication. So let's try and do that.

Under the Medication field, type "Tylenol", and choose the first option. Then under the sub-categories, choose the first option, "Acetaminophen 80 MG [Tylenol]". Finally, click the remaining option, "Acetaminophen 80 MG Chewable Tablet [Tylenol]".

At this point, you should see 2 cards appear. One card with an orange indicator (specifying a warning) which displays our CDS Service response with a suggestion, and another card from one of the default CDS Services for the sandbox.

Because we're prescribing Tylenol, our CDS Service will make sure to suggest the switch to Aspirin 81 MG Oral Tablets. In general, suggestions are recommended to be styled as buttons, so you'll see the button that says "Switch to low-dose Aspirin" as a label. If you click on it, the EHR will "take" the suggestion and change the medication accordingly.

Since the EHR is prescribing a medicine again, the CDS Services will be invoked, and this time, our service will see that the appropriate Aspirin is being prescribed, so we send our basic textual card affirming the medication choice.

Notes about Sandbox

One thing to consider is that the EHR (or sandbox) will determine how to render card responses from CDS Services. If a CDS Service developer wants to test out how a card could look from a service response, they can click on "Card Demo" with the pencil icon in the header. Here, they can edit/insert their own service responses to test a single card and see how it renders in the Sandbox.

Another functionality to note is the CDS Developer Panel on the right side of the page; you can select a specific service from the dropdown of services configured for the current hook. Once you select a service, you can toggle the request and response panels to see what goes in the POST body request to the CDS Service, and what the body of the response from the CDS Service looks like. You can use this to verify the JSON your CDS Service sends back to the EHR (or sandbox) is what you expect.

Another thing to note is that you can configure the CDS Service definitions by clicking on the dropdown gear/settings button on the header, then clicking "Configure CDS Services" with the gear icon. A modal should appear with all the CDS Services configured for this sandbox. You can disable select services and delete them from the sandbox as needed.

Lastly, CDS Services (among other Sandbox properties) are stored on local storage once added to the sandbox, so if you reload the page, the services should still remain configured. You can click the gear/settings icon and click "Reset Configuration" to remove all newly added CDS Services from the sandbox (and saved Sandbox configuration), and they will be deleted off the local storage.

Next step: Exercises