@eka-care/ekascribe-ts-sdk 1.5.78 → 1.5.79
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.
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type TTemplateMessage = {
|
|
2
|
+
type: 'warning' | 'error';
|
|
3
|
+
code?: string;
|
|
4
|
+
msg: string;
|
|
5
|
+
};
|
|
6
|
+
export type TOutputSummary = {
|
|
7
|
+
template_id: string;
|
|
8
|
+
value?: string | null;
|
|
9
|
+
type: string;
|
|
10
|
+
name: string;
|
|
11
|
+
lang?: string;
|
|
12
|
+
status: TTemplateStatus;
|
|
13
|
+
errors?: TTemplateMessage[];
|
|
14
|
+
warnings?: TTemplateMessage[];
|
|
15
|
+
};
|
|
16
|
+
export type TTemplateStatus = 'success' | 'partial_success' | 'failure';
|
|
17
|
+
type TAdditionalData = {
|
|
18
|
+
doctor: {
|
|
19
|
+
_id: string;
|
|
20
|
+
profile: {
|
|
21
|
+
personal: {
|
|
22
|
+
name: {
|
|
23
|
+
l: string;
|
|
24
|
+
f: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
type TApiResponse = {
|
|
31
|
+
data: {
|
|
32
|
+
output: TOutputSummary[];
|
|
33
|
+
audio_matrix?: {
|
|
34
|
+
quality: string;
|
|
35
|
+
};
|
|
36
|
+
additional_data?: TAdditionalData;
|
|
37
|
+
meta_data?: {
|
|
38
|
+
total_resources?: number;
|
|
39
|
+
total_parsed_resources?: number;
|
|
40
|
+
};
|
|
41
|
+
created_at?: string;
|
|
42
|
+
template_results: {
|
|
43
|
+
integration: TOutputSummary[];
|
|
44
|
+
custom: TOutputSummary[];
|
|
45
|
+
transcript: TOutputSummary[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
error?: {
|
|
49
|
+
code: string;
|
|
50
|
+
msg: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export type TGetStatusResponse = {
|
|
54
|
+
response?: TApiResponse | null;
|
|
55
|
+
status_code: number;
|
|
56
|
+
message?: string;
|
|
57
|
+
};
|
|
58
|
+
export declare const getVoiceApiV3StatusTranscript: ({ txnId, }: {
|
|
59
|
+
txnId: string;
|
|
60
|
+
}) => Promise<TGetStatusResponse>;
|
|
61
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SDK_STATUS_CODE } from '../../constants/constant';
|
|
2
|
+
import fetchWrapper from '../../fetch-client';
|
|
3
|
+
import { GET_EKA_VOICE_HOST_V3 } from '../../fetch-client/helper';
|
|
4
|
+
export const getVoiceApiV3StatusTranscript = async ({ txnId, }) => {
|
|
5
|
+
try {
|
|
6
|
+
const headers = new Headers();
|
|
7
|
+
headers.append('Content-Type', 'application/json');
|
|
8
|
+
const options = {
|
|
9
|
+
method: 'GET',
|
|
10
|
+
headers,
|
|
11
|
+
};
|
|
12
|
+
// Use custom timeout for this API (16 seconds instead of default 5 seconds)
|
|
13
|
+
const getResponse = await fetchWrapper(`${GET_EKA_VOICE_HOST_V3()}/status/transcript/${txnId}`, options, 16000);
|
|
14
|
+
const response = await getResponse.json();
|
|
15
|
+
return {
|
|
16
|
+
response,
|
|
17
|
+
status_code: getResponse.status,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
|
|
23
|
+
message: `Something went wrong! ${error}`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ import searchSessions, { searchSessionsByPatient, searchSessionsBySessionId, } f
|
|
|
33
33
|
import { getConfigV2MyTemplates } from './api/config/get-voice-api-v2-config-my-templates';
|
|
34
34
|
import putVoiceApiV2Config from './api/config/patch-voice-api-v2-config';
|
|
35
35
|
import postConvertTranscriptionToTemplate from './api/templates/post-convert-transcription-to-template';
|
|
36
|
-
import {
|
|
36
|
+
import { getVoiceApiV3StatusTranscript } from './api/transaction/get-voice-api-v3-status-transcript';
|
|
37
37
|
class EkaScribe {
|
|
38
38
|
// Private constructor to prevent direct instantiation
|
|
39
39
|
constructor() {
|
|
@@ -239,7 +239,7 @@ class EkaScribe {
|
|
|
239
239
|
}
|
|
240
240
|
async getOutputTranscription({ txn_id }) {
|
|
241
241
|
try {
|
|
242
|
-
const getStatusResponse = await
|
|
242
|
+
const getStatusResponse = await getVoiceApiV3StatusTranscript({
|
|
243
243
|
txnId: txn_id,
|
|
244
244
|
});
|
|
245
245
|
return getStatusResponse;
|