@asymmetrik/node-cds-hooks
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Node CDS Hooks

Build Status

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

npm i s @asymmetrik/node-cds-hooks

Example Usage

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.

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!

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.1
    3
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.1
    3
  • 1.0.0
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i @asymmetrik/node-cds-hooks

Weekly Downloads

3

Version

1.1.1

License

MIT

Unpacked Size

167 kB

Total Files

23

Last publish

Collaborators

  • rblace
  • reblace
  • iisluan
  • ekoon121
  • amarcus
  • jlee-asymmetrik
  • soneill