elationjs

1.0.10 • Public • Published

elation.js

Elation Health API Client - Node.js

A Node.js client for the Elation Health API. Work In Progress, pull requests accepted.

Usage

// elation-client.js
import Elation from 'elationjs'
 
const credentials = { // your Elation API credentials
  clientID: string,
  clientSecret: string,
  username: string,
  password: string,
}
const sandbox: boolean = false // Use sandbox API URL. default: true
 
const apiClient = new Elation(credentials, sandbox)
apiClient.initialize()
 
export default apiClient

Patient endpoints

Create:

type PatientData = {
  id: ID,
  first_name: string,
  last_name: string,
  dob: string,
  sex: string,
  primary_physician: ID,
  caregiver_practice: ID,
  address: Address,
  phones: Phone[],
  email: Email[],
  metadata: PatientMetadata,
}
 
elationClient.Patient().postPatient(patient: PatientData): Promise<Patient>

Get One:

elationClient.Patient().getPatient(id: ID): Promise<Patient>

Search:

type FindPatientsData = {
  first_name?: string,
  last_name?: string,
  dob?: string,
  sex?: string,
}
 
elationClient.Patient().findPatients(search: PatientQuery): Promise<Patient[]>

Update:

type PatientUpdateData = {
  first_name?: string,
  last_name?: string,
  dob?: string,
  sex?: string,
  primary_physician?: ID,
  caregiver_practice?: ID,
  address?: Address,
  phones?: Phone[],
  email?: Email[],
  metadata?: PatientMetadata,
}
 
elationClient.Patient().update(patientID: ID, updateData: PatientUpdateData): Promise<Patient[]>

Note Endpoints

Build/Save:

const Note = elationClient.Note()
const data = {
  type: 'Visit Note',
  template: 'Simple',
  patient: 12345678,
  physician: 12345678,
  chart_date: new Date().toISOString(),
  document_date: new Date().toISOString(),
}
const note = new Note(data)
note.addBullet({
  category: 'Assessment',
  text: 'Patient is feeling bad',
})
note.addBullet({
  category: 'Assessment',
  text: 'Patient is feeling bad',
})
note.removeBullet(1) // remove bullets by index (bullets can't have an ID field)
note.save().then(note => console.log('Note saved: ', note))

Create:

type NoteInput = // see Flowtypes in src/Note.js for complete Note input type
 
elationClient.Note().create(note: NoteInput): Promise<Note>

Get One:

elationClient.Note().getNote(id: ID): Promise<Note>

Search:

type NoteSearchInput = {
  +patient: ID[],
  +physician: ID[],
  +practice: ID[],
}
 
elationClient.Note().findNotes(query: NoteSearchInput): Promise<Note[]>

Delete:

elationClient.Note().delete(id: NoteID): Promise<{ id: NoteID, deleted: true }>

Contributions

Pull requests welcome, need help with adding endpoint coverage and starting the test library.

Package Sidebar

Install

npm i elationjs

Weekly Downloads

1

Version

1.0.10

License

ISC

Unpacked Size

27.5 kB

Total Files

16

Last publish

Collaborators

  • pdeona