@eka-care/ekascribe-ts-sdk 1.4.40 → 1.4.42

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.
@@ -1,3 +1,3 @@
1
1
  import { TPostTransactionInitRequest, TPostTransactionResponse } from '../constants/types';
2
- declare function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, patient_details, }: TPostTransactionInitRequest): Promise<TPostTransactionResponse>;
2
+ declare function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, model_type, }: TPostTransactionInitRequest): Promise<TPostTransactionResponse>;
3
3
  export default postTransactionInit;
@@ -1,7 +1,7 @@
1
1
  import { SDK_STATUS_CODE } from '../constants/constant';
2
2
  import fetchWrapper from '../fetch-client';
3
3
  import { GET_EKA_V2RX_HOST_V2 } from '../fetch-client/helper';
4
- async function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, patient_details, }) {
4
+ async function postTransactionInit({ mode, txnId, s3Url, input_language, output_format_template, model_training_consent, auto_download, transfer, system_info, model_type, }) {
5
5
  try {
6
6
  const headers = new Headers();
7
7
  headers.append('Content-Type', 'application/json');
@@ -14,7 +14,7 @@ async function postTransactionInit({ mode, txnId, s3Url, input_language, output_
14
14
  auto_download,
15
15
  transfer,
16
16
  system_info,
17
- patient_details,
17
+ model_type,
18
18
  };
19
19
  const options = {
20
20
  method: 'POST',
@@ -57,11 +57,12 @@ export type TStartRecordingRequest = {
57
57
  system_info: TSystemInfo;
58
58
  patient_details?: TPatientDetails;
59
59
  };
60
+ export type Gender = 'M' | 'F' | 'O';
60
61
  export type TPatientDetails = {
61
62
  username: string;
62
63
  oid: string;
63
64
  age: number;
64
- biologicalSex: string;
65
+ biologicalSex: Gender;
65
66
  mobile?: string;
66
67
  email?: string;
67
68
  };
@@ -181,6 +182,7 @@ export type TSessionHistoryData = {
181
182
  mode: string;
182
183
  uuid: string;
183
184
  oid: string;
185
+ patient_details?: TPatientDetails;
184
186
  };
185
187
  export type TAudioChunksInfo = {
186
188
  fileName: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { TGetStatusResponse } from './api/transaction/get-voice-api-v3-status';
2
2
  import { TEndRecordingResponse, TErrorCallback, TFileUploadProgressCallback, TGetTransactionHistoryResponse, TPatchTransactionRequest, TPatchVoiceApiV2ConfigRequest, TPostTransactionResponse, TPostV1ConvertToTemplateRequest, TPostV1TemplateRequest, TPostV1TemplateSectionRequest, TStartRecordingRequest } from './constants/types';
3
+ import { TSearchSessionsByPatientRequest } from './utils/search-sessions-by-patient-name';
3
4
  declare class EkaScribe {
4
5
  private static instance;
5
6
  private vadInstance;
@@ -62,6 +63,7 @@ declare class EkaScribe {
62
63
  updateTemplateSection(templateSection: TPostV1TemplateSectionRequest): Promise<import("./constants/types").TPostV1TemplateSectionResponse>;
63
64
  deleteTemplateSection(section_id: string): Promise<import("./constants/types").TPostV1TemplateSectionResponse>;
64
65
  postTransactionConvertToTemplate({ txn_id, template_id }: TPostV1ConvertToTemplateRequest): Promise<import("./constants/types").TPostV1ConvertToTemplateResponse>;
66
+ searchSessionsByPatientName(request: TSearchSessionsByPatientRequest): Promise<unknown>;
65
67
  }
66
68
  export declare const getEkaScribeInstance: ({ access_token, env, clientId, }: {
67
69
  access_token?: string;
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ import deleteV1TemplateSection from './api/template-sections/delete-v1-template-
28
28
  import patchVoiceApiV2Config from './api/config/patch-voice-api-v2-config';
29
29
  import cookV1MediaAiCreateTemplate from './api/templates/cook-v1-medai-ai-create-template';
30
30
  import postV1ConvertToTemplate from './api/templates/post-transaction-convert-to-template';
31
+ import searchSessionsByPatient from './utils/search-sessions-by-patient-name';
31
32
  class EkaScribe {
32
33
  // Private constructor to prevent direct instantiation
33
34
  constructor() {
@@ -312,6 +313,10 @@ class EkaScribe {
312
313
  const convertToTemplateResponse = await postV1ConvertToTemplate({ txn_id, template_id });
313
314
  return convertToTemplateResponse;
314
315
  }
316
+ async searchSessionsByPatientName(request) {
317
+ const searchSessionsByPatientNameResponse = await searchSessionsByPatient(request);
318
+ return searchSessionsByPatientNameResponse;
319
+ }
315
320
  }
316
321
  Object.defineProperty(EkaScribe, "instance", {
317
322
  enumerable: true,
@@ -0,0 +1,7 @@
1
+ import { TSessionHistoryData } from '../constants/types';
2
+ export type TSearchSessionsByPatientRequest = {
3
+ sessions: TSessionHistoryData[];
4
+ patientName: string;
5
+ };
6
+ declare const searchSessionsByPatient: ({ sessions, patientName, }: TSearchSessionsByPatientRequest) => Promise<unknown>;
7
+ export default searchSessionsByPatient;
@@ -0,0 +1,27 @@
1
+ function debounce(func, delay) {
2
+ let timeoutId;
3
+ return (...args) => {
4
+ return new Promise((resolve) => {
5
+ clearTimeout(timeoutId);
6
+ timeoutId = setTimeout(() => {
7
+ resolve(func(...args));
8
+ }, delay);
9
+ });
10
+ };
11
+ }
12
+ const searchByName = (sessions, patientName) => {
13
+ if (!patientName.trim()) {
14
+ return sessions;
15
+ }
16
+ const searchTerm = patientName.toLowerCase().trim();
17
+ return sessions.filter((session) => {
18
+ if (!session.patient_details?.username)
19
+ return false;
20
+ return session.patient_details?.username.toLowerCase().includes(searchTerm);
21
+ });
22
+ };
23
+ const debouncedSearch = debounce(searchByName, 300);
24
+ const searchSessionsByPatient = async ({ sessions, patientName, }) => {
25
+ return debouncedSearch(sessions, patientName);
26
+ };
27
+ export default searchSessionsByPatient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/ekascribe-ts-sdk",
3
- "version": "1.4.40",
3
+ "version": "1.4.42",
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>",