Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bluehalo/node-cds-hooks
A framework for creating CDS Hooks applications
https://github.com/bluehalo/node-cds-hooks
Last synced: about 1 month ago
JSON representation
A framework for creating CDS Hooks applications
- Host: GitHub
- URL: https://github.com/bluehalo/node-cds-hooks
- Owner: bluehalo
- License: mit
- Created: 2020-07-14T15:47:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-17T13:41:25.000Z (over 4 years ago)
- Last Synced: 2024-11-12T07:52:16.687Z (about 1 month ago)
- Language: TypeScript
- Size: 150 KB
- Stars: 4
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Node CDS Hooks
![Build Status](https://travis-ci.org/Asymmetrik/node-cds-hooks.svg?branch=master)
A framework for making CDS Hooks applications -- APIs that serve Cards to providers within EHRs.
## Getting started
Install node-cds-hooks as an npm module and save it to your package.json as a dependency
```sh
npm i @asymmetrik/node-cds-hooks
```## Example Usage
```js
const { CDSServer, Service } = require('@asymmetrik/node-cds-hooks');const definition = {
hook: 'patient-view',
name: 'CDS Service Starter Patient View',
description: 'An example of a CDS Service that displays "Hello World!"',
id: 'cds-service-starter-patient-view',
prefetch: {
patient: 'Patient/{{context.patientId}}',
}
}const handler = (req) => {
return {
cards: [
{
summary: 'My summary',
detail: 'My details',
source: {
label: 'Node CDS Hooks',
url: 'https://example.com',
},
indicator: 'info',
}
]
}
}};
// Create the server
const app = new CDSServer();// Create the service
const service = new Service(definition, handler);// Register the service
app.registerService(service);// Start the application
const port = 9000
app.listen({ port }, () => {
logger.info('Application listening on port: ' + port);
}
```After your app is running, query your discovery endpoint.
```sh
curl http://localhost:9000/cds-services
{"services":[{"hook":"patient-view","name":"CDS Service Starter Patient View","description":"An example of a CDS Service that displays \"Hello World!\"","id":"cds-service-starter-patient-view","prefetch":{"patient":"Patient/{{context.patientId}}"}}]}
```You're up and running!