@icanbwell/bwell-sdk-ts 2.0.0-alpha.0-rc.1759844545 → 2.0.0-alpha.0-rc.1759861298
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.
- package/dist/__version__.d.ts +1 -1
- package/dist/__version__.js +1 -1
- package/dist/api/base/health-data/health-data-request.d.ts +6 -1
- package/dist/api/base/health-data/health-manager.d.ts +40 -2
- package/dist/api/graphql-api/healthdata/get-medication-dispenses-request-factory.d.ts +6 -0
- package/dist/api/graphql-api/healthdata/get-medication-dispenses-request-factory.js +25 -0
- package/dist/api/graphql-api/healthdata/graphql-health-manager.d.ts +4 -1
- package/dist/api/graphql-api/healthdata/graphql-health-manager.js +64 -2
- package/dist/graphql/operations/index.d.ts +55 -20
- package/dist/graphql/operations/index.js +634 -121
- package/dist/graphql/operations/types.d.ts +9424 -5849
- package/dist/models/common/dispense-request.d.ts +67 -0
- package/dist/models/common/dispense-request.js +1 -0
- package/dist/models/common/dosage.d.ts +68 -0
- package/dist/models/common/dosage.js +1 -0
- package/dist/models/common/index.d.ts +4 -0
- package/dist/models/common/medication.d.ts +42 -0
- package/dist/models/common/medication.js +1 -0
- package/dist/models/health-data/diagnostic-report.d.ts +82 -0
- package/dist/models/health-data/diagnostic-report.js +1 -0
- package/dist/models/health-data/index.d.ts +3 -0
- package/dist/models/health-data/medication-dispense.d.ts +108 -0
- package/dist/models/health-data/medication-dispense.js +1 -0
- package/dist/models/health-data/medication-request.d.ts +107 -0
- package/dist/models/health-data/medication-request.js +1 -0
- package/package.json +1 -1
package/dist/__version__.d.ts
CHANGED
package/dist/__version__.js
CHANGED
|
@@ -233,12 +233,17 @@ export declare class VitalSignGroupsRequest extends PagedRequest {
|
|
|
233
233
|
export declare class DiagnosticReportLabGroupsRequest extends PagedRequest {
|
|
234
234
|
}
|
|
235
235
|
/**
|
|
236
|
+
* Request object for fetching MedicationDispense data.
|
|
237
|
+
* @category Requests
|
|
238
|
+
* @title MedicationDispenseRequest
|
|
239
|
+
* @excerpt Request object for fetching MedicationDispense data
|
|
236
240
|
*/
|
|
237
241
|
type MedicationDispenseRequestInput = PagedRequestInput & {
|
|
238
242
|
prescription?: string[];
|
|
239
243
|
ids?: string[];
|
|
240
244
|
lastUpdated?: SearchDate;
|
|
241
|
-
|
|
245
|
+
status?: SearchToken;
|
|
246
|
+
sort?: FieldSortOrder[];
|
|
242
247
|
};
|
|
243
248
|
/**
|
|
244
249
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AllergyIntoleranceBundle, AllergyIntoleranceGroupBundle, CarePlanBundle, CarePlanGroupBundle, CareTeamBundle, ConditionBundle, ConditionGroupBundle, DiagnosticReportLabGroupBundle, EncounterBundle, EncounterGroupBundle, HealthSummary, ImmunizationBundle, ImmunizationGroupBundle, LabGroupBundle, MedicationGroupBundle, ProcedureBundle, ProcedureGroupBundle, VitalSignBundle, VitalSignGroupBundle } from "../../../models/health-data/index.js";
|
|
1
|
+
import type { AllergyIntoleranceBundle, AllergyIntoleranceGroupBundle, CarePlanBundle, CarePlanGroupBundle, CareTeamBundle, ConditionBundle, ConditionGroupBundle, DiagnosticReportBundle, DiagnosticReportLabGroupBundle, EncounterBundle, EncounterGroupBundle, HealthSummary, ImmunizationBundle, ImmunizationGroupBundle, LabGroupBundle, MedicationDispenseBundle, MedicationGroupBundle, MedicationRequestBundle, ProcedureBundle, ProcedureGroupBundle, VitalSignBundle, VitalSignGroupBundle } from "../../../models/health-data/index.js";
|
|
2
2
|
import type { BWellQueryResult } from "../../../results/index.js";
|
|
3
3
|
import type { BaseManagerError } from "../errors.js";
|
|
4
|
-
import type { AllergyIntoleranceGroupsRequest, CarePlanGroupsRequest, ConditionGroupsRequest, DiagnosticReportLabGroupsRequest, EncounterGroupsRequest, HealthDataRequest, ImmunizationGroupsRequest, LabGroupsRequest, MedicationGroupsRequest, ProcedureGroupsRequest, VitalSignGroupsRequest } from "./health-data-request.js";
|
|
4
|
+
import type { AllergyIntoleranceGroupsRequest, CarePlanGroupsRequest, ConditionGroupsRequest, DiagnosticReportLabGroupsRequest, EncounterGroupsRequest, HealthDataRequest, ImmunizationGroupsRequest, LabGroupsRequest, MedicationDispenseRequest, MedicationGroupsRequest, ProcedureGroupsRequest, VitalSignGroupsRequest } from "./health-data-request.js";
|
|
5
5
|
/**
|
|
6
6
|
* Health Manager for patient health records and clinical data access.
|
|
7
7
|
* Provides methods for retrieving health care records including conditions, medications,
|
|
@@ -261,6 +261,19 @@ export interface HealthManager {
|
|
|
261
261
|
* ```
|
|
262
262
|
*/
|
|
263
263
|
getMedicationGroups(request: MedicationGroupsRequest): Promise<BWellQueryResult<MedicationGroupBundle, BaseManagerError>>;
|
|
264
|
+
/**
|
|
265
|
+
* Retrieves a list of diagnostic report resources.
|
|
266
|
+
*
|
|
267
|
+
* @param {HealthDataRequest} request - Optional request class instance for specifying the search criteria
|
|
268
|
+
*
|
|
269
|
+
* @returns {Promise<BWellQueryResult<DiagnosticReportBundle>>} A promise resolving to an object representing the list of diagnostic reports retrieved.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* ```typescript
|
|
273
|
+
* const diagnosticReports = await sdk.health.getDiagnosticReports();
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
getDiagnosticReports(request?: HealthDataRequest): Promise<BWellQueryResult<DiagnosticReportBundle, BaseManagerError>>;
|
|
264
277
|
/**
|
|
265
278
|
* Retrieves a list of diagnostic report lab groups resources.
|
|
266
279
|
*
|
|
@@ -292,4 +305,29 @@ export interface HealthManager {
|
|
|
292
305
|
* ```
|
|
293
306
|
*/
|
|
294
307
|
getCareTeams(request?: HealthDataRequest): Promise<BWellQueryResult<CareTeamBundle, BaseManagerError>>;
|
|
308
|
+
/**
|
|
309
|
+
* Retrieves a list of medication dispense resources.
|
|
310
|
+
*
|
|
311
|
+
* @param request - Optional request class instance for specifying the search criteria
|
|
312
|
+
* @returns {Promise<BWellQueryResult<MedicationDispenseBundle>>} A promise resolving to an object representing the list of medication dispenses.
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```typescript
|
|
316
|
+
* const medicationDispenses = await sdk.health.getMedicationDispenses();
|
|
317
|
+
* ```
|
|
318
|
+
*/
|
|
319
|
+
getMedicationDispenses(request?: MedicationDispenseRequest): Promise<BWellQueryResult<MedicationDispenseBundle, BaseManagerError>>;
|
|
320
|
+
/**
|
|
321
|
+
* Retrieves a list of medication request resources.
|
|
322
|
+
*
|
|
323
|
+
* @param {HealthDataRequest} request - Optional request class instance for specifying the search criteria
|
|
324
|
+
*
|
|
325
|
+
* @returns {Promise<BWellQueryResult<MedicationRequestBundle>>} A promise resolving to an object representing the list of medication requests retrieved.
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* ```typescript
|
|
329
|
+
* const medicationRequests = await sdk.health.getMedicationRequests();
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
getMedicationRequests(request?: HealthDataRequest): Promise<BWellQueryResult<MedicationRequestBundle, BaseManagerError>>;
|
|
295
333
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { GetMedicationDispensesQueryVariables } from "../../../graphql/operations/types.js";
|
|
2
|
+
import { RequestFactory } from "../../../requests/request.js";
|
|
3
|
+
import { MedicationDispenseRequest } from "../../base/index.js";
|
|
4
|
+
export declare class GetMedicationDispensesRequestFactory implements RequestFactory<MedicationDispenseRequest, GetMedicationDispensesQueryVariables> {
|
|
5
|
+
create(request: MedicationDispenseRequest): GetMedicationDispensesQueryVariables;
|
|
6
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isNotNullOrUndefined, isNotNullOrUndefinedOrEmptyString, } from "../../../utils/type-utils.js";
|
|
2
|
+
import { toSortString } from "./health-data-request-factory.js";
|
|
3
|
+
export class GetMedicationDispensesRequestFactory {
|
|
4
|
+
create(request) {
|
|
5
|
+
var _a, _b, _c, _d;
|
|
6
|
+
const input = request.data();
|
|
7
|
+
let prescription = null;
|
|
8
|
+
if (isNotNullOrUndefined(input.prescription)) {
|
|
9
|
+
const filtered = input.prescription.filter((p) => isNotNullOrUndefinedOrEmptyString(p));
|
|
10
|
+
if (filtered.length > 0) {
|
|
11
|
+
prescription = filtered.join(",");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
id: input.ids ? { values: input.ids } : null,
|
|
16
|
+
page: input.page,
|
|
17
|
+
pageSize: input.pageSize,
|
|
18
|
+
prescription: prescription ? { value: prescription } : null,
|
|
19
|
+
lastUpdated: (_a = input.lastUpdated) !== null && _a !== void 0 ? _a : null,
|
|
20
|
+
sort: (_c = (_b = input.sort) === null || _b === void 0 ? void 0 : _b.map((sort) => toSortString(sort))) !== null && _c !== void 0 ? _c : null,
|
|
21
|
+
status: (_d = input.status) !== null && _d !== void 0 ? _d : null,
|
|
22
|
+
total: "accurate",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ValidationError } from "../../../errors/index.js";
|
|
2
2
|
import { LoggerProvider } from "../../../logger/index.js";
|
|
3
|
-
import type { AllergyIntoleranceBundle, AllergyIntoleranceGroupBundle, CarePlanBundle, CarePlanGroupBundle, CareTeamBundle, ConditionBundle, ConditionGroupBundle, DiagnosticReportLabGroupBundle, EncounterBundle, EncounterGroupBundle, HealthSummary, ImmunizationBundle, ImmunizationGroupBundle, LabGroupBundle, MedicationGroupBundle, ProcedureBundle, ProcedureGroupBundle, VitalSignBundle, VitalSignGroupBundle } from "../../../models/health-data/index.js";
|
|
3
|
+
import type { AllergyIntoleranceBundle, AllergyIntoleranceGroupBundle, CarePlanBundle, CarePlanGroupBundle, CareTeamBundle, ConditionBundle, ConditionGroupBundle, DiagnosticReportBundle, DiagnosticReportLabGroupBundle, EncounterBundle, EncounterGroupBundle, HealthSummary, ImmunizationBundle, ImmunizationGroupBundle, LabGroupBundle, MedicationDispenseBundle, MedicationGroupBundle, MedicationRequestBundle, ProcedureBundle, ProcedureGroupBundle, VitalSignBundle, VitalSignGroupBundle } from "../../../models/health-data/index.js";
|
|
4
4
|
import { BWellQueryResult } from "../../../results/index.js";
|
|
5
5
|
import { BaseManagerError } from "../../base/errors.js";
|
|
6
6
|
import * as health from "../../base/health-data/index.js";
|
|
@@ -29,4 +29,7 @@ export declare class GraphQLHealthManager extends GraphQLManager implements Heal
|
|
|
29
29
|
getMedicationGroups(request?: health.MedicationGroupsRequest): Promise<BWellQueryResult<MedicationGroupBundle, ValidationError | BaseManagerError>>;
|
|
30
30
|
getDiagnosticReportLabGroups(request?: health.DiagnosticReportLabGroupsRequest): Promise<BWellQueryResult<DiagnosticReportLabGroupBundle, ValidationError | BaseManagerError>>;
|
|
31
31
|
getCareTeams(request?: health.HealthDataRequest): Promise<BWellQueryResult<CareTeamBundle, BaseManagerError>>;
|
|
32
|
+
getMedicationDispenses(request?: health.MedicationDispenseRequest): Promise<BWellQueryResult<MedicationDispenseBundle, BaseManagerError>>;
|
|
33
|
+
getMedicationRequests(request?: health.HealthDataRequest): Promise<BWellQueryResult<MedicationRequestBundle, BaseManagerError>>;
|
|
34
|
+
getDiagnosticReports(request?: health.HealthDataRequest): Promise<BWellQueryResult<DiagnosticReportBundle, BaseManagerError>>;
|
|
32
35
|
}
|
|
@@ -18,11 +18,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
18
18
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
19
19
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
20
|
};
|
|
21
|
-
var _GraphQLHealthManager_sdk, _GraphQLHealthManager_logger, _GraphQLHealthManager_healthDataRequestFactory, _GraphQLHealthManager_getEncountersRequestFactory;
|
|
21
|
+
var _GraphQLHealthManager_sdk, _GraphQLHealthManager_logger, _GraphQLHealthManager_healthDataRequestFactory, _GraphQLHealthManager_getEncountersRequestFactory, _GraphQLHealthManager_getMedicationDispenseRequestFactory;
|
|
22
22
|
import { ConsoleLoggerProvider, } from "../../../logger/index.js";
|
|
23
23
|
import { BWellQueryResult } from "../../../results/index.js";
|
|
24
24
|
import { GraphQLManager } from "../graphql-manager/index.js";
|
|
25
25
|
import { GetEncountersRequestFactory } from "./get-encounters-request-factory.js";
|
|
26
|
+
import { GetMedicationDispensesRequestFactory } from "./get-medication-dispenses-request-factory.js";
|
|
26
27
|
import { HealthDataRequestFactory, } from "./health-data-request-factory.js";
|
|
27
28
|
export class GraphQLHealthManager extends GraphQLManager {
|
|
28
29
|
constructor(sdk, loggerProvider = new ConsoleLoggerProvider()) {
|
|
@@ -31,6 +32,7 @@ export class GraphQLHealthManager extends GraphQLManager {
|
|
|
31
32
|
_GraphQLHealthManager_logger.set(this, void 0);
|
|
32
33
|
_GraphQLHealthManager_healthDataRequestFactory.set(this, new HealthDataRequestFactory());
|
|
33
34
|
_GraphQLHealthManager_getEncountersRequestFactory.set(this, new GetEncountersRequestFactory());
|
|
35
|
+
_GraphQLHealthManager_getMedicationDispenseRequestFactory.set(this, new GetMedicationDispensesRequestFactory());
|
|
34
36
|
__classPrivateFieldSet(this, _GraphQLHealthManager_sdk, sdk, "f");
|
|
35
37
|
__classPrivateFieldSet(this, _GraphQLHealthManager_logger, loggerProvider.getLogger("GraphQLHealthManager"), "f");
|
|
36
38
|
}
|
|
@@ -389,5 +391,65 @@ export class GraphQLHealthManager extends GraphQLManager {
|
|
|
389
391
|
return new BWellQueryResult((_a = result.data) === null || _a === void 0 ? void 0 : _a.careTeams, result.error);
|
|
390
392
|
});
|
|
391
393
|
}
|
|
394
|
+
getMedicationDispenses(request) {
|
|
395
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
396
|
+
var _a;
|
|
397
|
+
const validationResult = this.validateRequest(request);
|
|
398
|
+
if (validationResult.failure()) {
|
|
399
|
+
return validationResult.toQueryResult();
|
|
400
|
+
}
|
|
401
|
+
let gqlRequest;
|
|
402
|
+
if (request !== undefined) {
|
|
403
|
+
gqlRequest = __classPrivateFieldGet(this, _GraphQLHealthManager_getMedicationDispenseRequestFactory, "f").create(request);
|
|
404
|
+
}
|
|
405
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").verbose("calling getMedicationDispenses...");
|
|
406
|
+
const result = yield this.handleQuery(__classPrivateFieldGet(this, _GraphQLHealthManager_sdk, "f").getMedicationDispenses(gqlRequest));
|
|
407
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").verbose("getMedicationDispenses complete");
|
|
408
|
+
if (result.hasError()) {
|
|
409
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").error("getMedicationDispenses errors", result.error);
|
|
410
|
+
}
|
|
411
|
+
return new BWellQueryResult((_a = result.data) === null || _a === void 0 ? void 0 : _a.medicationDispenses, result.error);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
getMedicationRequests(request) {
|
|
415
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
+
var _a;
|
|
417
|
+
const validationResult = this.validateRequest(request);
|
|
418
|
+
if (validationResult.failure()) {
|
|
419
|
+
return validationResult.toQueryResult();
|
|
420
|
+
}
|
|
421
|
+
let gqlRequest;
|
|
422
|
+
if (request !== undefined) {
|
|
423
|
+
gqlRequest = __classPrivateFieldGet(this, _GraphQLHealthManager_healthDataRequestFactory, "f").create(request);
|
|
424
|
+
}
|
|
425
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").verbose("calling getMedicationRequests...");
|
|
426
|
+
const result = yield this.handleQuery(__classPrivateFieldGet(this, _GraphQLHealthManager_sdk, "f").getMedicationRequest(gqlRequest));
|
|
427
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").verbose("getMedicationRequests complete");
|
|
428
|
+
if (result.hasError()) {
|
|
429
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").error("getMedicationRequests errors", result.error);
|
|
430
|
+
}
|
|
431
|
+
return new BWellQueryResult((_a = result.data) === null || _a === void 0 ? void 0 : _a.medicationRequests, result.error);
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
getDiagnosticReports(request) {
|
|
435
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
436
|
+
var _a;
|
|
437
|
+
const validationResult = this.validateRequest(request);
|
|
438
|
+
if (validationResult.failure()) {
|
|
439
|
+
return validationResult.toQueryResult();
|
|
440
|
+
}
|
|
441
|
+
let gqlRequest;
|
|
442
|
+
if (request !== undefined) {
|
|
443
|
+
gqlRequest = __classPrivateFieldGet(this, _GraphQLHealthManager_healthDataRequestFactory, "f").create(request);
|
|
444
|
+
}
|
|
445
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").verbose("calling getDiagnosticReports...");
|
|
446
|
+
const result = yield this.handleQuery(__classPrivateFieldGet(this, _GraphQLHealthManager_sdk, "f").getDiagnosticReports(gqlRequest));
|
|
447
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").verbose("getDiagnosticReports complete");
|
|
448
|
+
if (result.hasError()) {
|
|
449
|
+
__classPrivateFieldGet(this, _GraphQLHealthManager_logger, "f").error("getDiagnosticReports errors", result.error);
|
|
450
|
+
}
|
|
451
|
+
return new BWellQueryResult((_a = result.data) === null || _a === void 0 ? void 0 : _a.diagnosticReports, result.error);
|
|
452
|
+
});
|
|
453
|
+
}
|
|
392
454
|
}
|
|
393
|
-
_GraphQLHealthManager_sdk = new WeakMap(), _GraphQLHealthManager_logger = new WeakMap(), _GraphQLHealthManager_healthDataRequestFactory = new WeakMap(), _GraphQLHealthManager_getEncountersRequestFactory = new WeakMap();
|
|
455
|
+
_GraphQLHealthManager_sdk = new WeakMap(), _GraphQLHealthManager_logger = new WeakMap(), _GraphQLHealthManager_healthDataRequestFactory = new WeakMap(), _GraphQLHealthManager_getEncountersRequestFactory = new WeakMap(), _GraphQLHealthManager_getMedicationDispenseRequestFactory = new WeakMap();
|