@eka-care/ekascribe-ts-sdk 1.5.76 → 1.5.77

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 getVoiceApiV3StatusTranscription: ({ 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 getVoiceApiV3StatusTranscription = 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/${txnId}/?transcript=true`, 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.d.ts CHANGED
@@ -34,6 +34,9 @@ declare class EkaScribe {
34
34
  getTemplateOutput({ txn_id }: {
35
35
  txn_id: string;
36
36
  }): Promise<TGetStatusResponse>;
37
+ getOutputTranscription({ txn_id }: {
38
+ txn_id: string;
39
+ }): Promise<TGetStatusResponse>;
37
40
  getSessionHistory({ txn_count }: {
38
41
  txn_count: number;
39
42
  }): Promise<TGetTransactionHistoryResponse>;
package/dist/index.js CHANGED
@@ -33,6 +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 { getVoiceApiV3StatusTranscription } from './api/transaction/get-voice-api-v3-status-transcription';
36
37
  class EkaScribe {
37
38
  // Private constructor to prevent direct instantiation
38
39
  constructor() {
@@ -236,6 +237,20 @@ class EkaScribe {
236
237
  };
237
238
  }
238
239
  }
240
+ async getOutputTranscription({ txn_id }) {
241
+ try {
242
+ const getStatusResponse = await getVoiceApiV3StatusTranscription({
243
+ txnId: txn_id,
244
+ });
245
+ return getStatusResponse;
246
+ }
247
+ catch (error) {
248
+ return {
249
+ status_code: SDK_STATUS_CODE.INTERNAL_SERVER_ERROR,
250
+ message: `Failed to fetch output templates, ${error}`,
251
+ };
252
+ }
253
+ }
239
254
  async getSessionHistory({ txn_count }) {
240
255
  try {
241
256
  const transactionsResponse = await getTransactionHistory({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "1.5.76",
3
+ "version": "1.5.77",
4
4
  "main": "dist/index.js",
5
5
  "repository": "git@github.com:eka-care/eka-js-sdk.git",
6
6
  "author": "Sanikagoyal28 <sanikagoyal9@gmail.com>",