oro-sdk-apis 1.36.0 → 1.37.0

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.
@@ -4,6 +4,7 @@ export * from './axios';
4
4
  export * from './consult';
5
5
  export * from './diagnosis';
6
6
  export * from './guard';
7
+ export * from './search';
7
8
  export * from './practice';
8
9
  export * from './teller';
9
10
  export * from './vault';
@@ -0,0 +1,18 @@
1
+ import { APIService } from "./api";
2
+ import { SearchResponse, Terms } from "../models/search";
3
+ export declare class SearchService {
4
+ private api;
5
+ private baseURL;
6
+ constructor(api: APIService, baseURL: string);
7
+ /**
8
+ * Creates search indexes for the terms passed in order to be able to search for it in the future
9
+ * @param consultUUID
10
+ * @param terms the search terms to be indexed
11
+ */
12
+ index(consultUUID: string, terms: Terms): Promise<any>;
13
+ /**
14
+ * Searches for the consultations corresponding to the search terms entered in the query
15
+ * @param terms array of search terms
16
+ */
17
+ search(terms: Terms): Promise<SearchResponse>;
18
+ }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.36.0",
2
+ "version": "1.37.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
@@ -5,6 +5,7 @@ import {
5
5
  DiagnosisService,
6
6
  GuardService,
7
7
  PracticeService,
8
+ SearchService,
8
9
  TellerService,
9
10
  VaultService,
10
11
  WorkflowService,
@@ -28,6 +29,7 @@ export const init = (
28
29
  consultBaseURL,
29
30
  vaultBaseURL,
30
31
  guardBaseURL,
32
+ searchBaseURL,
31
33
  workflowBaseURL,
32
34
  diagnosisBaseURL,
33
35
  } = services
@@ -41,6 +43,7 @@ export const init = (
41
43
  consultService: consultBaseURL ? new ConsultService(apiService, consultBaseURL) : undefined,
42
44
  vaultService: vaultBaseURL ? new VaultService(apiService, vaultBaseURL) : undefined,
43
45
  guardService: guardBaseURL ? new GuardService(apiService, guardBaseURL) : undefined,
46
+ searchService: searchBaseURL ? new SearchService(apiService, searchBaseURL) : undefined,
44
47
  workflowService: workflowBaseURL ? new WorkflowService(apiService, workflowBaseURL) : undefined,
45
48
  diagnosisService: diagnosisBaseURL ? new DiagnosisService(apiService, diagnosisBaseURL) : undefined,
46
49
  }
@@ -66,6 +66,15 @@ export interface Drug extends DrugRequest {
66
66
  createdAt: string
67
67
  }
68
68
 
69
+ /**
70
+ * Status of the prescription
71
+ * Right now, it only serves a soft delete flag
72
+ */
73
+ export enum PrescriptionStatus {
74
+ Existing = 'Existing',
75
+ Deleted = 'Deleted',
76
+ }
77
+
69
78
  export interface PrescriptionRequest {
70
79
  uuid?: string
71
80
  uuidTreatment?: string
@@ -78,6 +87,7 @@ export interface PrescriptionRequest {
78
87
  export interface Prescription extends PrescriptionRequest {
79
88
  uuid: string
80
89
  uuidTreatment: string
90
+ status: PrescriptionStatus
81
91
  createdAt: string
82
92
  }
83
93
 
@@ -153,4 +163,4 @@ export interface TreatmentPlansResponseEntry {
153
163
  treatmentPlan: TreatmentPlan
154
164
  }
155
165
 
156
- export interface TreatmentPlansResponse extends Array<TreatmentPlansResponseEntry> {}
166
+ export interface TreatmentPlansResponse extends Array<TreatmentPlansResponseEntry> {}
@@ -3,6 +3,7 @@ import {
3
3
  ConsultService,
4
4
  DiagnosisService,
5
5
  GuardService,
6
+ SearchService,
6
7
  PracticeService,
7
8
  TellerService,
8
9
  VaultService,
@@ -16,6 +17,7 @@ export interface ServiceCollectionRequest {
16
17
  tellerBaseURL?: string
17
18
  vaultBaseURL?: string
18
19
  guardBaseURL?: string
20
+ searchBaseURL?: string
19
21
  practiceBaseURL?: string
20
22
  consultBaseURL?: string
21
23
  workflowBaseURL?: string
@@ -32,6 +34,7 @@ export interface ServiceCollection {
32
34
  consultService?: ConsultService
33
35
  vaultService?: VaultService
34
36
  guardService?: GuardService
37
+ searchService?: SearchService
35
38
  workflowService?: WorkflowService
36
39
  diagnosisService?: DiagnosisService
37
40
  }
@@ -0,0 +1,34 @@
1
+ export interface SearchRequest {
2
+ terms: Terms
3
+ }
4
+
5
+ export interface SearchResponse {
6
+ results: SearchResult[]
7
+ }
8
+
9
+ export interface SearchResult {
10
+ consultUUID: string
11
+ kind: string
12
+ score: number
13
+ }
14
+
15
+ export interface IndexRequest {
16
+ consultUUID: string
17
+ terms: Terms
18
+ }
19
+
20
+ export type Terms = Term[]
21
+ export interface Term {
22
+ kind?: string
23
+ value: string
24
+ }
25
+
26
+
27
+ export enum IndexKind {
28
+ consultUuid,
29
+ consultShortid,
30
+ firstName,
31
+ lastName,
32
+ healthId,
33
+ dob,
34
+ }
@@ -4,6 +4,7 @@ export * from './axios'
4
4
  export * from './consult'
5
5
  export * from './diagnosis'
6
6
  export * from './guard'
7
+ export * from './search'
7
8
  export * from './practice'
8
9
  export * from './teller'
9
10
  export * from './vault'
@@ -0,0 +1,39 @@
1
+ import {APIService} from "./api";
2
+ import {IndexRequest, SearchRequest, SearchResponse, Terms} from "../models/search";
3
+
4
+ export class SearchService {
5
+ constructor(private api: APIService, private baseURL: string) {}
6
+
7
+ /**
8
+ * Creates search indexes for the terms passed in order to be able to search for it in the future
9
+ * @param consultUUID
10
+ * @param terms the search terms to be indexed
11
+ */
12
+ public index(
13
+ consultUUID: string,
14
+ terms: Terms
15
+ ): Promise<any> {
16
+ return this.api.post<IndexRequest>(
17
+ `${this.baseURL}/v1/search`,
18
+ <IndexRequest> {
19
+ consultUUID,
20
+ terms
21
+ }
22
+ )
23
+ }
24
+
25
+ /**
26
+ * Searches for the consultations corresponding to the search terms entered in the query
27
+ * @param terms array of search terms
28
+ */
29
+ public search(
30
+ terms: Terms
31
+ ): Promise<SearchResponse> {
32
+ return this.api.post<SearchResponse>(
33
+ `${this.baseURL}/v1/search`,
34
+ <SearchRequest> {
35
+ terms
36
+ }
37
+ )
38
+ }
39
+ }