@metriport/api-sdk 11.0.0 → 12.0.0-alpha.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.
Files changed (37) hide show
  1. package/dist/api-sdk/src/index.d.ts +26 -0
  2. package/dist/api-sdk/src/index.d.ts.map +1 -0
  3. package/dist/api-sdk/src/index.js +64 -0
  4. package/dist/api-sdk/src/index.js.map +1 -0
  5. package/dist/api-sdk/src/medical/client/metriport.d.ts +350 -0
  6. package/dist/api-sdk/src/medical/client/metriport.d.ts.map +1 -0
  7. package/dist/api-sdk/src/medical/client/metriport.js +596 -0
  8. package/dist/api-sdk/src/medical/client/metriport.js.map +1 -0
  9. package/dist/api-sdk/src/medical/models/patientDTO.d.ts +52 -0
  10. package/dist/api-sdk/src/medical/models/patientDTO.d.ts.map +1 -0
  11. package/dist/api-sdk/src/medical/models/patientDTO.js +3 -0
  12. package/dist/api-sdk/src/medical/models/patientDTO.js.map +1 -0
  13. package/dist/devices/client/metriport.d.ts +2 -1
  14. package/dist/devices/client/metriport.d.ts.map +1 -1
  15. package/dist/devices/client/metriport.js +2 -1
  16. package/dist/devices/client/metriport.js.map +1 -1
  17. package/dist/medical/models/webhook-request.d.ts +376 -0
  18. package/dist/medical/models/webhook-request.d.ts.map +1 -0
  19. package/dist/medical/models/webhook-request.js +109 -0
  20. package/dist/medical/models/webhook-request.js.map +1 -0
  21. package/dist/medical/models/webhook-status-response.d.ts +7 -0
  22. package/dist/medical/models/webhook-status-response.d.ts.map +1 -0
  23. package/dist/medical/models/webhook-status-response.js +3 -0
  24. package/dist/medical/models/webhook-status-response.js.map +1 -0
  25. package/dist/shared/src/medical/webhook/webhook-request.d.ts +376 -0
  26. package/dist/shared/src/medical/webhook/webhook-request.d.ts.map +1 -0
  27. package/dist/shared/src/medical/webhook/webhook-request.js +109 -0
  28. package/dist/shared/src/medical/webhook/webhook-request.js.map +1 -0
  29. package/dist/shared/src/medical/webhook/webhook-status-response.d.ts +7 -0
  30. package/dist/shared/src/medical/webhook/webhook-status-response.d.ts.map +1 -0
  31. package/dist/shared/src/medical/webhook/webhook-status-response.js +3 -0
  32. package/dist/shared/src/medical/webhook/webhook-status-response.js.map +1 -0
  33. package/dist/shared.d.ts +1 -0
  34. package/dist/shared.d.ts.map +1 -1
  35. package/dist/shared.js +2 -1
  36. package/dist/shared.js.map +1 -1
  37. package/package.json +4 -4
