@metriport/commonwell-sdk 8.5.0 → 8.5.1

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,243 @@
1
+ /// <reference types="node" />
2
+ import * as stream from "stream";
3
+ import { GenderCodes } from "../models/demographics";
4
+ import { DocumentQueryFullResponse, DocumentReference } from "../models/document";
5
+ import { Patient, PatientCreateOrUpdateResp, PatientExistingLinks, PatientProbableLinks, PatientResponseItem, StatusResponse } from "../models/patient";
6
+ import { APIMode, CommonWellOptions } from "./common";
7
+ import { BaseOptions, CommonWellAPI, DocumentQueryParams, GetPatientParams, RetrieveDocumentResponse } from "./commonwell-api";
8
+ import { CommonWellBase } from "./commonwell-base";
9
+ /**
10
+ * Implementation of the CommonWell API, v4.
11
+ * @see https://www.commonwellalliance.org/specification/
12
+ */
13
+ export declare class CommonWell extends CommonWellBase implements CommonWellAPI {
14
+ private _orgName;
15
+ private _oid;
16
+ private _npi;
17
+ private _homeCommunityId;
18
+ private _authGrantorReferenceOid?;
19
+ private onError500;
20
+ /**
21
+ * Creates a new instance of the CommonWell API client pertaining to an
22
+ * organization to make requests on behalf of.
23
+ */
24
+ constructor({ orgCert, rsaPrivateKey, orgName, oid, npi, homeCommunityId, apiMode, authGrantorReferenceOid: authGrantorReference, options, }: {
25
+ /** The certificate (public key) for the organization. */
26
+ orgCert: string;
27
+ /** An RSA key corresponding to the specified orgCert. */
28
+ rsaPrivateKey: string;
29
+ /** The name of the organization that's making the request, the Principal or Delegate. */
30
+ orgName: string;
31
+ /** The OID of the organization that's making the request, the Principal or Delegate. */
32
+ oid: string;
33
+ /** The NPI of the organization that's making the request, the Principal or Delegate. */
34
+ npi: string;
35
+ /**
36
+ * The Home Community OID assigned to the Organization that is initiating the request,
37
+ * the implementor.
38
+ */
39
+ homeCommunityId: string;
40
+ /** The mode the client will be running. */
41
+ apiMode: APIMode;
42
+ /** The OID of the principal organization who authorized the request, aka The Principal. */
43
+ authGrantorReferenceOid?: string | undefined;
44
+ /** Optional parameters. */
45
+ options?: CommonWellOptions;
46
+ });
47
+ get oid(): string;
48
+ get npi(): string;
49
+ get orgName(): string;
50
+ get homeCommunityId(): string;
51
+ /**
52
+ * Register a new patient.
53
+ *
54
+ * @param patient The patient to register.
55
+ * @param options Optional parameters.
56
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
57
+ * @returns The patient collection containing the patient in the first position.
58
+ */
59
+ createOrUpdatePatient(patient: Patient, options?: BaseOptions): Promise<PatientCreateOrUpdateResp>;
60
+ /**
61
+ * Returns a patient based on its ID.
62
+ *
63
+ * @param params The patient ID and optional assign authority and assign authority type.
64
+ * @param options Optional parameters.
65
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
66
+ * @returns The patient response item containing the patient in the first position.
67
+ * @throws MetriportError if multiple patients are found for the given ID.
68
+ */
69
+ getPatient(params: GetPatientParams, options?: BaseOptions): Promise<PatientResponseItem | undefined>;
70
+ /**
71
+ * Returns a patient based on its ID. From the spec, about the patient ID:
72
+ *
73
+ * The local Patient Identifier. The value is under the control of the local Edge System and
74
+ * represents the unique identifier for the Patient Record in the local system. The format
75
+ * for this identifier MUST follow the HL7 CX data type format:
76
+ *
77
+ * IdentifierValue^^^&PatientIdAssignAuthority&PatientIdAssignAuthorityType
78
+ *
79
+ * @param id Patient's ID, HL7 CX data type format.
80
+ * @param options Optional parameters.
81
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
82
+ * @returns The patient response item containing the patient in the first position.
83
+ * @throws MetriportError if multiple patients are found for the given ID.
84
+ * @see Section "8.3.2 Get Patient" of the spec.
85
+ */
86
+ getPatient(id: string, options?: BaseOptions): Promise<PatientResponseItem>;
87
+ /**
88
+ * Deletes a patient.
89
+ *
90
+ * @param patientId The patient to be deleted.
91
+ * @param options Optional parameters.
92
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
93
+ */
94
+ deletePatient(patientId: string, options?: BaseOptions): Promise<void>;
95
+ /**
96
+ * Merges two patients into one.
97
+ *
98
+ * @param nonSurvivingPatientId The local Patient ID of the non-surviving Patient Record (This patient gets replaced).
99
+ * @param survivingPatientId The patient ID of the patient that will replace the non surviving patient
100
+ * @param options Optional parameters.
101
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
102
+ * @returns The patient merge response.
103
+ */
104
+ mergePatients({ nonSurvivingPatientId, survivingPatientId, }: {
105
+ nonSurvivingPatientId: string;
106
+ survivingPatientId: string;
107
+ }, options?: BaseOptions): Promise<StatusResponse>;
108
+ /**
109
+ * Returns the links the patient has with other patients.
110
+ *
111
+ * An Edge System can search and request Patient Links by a local patient identifier. The result of the query will
112
+ * include local and remote patient's links that are autolinked by the rules engine or manually linked.
113
+ *
114
+ * The links returned are confirmed links of LOLA 2 or higher.
115
+ *
116
+ * @param meta Metadata about the request.
117
+ * @param patientId The person id to be link to a patient.
118
+ * @returns Response with list of links to Patients
119
+ */
120
+ getPatientLinksByPatientId(patientId: string, options?: BaseOptions): Promise<PatientExistingLinks>;
121
+ /**
122
+ * Returns the potential links the patient has. Those are links the CommonWell MPI was not
123
+ * confident enough to confirm (LOLA2+), but could potentially be a match in case some of
124
+ * the patient's demographics have changed.
125
+ *
126
+ * An Edge System can request probable patient links by a local patient identifier. MPI will identify probable
127
+ * patients based on MPI match scores that are within a certain threshold range but are not auto matched.
128
+ * Probable matches are determined by probabilistic algorithms. This will enable Edge Systems to confirm
129
+ * additional patient matches across other organizations. On confirmation, the patient will be matched to a
130
+ * person. Probable links need to be manually linked to the local patient before documents can be requested.
131
+ *
132
+ * The links returned are LOLA 1.
133
+ *
134
+ * @param patientId The ID of the patient to get probable links for.
135
+ * @returns Response with list of probable (LOLA1) links to other Patients
136
+ */
137
+ getProbableLinksById(patientId: string, options?: BaseOptions): Promise<PatientProbableLinks>;
138
+ /**
139
+ * Returns the potential links for a patient with the provided demographics.
140
+ *
141
+ * An Edge System can request probable patient links by a local patient identifier. MPI will identify probable
142
+ * patients based on MPI match scores that are within a certain threshold range but are not auto matched.
143
+ * Probable matches are determined by probabilistic algorithms. This will enable Edge Systems to confirm
144
+ * additional patient matches across other organizations. On confirmation, the patient will be matched to a
145
+ * person. Probable links need to be manually linked to the local patient before documents can be requested.
146
+ *
147
+ * The links returned are LOLA 1.
148
+ *
149
+ * @param firstName The first name of the patient.
150
+ * @param lastName The last name of the patient.
151
+ * @param dob The date of birth of the patient.
152
+ * @param gender The gender of the patient.
153
+ * @param zip The zip code of the patient.
154
+ * @param options Optional parameters.
155
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
156
+ * @returns Response with list of probable (LOLA1) links to existing Patients
157
+ */
158
+ getProbableLinksByDemographics({ firstName, lastName, dob, gender, zip, }: {
159
+ firstName: string;
160
+ lastName: string;
161
+ dob: string;
162
+ gender: GenderCodes;
163
+ zip: string;
164
+ }, options?: BaseOptions): Promise<PatientProbableLinks>;
165
+ /**
166
+ * An Edge System reviews the probable matches. An Edge System can link remote patient(s) if these patients are
167
+ * the same as local patient.
168
+ *
169
+ * Use getPatientLinksByPatientId to get the Link URL.
170
+ *
171
+ * Remote patients will be linked with the local patient and now considered as a manual confirmed LOLA 2 link.
172
+ *
173
+ * @param urlToLinkPatients The URL to link the patients.
174
+ * @param options Optional parameters.
175
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
176
+ */
177
+ linkPatients(urlToLinkPatients: string, options?: BaseOptions): Promise<StatusResponse>;
178
+ /**
179
+ * After reviewing remote patient links for their local patient, an Edge System can unlink a remote patient that
180
+ * does not belong in the Patient collection and remove the existing LOLA2 network link.
181
+ *
182
+ * Use getPatientLinksByPatientId to get the Unlink URL.
183
+ *
184
+ * Patient Links that are manually unlinked will no longer be autolinked to the same patient in the future by the
185
+ * matching algorithm.
186
+ *
187
+ * @param urlToUnlinkPatients The URL to unlink the patients.
188
+ * @param options Optional parameters.
189
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
190
+ */
191
+ unlinkPatients(urlToUnlinkPatients: string, options?: BaseOptions): Promise<StatusResponse>;
192
+ /**
193
+ * Edge Systems can perform a “reset” to a Patient which will detach all LOLA 2 links to the specified Patient. This
194
+ * patient may be linked to the same collection of Patients (Person) again in the future.
195
+ *
196
+ * Use getPatientLinksByPatientId to get the ResetLink URL.
197
+ *
198
+ * @param urlToResetPatientLinks The URL to reset the patient links.
199
+ * @param options Optional parameters.
200
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
201
+ */
202
+ resetPatientLinks(urlToResetPatientLinks: string, options?: BaseOptions): Promise<StatusResponse>;
203
+ private queryDocumentsInternal;
204
+ /**
205
+ * Queries a patient's Documents. Returns only documents.
206
+ *
207
+ * @param patientId The patient's ID.
208
+ * @param options Query parameters and query parameters.
209
+ * @param options.status The status of the document. Defaults to `current`, even if a param is
210
+ * provided without status.
211
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
212
+ * @returns an array of DocumentReference FHIR resources.
213
+ */
214
+ queryDocuments(patientId: string, options?: BaseOptions & DocumentQueryParams): Promise<DocumentReference[]>;
215
+ /**
216
+ * Queries a patient's Documents. Returns documents and errors from the fanout to other gateways.
217
+ *
218
+ * @param patientId The patient's ID.
219
+ * @param options Query parameters and query parameters.
220
+ * @param options.status The status of the document. Defaults to `current`, even if a param is
221
+ * provided without status.
222
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
223
+ * @returns a Bundle containing DocumentReferences of a patient's available DocumentReferences
224
+ * and/or OperationOutcomes denoting problems with the query.
225
+ */
226
+ queryDocumentsFull(patientId: string, options?: BaseOptions & DocumentQueryParams): Promise<DocumentQueryFullResponse>;
227
+ /**
228
+ * Retrieve a Document and send its bytes to the outputStream.
229
+ *
230
+ * @param inputUrl The URL of the file to be downloaded. Obtained from a DocumentReference that
231
+ * was retrieved from a previous call to `queryDocuments`.
232
+ * @param outputStream The stream to receive the downloaded file's bytes.
233
+ * @param options Optional parameters.
234
+ * @param options.meta Metadata about the request. Defaults to the data used to initialize the client.
235
+ * @returns The content type and size of the downloaded file.
236
+ */
237
+ retrieveDocument(inputUrl: string, outputStream: stream.Writable, options?: BaseOptions): Promise<RetrieveDocumentResponse>;
238
+ private buildQueryHeaders;
239
+ private buildOrganizationQueryMeta;
240
+ private executeWithRetriesOn500IfEnabled;
241
+ private getDescriptiveError;
242
+ }
243
+ //# sourceMappingURL=commonwell%20copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commonwell copy.d.ts","sourceRoot":"","sources":["../../src/client/commonwell copy.ts"],"names":[],"mappings":";AAUA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAUjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,yBAAyB,EAGzB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,OAAO,EACP,yBAAyB,EACzB,oBAAoB,EAEpB,oBAAoB,EAEpB,mBAAmB,EAEnB,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAwC,MAAM,UAAU,CAAC;AAC5F,OAAO,EACL,WAAW,EACX,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAEhB,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;GAGG;AACH,qBAAa,UAAW,SAAQ,cAAe,YAAW,aAAa;IACrE,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,wBAAwB,CAAC,CAAqB;IACtD,OAAO,CAAC,UAAU,CAAoB;IAEtC;;;OAGG;gBACS,EACV,OAAO,EACP,aAAa,EACb,OAAO,EACP,GAAG,EACH,GAAG,EACH,eAAe,EACf,OAAO,EACP,uBAAuB,EAAE,oBAAoB,EAC7C,O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