Recommended use
// open the widget
document.getElementById('heidi-button').addEventListener('click', () => {
Heidi.open({
patient: {
id: '123',
name: 'John Doe',
gender: 'Male',
dob: '1990-01-01',
},
});
});
// open the widget with a custom template
document.getElementById('heidi-button').addEventListener('click', () => {
Heidi.open({
template: templateData, //templateData is your custom template object
patient: {
id: '123',
name: 'John Doe',
gender: 'Male',
dob: '1990-01-01',
},
});
});
All methods and callbacks
Heidi.open(params?)
Attribute | Value |
---|---|
Params | Open parameters described below. |
Description | Opens Heidi and starts a new session. - If a sessionId is specified, the widget will open that session. - If startNewSession is set to true, the widget will create a new session, regardless of whether a sessionId is provided. |
Heidi.close(params?)
Attribute | Value |
---|---|
Params | params?:{ keepSession?: boolean, force?: boolean } : set params.force to close Heidi skipping the confirmation step. If params.keepSession is true and params.force is used, then Heidi will keep the current session open. |
Description | Close Heidi, showing a confirmation modal unless params.force is set to true . |
Heidi.onPushData(callback)
Attribute | Value |
---|---|
Params | callback(data) : a function called when the user chooses to push notes from the Heidi library to your EHR. data.notesData contains the note data as a string, if a template was not provided, or following the Template interface. |
Description | Triggered when a user clicks Push Note in the Heidi widget. If this callback is not set, the Push Note button will not be available on the UI. |
Heidi.onPushDocument(callback)
Attribute | Value |
---|---|
Params | callback(data) : a function called when the user chooses to push document from the Heidi library to your EHR. data.title and data.content contain the document title and content. |
Description | Triggered when a user clicks Push Document in the Heidi widget. If this callback is not set, the Push Document button will not be available on the UI. |
Heidi.onSessionStarted(callback)
Attribute | Value |
---|---|
Params | callback(sessionId) : a function called when a new Heidi Session is created. sessionId is a string containing the current Heidi Session Id |
Description | Returns the sessionId of the current Heidi session. |
Heidi.onTokenExpired(callback)
Attribute | Value |
---|---|
Params | callback() : a function called when the current Heidi token expires. |
Description | When called, use this callback to generate a new token and provide it to the widget via Heidi.setToken (see below). |
Heidi.setToken(token)
Attribute | Value |
---|---|
Params | setToken : a valid Heidi JWT token. |
Description | Update the current token used by Heidi. |
Heidi.onOpen(callback)
Attribute | Value |
---|---|
Params | callback : called when Heidi is opened. |
Description | Called when the Heidi widget is opened. |
Heidi.onClose(callback)
Attribute | Value |
---|---|
Params | callback : called when Heidi is closed. |
Description | Called when the Heidi widget is closed. |
Heidi.setPatient(patientInfo)
Attribute | Value |
---|---|
Params | patientInfo: PatientInfo : patient information for the current patient in your EMR. See below for more info on the data type. |
Description | Update the patient information for the current session. |
Heidi.setContext(context)
Attribute | Value |
---|---|
Params | context: HeidiContext : an object containing a context information string, {context: string} . |
Description | Set context information for the session, if no context was set before. This can be used to set Medications, Allergies and any other patient info to enrich Heidi's notes. |
Heidi.onResize(callback)
Attribute | Value |
---|---|
Params | callback(expanded: boolean) : a function called when the user resizes the Heidi widget. expanded is a boolean indicating whether the widget is expanded or not. |
Description | Called when the user resizes(expands or collapses) the Heidi widget. |
Heidi.onRecordingStarted(callback)
Attribute | Value |
---|---|
Params | callback() : a function called when the user starts a recording in the Heidi widget |
Description | Called when the user starts a recording. |
Heidi.onRecordingStopped(callback)
Attribute | Value |
---|---|
Params | callback() : a function called when the user stops a recording in the Heidi widget |
Description | Called when the user stops a recording. |
Widget open parameters
The Heidi.open()
method accepts an optional params
object with the following properties:
Attribute | Type | Value |
---|---|---|
patient | PatientInfo | Patient information as defined in Patient Information |
sessionId | string | A valid Heidi Session ID, obtained from Heidi.onSessionStarted |
template | Template | Custom template to use for the session. See Custom Templates for more info on the data structure. |
startNewSession | boolean | Whether to start a new session, regardless of whether a sessionId is provided. |
context | string | Set context information for the session, if no context was set before. This can be used to set Medications, Allergies and any other patient info to enrich Heidi's notes. |
Typescript Interface
interface HeidiOpenParams {
template?: Template,
patient?: PatientInfo,
sessionId?: string,
startNewSession?: boolean
}