srcdirectory, create a folder called
cdinto it and create the file
Serviceclass and a
Cardclass. Import those at the top of the file:
idparameter is the unique identifier for a service.
patient-viewHook. This is used to tell the a CDS client when to use this decision support (in this case, when a patient record is being view). Hooks also help us define data requirements, which we will cover in a later section.
asyncfunction that runs when a request is made from a Client to a Service. In this case, an HTTP GET request is sent to
idwe defined in the options above is what configures this url.
Carddisplaying the current time. Let's expand our handler:
Cardcontaining information about the current time. Not exactly ground-breaking decision support, but we need to start somewhere!
get-current-time.js, let's add a default export:
index.jsand import the service.
package.jsonneeds a new script, as well the
typekey set to
npm run start.
patient-viewhook invocation that returns a card with the text Now seeing: Daniel. You can see the Card rendering this information on the left.
httpslink from ngrok into the input area. Append
/cds-servicesto the end of the link, and click "Save." This is known as the "Discovery Endpoint" for our Service.
get-current-timereturns a Card, now displayed on the left, with the current time.