@@ -0,0 +1,26 @@
1
+ export { MetriportDevicesApi } from "./devices/client/metriport";
2
+ export { Activity } from "./devices/models/activity";
3
+ export { Biometrics } from "./devices/models/biometrics";
4
+ export { Body } from "./devices/models/body";
5
+ export { ConnectedUserInfo } from "./devices/models/common/connected-user-info";
6
+ export { Food } from "./devices/models/common/food";
7
+ export { ProviderSource } from "./devices/models/common/provider-source";
8
+ export { SourceType } from "./devices/models/common/source-type";
9
+ export { Nutrition } from "./devices/models/nutrition";
10
+ export { Sleep } from "./devices/models/sleep";
11
+ export { User } from "./devices/models/user";
12
+ export { WebhookRequestParsingError, WebhookRequest as WebhookRequestData, WebhookRequestStatus, WebhookType, } from "@metriport/shared/src/medical/webhook/webhook-request";
13
+ export { MetriportMedicalApi } from "./medical/client/metriport";
14
+ export { Address, addressSchema } from "./medical/models/common/address";
15
+ export { BaseUpdate, baseUpdateSchema } from "./medical/models/common/base-update";
16
+ export { MedicalDataSource } from "./medical/models/common/medical-data-source";
17
+ export { USState, usStateSchema } from "./medical/models/common/us-data";
18
+ export { contactSchema, Demographics, demographicsSchema, genderAtBirthSchema, PersonalIdentifier, personalIdentifierSchema, generalPersonalIdentifiers, driversLicensePersonalIdentifier, } from "./medical/models/demographics";
19
+ export { DocumentQuery, documentQuerySchema, DocumentQueryStatus, documentQueryStatusSchema, ListDocumentFilters, ListDocumentResult, UploadDocumentResult, } from "./medical/models/document";
20
+ export { MedicalRecordsStatusDTO } from "./medical/models/medicalRecordStatus";
21
+ export { Facility, FacilityCreate, facilityCreateSchema, facilityListSchema, facilitySchema, } from "./medical/models/facility";
22
+ export * from "./medical/models/fhir";
23
+ export { Organization, OrganizationCreate, organizationCreateSchema, organizationSchema, OrgType, orgTypeSchema, } from "./medical/models/organization";
24
+ export { Patient, PatientCreate, patientCreateSchema, patientListSchema, patientSchema, PatientUpdate, patientUpdateSchema, } from "./medical/models/patient";
25
+ export { PatientDTO } from "./medical/models/patientDTO";
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAG7C,OAAO,EACL,0BAA0B,EAC1B,cAAc,IAAI,kBAAkB,EACpC,oBAAoB,EACpB,WAAW,GACZ,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EACL,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,OAAO,EACP,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.patientUpdateSchema = exports.patientSchema = exports.patientListSchema = exports.patientCreateSchema = exports.orgTypeSchema = exports.OrgType = exports.organizationSchema = exports.organizationCreateSchema = exports.facilitySchema = exports.facilityListSchema = exports.facilityCreateSchema = exports.documentQueryStatusSchema = exports.documentQuerySchema = exports.driversLicensePersonalIdentifier = exports.generalPersonalIdentifiers = exports.personalIdentifierSchema = exports.genderAtBirthSchema = exports.demographicsSchema = exports.contactSchema = exports.usStateSchema = exports.USState = exports.MedicalDataSource = exports.baseUpdateSchema = exports.addressSchema = exports.MetriportMedicalApi = exports.WebhookRequestParsingError = exports.SourceType = exports.ProviderSource = exports.MetriportDevicesApi = void 0;
18
+ // Devices API
19
+ var metriport_1 = require("./devices/client/metriport");
20
+ Object.defineProperty(exports, "MetriportDevicesApi", { enumerable: true, get: function () { return metriport_1.MetriportDevicesApi; } });
21
+ var provider_source_1 = require("./devices/models/common/provider-source");
22
+ Object.defineProperty(exports, "ProviderSource", { enumerable: true, get: function () { return provider_source_1.ProviderSource; } });
23
+ var source_type_1 = require("./devices/models/common/source-type");
24
+ Object.defineProperty(exports, "SourceType", { enumerable: true, get: function () { return source_type_1.SourceType; } });
25
+ // Medical API
26
+ var webhook_request_1 = require("@metriport/shared/src/medical/webhook/webhook-request");
27
+ Object.defineProperty(exports, "WebhookRequestParsingError", { enumerable: true, get: function () { return webhook_request_1.WebhookRequestParsingError; } });
28
+ var metriport_2 = require("./medical/client/metriport");
29
+ Object.defineProperty(exports, "MetriportMedicalApi", { enumerable: true, get: function () { return metriport_2.MetriportMedicalApi; } });
30
+ var address_1 = require("./medical/models/common/address");
31
+ Object.defineProperty(exports, "addressSchema", { enumerable: true, get: function () { return address_1.addressSchema; } });
32
+ var base_update_1 = require("./medical/models/common/base-update");
33
+ Object.defineProperty(exports, "baseUpdateSchema", { enumerable: true, get: function () { return base_update_1.baseUpdateSchema; } });
34
+ var medical_data_source_1 = require("./medical/models/common/medical-data-source");
35
+ Object.defineProperty(exports, "MedicalDataSource", { enumerable: true, get: function () { return medical_data_source_1.MedicalDataSource; } });
36
+ var us_data_1 = require("./medical/models/common/us-data");
37
+ Object.defineProperty(exports, "USState", { enumerable: true, get: function () { return us_data_1.USState; } });
38
+ Object.defineProperty(exports, "usStateSchema", { enumerable: true, get: function () { return us_data_1.usStateSchema; } });
39
+ var demographics_1 = require("./medical/models/demographics");
40
+ Object.defineProperty(exports, "contactSchema", { enumerable: true, get: function () { return demographics_1.contactSchema; } });
41
+ Object.defineProperty(exports, "demographicsSchema", { enumerable: true, get: function () { return demographics_1.demographicsSchema; } });
42
+ Object.defineProperty(exports, "genderAtBirthSchema", { enumerable: true, get: function () { return demographics_1.genderAtBirthSchema; } });
43
+ Object.defineProperty(exports, "personalIdentifierSchema", { enumerable: true, get: function () { return demographics_1.personalIdentifierSchema; } });
44
+ Object.defineProperty(exports, "generalPersonalIdentifiers", { enumerable: true, get: function () { return demographics_1.generalPersonalIdentifiers; } });
45
+ Object.defineProperty(exports, "driversLicensePersonalIdentifier", { enumerable: true, get: function () { return demographics_1.driversLicensePersonalIdentifier; } });
46
+ var document_1 = require("./medical/models/document");
47
+ Object.defineProperty(exports, "documentQuerySchema", { enumerable: true, get: function () { return document_1.documentQuerySchema; } });
48
+ Object.defineProperty(exports, "documentQueryStatusSchema", { enumerable: true, get: function () { return document_1.documentQueryStatusSchema; } });
49
+ var facility_1 = require("./medical/models/facility");
50
+ Object.defineProperty(exports, "facilityCreateSchema", { enumerable: true, get: function () { return facility_1.facilityCreateSchema; } });
51
+ Object.defineProperty(exports, "facilityListSchema", { enumerable: true, get: function () { return facility_1.facilityListSchema; } });
52
+ Object.defineProperty(exports, "facilitySchema", { enumerable: true, get: function () { return facility_1.facilitySchema; } });
53
+ __exportStar(require("./medical/models/fhir"), exports);
54
+ var organization_1 = require("./medical/models/organization");
55
+ Object.defineProperty(exports, "organizationCreateSchema", { enumerable: true, get: function () { return organization_1.organizationCreateSchema; } });
56
+ Object.defineProperty(exports, "organizationSchema", { enumerable: true, get: function () { return organization_1.organizationSchema; } });
57
+ Object.defineProperty(exports, "OrgType", { enumerable: true, get: function () { return organization_1.OrgType; } });
58
+ Object.defineProperty(exports, "orgTypeSchema", { enumerable: true, get: function () { return organization_1.orgTypeSchema; } });
59
+ var patient_1 = require("./medical/models/patient");
60
+ Object.defineProperty(exports, "patientCreateSchema", { enumerable: true, get: function () { return patient_1.patientCreateSchema; } });
61
+ Object.defineProperty(exports, "patientListSchema", { enumerable: true, get: function () { return patient_1.patientListSchema; } });
62
+ Object.defineProperty(exports, "patientSchema", { enumerable: true, get: function () { return patient_1.patientSchema; } });
63
+ Object.defineProperty(exports, "patientUpdateSchema", { enumerable: true, get: function () { return patient_1.patientUpdateSchema; } });
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,cAAc;AACd,wDAAiE;AAAxD,gHAAA,mBAAmB,OAAA;AAM5B,2EAAyE;AAAhE,iHAAA,cAAc,OAAA;AACvB,mEAAiE;AAAxD,yGAAA,UAAU,OAAA;AAKnB,cAAc;AACd,yFAK+D;AAJ7D,6HAAA,0BAA0B,OAAA;AAK5B,wDAAiE;AAAxD,gHAAA,mBAAmB,OAAA;AAC5B,2DAAyE;AAAvD,wGAAA,aAAa,OAAA;AAC/B,mEAAmF;AAA9D,+GAAA,gBAAgB,OAAA;AACrC,mFAAgF;AAAvE,wHAAA,iBAAiB,OAAA;AAC1B,2DAAyE;AAAhE,kGAAA,OAAO,OAAA;AAAE,wGAAA,aAAa,OAAA;AAC/B,8DASuC;AARrC,6GAAA,aAAa,OAAA;AAEb,kHAAA,kBAAkB,OAAA;AAClB,mHAAA,mBAAmB,OAAA;AAEnB,wHAAA,wBAAwB,OAAA;AACxB,0HAAA,0BAA0B,OAAA;AAC1B,gIAAA,gCAAgC,OAAA;AAElC,sDAQmC;AANjC,+GAAA,mBAAmB,OAAA;AAEnB,qHAAA,yBAAyB,OAAA;AAM3B,sDAMmC;AAHjC,gHAAA,oBAAoB,OAAA;AACpB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AAEhB,wDAAsC;AACtC,8DAOuC;AAJrC,wHAAA,wBAAwB,OAAA;AACxB,kHAAA,kBAAkB,OAAA;AAClB,uGAAA,OAAO,OAAA;AACP,6GAAA,aAAa,OAAA;AAEf,oDAQkC;AALhC,8GAAA,mBAAmB,OAAA;AACnB,4GAAA,iBAAiB,OAAA;AACjB,wGAAA,aAAa,OAAA;AAEb,8GAAA,mBAAmB,OAAA"}
@@ -0,0 +1,350 @@
1
+ import { Bundle, DocumentReference as FHIRDocumentReference, Resource } from "@medplum/fhirtypes";
2
+ import { AxiosInstance, AxiosStatic } from "axios";
3
+ import { Demographics } from "../models/demographics";
4
+ import { BulkGetDocumentUrlQuery, DocumentQuery, DocumentReference, ListDocumentFilters, ListDocumentResult, UploadDocumentResult } from "../models/document";
5
+ import { Facility, FacilityCreate } from "../models/facility";
6
+ import { ConsolidatedCountResponse, ResourceTypeForConsolidation } from "../models/fhir";
7
+ import { Organization, OrganizationCreate } from "../models/organization";
8
+ import { PatientCreate, PatientUpdate, QueryProgress } from "../models/patient";
9
+ import { PatientDTO } from "../models/patientDTO";
10
+ import { SettingsResponse } from "../models/settings-response";
11
+ import { WebhookRequest, WebhookRequestParsingError } from "@metriport/shared/src/medical/webhook/webhook-request";
12
+ import { WebhookStatusResponse } from "@metriport/shared/src/medical/webhook/webhook-status-response";
13
+ export type Options = {
14
+ axios?: AxiosStatic;
15
+ timeout?: number;
16
+ additionalHeaders?: Record<string, string>;
17
+ } & ({
18
+ sandbox?: boolean;
19
+ baseAddress?: never;
20
+ } | {
21
+ sandbox?: never;
22
+ baseAddress?: string;
23
+ });
24
+ export declare class MetriportMedicalApi {
25
+ readonly api: AxiosInstance;
26
+ private optionsForSettingsEndpoints;
27
+ static readonly headers: {
28
+ clientApp: string;
29
+ };
30
+ /**
31
+ * Creates a new instance of the Metriport Medical API client.
32
+ *
33
+ * @param apiKey Your Metriport API key.
34
+ * @param options - Optional parameters
35
+ * @param options.additionalHeaders - HTTP headers to be used in all requests.
36
+ * @param options.axios - Axios instance, default, useful when the dependency is not being imported
37
+ * properly by NPM.
38
+ * @param options.sandbox - Indicates whether to connect to the sandbox, default false.
39
+ * @param options.timeout - Connection timeout in milliseconds, default 20 seconds.
40
+ */
41
+ constructor(apiKey: string, options?: Options);
42
+ /**
43
+ * Gets the settings for your account.
44
+ *
45
+ * @returns Your account settings.
46
+ */
47
+ getSettings(): Promise<SettingsResponse>;
48
+ /**
49
+ * Update the settings for your account.
50
+ *
51
+ * @returns Your updated account settings.
52
+ */
53
+ updateSettings(webhookUrl: string): Promise<SettingsResponse>;
54
+ /**
55
+ * Gets the status of communication with your app's webhook.
56
+ *
57
+ * @returns The status of communication with your app's webhook.
58
+ */
59
+ getWebhookStatus(): Promise<WebhookStatusResponse>;
60
+ /**
61
+ * Retries failed webhook requests.
62
+ *
63
+ * @returns void
64
+ */
65
+ retryWebhookRequests(): Promise<void>;
66
+ /**
67
+ * Creates a new organization if one does not already exist.
68
+ *
69
+ * @param data The data to be used to create a new organization.
70
+ * @throws Error (400) if an organization already exists for the customer.
71
+ * @returns The created organization.
72
+ */
73
+ createOrganization(data: OrganizationCreate): Promise<Organization>;
74
+ /**
75
+ * Updates an organization.
76
+ *
77
+ * @param organization The organization data to be updated.
78
+ * @return The updated organization.
79
+ */
80
+ updateOrganization(organization: Organization): Promise<Organization>;
81
+ /**
82
+ * Retrieve an organization representing this account.
83
+ *
84
+ * @returns The organization, or undefined if no organization has been created.
85
+ */
86
+ getOrganization(): Promise<Organization | undefined>;
87
+ /**
88
+ * Creates a new facility.
89
+ *
90
+ * @param data The data to be used to create a new facility.
91
+ * @return The newly created facility.
92
+ */
93
+ createFacility(data: FacilityCreate): Promise<Facility>;
94
+ /**
95
+ * Returns a facility.
96
+ *
97
+ * @param id The ID of the facility to be returned.
98
+ * @return The facilities.
99
+ */
100
+ getFacility(id: string): Promise<Facility>;
101
+ /**
102
+ * Updates a facility.
103
+ *
104
+ * @param facility The facility data to be updated.
105
+ * @return The updated facility.
106
+ */
107
+ updateFacility(facility: Facility): Promise<Facility>;
108
+ /**
109
+ * Returns the facilities associated with this account.
110
+ *
111
+ * @return The list of facilities.
112
+ */
113
+ listFacilities(): Promise<Facility[]>;
114
+ /**
115
+ * Deletes a facility. It will fail if the facility has patients associated with it.
116
+ *
117
+ * @param facilityId The ID of facility to be deleted.
118
+ */
119
+ deleteFacility(facilityId: string, eTag?: string): Promise<void>;
120
+ /**
121
+ * Creates a new patient at Metriport and HIEs.
122
+ *
123
+ * @param data The data to be used to create a new patient.
124
+ * @param facilityId The facility providing the NPI to support this operation.
125
+ * @return The newly created patient.
126
+ */
127
+ createPatient(data: PatientCreate, facilityId: string): Promise<PatientDTO>;
128
+ /**
129
+ * Returns a patient.
130
+ *
131
+ * @param id The ID of the patient to be returned.
132
+ * @return The patient.
133
+ */
134
+ getPatient(id: string): Promise<PatientDTO>;
135
+ /**
136
+ * Searches for a patient previously created at Metriport, based on demographics.
137
+ *
138
+ * @return The patient if found.
139
+ */
140
+ matchPatient(data: Demographics): Promise<PatientDTO | undefined>;
141
+ /**
142
+ * Updates a patient at Metriport and at HIEs the patient is linked to.
143
+ *
144
+ * @param patient The patient data to be updated.
145
+ * @param facilityId Optional. The facility providing the NPI to support this operation. If not provided and the patient has only one facility, that one will be used. If not provided and the patient has multiple facilities, an error will be thrown.
146
+ * @return The updated patient.
147
+ */
148
+ updatePatient(patient: PatientUpdate, facilityId?: string): Promise<PatientDTO>;
149
+ /** ---------------------------------------------------------------------------
150
+ * Returns a patient's consolidated data.
151
+ * @deprecated Use startConsolidatedQuery() and getConsolidatedQueryStatus() instead.
152
+ *
153
+ * Note if only patientId is provided the endpoint may take long to respond as its
154
+ * fetching all the resources for the patient.
155
+ *
156
+ * @param patientId The ID of the patient whose data is to be returned.
157
+ * @param resources Optional array of resources to be returned.
158
+ * @param dateFrom Optional start date that resources will be filtered by (inclusive). Format is YYYY-MM-DD.
159
+ * @param dateTo Optional end date that resources will be filtered by (inclusive). Format is YYYY-MM-DD.
160
+ * @return Patient's consolidated data.
161
+ */
162
+ getPatientConsolidated(patientId: string, resources?: string[], dateFrom?: string, dateTo?: string): Promise<Bundle<Resource>>;
163
+ /** ---------------------------------------------------------------------------
164
+ * Start a query for the patient's consolidated data (FHIR resources).
165
+ * The results are sent through Webhook (see https://docs.metriport.com/medical-api/more-info/webhooks).
166
+ * Only one query per given patient can be executed at a time.
167
+ *
168
+ * @param patientId The ID of the patient whose data is to be returned.
169
+ * @param resources Optional array of resources to be returned (defaults to all resource types).
170
+ * @param dateFrom Optional start date that resources will be filtered by (inclusive). Format is YYYY-MM-DD.
171
+ * @param dateTo Optional end date that resources will be filtered by (inclusive). Format is YYYY-MM-DD.
172
+ * @param conversionType Optional to indicate how the medical record should be rendered - one of:
173
+ * "pdf", "html", or "json" (defaults to "json"). If "html" or "pdf", the Webhook payload
174
+ * will contain a signed URL to download the file, which is active for 3 minutes.
175
+ * If not provided, will send json payload in the webhook.
176
+ * @param metadata Optional metadata to be sent along the webhook request as response of this query.
177
+ * @return The consolidated data query status.
178
+ */
179
+ startConsolidatedQuery(patientId: string, resources?: readonly ResourceTypeForConsolidation[], dateFrom?: string, dateTo?: string, conversionType?: string, metadata?: Record<string, string>): Promise<QueryProgress>;
180
+ /** ---------------------------------------------------------------------------
181
+ * Get the consolidated data query status for a given patient.
182
+ * The results to the query are sent through Webhook (see
183
+ * startConsolidatedQuery() and https://docs.metriport.com/medical-api/more-info/webhooks).
184
+ *
185
+ * @param patientId The ID of the patient whose data is to be returned.
186
+ * @return The consolidated data query status.
187
+ */
188
+ getConsolidatedQueryStatus(patientId: string): Promise<QueryProgress>;
189
+ /** ---------------------------------------------------------------------------
190
+ * Add patient data as FHIR resources. Those can later be queried with startConsolidatedQuery(),
191
+ * and will be made available to HIEs.
192
+ *
193
+ * Note: each call to this function is limited to 50 resources and 1Mb of data. You can make multiple
194
+ * calls to this function to add more data.
195
+ *
196
+ * @param patientId The ID of the patient to associate resources to.
197
+ * @param payload The FHIR Bundle to create resources.
198
+ * @return FHIR Bundle with operation outcome.
199
+ */
200
+ createPatientConsolidated(patientId: string, payload: Bundle): Promise<Bundle<Resource>>;
201
+ /** ---------------------------------------------------------------------------
202
+ * Returns the amount of resources available for a given patient, per resource type.
203
+ *
204
+ * @param patientId The ID of the patient whose data is to be returned.
205
+ * @param resources Optional array of resources to be considered.
206
+ * @param dateFrom Optional start date that resources will be filtered by (inclusive). Format is YYYY-MM-DD.
207
+ * @param dateTo Optional end date that resources will be filtered by (inclusive). Format is YYYY-MM-DD.
208
+ * @return the amount of resources available per resource type for the given Patient.
209
+ */
210
+ countPatientConsolidated(patientId: string, resources?: readonly ResourceTypeForConsolidation[], dateFrom?: string, dateTo?: string): Promise<ConsolidatedCountResponse>;
211
+ /**
212
+ * Removes a patient at Metriport and at HIEs the patient is linked to.
213
+ *
214
+ * @param patientId The ID of the patient to be deleted.
215
+ * @param facilityId The facility providing the NPI to support this operation.
216
+ */
217
+ deletePatient(patientId: string, facilityId: string, eTag?: string): Promise<void>;
218
+ /**
219
+ * Returns the patients associated with given facility.
220
+ *
221
+ * @param facilityId The ID of the facility.
222
+ * @return The list of patients.
223
+ */
224
+ listPatients(facilityId: string): Promise<PatientDTO[]>;
225
+ /**
226
+ * Returns document references for the given patient across HIEs.
227
+ *
228
+ * @param patientId Patient ID for which to retrieve document metadata.
229
+ * @param filters.dateFrom Optional start date that docs will be filtered by (inclusive).
230
+ * If the type is Date, its assumed UTC. If the type is string, its assumed to be ISO 8601 (Date only).
231
+ * @param filters.dateTo Optional end date that docs will be filtered by (inclusive).
232
+ * If the type is Date, its assumed UTC. If the type is string, its assumed to be ISO 8601 (Date only).
233
+ * @param filters.content Optional value to search on the document reference
234
+ * (partial match and case insentitive, minimum 3 chars).
235
+ * @return The list of document references.
236
+ */
237
+ listDocuments(patientId: string, { dateFrom, dateTo, content }?: ListDocumentFilters): Promise<ListDocumentResult>;
238
+ /**
239
+ * @deprecated Use listDocuments() instead.
240
+ *
241
+ * Returns document references for the given patient across HIEs, in the DTO format.
242
+ *
243
+ * @param patientId Patient ID for which to retrieve document metadata.
244
+ * @param filters.dateFrom Optional start date that docs will be filtered by (inclusive).
245
+ * If the type is Date, its assumed UTC. If the type is string, its assumed to be ISO 8601 (Date only).
246
+ * @param filters.dateTo Optional end date that docs will be filtered by (inclusive).
247
+ * If the type is Date, its assumed UTC. If the type is string, its assumed to be ISO 8601 (Date only).
248
+ * @param filters.content Optional value to search on the document reference
249
+ * (partial match and case insentitive, minimum 3 chars).
250
+ * @return The list of document references.
251
+ */
252
+ listDocumentsAsDTO(patientId: string, { dateFrom, dateTo, content }?: ListDocumentFilters): Promise<DocumentReference[]>;
253
+ /**
254
+ * Start a document query for the given patient across HIEs.
255
+ *
256
+ * @param patientId Patient ID for which to retrieve document metadata.
257
+ * @param facilityId The facility providing the NPI to support this operation (optional).
258
+ * If not provided and the patient has only one facility, that one will be used.
259
+ * If not provided and the patient has multiple facilities, an error will be thrown.
260
+ * @param metadata Optional metadata to be sent along the webhook request as response of this query.
261
+ * @return The document query request ID, progress & status indicating whether its being executed or not.
262
+ */
263
+ startDocumentQuery(patientId: string, facilityId?: string, metadata?: Record<string, string>): Promise<DocumentQuery>;
264
+ /**
265
+ * Start a bulk document download for a given patient, with the payload returned to the webhook.
266
+ *
267
+ * @param patientId Patient ID for which to retrieve document URLs.
268
+ * @param metadata Optional metadata to be sent along the webhook request as response of this query.
269
+ * @return The document query request ID, progress, and status indicating whether it's being executed or not.
270
+ */
271
+ startBulkGetDocumentUrl(patientId: string, metadata?: Record<string, string>): Promise<BulkGetDocumentUrlQuery>;
272
+ /**
273
+ * Returns the document query status for the specified patient.
274
+ *
275
+ * @param patientId Patient ID for which to retrieve document query status.
276
+ * @return The document query request ID, progress & status indicating whether its being executed or not.
277
+ */
278
+ getDocumentQueryStatus(patientId: string): Promise<DocumentQuery>;
279
+ /**
280
+ * Returns a URL that can be used to download the document.
281
+ *
282
+ * @param req.query.fileName The file name of the document in s3.
283
+ * @param req.query.conversionType The doc type to convert to. Valid values are "html" and "pdf".
284
+ * @return presigned url
285
+ */
286
+ getDocumentUrl(fileName: string, conversionType?: "html" | "pdf"): Promise<{
287
+ url: string;
288
+ }>;
289
+ /**
290
+ * @deprecated - Use createDocumentReference() instead.
291
+ * Returns a URL to upload a file to Metriport and make the document available to other HIEs.
292
+ * To upload your file contents, execute a PUT request using this URL with the file contents as the request body.
293
+ * Refer to Metriport documentation for more details:
294
+ * https://docs.metriport.com/medical-api/api-reference/document/post-upload-url
295
+ *
296
+ * @param patientId - the ID of the patient.
297
+ * @param docRef - a FHIR Document Reference for this file upload. Mandatory fields include DocumentReference.description, DocumentReference.type, and DocumentReference.context. Besides that, try to include as much metadata on the document as possible. Note that you DO NOT need to fill in the Organization or Patient fields under the author or contained fields - Metriport will fill this in and overwrite whatever you put in.
298
+ * Refer to Metriport's documentation for more details: https://docs.metriport.com/medical-api/fhir/resources/documentreference.
299
+ *
300
+ * @returns A URL string to be used for subsequent file upload.
301
+ */
302
+ getDocumentUploadUrl(patientId: string, docRef: Partial<FHIRDocumentReference>): Promise<string>;
303
+ /**
304
+ * Creates a DocumentReference and returns its ID along with a URL to upload the respective Document file to Metriport and make this document available to other HIEs.
305
+ * To upload your file contents, execute a PUT request using the returned uploadUrl with the file contents as the request body.
306
+ * Refer to Metriport Documentation for more details:
307
+ * https://docs.metriport.com/medical-api/api-reference/document/post-upload-url
308
+ *
309
+ * @param patientId - the ID of the patient.
310
+ * @param docRef - a FHIR Document Reference for this file upload. Mandatory fields include DocumentReference.description, DocumentReference.type, and DocumentReference.context. Besides that, try to include as much metadata on the document as possible. Note that you DO NOT need to fill in the Organization or Patient fields under the author or contained fields - Metriport will fill this in and overwrite whatever you put in.
311
+ * Refer to Metriport's documentation for more details: https://docs.metriport.com/medical-api/fhir/resources/documentreference.
312
+ *
313
+ * @returns The DocumentReference ID, and the URL to be used for subsequent file upload.
314
+ */
315
+ createDocumentReference(patientId: string, docRef: Partial<FHIRDocumentReference>): Promise<UploadDocumentResult>;
316
+ /**
317
+ * Verifies the signature of a webhook request.
318
+ * Refer to Metriport's documentation for more details: https://docs.metriport.com/medical-api/more-info/webhooks.
319
+ *
320
+ * @param wh_key - your webhook key.
321
+ * @param req.body - the body of the webhook request.
322
+ * @param signature - the signature obtained from the webhook request header.
323
+ *
324
+ * @returns True if the signature is verified, false otherwise.
325
+ */
326
+ verifyWebhookSignature(wh_key: string, reqBody: string, signature: string): boolean;
327
+ /**
328
+ * Verifies the signature of a webhook request.
329
+ * Refer to Metriport's documentation for more details: https://docs.metriport.com/medical-api/more-info/webhooks.
330
+ *
331
+ * @param wh_key - your webhook key.
332
+ * @param req.body - the body of the webhook request.
333
+ * @param signature - the signature obtained from the webhook request header.
334
+ *
335
+ * @returns True if the signature is verified, false otherwise.
336
+ */
337
+ static verifyWebhookSignature(wh_key: string, reqBody: string, signature: string): boolean;
338
+ /**
339
+ *
340
+ * @param requestBody
341
+ * @param throwOnError
342
+ * @throws Error if the request body is not a valid webhook request and throwOnError is 'true'.
343
+ * Details can be obtained from the error object under the 'cause' property (instance
344
+ * of ZodError).
345
+ */
346
+ static parseWebhookResponse(requestBody: unknown, throwOnError: false): WebhookRequest | WebhookRequestParsingError;
347
+ static parseWebhookResponse(reqBody: unknown, throwOnError: true): WebhookRequest;
348
+ static parseWebhookResponse(reqBody: unknown): WebhookRequest;
349
+ }
350
+ //# sourceMappingURL=metriport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metriport.d.ts","sourceRoot":"","sources":["../../../../../src/medical/client/metriport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,iBAAiB,IA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