augnitoambientsdk
v2.0.3
Published
Use this typescript SDK to integrate Augnito’s Ambient Tech within your EMR. To get access credentials or know more about how Augnito Ambient can benefit you, please visit our website and connect with our sales team: https://augnito.ai/
Downloads
315
Maintainers
Readme
Augnito Ambient SDK
Use this typescript SDK to integrate Augnito’s Ambient Tech within your EMR. To get access credentials or know more about how Augnito Ambient can benefit you, please visit our website and connect with our sales team: https://augnito.ai/
Installation
Install the library in your project
Typescript
npm install augnitoambientsdk
Vanilla JS
use https://cdn.jsdelivr.net/npm/augnitoambientsdk@latest/dist/augnitoambientsdk.js to import the library from npm using CDN url.
Basic Usage
Import the library
Typescript
import { AugnitoAmbient, AmbientConfig } from "augnitoambientsdk";
Vanilla JS
import { AugnitoAmbient } from "https://cdn.jsdelivr.net/npm/augnitoambientsdk@latest/dist/augnitoambientsdk.js";
Create the configuration file and instantiate Augnito Ambient Manager
private ambientConfig: AmbientConfig = {
server: '<your server>',
subscriptionCode: '<your subscriptionCode>',
accessKey: '<your accessKey>',
userTag: '<your usertag>',
enableLogs: false, // set to true to check sdk logs in the browser console
};
const augnitoAmbient = new AugnitoAmbient(ambientConfig);
1- Get Note Parameters
Get Region, Note Type and Gender
Get all possible note-parameters (applicable categories and possible values) that are expected to be passed when creating a job (when doctor-patient consultation is started). These details are used to provide consultation SOAP notes with higher accuracy.
//Returns JSON of Region, Note Type and Gender const noteParamsJson = augnitoAmbient.getNoteParams();
Get Speciality and Visit Types
Augnito allows the speciality-type and visit-types for the doctor-patient consultation mapped at the hospital organization level. This method returns the list of speciality-type or visit-type (based on the value of ConfigTypeId parameter) mapped for the user in the hospital-organization.
All supported specialty-types and visit-types for the hospital-organization can be specified to Augnito team at the start of integration or as and when needed.
At the start of recording it is necessary to pass the ConfigID of applicable (user can select one or default value to be sent) Speciality and VisitType in the noteparams string.
Typescript
//Get list of specialities enabled for organisation const specialities = await augnitoAmbient.getUserConfiguration( SettingsConfigType.SPECIALITY );
Vanilla JS
import { SettingsConfigType } from "https://cdn.jsdelivr.net/npm/augnitoambientsdk@latest/dist/augnitoambientsdk.js"; //Get list of specialities enabled for organisation const specialities = await augnitoAmbient.getUserConfiguration( SettingsConfigType["SPECIALITY"] );
Typescript
//Get list of visit types enabled for organisation const visitTypes = await augnitoAmbient.getUserConfiguration( SettingsConfigType.VISIT_TYPE );
Vanilla JS
import { SettingsConfigType } from "https://cdn.jsdelivr.net/npm/augnitoambientsdk@latest/dist/augnitoambientsdk.js"; //Get list of visit types enabled for organisation const visitTypes = await augnitoAmbient.getUserConfiguration( SettingsConfigType["VISIT_TYPE"] );
Response JSON for each item of speciality and visit type has the following structure
ID: number; ConfigID: number; Value: string; Description: string; IsSelected: boolean; IsDefault: boolean;
2- Toggle the client
Now all you have to do is toggle the status when you want to start/stop or pause/resume recording!
/**
* @param filetype Type of file being uploaded, wav, mp3, etc. Ex: “filetype=wav“
* @param noteparams Qualifiers to determine the type of clinical note to be generated for that audio file. Region, NoteType and Gender values to be passed from response for getNoteParams(). Speciality and Visit Type can be set to the ConfigID returned by getUserConfiguration()
* @param jobName, optional, a title for the note generated
* @param jobId, optional, to be set if reconnecting to paused job id to continue recording the note
* @param recordedDuration, optional, set recorded duration of previous paused job id if reconnecting to it
*/
// Toggles the start/stop recording
augnitoAmbient.toggleListening(
filetype:string,
noteparams:string,
jobName?: string,
jobId?: string,
recordedDuration?: number
);
example: augnitoAmbient.toggleListening("wav",`{"Region": 1, "Speciality": 11, "NoteType": 1, "VisitType":29, "Gender": 0}`)
//Toggles the Pause/Resume recording
augnitoAmbient.togglePauseResumeListening(
filetype: string,
noteparams: string,
jobName?: string,
jobId?: string,
recordedDuration?: number
);
example: augnitoAmbient.togglePauseResumeListening("wav",`{"Region": 1, "Speciality": 11, "NoteType": 1, "VisitType":29, "Gender": 0}`)
//#region Callbacks
//Callback to change recording button style
public onStateChanged?: (isRecording: boolean)
example: augnitoAmbient.onStateChanged = (isRecording: boolean) => {console.log(isRecording)}
//Callback to receive the Job Id
public onJobCreated?: (text: string)
example: augnitoAmbient.onJobCreated = (text: string) => {console.log(text)}
//Callback to receive when an error occurs within the SDK
public onError?: (errorMessage: string)
example: augnitoAmbient.onError = (errorMessage: string) => {console.log(errorMessage)}
//#endregion
3- Explicitly stop the recording
/**
* Stops the recording and cleans up resources
* This function needs to be explicitly called whenever togglePauseResumeListening() function is used
*/
augnitoAmbient.stopListening();
4- List Jobs
Get all Jobs (SOAP notes and other clinical notes) created within the doctor (user’s) account with respect to the given usertag along with meta data. These notes are sorted by timestamp of creation and support pagination.
/**
* @param PageSize a number, to fetch specified number of notes as a page for each request
* @param PageID is optional parameter, a string value, When PageID is not given, first set of notes is retrieved according to the specified PageSize. To fetch next set of notes send the PageIDNext received as part of response from the previous getAllNotes call
* @returns list of notes for the user on success else fail response
*/
const JobList = await augnitoAmbient.getAllNotes(PageSize: number, PageID?: string);
5- Fetch Job Output
Retrieve a particular SOAP note or any other clinical note for the given JobId and with respect to the given UserTag (doctor).
/**
* @param JobId string, to retrieve output for a specific audio file
* @returns JSON object contains Transcript, Note, FormattedSoap, Codes, NoteParams and SystemEOS on success else fail response
*/
const JobOutput = augnitoAmbient.getSummarizedNote(JobId:string);
6- Send Final Note
Doctor might make edits to the generated SOAP note and then save it to the EMR. You can use this API to send the final edited SOAP note to help increase accuracy of output in future.
/**
* @param JobId string, needs to pass to store the final Note for that audio file
* @param NoteData string, This key will store the final edited Note that user wants to send.
* @returns success response on successful submit of note else fail response
*/
augnitoAmbient.sendSummarizedNote(JobId:string, NoteData:string);
7- Delete Notes
Allows you to build a capability for the user (doctor) to delete one or more notes generated under his/her UserTag.
/**
* @param JobIds array of jobid string values, to delete one or more notes
* @returns success response on successful delete of notes else fail response
*/
const result = await augnitoAmbient.deleteNotes(JobIds: string[])
8- Rename Note Title
Allows you to build a capability for the user (doctor) to rename generated note under his/her UserTag.
/**
* @param JobId string, to rename note title
* @param NewJobName string, new title for the note
* @returns success response on successful rename of note else fail response
*/
const result = await augnitoAmbient.renameNoteTitle(JobId: string, NewJobName: string)
9- Download Note as PDF
Allows you to build a capability for the user (doctor) to download generated note as PDF.
/**
* @param JobId to retrieve pdf for a specific note
* @returns base64 string of the pdf output
*/
const result = await augnitoAmbient.getNotePDF(JobId: string)
10- Update Speciality and Visit type config
To select/deselect or to set as default any specialty and visit type for the individual user (doctor) differentiated through UserTag.
All specialties and visit types specified by the organization to Augnito will be available (through function defined in Get Speciality and Visit Types section above) for the mapping to organization users. Out of the mapping, only the applicable specialty and visit types for the user can be configured using this API
/**
* @param ConfigMap Config mapping json. ID to set each config can be obtained by calling the function defined in Get Speciality and Visit Types section above
* @returns success response on successful update else fail response
*/
const result = await augnitoAmbient.updateUserConfiguration(ConfigMap: UserConfigMap[])
11- Send EOS for abruptly ended Job
Allows the client-application to send explicit EOS for a recording which did not finish due to reasons such as mistakenly closing browser before stopping the recording.
getAllNotes method will return status of such a job as JOBPAUSED. endPausedJob method can be called to end the job successfully.
If recording was not completed before abrupt closure then reconnection to JobID can be done using toggleListening or togglePauseResumeListening with jobid and recordedDuration(previously recorded duration through getAllNotes response) to continue recording.
The reconnection needs to be done within 5-10 of the initial recording, else Augnito system will generate the note output with audio data sent to it.
/**
* @param JobId to send EOS for a paused job
* @returns success response on EOS sent for job else fail response
*/
const result = await augnitoAmbient.endPausedJob(JobId: string)
12- Generate CDI suggestions
Allows you to generate CDI suggestions for the given SOAP note along with additional data sent to the method, as parameters mentioned below.
/**
* @param JobId that was sent by Augnito Ambient-service in response to the successful web-socket connection
* @param NoteParams that was sent to toggleListening/togglePauseResumeListening while recording the note
* @param SoapNote is the structured json string of soap note.
* @param Codes is structured medical codes json string.
* @param PatientDetails json string which contains details such as age, gender and history of illness
* @returns success response on successful submit of note else fail response
*/
const result = await augnitoAmbient.generateCDISuggestions(
JobId: string,
NoteParams: string,
SoapNote: string,
Codes: string,
PatientDetails: string
)
example input:
{"JobID": "23916cc6-2f9c-46bf-b95e-d68d82cae899",
"NoteParams": {"specialty_type": 11, "visit_type": 29},
"PatientDetails": {"age": 33,"gender": "Male","previous_history": "patient was diagnosed with heart disease 3 years ago." },
"SoapNote": {"chief_complaints": "Severe cough and wheezing","history_of_present_illness": "Since the last 7 days.History of travel","current_medication_name":"Aspirin","family_history": {"name": "Asthma","remarks": "Father has asthma" }, "medical_history": { "name": "Valvular Heart Disease","remarks": "Medical history of valvular heart disease"},"surgical_history": { "name": "Orthopaedic surgery","remarks": "surgery in the right knee due to fall injury"},"social_history": {"name": "Smoking","remarks": "Active smoker since last 9 years" }, "infection_history": { "name": "Eye Infection","remarks": "history of eye infection"},"physical_examination": { "name": "lower back","type": "abnormal","remarks": "lower back pain observed since last 5 days"},"plan_of_care": "get the test done, avoid dusty environments and exposure to cold water"},
"Codes": {"allergy": [{"description": "FLOROQUINOLONES","severity": "Moderate","remarks": "Allergic to all floroquinolones"},{"description": "dust allergy","severity": "severe","remarks": "allergic to dust and pollen"}],
"prescription_medication": [{"generic_medicine_name": "CLARITINE 5 MG / 5 ML SYR 100 ML","frequency": "in the morning","route": "oral","duration": "3 days","remarks": "Claritine syrup for next 3 days and stop if any abdominal pain persists"},{"generic_medicine_name": "Amoxicillin & K Clavulanate for Susp-600 42.9 MG/5ML","frequency": "morning and evening","route": "oral","Duration": "3 days","remarks": "Amoxicillin & K Clavulanate for Susp for next 3 days and stop if any abdominal pain persists" }],
"procedures": [{"name": "AUTOLOGUS BLOOD OR COMPONENT COLLECTION", "remarks": "Autologus blood test" },{"name": "CBC","remarks": "Complete blood count test"}]}}
example output:
{"Data": [{"Key": "suggestion-heading-1", "Value": "suggestion-brief-1"},
{"Key": "suggestion-heading-2", "Value": "suggestion-brief-2"}],
"ErrorMessage": "string",
"Status": http-success-code}