Eka Care Ekascribe Typescript SDK Integration
This guide explains how to integrate the Eka Care Ekascribe Typescript SDK into your application.Overview
The Eka Care Ekascribe SDK allows you to capture and process audio, generating structured medical documentation using Eka Care’s voice transcription API.Prerequisites
Before getting started, ensure you have:- Node 14 or higher
npm
oryarn
for dependency management- Access and refresh tokens from Eka Care (optional for some methods)
- Microphone access via browser permissions
- Stable network connectivity
Installation
Install the SDK usingnpm
or yarn
:
Usage
1. Get Ekascribe Instance
It will give you the main class instance, use this instance to access all methods2. Fetch configurations list
Get supported input languages, output formats, and consultation modes.-
Sample Response:
3. Init transaction
Use this method to init a transaction before starting recording.-
Sample Response:
4. Start recording
Start recording with user-selected options.-
Sample Response:
5. Pause recording
Use the method to pause voice recording-
Sample Response:
6. Resume recording
Use the method to resume voice recording-
Sample Response:
7. End recording
Use the method to end voice recording-
Sample Response:
8. Retry upload recording
Use this method to retry uploading failed audio files.-
Sample Response:
force_commit
behavior
— If force_commit
is set to true
, the SDK will call the commit API even if some audio files still fail to upload after retrying once.
— If force_commit
is set to false
, the SDK will wait until all audio files are uploaded successfully before making the commit request.
9. Patch recording session status
Use the method to cancel a recording session.-
Sample Response:
10. Commit transaction
Use this method to commit a transaction that is not yet committed or returned a “commit failed” error in a previous step.-
Response type:
11. Stop transaction
Use this method to stop a transaction that has not yet been stopped or returned a “stop failed” error in a previous step.-
Response type:
12. Get output template prescriptions
Use this method to fetch the final generated prescription output for a session.13. Get previous sessions
Use this method to retrieve all the previous sessions for a specific doctor ID-
Response type:
14. Get All Templates
Use this method to retrieve all available templates for the current user.-
Response type:
15. Create Template
Use this method to create a new custom template.-
Response type:
16. Edit Template
Use this method to update an existing template.-
Response type:
17. Delete Template
Use this method to delete an existing template.-
Response type:
18. Generate Template with AI by giving a prompt
Use this method to generate a template using AI with a text prompt.-
Response type:
19. Add templates to list
Use this method to mark templates as favourite templates.-
Response type:
20. Get All Sections
Use this method to retrieve all available template sections.-
Response type:
21. Create Section in a template
Use this method to create a new section that can be used in templates.-
Response type:
22. Edit Section in a template
Use this method to update an existing template section.-
Response type:
23. Delete Section from a template
Use this method to delete a template section.-
Response type:
24. Convert a transaction into another template after prescription generation
Use this method to convert an existing transaction’s output to use a different template format.-
Response type:
25. Search past sessions by a patient name
Use this method to search through previous sessions by patient name.-
Response type:
26. Upload audio file to get output summary
Use this method to upload audio files directly and get transcription output without real-time recording.-
Response type:
27. Edit output summary
Use this method to edit the generated output summary for a completed transaction.-
Response type:
Utility Methods
1. Get total uploaded files
Use this method to retrieve all the audio files generated for a specific session.-
Response type:
2. Get successfully uploaded files
Use this method to retrieve all the audio files that were uploaded successfully.-
Response type:
3. Get failed audio files
Use this method to retrieve all the audio files that failed to upload.-
Response type:
4. Reset Class Instance
Use this method to reset the EkaScribe instance and clear all stored data.5. Reinitialise VAD Instance
Use this method to reinitialize the Voice Activity Detection (VAD) instance.6. Pause VAD Instance
Use this method to pause the Voice Activity Detection without stopping the recording session.7. Destroy VAD Instance
Use this method to completely destroy the VAD instance and free up resources.8. Update Authentication Tokens
Use this method to update the access token without reinitializing the entire SDK instance.Generic Callbacks
1. Event callback
This is a comprehensive callback that provides information about SDK operations, including success events, errors, progress updates, and system status. Use this callback to monitor all SDK activities and handle events globally in your application.-
Sample Callback Data:
2. User speech callback
This callback will return a boolean indicating whether the user is speaking or not.3. VAD Callback to check if a frame is valid speech or not
This callback provides information about voice activity detection frames and audio processing status.-
Sample Callback Data:
Error codes
Error Code | Description |
---|---|
microphone | Microphone access error (permission denied or unavailable) |
txn_init_failed | Failed to initialize transaction |
txn_limit_exceeded | Maximum number of concurrent transactions exceeded |
unknown_error | An unknown or unclassified error occurred |
txn_stop_failed | Error occurred while stopping the transaction |
audio_upload_failed | Audio file upload to server failed |
txn_commit_failed | Commit call failed for the current transaction |
invalid_request | Request to SDK was malformed or missing required parameters |
vad_not_initialized | Voice activity detection engine was not initialized |
no_audio_capture | No audio was captured during the recording session |
txn_status_mismatch | Invalid operation due to mismatched transaction status |