@eka-care/ekascribe-ts-sdk 1.5.21 → 1.5.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +605 -105
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ The Eka Care Ekascribe SDK allows you to capture and process audio, generating s
|
|
|
8
8
|
|
|
9
9
|
## Documentation
|
|
10
10
|
|
|
11
|
-
[Visit the documentation site](https://developer.eka.care/api-reference/
|
|
11
|
+
[Visit the documentation site](https://developer.eka.care/api-reference/health-ai/ekascribe/SDKs/TS-sdk)
|
|
12
12
|
|
|
13
13
|
## Prerequisites
|
|
14
14
|
|
|
@@ -25,65 +25,71 @@ Before getting started, ensure you have:
|
|
|
25
25
|
Install the SDK using `npm` or `yarn`:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm install ekascribe-ts-sdk
|
|
28
|
+
npm install @eka-care/ekascribe-ts-sdk
|
|
29
29
|
# or
|
|
30
|
-
yarn add ekascribe-ts-sdk
|
|
30
|
+
yarn add @eka-care/ekascribe-ts-sdk
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
34
34
|
|
|
35
|
-
### 1.
|
|
35
|
+
### 1. Get Ekascribe Instance
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
It will give you the main class instance, use this instance to access all methods
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
|
|
40
|
+
getEkaScribeInstance({
|
|
41
41
|
access_token: '<your_access_token>',
|
|
42
|
-
refresh_token: '<your_refresh_token>',
|
|
43
42
|
});
|
|
44
43
|
```
|
|
45
44
|
|
|
45
|
+
```ts
|
|
46
|
+
const ekaScribe = getEkaScribeInstance({ access_token: 'old_token' });
|
|
47
|
+
```
|
|
48
|
+
|
|
46
49
|
### 2. Fetch configurations list
|
|
47
50
|
|
|
48
51
|
Get supported input languages, output formats, and consultation modes.
|
|
49
52
|
|
|
50
53
|
```ts
|
|
51
|
-
getEkascribeConfig();
|
|
54
|
+
ekascribe.getEkascribeConfig();
|
|
52
55
|
```
|
|
53
56
|
|
|
54
|
-
- #### Response
|
|
57
|
+
- #### Sample Response:
|
|
55
58
|
|
|
56
59
|
```ts
|
|
57
60
|
{
|
|
58
|
-
data
|
|
59
|
-
supported_languages: [
|
|
60
|
-
{ id:
|
|
61
|
-
{ id:
|
|
62
|
-
]
|
|
63
|
-
supported_output_formats: [
|
|
64
|
-
|
|
65
|
-
{ id: 'clinical-notes-template', name: 'Clinical Notes' }
|
|
66
|
-
];
|
|
67
|
-
consultation_modes: [
|
|
68
|
-
{
|
|
69
|
-
id: 'consultation',
|
|
70
|
-
name: 'Consultation',
|
|
71
|
-
desc: 'Eka Scribe will listen to your conversation and create clinical notes'
|
|
72
|
-
},
|
|
61
|
+
"data": {
|
|
62
|
+
"supported_languages": [
|
|
63
|
+
{ "id": "en", "name": "English" },
|
|
64
|
+
{ "id": "hi", "name": "Hindi" }
|
|
65
|
+
],
|
|
66
|
+
"supported_output_formats": [{ "id": "clinical-notes-template", "name": "Clinical Notes" }],
|
|
67
|
+
"consultation_modes": [
|
|
73
68
|
{
|
|
74
|
-
id:
|
|
75
|
-
name:
|
|
76
|
-
desc:
|
|
69
|
+
"id": "consultation",
|
|
70
|
+
"name": "Consultation",
|
|
71
|
+
"desc": "Eka Scribe will listen to your conversation and create clinical notes"
|
|
77
72
|
}
|
|
78
|
-
]
|
|
79
|
-
max_selection: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
],
|
|
74
|
+
"max_selection": {
|
|
75
|
+
"supported_languages": 2,
|
|
76
|
+
"supported_output_formats": 2,
|
|
77
|
+
"consultation_modes": 1
|
|
78
|
+
},
|
|
79
|
+
"user_details": {
|
|
80
|
+
"fn": "Dr. John",
|
|
81
|
+
"mn": "",
|
|
82
|
+
"ln": "Doe",
|
|
83
|
+
"dob": "1985-06-15",
|
|
84
|
+
"gen": "M",
|
|
85
|
+
"s": "active",
|
|
86
|
+
"is_paid_doc": true,
|
|
87
|
+
"uuid": "user-uuid-123"
|
|
88
|
+
},
|
|
89
|
+
"wid": "workspace-id-456"
|
|
90
|
+
},
|
|
91
|
+
"message": "Configuration fetched successfully",
|
|
92
|
+
"code": 200
|
|
87
93
|
}
|
|
88
94
|
```
|
|
89
95
|
|
|
@@ -92,26 +98,41 @@ getEkascribeConfig();
|
|
|
92
98
|
Use this method to init a transaction before starting recording.
|
|
93
99
|
|
|
94
100
|
```ts
|
|
95
|
-
await initTransaction({
|
|
101
|
+
await ekascribe.initTransaction({
|
|
96
102
|
mode: 'consultation',
|
|
97
103
|
input_language: ['te', 'en'],
|
|
98
104
|
output_format_template: [{ template_id: 'eka_emr_template' }],
|
|
99
105
|
txn_id: 'abc-123',
|
|
106
|
+
auto_download: false,
|
|
107
|
+
model_training_consent: false,
|
|
108
|
+
transfer: 'vaded' | 'non-vaded',
|
|
109
|
+
model_type: 'pro' | 'lite',
|
|
110
|
+
system_info: {
|
|
111
|
+
platform: 'web',
|
|
112
|
+
language: 'en',
|
|
113
|
+
time_zone: 'Asia/Kolkata',
|
|
114
|
+
},
|
|
115
|
+
patient_details: {
|
|
116
|
+
username: 'John Doe',
|
|
117
|
+
age: 35,
|
|
118
|
+
biologicalSex: 'M',
|
|
119
|
+
},
|
|
120
|
+
version: '1.0.0',
|
|
121
|
+
flavour: 'web' | 'extension',
|
|
100
122
|
});
|
|
101
123
|
```
|
|
102
124
|
|
|
103
|
-
- #### Response
|
|
125
|
+
- #### Sample Response:
|
|
104
126
|
|
|
105
127
|
```ts
|
|
106
128
|
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
129
|
+
"status_code": 200,
|
|
130
|
+
"message": "Transaction initialized successfully",
|
|
131
|
+
"business_id": "biz_abc123def456",
|
|
132
|
+
"txn_id": "abc-123",
|
|
133
|
+
"oid": "org_789xyz",
|
|
134
|
+
"uuid": "user_uuid_456"
|
|
135
|
+
}
|
|
115
136
|
```
|
|
116
137
|
|
|
117
138
|
### 4. Start recording
|
|
@@ -119,18 +140,18 @@ await initTransaction({
|
|
|
119
140
|
Start recording with user-selected options.
|
|
120
141
|
|
|
121
142
|
```ts
|
|
122
|
-
await startRecording();
|
|
143
|
+
await ekascribe.startRecording();
|
|
123
144
|
```
|
|
124
145
|
|
|
125
|
-
- #### Response
|
|
146
|
+
- #### Sample Response:
|
|
126
147
|
|
|
127
148
|
```ts
|
|
128
149
|
{
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
150
|
+
"status_code": 200,
|
|
151
|
+
"message": "Recording started successfully",
|
|
152
|
+
"txn_id": "abc-123",
|
|
153
|
+
error_code?: ERROR_CODE
|
|
154
|
+
}
|
|
134
155
|
```
|
|
135
156
|
|
|
136
157
|
### 5. Pause recording
|
|
@@ -138,18 +159,18 @@ await startRecording();
|
|
|
138
159
|
Use the method to pause voice recording
|
|
139
160
|
|
|
140
161
|
```ts
|
|
141
|
-
await pauseRecording();
|
|
162
|
+
await ekascribe.pauseRecording();
|
|
142
163
|
```
|
|
143
164
|
|
|
144
|
-
- #### Response
|
|
165
|
+
- #### Sample Response:
|
|
145
166
|
|
|
146
167
|
```ts
|
|
147
168
|
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
169
|
+
"status_code": 200,
|
|
170
|
+
"message": "Recording paused successfully",
|
|
171
|
+
"is_paused": true,
|
|
172
|
+
error_code?: ERROR_CODE,
|
|
173
|
+
}
|
|
153
174
|
```
|
|
154
175
|
|
|
155
176
|
### 6. Resume recording
|
|
@@ -157,18 +178,18 @@ await pauseRecording();
|
|
|
157
178
|
Use the method to resume voice recording
|
|
158
179
|
|
|
159
180
|
```ts
|
|
160
|
-
await resumeRecording();
|
|
181
|
+
await ekascribe.resumeRecording();
|
|
161
182
|
```
|
|
162
183
|
|
|
163
|
-
- #### Response
|
|
184
|
+
- #### Sample Response:
|
|
164
185
|
|
|
165
186
|
```ts
|
|
166
187
|
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
188
|
+
"status_code": 200,
|
|
189
|
+
"message": "Recording resumed successfully",
|
|
190
|
+
"is_paused": false,
|
|
191
|
+
error_code?: ERROR_CODE,
|
|
192
|
+
}
|
|
172
193
|
```
|
|
173
194
|
|
|
174
195
|
### 7. End recording
|
|
@@ -176,19 +197,19 @@ await resumeRecording();
|
|
|
176
197
|
Use the method to end voice recording
|
|
177
198
|
|
|
178
199
|
```ts
|
|
179
|
-
await endRecording();
|
|
200
|
+
await ekascribe.endRecording();
|
|
180
201
|
```
|
|
181
202
|
|
|
182
|
-
- #### Response
|
|
203
|
+
- #### Sample Response:
|
|
183
204
|
|
|
184
205
|
```ts
|
|
185
206
|
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
message: string;
|
|
207
|
+
"status_code": 200,
|
|
208
|
+
"message": "Recording ended and files uploaded successfully",
|
|
189
209
|
failed_files?: ['1.mp3', '2.mp3']; // if there are any failed files
|
|
190
210
|
total_audio_files?: ['1.mp3', '2.mp3', '3.mp3', '4.mp3']; // list of all audio files generated
|
|
191
|
-
|
|
211
|
+
error_code?: ERROR_CODE;
|
|
212
|
+
}
|
|
192
213
|
```
|
|
193
214
|
|
|
194
215
|
### 8. Retry upload recording
|
|
@@ -196,19 +217,19 @@ await endRecording();
|
|
|
196
217
|
Use this method to retry uploading failed audio files.
|
|
197
218
|
|
|
198
219
|
```ts
|
|
199
|
-
await retryUploadRecording({ force_commit: true
|
|
220
|
+
await ekascribe.retryUploadRecording({ force_commit: true });
|
|
200
221
|
```
|
|
201
222
|
|
|
202
|
-
- #### Response
|
|
223
|
+
- #### Sample Response:
|
|
203
224
|
|
|
204
225
|
```ts
|
|
205
226
|
{
|
|
227
|
+
"status_code": 200,
|
|
228
|
+
"message": "All files uploaded successfully after retry",
|
|
206
229
|
error_code?: ERROR_CODE;
|
|
207
|
-
status_code: number;
|
|
208
|
-
message: string;
|
|
209
230
|
failed_files?: ['1.mp3', '2.mp3'];
|
|
210
231
|
total_audio_files?: ['1.mp3', '2.mp3', '3.mp3', '4.mp3'];
|
|
211
|
-
}
|
|
232
|
+
}
|
|
212
233
|
```
|
|
213
234
|
|
|
214
235
|
`force_commit` behavior
|
|
@@ -222,26 +243,26 @@ await retryUploadRecording({ force_commit: true / false });
|
|
|
222
243
|
Use the method to cancel a recording session.
|
|
223
244
|
|
|
224
245
|
```ts
|
|
225
|
-
await patchSessionStatus({
|
|
246
|
+
await ekascribe.patchSessionStatus({
|
|
226
247
|
sessionId: 'abc-123',
|
|
227
248
|
processing_status: 'cancelled',
|
|
228
249
|
processing_error: {
|
|
229
250
|
error: {
|
|
230
|
-
type: '',
|
|
251
|
+
type: 'user_action',
|
|
231
252
|
code: 'cancelled_by_user',
|
|
232
|
-
msg: '
|
|
253
|
+
msg: 'Session cancelled by user',
|
|
233
254
|
},
|
|
234
255
|
},
|
|
235
256
|
});
|
|
236
257
|
```
|
|
237
258
|
|
|
238
|
-
- #### Response
|
|
259
|
+
- #### Sample Response:
|
|
239
260
|
|
|
240
261
|
```ts
|
|
241
262
|
{
|
|
242
|
-
status:
|
|
243
|
-
message:
|
|
244
|
-
code:
|
|
263
|
+
"status": "success",
|
|
264
|
+
"message": "Session status updated successfully",
|
|
265
|
+
"code": 200,
|
|
245
266
|
error?: {
|
|
246
267
|
code: string;
|
|
247
268
|
message: string;
|
|
@@ -255,7 +276,7 @@ await patchSessionStatus({
|
|
|
255
276
|
Use this method to commit a transaction that is not yet committed or returned a "commit failed" error in a previous step.
|
|
256
277
|
|
|
257
278
|
```ts
|
|
258
|
-
await commitTransactionCall();
|
|
279
|
+
await ekascribe.commitTransactionCall();
|
|
259
280
|
```
|
|
260
281
|
|
|
261
282
|
- #### Response type:
|
|
@@ -273,7 +294,7 @@ await commitTransactionCall();
|
|
|
273
294
|
Use this method to stop a transaction that has not yet been stopped or returned a "stop failed" error in a previous step.
|
|
274
295
|
|
|
275
296
|
```ts
|
|
276
|
-
await stopTransactionCall();
|
|
297
|
+
await ekascribe.stopTransactionCall();
|
|
277
298
|
```
|
|
278
299
|
|
|
279
300
|
- #### Response type:
|
|
@@ -291,7 +312,7 @@ await stopTransactionCall();
|
|
|
291
312
|
Use this method to fetch the final generated prescription output for a session.
|
|
292
313
|
|
|
293
314
|
```ts
|
|
294
|
-
await getTemplateOutput({ txn_id: 'abc-123' });
|
|
315
|
+
await ekascribe.getTemplateOutput({ txn_id: 'abc-123' });
|
|
295
316
|
```
|
|
296
317
|
|
|
297
318
|
### 13. Get previous sessions
|
|
@@ -299,7 +320,7 @@ await getTemplateOutput({ txn_id: 'abc-123' });
|
|
|
299
320
|
Use this method to retrieve all the previous sessions for a specific doctor ID
|
|
300
321
|
|
|
301
322
|
```ts
|
|
302
|
-
const sessions = await getSessionHistory({ txn_count: 10 });
|
|
323
|
+
const sessions = await ekascribe.getSessionHistory({ txn_count: 10 });
|
|
303
324
|
```
|
|
304
325
|
|
|
305
326
|
- #### Response type:
|
|
@@ -325,12 +346,409 @@ const sessions = await getSessionHistory({ txn_count: 10 });
|
|
|
325
346
|
}
|
|
326
347
|
```
|
|
327
348
|
|
|
328
|
-
### 14. Get
|
|
349
|
+
### 14. Get All Templates
|
|
350
|
+
|
|
351
|
+
Use this method to retrieve all available templates for the current user.
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
const templates = await ekascribe.getAllTemplates();
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
- #### Response type:
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
{
|
|
361
|
+
items: [
|
|
362
|
+
{
|
|
363
|
+
id: "123;
|
|
364
|
+
title: "Template Name";
|
|
365
|
+
desc: "Template Description";
|
|
366
|
+
section_ids: ["section-1", "section-2"];
|
|
367
|
+
is_editable: true | false;
|
|
368
|
+
}
|
|
369
|
+
];
|
|
370
|
+
code: number;
|
|
371
|
+
error?: { code: string; message: string };
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### 15. Create Template
|
|
376
|
+
|
|
377
|
+
Use this method to create a new custom template.
|
|
378
|
+
|
|
379
|
+
```ts
|
|
380
|
+
const newTemplate = await ekascribe.createTemplate({
|
|
381
|
+
title: 'My Custom Template',
|
|
382
|
+
desc: 'Description of the template',
|
|
383
|
+
section_ids: ['section1', 'section2', 'section3'],
|
|
384
|
+
});
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
- #### Response type:
|
|
388
|
+
|
|
389
|
+
```ts
|
|
390
|
+
{
|
|
391
|
+
code: number;
|
|
392
|
+
msg: string;
|
|
393
|
+
template_id?: string;
|
|
394
|
+
message?: string;
|
|
395
|
+
error?: { code: string; message: string };
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### 16. Edit Template
|
|
400
|
+
|
|
401
|
+
Use this method to update an existing template.
|
|
402
|
+
|
|
403
|
+
```ts
|
|
404
|
+
const updatedTemplate = await ekascribe.updateTemplate({
|
|
405
|
+
template_id: 'template-123',
|
|
406
|
+
title: 'Updated Template Title',
|
|
407
|
+
desc: 'Updated description',
|
|
408
|
+
section_ids: ['section1', 'section2', 'section4'],
|
|
409
|
+
});
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
- #### Response type:
|
|
413
|
+
|
|
414
|
+
```ts
|
|
415
|
+
{
|
|
416
|
+
code: number;
|
|
417
|
+
msg: string;
|
|
418
|
+
template_id?: string;
|
|
419
|
+
message?: string;
|
|
420
|
+
error?: { code: string; message: string };
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### 17. Delete Template
|
|
425
|
+
|
|
426
|
+
Use this method to delete an existing template.
|
|
427
|
+
|
|
428
|
+
```ts
|
|
429
|
+
const deleteResult = await ekascribe.deleteTemplate('template-123');
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
- #### Response type:
|
|
433
|
+
|
|
434
|
+
```ts
|
|
435
|
+
{
|
|
436
|
+
code: number;
|
|
437
|
+
msg: string;
|
|
438
|
+
template_id?: string;
|
|
439
|
+
message?: string;
|
|
440
|
+
error?: { code: string; message: string };
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### 18. Generate Template with AI by giving a prompt
|
|
445
|
+
|
|
446
|
+
Use this method to generate a template using AI with a text prompt.
|
|
447
|
+
|
|
448
|
+
```ts
|
|
449
|
+
const formData = new FormData();
|
|
450
|
+
formData.append('content', 'Create a cardiology consultation template');
|
|
451
|
+
formData.append('file', file);
|
|
452
|
+
formData.append('contentType', 'text/file');
|
|
453
|
+
|
|
454
|
+
const aiTemplate = await ekascribe.aiGenerateTemplate(formData);
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
- #### Response type:
|
|
458
|
+
|
|
459
|
+
```ts
|
|
460
|
+
{
|
|
461
|
+
title: string;
|
|
462
|
+
desc: string;
|
|
463
|
+
sections: [
|
|
464
|
+
{
|
|
465
|
+
id: string;
|
|
466
|
+
title: string;
|
|
467
|
+
desc: string;
|
|
468
|
+
format: 'P' | 'B';
|
|
469
|
+
example: string;
|
|
470
|
+
default?: boolean;
|
|
471
|
+
parent_section_id?: string;
|
|
472
|
+
}
|
|
473
|
+
];
|
|
474
|
+
code: number;
|
|
475
|
+
message: string;
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### 19. Add templates to list
|
|
480
|
+
|
|
481
|
+
Use this method to mark templates as favourite templates.
|
|
482
|
+
|
|
483
|
+
```ts
|
|
484
|
+
const configUpdate = await ekascribe.updateConfig({
|
|
485
|
+
my_templates: ['template1', 'template2'],
|
|
486
|
+
});
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
- #### Response type:
|
|
490
|
+
|
|
491
|
+
```ts
|
|
492
|
+
{
|
|
493
|
+
auto_download?: boolean;
|
|
494
|
+
default_languages?: string[];
|
|
495
|
+
my_templates?: string[];
|
|
496
|
+
scribe_enabled?: boolean;
|
|
497
|
+
msg: string;
|
|
498
|
+
code: number;
|
|
499
|
+
error?: { code: string; message: string };
|
|
500
|
+
}
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
### 20. Get All Sections
|
|
504
|
+
|
|
505
|
+
Use this method to retrieve all available template sections.
|
|
506
|
+
|
|
507
|
+
```ts
|
|
508
|
+
const sections = await ekascribe.getAllTemplateSections();
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
- #### Response type:
|
|
512
|
+
|
|
513
|
+
```ts
|
|
514
|
+
{
|
|
515
|
+
items: [
|
|
516
|
+
{
|
|
517
|
+
id: string;
|
|
518
|
+
title: string;
|
|
519
|
+
desc: string;
|
|
520
|
+
format: 'P' | 'B';
|
|
521
|
+
example: string;
|
|
522
|
+
default?: boolean;
|
|
523
|
+
parent_section_id?: string;
|
|
524
|
+
}
|
|
525
|
+
];
|
|
526
|
+
code: number;
|
|
527
|
+
error?: { code: string; message: string };
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### 21. Create Section in a template
|
|
532
|
+
|
|
533
|
+
Use this method to create a new section that can be used in templates.
|
|
534
|
+
|
|
535
|
+
```ts
|
|
536
|
+
const newSection = await ekascribe.createTemplateSection({
|
|
537
|
+
title: 'Chief Complaint',
|
|
538
|
+
desc: "Patient's primary concern",
|
|
539
|
+
format: 'P', // 'P' for paragraph, 'B' for bullet points
|
|
540
|
+
example: 'Patient presents with chest pain for 2 days',
|
|
541
|
+
});
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
- #### Response type:
|
|
545
|
+
|
|
546
|
+
```ts
|
|
547
|
+
{
|
|
548
|
+
msg: string;
|
|
549
|
+
section_id: string;
|
|
550
|
+
code: number;
|
|
551
|
+
action: 'updated' | 'created_custom';
|
|
552
|
+
error?: { code: string; message: string };
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### 22. Edit Section in a template
|
|
557
|
+
|
|
558
|
+
Use this method to update an existing template section.
|
|
559
|
+
|
|
560
|
+
```ts
|
|
561
|
+
const updatedSection = await ekascribe.updateTemplateSection({
|
|
562
|
+
section_id: 'section-123',
|
|
563
|
+
title: 'Updated Chief Complaint',
|
|
564
|
+
desc: 'Updated description',
|
|
565
|
+
format: 'B',
|
|
566
|
+
example: 'Updated example text',
|
|
567
|
+
});
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
- #### Response type:
|
|
571
|
+
|
|
572
|
+
```ts
|
|
573
|
+
{
|
|
574
|
+
msg: string;
|
|
575
|
+
section_id: string;
|
|
576
|
+
code: number;
|
|
577
|
+
action: 'updated' | 'created_custom';
|
|
578
|
+
error?: { code: string; message: string };
|
|
579
|
+
}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### 23. Delete Section from a template
|
|
583
|
+
|
|
584
|
+
Use this method to delete a template section.
|
|
585
|
+
|
|
586
|
+
```ts
|
|
587
|
+
const deleteResult = await ekascribe.deleteTemplateSection('section-123');
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
- #### Response type:
|
|
591
|
+
|
|
592
|
+
```ts
|
|
593
|
+
{
|
|
594
|
+
msg: string;
|
|
595
|
+
section_id: string;
|
|
596
|
+
code: number;
|
|
597
|
+
action: 'updated' | 'created_custom';
|
|
598
|
+
error?: { code: string; message: string };
|
|
599
|
+
}
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
### 24. Convert a transaction into another template after prescription generation
|
|
603
|
+
|
|
604
|
+
Use this method to convert an existing transaction's output to use a different template format.
|
|
605
|
+
|
|
606
|
+
```ts
|
|
607
|
+
const convertResult = await ekascribe.postTransactionConvertToTemplate({
|
|
608
|
+
txn_id: 'abc-123',
|
|
609
|
+
template_id: 'new-template-456',
|
|
610
|
+
});
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
- #### Response type:
|
|
614
|
+
|
|
615
|
+
```ts
|
|
616
|
+
{
|
|
617
|
+
status: 'success' | 'failed';
|
|
618
|
+
message: string;
|
|
619
|
+
txn_id: string;
|
|
620
|
+
template_id: string;
|
|
621
|
+
b_id: string;
|
|
622
|
+
code: number;
|
|
623
|
+
msg: string;
|
|
624
|
+
error?: { code: string; message: string; display_message: string };
|
|
625
|
+
}
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### 25. Search past sessions by a patient name
|
|
629
|
+
|
|
630
|
+
Use this method to search through previous sessions by patient name.
|
|
631
|
+
|
|
632
|
+
```ts
|
|
633
|
+
// First get session history
|
|
634
|
+
const sessions = await ekascribe.getSessionHistory({ txn_count: 50 });
|
|
635
|
+
|
|
636
|
+
// Then search by patient name
|
|
637
|
+
const filteredSessions = await ekascribe.searchSessionsByPatientName({
|
|
638
|
+
sessions: sessions.data || [],
|
|
639
|
+
patientName: 'John Doe',
|
|
640
|
+
});
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
- #### Response type:
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
// Returns filtered array of session history data
|
|
647
|
+
[
|
|
648
|
+
{
|
|
649
|
+
created_at: 'string',
|
|
650
|
+
b_id: 'string',
|
|
651
|
+
user_status: 'string',
|
|
652
|
+
processing_status: 'string',
|
|
653
|
+
txn_id: 'string',
|
|
654
|
+
mode: 'string',
|
|
655
|
+
uuid: 'string',
|
|
656
|
+
oid: 'string',
|
|
657
|
+
patient_details: {
|
|
658
|
+
username: 'string',
|
|
659
|
+
oid: 'string',
|
|
660
|
+
age: number,
|
|
661
|
+
biologicalSex: 'M' | 'F' | 'O',
|
|
662
|
+
mobile: 'string',
|
|
663
|
+
email: 'string',
|
|
664
|
+
},
|
|
665
|
+
},
|
|
666
|
+
];
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
### 26. Upload audio file to get output summary
|
|
670
|
+
|
|
671
|
+
Use this method to upload audio files directly and get transcription output without real-time recording.
|
|
672
|
+
|
|
673
|
+
```ts
|
|
674
|
+
const audioFiles = [file1, file2]; // File or Blob objects
|
|
675
|
+
const audioFileNames = ['audio1.mp3', 'audio2.mp3'];
|
|
676
|
+
|
|
677
|
+
const uploadResult = await ekascribe.uploadAudioWithPresignedUrl({
|
|
678
|
+
action: 'upload',
|
|
679
|
+
audioFiles,
|
|
680
|
+
audioFileNames,
|
|
681
|
+
mode: 'consultation',
|
|
682
|
+
txn_id: 'upload-session-123',
|
|
683
|
+
input_language: ['en'],
|
|
684
|
+
output_format_template: [{ template_id: 'eka_emr_template' }],
|
|
685
|
+
transfer: 'non-vaded',
|
|
686
|
+
auto_download: false,
|
|
687
|
+
model_training_consent: false,
|
|
688
|
+
system_info: {
|
|
689
|
+
platform: 'web',
|
|
690
|
+
language: 'en',
|
|
691
|
+
time_zone: 'Asia/Kolkata',
|
|
692
|
+
},
|
|
693
|
+
model_type: 'pro',
|
|
694
|
+
});
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
- #### Response type:
|
|
698
|
+
|
|
699
|
+
```ts
|
|
700
|
+
{
|
|
701
|
+
error_code?: ERROR_CODE;
|
|
702
|
+
status_code: number;
|
|
703
|
+
message: string;
|
|
704
|
+
business_id?: string;
|
|
705
|
+
txn_id?: string;
|
|
706
|
+
oid?: string;
|
|
707
|
+
uuid?: string;
|
|
708
|
+
}
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
### 27. Edit output summary
|
|
712
|
+
|
|
713
|
+
Use this method to edit the generated output summary for a completed transaction.
|
|
714
|
+
|
|
715
|
+
```ts
|
|
716
|
+
const editResult = await ekascribe.updateResultSummary({
|
|
717
|
+
txnId: 'abc-123',
|
|
718
|
+
data: [
|
|
719
|
+
{
|
|
720
|
+
'template-id': 'eka_emr_template',
|
|
721
|
+
data: 'Updated prescription content here',
|
|
722
|
+
},
|
|
723
|
+
],
|
|
724
|
+
});
|
|
725
|
+
```
|
|
726
|
+
|
|
727
|
+
- #### Response type:
|
|
728
|
+
|
|
729
|
+
```ts
|
|
730
|
+
{
|
|
731
|
+
status: string;
|
|
732
|
+
message: string;
|
|
733
|
+
txn_id: string;
|
|
734
|
+
b_id: string;
|
|
735
|
+
code: number;
|
|
736
|
+
error?: { code: string; message: string; display_message: string };
|
|
737
|
+
}
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
## Utility Methods
|
|
741
|
+
|
|
742
|
+
```ts
|
|
743
|
+
const ekaScribe = getEkaScribeInstance({ access_token: 'old_token' });
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
### 1. Get total uploaded files
|
|
329
747
|
|
|
330
748
|
Use this method to retrieve all the audio files generated for a specific session.
|
|
331
749
|
|
|
332
750
|
```ts
|
|
333
|
-
const files =
|
|
751
|
+
const files = ekascribe.getTotalAudioFiles();
|
|
334
752
|
```
|
|
335
753
|
|
|
336
754
|
- #### Response type:
|
|
@@ -339,12 +757,12 @@ const files = await getTotalAudioFiles();
|
|
|
339
757
|
['1.mp3', '2.mp3', '3.mp3', '4.mp3'];
|
|
340
758
|
```
|
|
341
759
|
|
|
342
|
-
###
|
|
760
|
+
### 2. Get successfully uploaded files
|
|
343
761
|
|
|
344
762
|
Use this method to retrieve all the audio files that were uploaded successfully.
|
|
345
763
|
|
|
346
764
|
```ts
|
|
347
|
-
const successFiles =
|
|
765
|
+
const successFiles = ekascribe.getSuccessFiles();
|
|
348
766
|
```
|
|
349
767
|
|
|
350
768
|
- #### Response type:
|
|
@@ -353,12 +771,12 @@ const successFiles = await getSuccessfullyUploadedFiles();
|
|
|
353
771
|
['3.mp3', '4.mp3'];
|
|
354
772
|
```
|
|
355
773
|
|
|
356
|
-
###
|
|
774
|
+
### 3. Get failed audio files
|
|
357
775
|
|
|
358
776
|
Use this method to retrieve all the audio files that failed to upload.
|
|
359
777
|
|
|
360
778
|
```ts
|
|
361
|
-
const failedFiles =
|
|
779
|
+
const failedFiles = ekascribe.getFailedFiles();
|
|
362
780
|
```
|
|
363
781
|
|
|
364
782
|
- #### Response type:
|
|
@@ -367,38 +785,120 @@ const failedFiles = await getFailedFiles();
|
|
|
367
785
|
['1.mp3', '2.mp3'];
|
|
368
786
|
```
|
|
369
787
|
|
|
788
|
+
### 4. Reset Class Instance
|
|
789
|
+
|
|
790
|
+
Use this method to reset the EkaScribe instance and clear all stored data.
|
|
791
|
+
|
|
792
|
+
```ts
|
|
793
|
+
ekaScribe.resetEkaScribe();
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
### 5. Reinitialise VAD Instance
|
|
797
|
+
|
|
798
|
+
Use this method to reinitialize the Voice Activity Detection (VAD) instance.
|
|
799
|
+
|
|
800
|
+
```ts
|
|
801
|
+
ekaScribe.reinitializeVad();
|
|
802
|
+
```
|
|
803
|
+
|
|
804
|
+
### 6. Pause VAD Instance
|
|
805
|
+
|
|
806
|
+
Use this method to pause the Voice Activity Detection without stopping the recording session.
|
|
807
|
+
|
|
808
|
+
```ts
|
|
809
|
+
ekaScribe.pauseVad();
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### 7. Destroy VAD Instance
|
|
813
|
+
|
|
814
|
+
Use this method to completely destroy the VAD instance and free up resources.
|
|
815
|
+
|
|
816
|
+
```ts
|
|
817
|
+
ekaScribe.destroyVad();
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
### 8. Update Authentication Tokens
|
|
821
|
+
|
|
822
|
+
Use this method to update the access token without reinitializing the entire SDK instance.
|
|
823
|
+
|
|
824
|
+
```ts
|
|
825
|
+
ekaScribe.updateAuthTokens({ access_token: 'new_token' });
|
|
826
|
+
```
|
|
827
|
+
|
|
370
828
|
## Generic Callbacks
|
|
371
829
|
|
|
372
|
-
|
|
830
|
+
```ts
|
|
831
|
+
const ekaScribe = getEkaScribeInstance({ access_token: 'your_token' });
|
|
832
|
+
```
|
|
373
833
|
|
|
374
|
-
|
|
834
|
+
### 1. Event callback
|
|
835
|
+
|
|
836
|
+
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.
|
|
375
837
|
|
|
376
838
|
```ts
|
|
377
|
-
|
|
378
|
-
console.
|
|
839
|
+
ekaScribe.onEventCallback((eventData) => {
|
|
840
|
+
console.log('Event callback triggered:', eventData);
|
|
379
841
|
});
|
|
380
842
|
```
|
|
381
843
|
|
|
844
|
+
- #### Sample Callback Data:
|
|
845
|
+
|
|
846
|
+
```ts
|
|
847
|
+
{
|
|
848
|
+
callback_type: 'AUDIO_UPLOAD' | 'TRANSACTION_STATUS' | 'VAD_STATUS' | 'RECORDING_STATUS',
|
|
849
|
+
status: 'success' | 'error' | 'progress' | 'info',
|
|
850
|
+
message: 'Audio file uploaded successfully',
|
|
851
|
+
error?: {
|
|
852
|
+
code: 500,
|
|
853
|
+
msg: 'Upload failed',
|
|
854
|
+
details: { fileName: 'audio_chunk_1.mp3' }
|
|
855
|
+
},
|
|
856
|
+
data?: {
|
|
857
|
+
success: 3,
|
|
858
|
+
total: 4,
|
|
859
|
+
is_uploaded: true,
|
|
860
|
+
fileName: 'audio_chunk_1.mp3',
|
|
861
|
+
request: { txn_id: 'abc-123' },
|
|
862
|
+
response: { status: 'uploaded' }
|
|
863
|
+
},
|
|
864
|
+
timestamp: '2024-01-15T10:30:45.123Z',
|
|
865
|
+
metadata?: {
|
|
866
|
+
txn_id: 'abc-123',
|
|
867
|
+
chunk_index: 1
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
```
|
|
871
|
+
|
|
382
872
|
### 2. User speech callback
|
|
383
873
|
|
|
384
874
|
This callback will return a boolean indicating whether the user is speaking or not.
|
|
385
875
|
|
|
386
876
|
```ts
|
|
387
|
-
onUserSpeechCallback((isSpeech) => {
|
|
388
|
-
console.
|
|
877
|
+
ekaScribe.onUserSpeechCallback((isSpeech) => {
|
|
878
|
+
console.log(isSpeech ? 'User is speaking' : 'User is not speaking');
|
|
389
879
|
});
|
|
390
880
|
```
|
|
391
881
|
|
|
392
|
-
### 3.
|
|
882
|
+
### 3. VAD Callback to check if a frame is valid speech or not
|
|
393
883
|
|
|
394
|
-
This callback provides
|
|
884
|
+
This callback provides information about voice activity detection frames and audio processing status.
|
|
395
885
|
|
|
396
886
|
```ts
|
|
397
|
-
|
|
398
|
-
console.
|
|
887
|
+
ekaScribe.onVadFramesCallback((vadData) => {
|
|
888
|
+
console.log('VAD frame processed:', vadData);
|
|
399
889
|
});
|
|
400
890
|
```
|
|
401
891
|
|
|
892
|
+
- #### Sample Callback Data:
|
|
893
|
+
|
|
894
|
+
```ts
|
|
895
|
+
{
|
|
896
|
+
status_code: 200,
|
|
897
|
+
message: 'Audio captured. | No audio captured.',
|
|
898
|
+
error_code?: 'speech_detected' | 'no_audio_capture'
|
|
899
|
+
}
|
|
900
|
+
```
|
|
901
|
+
|
|
402
902
|
### Error codes
|
|
403
903
|
|
|
404
904
|
| Error Code | Description |
|