@ovok/core 0.3.6 → 0.3.8
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/README.md +35 -0
- package/dist/client/carehub/methods.d.ts +71 -0
- package/dist/client/carehub/methods.js +205 -0
- package/dist/client/carehub/types.d.ts +312 -0
- package/dist/client/carehub/types.js +2 -0
- package/dist/client/ovok-client.d.ts +2 -1
- package/dist/client/ovok-client.js +2 -0
- package/dist/conformance/api-requirements.js +48 -0
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/hooks/api-hooks.d.ts +39 -0
- package/dist/hooks/api-hooks.js +179 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +14 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ Core TypeScript SDK for healthcare applications. Provides authentication, AI-FHI
|
|
|
16
16
|
- 📥 Opt-in durable offline measurement queue with idempotent retries
|
|
17
17
|
- 🧭 Runtime discovery of the backend FHIR and public API capabilities
|
|
18
18
|
- 🧩 Typed accounts, projects, localization, and patient-observation APIs
|
|
19
|
+
- 🏥 Typed CareHub patient, device, telemetry, notification, and monitoring APIs
|
|
19
20
|
|
|
20
21
|
## Installation
|
|
21
22
|
|
|
@@ -72,6 +73,40 @@ const locales = await client.getLocales();
|
|
|
72
73
|
All methods preserve the backend HTTP verbs and return the backend response shapes. Billing is
|
|
73
74
|
not included until Ovok publishes a supported billing contract.
|
|
74
75
|
|
|
76
|
+
## CareHub APIs
|
|
77
|
+
|
|
78
|
+
CareHub methods cover the verified `/v1/carehub/*` and `/v2/carehub/*` application routes for
|
|
79
|
+
patients, devices, telemetry, notifications, thresholds, trends, sleep, locations, zones, and
|
|
80
|
+
PDF export. These routes require the backend's bearer session and CareHub permissions.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const residents = await client.listCarehubPatients({ residentState: "active" });
|
|
84
|
+
const devices = await client.listCarehubDevices({ active: true });
|
|
85
|
+
const telemetry = await client.getCarehubDeviceTelemetry(deviceId);
|
|
86
|
+
const alerts = await client.listCarehubMedicalNotifications({ count: 25 });
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
CareHub is intentionally represented as typed application APIs rather than changing the FHIR
|
|
90
|
+
observation save/offline behavior used by native integrations.
|
|
91
|
+
|
|
92
|
+
## React hooks
|
|
93
|
+
|
|
94
|
+
The package exports additive hooks for capability discovery, project configuration, CareHub lists,
|
|
95
|
+
telemetry, and notifications. Every request hook returns `data`, `loading`, `error`, and `reload`.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
const { data: patients, loading, error } = useCarehubPatients({
|
|
99
|
+
residentState: "active",
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const saveSettings = useOvokMutation((client, settings: OvokProjectSettings) =>
|
|
103
|
+
client.updateProjectSetting("PATIENT_LOGIN_ENABLED", settings.settings.PATIENT_LOGIN_ENABLED),
|
|
104
|
+
);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Hooks are additive to the existing `OvokProvider`, observation hooks, auth methods, and offline
|
|
108
|
+
queue. Billing remains outside the SDK contract.
|
|
109
|
+
|
|
75
110
|
## Offline measurements
|
|
76
111
|
|
|
77
112
|
Pass a durable Medplum storage adapter and opt in to queue measurements while offline:
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Bundle, Resource } from "@medplum/fhirtypes";
|
|
2
|
+
import { OvokClient } from "../ovok-client";
|
|
3
|
+
import { CarehubAssignDevice, CarehubCreateDevice, CarehubCreateLocation, CarehubCreatePatient, CarehubDevice, CarehubDeviceListItem, CarehubDeviceListQuery, CarehubDeviceTelemetry, CarehubExportPdf, CarehubExportPdfRequest, CarehubLiveQuery, CarehubLiveTelemetry, CarehubLocation, CarehubLocationQuery, CarehubNotification, CarehubNotificationsQuery, CarehubNotificationsResponse, CarehubObservationIds, CarehubPage, CarehubPatient, CarehubPatientListItem, CarehubPatientListQuery, CarehubRecentNotificationsResponse, CarehubSleepStatistics, CarehubThreshold, CarehubTrends, CarehubUpdateDevice, CarehubUpdateLocation, CarehubUpdatePatient, CarehubZone, CarehubZoneDetail } from "./types";
|
|
4
|
+
export declare function listCarehubPatients(this: OvokClient, params?: CarehubPatientListQuery): Promise<CarehubPage<CarehubPatientListItem>>;
|
|
5
|
+
export declare function getCarehubPatient(this: OvokClient, patientId: string): Promise<CarehubPatient>;
|
|
6
|
+
export declare function getCarehubPatientEverything(this: OvokClient, patientId: string): Promise<Bundle<Resource>>;
|
|
7
|
+
export declare function getCarehubPatientCurrentVitals(this: OvokClient, patientId: string): Promise<Record<string, unknown>>;
|
|
8
|
+
export declare function createCarehubPatient(this: OvokClient, body: CarehubCreatePatient): Promise<CarehubPatient>;
|
|
9
|
+
export declare function updateCarehubPatient(this: OvokClient, patientId: string, body: CarehubUpdatePatient): Promise<CarehubPatient>;
|
|
10
|
+
export declare function deleteCarehubPatient(this: OvokClient, patientId: string): Promise<void>;
|
|
11
|
+
export declare function listCarehubDevices(this: OvokClient, params?: CarehubDeviceListQuery): Promise<CarehubPage<CarehubDeviceListItem>>;
|
|
12
|
+
export declare function getCarehubDevice(this: OvokClient, deviceId: string): Promise<CarehubDevice>;
|
|
13
|
+
export declare function createCarehubDevice(this: OvokClient, body: CarehubCreateDevice): Promise<CarehubDevice>;
|
|
14
|
+
export declare function updateCarehubDevice(this: OvokClient, deviceId: string, body: CarehubUpdateDevice): Promise<CarehubDevice>;
|
|
15
|
+
export declare function deleteCarehubDevice(this: OvokClient, deviceId: string): Promise<void>;
|
|
16
|
+
export declare function assignCarehubDeviceToProject(this: OvokClient, body: CarehubAssignDevice): Promise<CarehubDevice>;
|
|
17
|
+
export declare function listCarehubLiveDevices(this: OvokClient, params?: CarehubLiveQuery): Promise<CarehubPage<Record<string, unknown>>>;
|
|
18
|
+
export declare function listCarehubLiveTelemetry(this: OvokClient, params?: CarehubLiveQuery): Promise<CarehubLiveTelemetry>;
|
|
19
|
+
export declare function getCarehubDeviceSleepStatus(this: OvokClient, deviceId: string): Promise<Record<string, unknown>>;
|
|
20
|
+
export declare function getCarehubDeviceTelemetry(this: OvokClient, deviceId: string): Promise<CarehubDeviceTelemetry>;
|
|
21
|
+
export declare function listCarehubEffectiveObservationIds(this: OvokClient): Promise<Record<string, CarehubObservationIds>>;
|
|
22
|
+
export declare function listCarehubLastObservationIds(this: OvokClient): Promise<Record<string, CarehubObservationIds>>;
|
|
23
|
+
export declare function getCarehubDeviceEffectiveObservationIds(this: OvokClient, deviceId: string): Promise<Omit<CarehubObservationIds, "batch">>;
|
|
24
|
+
export declare function getCarehubDeviceLastObservationIds(this: OvokClient, deviceId: string): Promise<CarehubObservationIds>;
|
|
25
|
+
export declare function listCarehubNotifications(this: OvokClient, params?: CarehubNotificationsQuery): Promise<CarehubNotificationsResponse>;
|
|
26
|
+
export declare function getRecentCarehubNotifications(this: OvokClient, count?: number): Promise<CarehubRecentNotificationsResponse>;
|
|
27
|
+
export declare function listCarehubOutOfBedNotifications(this: OvokClient, params?: Omit<CarehubNotificationsQuery, "type">): Promise<CarehubNotificationsResponse>;
|
|
28
|
+
export declare function listCarehubMedicalNotifications(this: OvokClient, params?: CarehubNotificationsQuery): Promise<CarehubNotificationsResponse>;
|
|
29
|
+
export declare function getRecentCarehubMedicalNotifications(this: OvokClient, count?: number): Promise<CarehubRecentNotificationsResponse>;
|
|
30
|
+
export declare function getCarehubMedicalNotification(this: OvokClient, episodeId: string): Promise<CarehubNotification>;
|
|
31
|
+
export declare function acknowledgeCarehubMedicalNotification(this: OvokClient, episodeId: string): Promise<CarehubNotification>;
|
|
32
|
+
export declare function acknowledgeCarehubNotification(this: OvokClient, notificationId: string): Promise<CarehubNotification>;
|
|
33
|
+
export declare function getCarehubThreshold(this: OvokClient): Promise<CarehubThreshold>;
|
|
34
|
+
export declare function updateCarehubThreshold(this: OvokClient, body: Record<string, unknown>): Promise<CarehubThreshold>;
|
|
35
|
+
export declare function getCarehubPatientThreshold(this: OvokClient, patientId: string): Promise<Record<string, unknown>>;
|
|
36
|
+
export declare function updateCarehubPatientThreshold(this: OvokClient, patientId: string, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
37
|
+
export declare function getCarehubThresholdV2(this: OvokClient): Promise<Record<string, unknown>>;
|
|
38
|
+
export declare function updateCarehubThresholdV2(this: OvokClient, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
39
|
+
export declare function getCarehubPatientThresholdV2(this: OvokClient, patientId: string): Promise<Record<string, unknown>>;
|
|
40
|
+
export declare function updateCarehubPatientThresholdV2(this: OvokClient, patientId: string, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
41
|
+
export declare function getCarehubTrends(this: OvokClient, params: {
|
|
42
|
+
patientId: string;
|
|
43
|
+
startDate: string;
|
|
44
|
+
endDate: string;
|
|
45
|
+
graphType: string;
|
|
46
|
+
}): Promise<CarehubTrends>;
|
|
47
|
+
export declare function getCarehubSleepStatistics(this: OvokClient, params: {
|
|
48
|
+
endDate: string;
|
|
49
|
+
lastDayCount?: number;
|
|
50
|
+
patientId: string;
|
|
51
|
+
}): Promise<CarehubSleepStatistics>;
|
|
52
|
+
export declare function listCarehubLocations(this: OvokClient, params?: CarehubLocationQuery): Promise<CarehubPage<CarehubLocation>>;
|
|
53
|
+
export declare function getCarehubLocation(this: OvokClient, locationId: string): Promise<CarehubLocation>;
|
|
54
|
+
export declare function createCarehubLocation(this: OvokClient, body: CarehubCreateLocation): Promise<CarehubLocation>;
|
|
55
|
+
export declare function updateCarehubLocation(this: OvokClient, locationId: string, body: CarehubUpdateLocation): Promise<CarehubLocation>;
|
|
56
|
+
export declare function deleteCarehubLocation(this: OvokClient, locationId: string): Promise<void>;
|
|
57
|
+
export declare function listCarehubZones(this: OvokClient, params?: {
|
|
58
|
+
page?: number;
|
|
59
|
+
count?: number;
|
|
60
|
+
sortBy?: string;
|
|
61
|
+
orderBy?: "ASC" | "DESC";
|
|
62
|
+
search?: string;
|
|
63
|
+
}): Promise<CarehubPage<CarehubZone>>;
|
|
64
|
+
export declare function getCarehubZone(this: OvokClient, zoneId: string): Promise<CarehubZoneDetail>;
|
|
65
|
+
export declare function getCarehubZoneDeviceCounts(this: OvokClient, params?: {
|
|
66
|
+
all?: boolean;
|
|
67
|
+
effectiveSleepStatus?: string;
|
|
68
|
+
includeUnassigned?: boolean;
|
|
69
|
+
includeEmpty?: boolean;
|
|
70
|
+
}): Promise<Record<string, unknown>>;
|
|
71
|
+
export declare function exportCarehubPatientPdf(this: OvokClient, body: CarehubExportPdfRequest): Promise<CarehubExportPdf>;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listCarehubPatients = listCarehubPatients;
|
|
4
|
+
exports.getCarehubPatient = getCarehubPatient;
|
|
5
|
+
exports.getCarehubPatientEverything = getCarehubPatientEverything;
|
|
6
|
+
exports.getCarehubPatientCurrentVitals = getCarehubPatientCurrentVitals;
|
|
7
|
+
exports.createCarehubPatient = createCarehubPatient;
|
|
8
|
+
exports.updateCarehubPatient = updateCarehubPatient;
|
|
9
|
+
exports.deleteCarehubPatient = deleteCarehubPatient;
|
|
10
|
+
exports.listCarehubDevices = listCarehubDevices;
|
|
11
|
+
exports.getCarehubDevice = getCarehubDevice;
|
|
12
|
+
exports.createCarehubDevice = createCarehubDevice;
|
|
13
|
+
exports.updateCarehubDevice = updateCarehubDevice;
|
|
14
|
+
exports.deleteCarehubDevice = deleteCarehubDevice;
|
|
15
|
+
exports.assignCarehubDeviceToProject = assignCarehubDeviceToProject;
|
|
16
|
+
exports.listCarehubLiveDevices = listCarehubLiveDevices;
|
|
17
|
+
exports.listCarehubLiveTelemetry = listCarehubLiveTelemetry;
|
|
18
|
+
exports.getCarehubDeviceSleepStatus = getCarehubDeviceSleepStatus;
|
|
19
|
+
exports.getCarehubDeviceTelemetry = getCarehubDeviceTelemetry;
|
|
20
|
+
exports.listCarehubEffectiveObservationIds = listCarehubEffectiveObservationIds;
|
|
21
|
+
exports.listCarehubLastObservationIds = listCarehubLastObservationIds;
|
|
22
|
+
exports.getCarehubDeviceEffectiveObservationIds = getCarehubDeviceEffectiveObservationIds;
|
|
23
|
+
exports.getCarehubDeviceLastObservationIds = getCarehubDeviceLastObservationIds;
|
|
24
|
+
exports.listCarehubNotifications = listCarehubNotifications;
|
|
25
|
+
exports.getRecentCarehubNotifications = getRecentCarehubNotifications;
|
|
26
|
+
exports.listCarehubOutOfBedNotifications = listCarehubOutOfBedNotifications;
|
|
27
|
+
exports.listCarehubMedicalNotifications = listCarehubMedicalNotifications;
|
|
28
|
+
exports.getRecentCarehubMedicalNotifications = getRecentCarehubMedicalNotifications;
|
|
29
|
+
exports.getCarehubMedicalNotification = getCarehubMedicalNotification;
|
|
30
|
+
exports.acknowledgeCarehubMedicalNotification = acknowledgeCarehubMedicalNotification;
|
|
31
|
+
exports.acknowledgeCarehubNotification = acknowledgeCarehubNotification;
|
|
32
|
+
exports.getCarehubThreshold = getCarehubThreshold;
|
|
33
|
+
exports.updateCarehubThreshold = updateCarehubThreshold;
|
|
34
|
+
exports.getCarehubPatientThreshold = getCarehubPatientThreshold;
|
|
35
|
+
exports.updateCarehubPatientThreshold = updateCarehubPatientThreshold;
|
|
36
|
+
exports.getCarehubThresholdV2 = getCarehubThresholdV2;
|
|
37
|
+
exports.updateCarehubThresholdV2 = updateCarehubThresholdV2;
|
|
38
|
+
exports.getCarehubPatientThresholdV2 = getCarehubPatientThresholdV2;
|
|
39
|
+
exports.updateCarehubPatientThresholdV2 = updateCarehubPatientThresholdV2;
|
|
40
|
+
exports.getCarehubTrends = getCarehubTrends;
|
|
41
|
+
exports.getCarehubSleepStatistics = getCarehubSleepStatistics;
|
|
42
|
+
exports.listCarehubLocations = listCarehubLocations;
|
|
43
|
+
exports.getCarehubLocation = getCarehubLocation;
|
|
44
|
+
exports.createCarehubLocation = createCarehubLocation;
|
|
45
|
+
exports.updateCarehubLocation = updateCarehubLocation;
|
|
46
|
+
exports.deleteCarehubLocation = deleteCarehubLocation;
|
|
47
|
+
exports.listCarehubZones = listCarehubZones;
|
|
48
|
+
exports.getCarehubZone = getCarehubZone;
|
|
49
|
+
exports.getCarehubZoneDeviceCounts = getCarehubZoneDeviceCounts;
|
|
50
|
+
exports.exportCarehubPatientPdf = exportCarehubPatientPdf;
|
|
51
|
+
const query = (params) => {
|
|
52
|
+
const values = new URLSearchParams();
|
|
53
|
+
for (const [key, value] of Object.entries(params)) {
|
|
54
|
+
if (value !== undefined) {
|
|
55
|
+
values.set(key, String(value));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const encoded = values.toString();
|
|
59
|
+
return encoded === "" ? "" : `?${encoded}`;
|
|
60
|
+
};
|
|
61
|
+
const segment = (value) => encodeURIComponent(value);
|
|
62
|
+
async function listCarehubPatients(params = {}) {
|
|
63
|
+
return this.get(`/v1/carehub/patient${query(params)}`);
|
|
64
|
+
}
|
|
65
|
+
async function getCarehubPatient(patientId) {
|
|
66
|
+
return this.get(`/v1/carehub/patient/${segment(patientId)}`);
|
|
67
|
+
}
|
|
68
|
+
async function getCarehubPatientEverything(patientId) {
|
|
69
|
+
return this.get(`/v1/carehub/patient/${segment(patientId)}/$everything`);
|
|
70
|
+
}
|
|
71
|
+
async function getCarehubPatientCurrentVitals(patientId) {
|
|
72
|
+
return this.get(`/v1/carehub/patient/${segment(patientId)}/current-vitals`);
|
|
73
|
+
}
|
|
74
|
+
async function createCarehubPatient(body) {
|
|
75
|
+
return this.post("/v1/carehub/patient", body);
|
|
76
|
+
}
|
|
77
|
+
async function updateCarehubPatient(patientId, body) {
|
|
78
|
+
return (await this.put(`/v1/carehub/patient/${segment(patientId)}`, body));
|
|
79
|
+
}
|
|
80
|
+
async function deleteCarehubPatient(patientId) {
|
|
81
|
+
await this.delete(`/v1/carehub/patient/${segment(patientId)}`);
|
|
82
|
+
}
|
|
83
|
+
async function listCarehubDevices(params = {}) {
|
|
84
|
+
return this.get(`/v1/carehub/device${query(params)}`);
|
|
85
|
+
}
|
|
86
|
+
async function getCarehubDevice(deviceId) {
|
|
87
|
+
return this.get(`/v1/carehub/device/${segment(deviceId)}`);
|
|
88
|
+
}
|
|
89
|
+
async function createCarehubDevice(body) {
|
|
90
|
+
return this.post("/v1/carehub/device", body);
|
|
91
|
+
}
|
|
92
|
+
async function updateCarehubDevice(deviceId, body) {
|
|
93
|
+
return (await this.put(`/v1/carehub/device/${segment(deviceId)}`, body));
|
|
94
|
+
}
|
|
95
|
+
async function deleteCarehubDevice(deviceId) {
|
|
96
|
+
await this.delete(`/v1/carehub/device/${segment(deviceId)}`);
|
|
97
|
+
}
|
|
98
|
+
async function assignCarehubDeviceToProject(body) {
|
|
99
|
+
return (await this.put("/v1/carehub/device/assign/project", body));
|
|
100
|
+
}
|
|
101
|
+
async function listCarehubLiveDevices(params = {}) {
|
|
102
|
+
return this.get(`/v1/carehub/device/live${query(params)}`);
|
|
103
|
+
}
|
|
104
|
+
async function listCarehubLiveTelemetry(params = {}) {
|
|
105
|
+
return this.get(`/v1/carehub/device/live/telemetry${query(params)}`);
|
|
106
|
+
}
|
|
107
|
+
async function getCarehubDeviceSleepStatus(deviceId) {
|
|
108
|
+
return this.get(`/v1/carehub/device/live/cloudwatch/${segment(deviceId)}`);
|
|
109
|
+
}
|
|
110
|
+
async function getCarehubDeviceTelemetry(deviceId) {
|
|
111
|
+
return this.get(`/v1/carehub/telemetry/${segment(deviceId)}`);
|
|
112
|
+
}
|
|
113
|
+
async function listCarehubEffectiveObservationIds() {
|
|
114
|
+
return this.get("/v1/carehub/telemetry/effectiveIds");
|
|
115
|
+
}
|
|
116
|
+
async function listCarehubLastObservationIds() {
|
|
117
|
+
return this.get("/v1/carehub/telemetry/lastIds");
|
|
118
|
+
}
|
|
119
|
+
async function getCarehubDeviceEffectiveObservationIds(deviceId) {
|
|
120
|
+
return this.get(`/v1/carehub/telemetry/${segment(deviceId)}/effectiveIds`);
|
|
121
|
+
}
|
|
122
|
+
async function getCarehubDeviceLastObservationIds(deviceId) {
|
|
123
|
+
return this.get(`/v1/carehub/telemetry/${segment(deviceId)}/lastIds`);
|
|
124
|
+
}
|
|
125
|
+
async function listCarehubNotifications(params = {}) {
|
|
126
|
+
return this.get(`/v1/carehub/notifications${query(params)}`);
|
|
127
|
+
}
|
|
128
|
+
async function getRecentCarehubNotifications(count) {
|
|
129
|
+
return this.get(`/v1/carehub/notifications/recent${query({ count })}`);
|
|
130
|
+
}
|
|
131
|
+
async function listCarehubOutOfBedNotifications(params = {}) {
|
|
132
|
+
return this.get(`/v1/carehub/notifications/oob${query(params)}`);
|
|
133
|
+
}
|
|
134
|
+
async function listCarehubMedicalNotifications(params = {}) {
|
|
135
|
+
return this.get(`/v1/carehub/notifications/medical${query(params)}`);
|
|
136
|
+
}
|
|
137
|
+
async function getRecentCarehubMedicalNotifications(count) {
|
|
138
|
+
return this.get(`/v1/carehub/notifications/recent/medical${query({ count })}`);
|
|
139
|
+
}
|
|
140
|
+
async function getCarehubMedicalNotification(episodeId) {
|
|
141
|
+
return this.get(`/v1/carehub/notifications/medical/${segment(episodeId)}`);
|
|
142
|
+
}
|
|
143
|
+
async function acknowledgeCarehubMedicalNotification(episodeId) {
|
|
144
|
+
return this.post(`/v1/carehub/notifications/medical/${segment(episodeId)}/ack`);
|
|
145
|
+
}
|
|
146
|
+
async function acknowledgeCarehubNotification(notificationId) {
|
|
147
|
+
return (await this.patch(`/v1/carehub/notifications/${segment(notificationId)}/ack`, []));
|
|
148
|
+
}
|
|
149
|
+
async function getCarehubThreshold() {
|
|
150
|
+
return this.get("/v1/carehub/threshold");
|
|
151
|
+
}
|
|
152
|
+
async function updateCarehubThreshold(body) {
|
|
153
|
+
return (await this.put("/v1/carehub/threshold", body));
|
|
154
|
+
}
|
|
155
|
+
async function getCarehubPatientThreshold(patientId) {
|
|
156
|
+
return this.get(`/v1/carehub/threshold/patient/${segment(patientId)}`);
|
|
157
|
+
}
|
|
158
|
+
async function updateCarehubPatientThreshold(patientId, body) {
|
|
159
|
+
return (await this.put(`/v1/carehub/threshold/patient/${segment(patientId)}`, body));
|
|
160
|
+
}
|
|
161
|
+
async function getCarehubThresholdV2() {
|
|
162
|
+
return this.get("/v2/carehub/threshold");
|
|
163
|
+
}
|
|
164
|
+
async function updateCarehubThresholdV2(body) {
|
|
165
|
+
return (await this.put("/v2/carehub/threshold", body));
|
|
166
|
+
}
|
|
167
|
+
async function getCarehubPatientThresholdV2(patientId) {
|
|
168
|
+
return this.get(`/v2/carehub/threshold/patient/${segment(patientId)}`);
|
|
169
|
+
}
|
|
170
|
+
async function updateCarehubPatientThresholdV2(patientId, body) {
|
|
171
|
+
return (await this.put(`/v2/carehub/threshold/patient/${segment(patientId)}`, body));
|
|
172
|
+
}
|
|
173
|
+
async function getCarehubTrends(params) {
|
|
174
|
+
return this.get(`/v1/carehub/trends/graphs${query(params)}`);
|
|
175
|
+
}
|
|
176
|
+
async function getCarehubSleepStatistics(params) {
|
|
177
|
+
return this.get(`/v1/carehub/sleep/statistics${query(params)}`);
|
|
178
|
+
}
|
|
179
|
+
async function listCarehubLocations(params = {}) {
|
|
180
|
+
return this.get(`/v1/carehub/location${query(params)}`);
|
|
181
|
+
}
|
|
182
|
+
async function getCarehubLocation(locationId) {
|
|
183
|
+
return this.get(`/v1/carehub/location/${segment(locationId)}`);
|
|
184
|
+
}
|
|
185
|
+
async function createCarehubLocation(body) {
|
|
186
|
+
return this.post("/v1/carehub/location", body);
|
|
187
|
+
}
|
|
188
|
+
async function updateCarehubLocation(locationId, body) {
|
|
189
|
+
return (await this.put(`/v1/carehub/location/${segment(locationId)}`, body));
|
|
190
|
+
}
|
|
191
|
+
async function deleteCarehubLocation(locationId) {
|
|
192
|
+
await this.delete(`/v1/carehub/location/${segment(locationId)}`);
|
|
193
|
+
}
|
|
194
|
+
async function listCarehubZones(params = {}) {
|
|
195
|
+
return this.get(`/v1/carehub/zones${query(params)}`);
|
|
196
|
+
}
|
|
197
|
+
async function getCarehubZone(zoneId) {
|
|
198
|
+
return this.get(`/v1/carehub/zones/${segment(zoneId)}`);
|
|
199
|
+
}
|
|
200
|
+
async function getCarehubZoneDeviceCounts(params = {}) {
|
|
201
|
+
return this.get(`/v1/carehub/zones/device-counts${query(params)}`);
|
|
202
|
+
}
|
|
203
|
+
async function exportCarehubPatientPdf(body) {
|
|
204
|
+
return this.post("/v1/carehub/export/pdf", body);
|
|
205
|
+
}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
export type CarehubPage<T> = {
|
|
2
|
+
total: number;
|
|
3
|
+
page: number;
|
|
4
|
+
count: number;
|
|
5
|
+
resources: T[];
|
|
6
|
+
};
|
|
7
|
+
export type CarehubResidentState = "active" | "archived" | "discharged" | "discharged-recent";
|
|
8
|
+
export type CarehubHumanName = {
|
|
9
|
+
use: "official" | "nickname" | "maiden";
|
|
10
|
+
given?: string[];
|
|
11
|
+
family?: string;
|
|
12
|
+
};
|
|
13
|
+
export type CarehubPatient = {
|
|
14
|
+
id: string;
|
|
15
|
+
name: CarehubHumanName[];
|
|
16
|
+
gender?: "male" | "female" | "other" | "unknown";
|
|
17
|
+
birthDate?: string;
|
|
18
|
+
deviceId: string | null;
|
|
19
|
+
organizationId?: string;
|
|
20
|
+
locationId?: string;
|
|
21
|
+
floor?: string;
|
|
22
|
+
room?: string;
|
|
23
|
+
bed?: string;
|
|
24
|
+
residentState: CarehubResidentState;
|
|
25
|
+
admissionDate?: string;
|
|
26
|
+
dischargeDate?: string;
|
|
27
|
+
};
|
|
28
|
+
export type CarehubPatientListItem = {
|
|
29
|
+
id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
nickname: string | null;
|
|
32
|
+
residentState: CarehubResidentState;
|
|
33
|
+
admissionDate: string | null;
|
|
34
|
+
dischargeDate: string | null;
|
|
35
|
+
organizationId: string | null;
|
|
36
|
+
organizationName: string | null;
|
|
37
|
+
locationId: string | null;
|
|
38
|
+
locationName: string | null;
|
|
39
|
+
deviceId: string | null;
|
|
40
|
+
deviceName: string | null;
|
|
41
|
+
medicalSettings: string | null;
|
|
42
|
+
bedActivitySettings: string | null;
|
|
43
|
+
};
|
|
44
|
+
export type CarehubPatientListQuery = {
|
|
45
|
+
page?: number;
|
|
46
|
+
count?: number;
|
|
47
|
+
sortBy?: string;
|
|
48
|
+
orderBy?: "ASC" | "DESC";
|
|
49
|
+
search?: string;
|
|
50
|
+
residentState?: CarehubResidentState | "all";
|
|
51
|
+
includeDischargedRecent?: boolean;
|
|
52
|
+
organizationId?: string;
|
|
53
|
+
hasDevice?: boolean;
|
|
54
|
+
medicalSettings?: string;
|
|
55
|
+
bedActivitySettings?: string;
|
|
56
|
+
};
|
|
57
|
+
export type CarehubCreatePatient = {
|
|
58
|
+
name: CarehubHumanName[];
|
|
59
|
+
gender?: "male" | "female" | "other" | "unknown";
|
|
60
|
+
birthDate?: string;
|
|
61
|
+
deviceId?: string | null;
|
|
62
|
+
organizationId?: string;
|
|
63
|
+
locationId?: string;
|
|
64
|
+
admissionDate?: string;
|
|
65
|
+
};
|
|
66
|
+
export type CarehubUpdatePatient = Partial<CarehubCreatePatient> & {
|
|
67
|
+
residentState?: CarehubResidentState;
|
|
68
|
+
dischargeDate?: string;
|
|
69
|
+
};
|
|
70
|
+
export type CarehubDevice = {
|
|
71
|
+
name: string;
|
|
72
|
+
status?: "active" | "inactive" | "entered-in-error" | "unknown";
|
|
73
|
+
statusReason: Array<{
|
|
74
|
+
code: string;
|
|
75
|
+
display: string | null;
|
|
76
|
+
}>;
|
|
77
|
+
thingsboardId?: string;
|
|
78
|
+
organizationId?: string;
|
|
79
|
+
organizationName: string | null;
|
|
80
|
+
locationId?: string;
|
|
81
|
+
locationName: string | null;
|
|
82
|
+
patientId?: string;
|
|
83
|
+
patientName: string | null;
|
|
84
|
+
floor?: string;
|
|
85
|
+
room?: string;
|
|
86
|
+
bed?: string;
|
|
87
|
+
};
|
|
88
|
+
export type CarehubDeviceListItem = {
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
thingsboardId?: string;
|
|
92
|
+
status: "active" | "inactive";
|
|
93
|
+
organizationId: string | null;
|
|
94
|
+
organizationName: string | null;
|
|
95
|
+
locationId: string | null;
|
|
96
|
+
locationName: string | null;
|
|
97
|
+
patientId: string | null;
|
|
98
|
+
patientName: string | null;
|
|
99
|
+
lastActivityTime?: string | null;
|
|
100
|
+
createdAt?: string | null;
|
|
101
|
+
};
|
|
102
|
+
export type CarehubDeviceListQuery = {
|
|
103
|
+
page?: number;
|
|
104
|
+
count?: number;
|
|
105
|
+
sortBy?: string;
|
|
106
|
+
orderBy?: "ASC" | "DESC";
|
|
107
|
+
search?: string;
|
|
108
|
+
patientSearch?: string;
|
|
109
|
+
organizationId?: string;
|
|
110
|
+
locationId?: string;
|
|
111
|
+
patientId?: string;
|
|
112
|
+
active?: boolean;
|
|
113
|
+
};
|
|
114
|
+
export type CarehubCreateDevice = {
|
|
115
|
+
name: string;
|
|
116
|
+
thingsboardId?: string;
|
|
117
|
+
organizationId?: string;
|
|
118
|
+
locationId?: string;
|
|
119
|
+
patientId?: string;
|
|
120
|
+
};
|
|
121
|
+
export type CarehubUpdateDevice = {
|
|
122
|
+
name: string;
|
|
123
|
+
thingsboardId?: string;
|
|
124
|
+
organizationId?: string | null;
|
|
125
|
+
locationId?: string | null;
|
|
126
|
+
patientId?: string | null;
|
|
127
|
+
};
|
|
128
|
+
export type CarehubAssignDevice = {
|
|
129
|
+
deviceId: string;
|
|
130
|
+
projectId: string;
|
|
131
|
+
locationId?: string;
|
|
132
|
+
};
|
|
133
|
+
export type CarehubTelemetryValue = {
|
|
134
|
+
value: string | number | boolean | null;
|
|
135
|
+
ts: number | null;
|
|
136
|
+
};
|
|
137
|
+
export type CarehubTelemetrySummary = Record<string, CarehubTelemetryValue>;
|
|
138
|
+
export type CarehubAlertSummary = Record<string, unknown>;
|
|
139
|
+
export type CarehubLiveQuery = {
|
|
140
|
+
page?: number;
|
|
141
|
+
count?: number;
|
|
142
|
+
sortBy?: string;
|
|
143
|
+
orderBy?: "ASC" | "DESC";
|
|
144
|
+
search?: string;
|
|
145
|
+
deviceId?: string;
|
|
146
|
+
organizationId?: string;
|
|
147
|
+
effectiveSleepStatus?: string;
|
|
148
|
+
residentState?: CarehubResidentState;
|
|
149
|
+
includeUnassigned?: boolean;
|
|
150
|
+
};
|
|
151
|
+
export type CarehubLiveTelemetry = {
|
|
152
|
+
total: number;
|
|
153
|
+
page: number;
|
|
154
|
+
count: number;
|
|
155
|
+
telemetry: Record<string, CarehubTelemetrySummary>;
|
|
156
|
+
alerts: Record<string, CarehubAlertSummary>;
|
|
157
|
+
};
|
|
158
|
+
export type CarehubDeviceTelemetry = {
|
|
159
|
+
deviceId: string;
|
|
160
|
+
telemetry?: CarehubTelemetrySummary;
|
|
161
|
+
alerts?: CarehubAlertSummary;
|
|
162
|
+
};
|
|
163
|
+
export type CarehubObservationIds = {
|
|
164
|
+
heartRate: string | null;
|
|
165
|
+
respiratoryRate: string | null;
|
|
166
|
+
sleepStatus: string | null;
|
|
167
|
+
presenceStatus: string | null;
|
|
168
|
+
batch?: string | null;
|
|
169
|
+
};
|
|
170
|
+
export type CarehubNotification = {
|
|
171
|
+
commId: string;
|
|
172
|
+
status: string;
|
|
173
|
+
authoredOn: string;
|
|
174
|
+
type: string;
|
|
175
|
+
[key: string]: unknown;
|
|
176
|
+
};
|
|
177
|
+
export type CarehubNotificationsQuery = {
|
|
178
|
+
patient?: string;
|
|
179
|
+
device?: string;
|
|
180
|
+
status?: string;
|
|
181
|
+
type?: string;
|
|
182
|
+
startDate?: string;
|
|
183
|
+
endDate?: string;
|
|
184
|
+
cursor?: string;
|
|
185
|
+
page?: number;
|
|
186
|
+
count?: number;
|
|
187
|
+
};
|
|
188
|
+
export type CarehubNotificationsResponse = CarehubPage<CarehubNotification> & {
|
|
189
|
+
truncated: {
|
|
190
|
+
reason: "result-cap" | "scan-budget";
|
|
191
|
+
limit: number;
|
|
192
|
+
} | null;
|
|
193
|
+
};
|
|
194
|
+
export type CarehubRecentNotificationsResponse = {
|
|
195
|
+
recent: CarehubNotification[];
|
|
196
|
+
total: number;
|
|
197
|
+
warm: boolean;
|
|
198
|
+
source: "redis" | "medplum";
|
|
199
|
+
};
|
|
200
|
+
export type CarehubThreshold = {
|
|
201
|
+
id?: string;
|
|
202
|
+
projectId?: string;
|
|
203
|
+
status: "active" | "retired";
|
|
204
|
+
date?: string;
|
|
205
|
+
settings: Record<string, unknown>;
|
|
206
|
+
};
|
|
207
|
+
export type CarehubTrendPoint = {
|
|
208
|
+
timestamp: string;
|
|
209
|
+
timestampMs: number;
|
|
210
|
+
data: number | null;
|
|
211
|
+
maxThreshold?: number;
|
|
212
|
+
minThreshold?: number;
|
|
213
|
+
maxBaseLine?: number;
|
|
214
|
+
minBaseLine?: number;
|
|
215
|
+
pointTimestamp?: string;
|
|
216
|
+
pointTimestampRange?: {
|
|
217
|
+
start?: string;
|
|
218
|
+
end?: string;
|
|
219
|
+
};
|
|
220
|
+
deviceManufacturer?: string;
|
|
221
|
+
deviceModel?: string;
|
|
222
|
+
deviceId?: string;
|
|
223
|
+
};
|
|
224
|
+
export type CarehubTrends = {
|
|
225
|
+
heartRate?: Record<string, CarehubTrendPoint[]>;
|
|
226
|
+
respiratoryRate?: Record<string, CarehubTrendPoint[]>;
|
|
227
|
+
};
|
|
228
|
+
export type CarehubSleepMetric = {
|
|
229
|
+
current: number | string | null;
|
|
230
|
+
average: number | string | null;
|
|
231
|
+
diff: number | null;
|
|
232
|
+
};
|
|
233
|
+
export type CarehubSleepStatistics = Record<string, Record<string, CarehubSleepMetric>>;
|
|
234
|
+
export type CarehubLocation = {
|
|
235
|
+
id: string;
|
|
236
|
+
name: string;
|
|
237
|
+
floor?: string;
|
|
238
|
+
room?: string;
|
|
239
|
+
bed?: string;
|
|
240
|
+
organizationId?: string;
|
|
241
|
+
organizationName?: string;
|
|
242
|
+
deviceName?: string;
|
|
243
|
+
patientName?: string;
|
|
244
|
+
deviceId?: string;
|
|
245
|
+
patientId?: string;
|
|
246
|
+
};
|
|
247
|
+
export type CarehubLocationQuery = {
|
|
248
|
+
search?: string;
|
|
249
|
+
floor?: string;
|
|
250
|
+
room?: string;
|
|
251
|
+
bed?: string;
|
|
252
|
+
organizationId?: string;
|
|
253
|
+
deviceId?: string;
|
|
254
|
+
page?: number;
|
|
255
|
+
count?: number;
|
|
256
|
+
};
|
|
257
|
+
export type CarehubCreateLocation = {
|
|
258
|
+
name: string;
|
|
259
|
+
floor?: string;
|
|
260
|
+
room?: string;
|
|
261
|
+
bed?: string;
|
|
262
|
+
organizationId?: string;
|
|
263
|
+
};
|
|
264
|
+
export type CarehubUpdateLocation = CarehubCreateLocation & {
|
|
265
|
+
organizationId?: string | null;
|
|
266
|
+
deviceId?: string | null;
|
|
267
|
+
patientId?: string;
|
|
268
|
+
};
|
|
269
|
+
export type CarehubZone = {
|
|
270
|
+
zoneId: string;
|
|
271
|
+
zoneName: string;
|
|
272
|
+
deviceCount: number;
|
|
273
|
+
assignedResidentDeviceCount: number;
|
|
274
|
+
activeDeviceCount: number;
|
|
275
|
+
inactiveDeviceCount: number;
|
|
276
|
+
};
|
|
277
|
+
export type CarehubZoneDetail = {
|
|
278
|
+
id: string;
|
|
279
|
+
name: string;
|
|
280
|
+
locations: Array<{
|
|
281
|
+
id: string;
|
|
282
|
+
name: string;
|
|
283
|
+
floor?: string;
|
|
284
|
+
room?: string;
|
|
285
|
+
bed?: string;
|
|
286
|
+
devices: Array<{
|
|
287
|
+
id: string;
|
|
288
|
+
name?: string;
|
|
289
|
+
}>;
|
|
290
|
+
residents: Array<{
|
|
291
|
+
id: string;
|
|
292
|
+
name?: string;
|
|
293
|
+
}>;
|
|
294
|
+
}>;
|
|
295
|
+
};
|
|
296
|
+
export type CarehubExportPdf = {
|
|
297
|
+
documentReference: Record<string, unknown>;
|
|
298
|
+
binary: Record<string, unknown>;
|
|
299
|
+
downloadUrl: string;
|
|
300
|
+
expiresAt?: string;
|
|
301
|
+
};
|
|
302
|
+
export type CarehubExportPdfRequest = {
|
|
303
|
+
code: string;
|
|
304
|
+
mailTo?: string[];
|
|
305
|
+
timeZone?: string;
|
|
306
|
+
language: string;
|
|
307
|
+
patientId: string;
|
|
308
|
+
period: {
|
|
309
|
+
start: string;
|
|
310
|
+
end: string;
|
|
311
|
+
};
|
|
312
|
+
};
|
|
@@ -4,6 +4,7 @@ import { OvokPublicApiEndpoint } from "../conformance/capability";
|
|
|
4
4
|
import * as aiFhirMethods from "./ai-fhir/methods";
|
|
5
5
|
import * as authMethods from "./auth/methods";
|
|
6
6
|
import * as botMethods from "./bot/methods";
|
|
7
|
+
import * as carehubMethods from "./carehub/methods";
|
|
7
8
|
import * as aiMethods from "./chat/ai/methods";
|
|
8
9
|
import * as observationMethods from "./observation/methods";
|
|
9
10
|
import { GenerateObservationBodyParams } from "./observation/types/generate-observation-body/GenerateObservationBodyParams";
|
|
@@ -55,7 +56,7 @@ export declare class OvokClient extends MedplumClient {
|
|
|
55
56
|
*/
|
|
56
57
|
getSubscriptionManager(): SubscriptionManager;
|
|
57
58
|
}
|
|
58
|
-
type Methods = typeof authMethods & typeof observationMethods & typeof questionnaireResponseMethods & typeof aiMethods & typeof aiFhirMethods & typeof botMethods & typeof platformMethods;
|
|
59
|
+
type Methods = typeof authMethods & typeof observationMethods & typeof questionnaireResponseMethods & typeof aiMethods & typeof aiFhirMethods & typeof botMethods & typeof carehubMethods & typeof platformMethods;
|
|
59
60
|
type Omitted<T> = Omit<T, "executeBot">;
|
|
60
61
|
declare module "./ovok-client" {
|
|
61
62
|
interface OvokClient extends Omitted<Methods> {
|
|
@@ -40,6 +40,7 @@ const capability_1 = require("../conformance/capability");
|
|
|
40
40
|
const aiFhirMethods = __importStar(require("./ai-fhir/methods"));
|
|
41
41
|
const authMethods = __importStar(require("./auth/methods"));
|
|
42
42
|
const botMethods = __importStar(require("./bot/methods"));
|
|
43
|
+
const carehubMethods = __importStar(require("./carehub/methods"));
|
|
43
44
|
const aiMethods = __importStar(require("./chat/ai/methods"));
|
|
44
45
|
const rate_limit_error_1 = require("./errors/rate-limit-error");
|
|
45
46
|
const observationMethods = __importStar(require("./observation/methods"));
|
|
@@ -66,6 +67,7 @@ class OvokClient extends core_1.MedplumClient {
|
|
|
66
67
|
this.bindMethods(aiMethods);
|
|
67
68
|
this.bindMethods(aiFhirMethods);
|
|
68
69
|
this.bindMethods(botMethods);
|
|
70
|
+
this.bindMethods(carehubMethods);
|
|
69
71
|
this.bindMethods(platformMethods);
|
|
70
72
|
this.clientStorage = config.storage;
|
|
71
73
|
this.offlineQueueOptions = (_b = config.offlineQueue) !== null && _b !== void 0 ? _b : {};
|
|
@@ -56,5 +56,53 @@ exports.OVOK_CORE_API_REQUIREMENTS = {
|
|
|
56
56
|
{ method: "GET", path: "/localization/i18next/:language", group: "Localization" },
|
|
57
57
|
{ method: "PATCH", path: "/localization/i18next/:language", group: "Localization" },
|
|
58
58
|
{ method: "GET", path: "/patient/:id/observation", group: "Patient" },
|
|
59
|
+
{ method: "GET", path: "/v1/carehub/patient", group: "Carehub/Patient" },
|
|
60
|
+
{ method: "GET", path: "/v1/carehub/patient/:id", group: "Carehub/Patient" },
|
|
61
|
+
{ method: "GET", path: "/v1/carehub/patient/:id/$everything", group: "Carehub/Patient" },
|
|
62
|
+
{ method: "GET", path: "/v1/carehub/patient/:id/current-vitals", group: "Carehub/Patient" },
|
|
63
|
+
{ method: "POST", path: "/v1/carehub/patient", group: "Carehub/Patient" },
|
|
64
|
+
{ method: "PUT", path: "/v1/carehub/patient/:id", group: "Carehub/Patient" },
|
|
65
|
+
{ method: "DELETE", path: "/v1/carehub/patient/:id", group: "Carehub/Patient" },
|
|
66
|
+
{ method: "GET", path: "/v1/carehub/device", group: "Carehub/Device" },
|
|
67
|
+
{ method: "GET", path: "/v1/carehub/device/:id", group: "Carehub/Device" },
|
|
68
|
+
{ method: "POST", path: "/v1/carehub/device", group: "Carehub/Device" },
|
|
69
|
+
{ method: "PUT", path: "/v1/carehub/device/:id", group: "Carehub/Device" },
|
|
70
|
+
{ method: "DELETE", path: "/v1/carehub/device/:id", group: "Carehub/Device" },
|
|
71
|
+
{ method: "PUT", path: "/v1/carehub/device/assign/project", group: "Carehub/Device" },
|
|
72
|
+
{ method: "GET", path: "/v1/carehub/device/live", group: "Carehub/Device" },
|
|
73
|
+
{ method: "GET", path: "/v1/carehub/device/live/telemetry", group: "Carehub/Device" },
|
|
74
|
+
{ method: "GET", path: "/v1/carehub/device/live/cloudwatch/:deviceId", group: "Carehub/Device" },
|
|
75
|
+
{ method: "GET", path: "/v1/carehub/telemetry/:deviceId", group: "Carehub/Telemetry" },
|
|
76
|
+
{ method: "GET", path: "/v1/carehub/telemetry/effectiveIds", group: "Carehub/Telemetry" },
|
|
77
|
+
{ method: "GET", path: "/v1/carehub/telemetry/lastIds", group: "Carehub/Telemetry" },
|
|
78
|
+
{ method: "GET", path: "/v1/carehub/telemetry/:deviceId/effectiveIds", group: "Carehub/Telemetry" },
|
|
79
|
+
{ method: "GET", path: "/v1/carehub/telemetry/:deviceId/lastIds", group: "Carehub/Telemetry" },
|
|
80
|
+
{ method: "GET", path: "/v1/carehub/notifications", group: "Carehub/Notifications" },
|
|
81
|
+
{ method: "GET", path: "/v1/carehub/notifications/recent", group: "Carehub/Notifications" },
|
|
82
|
+
{ method: "GET", path: "/v1/carehub/notifications/oob", group: "Carehub/Notifications" },
|
|
83
|
+
{ method: "GET", path: "/v1/carehub/notifications/medical", group: "Carehub/Notifications" },
|
|
84
|
+
{ method: "GET", path: "/v1/carehub/notifications/recent/medical", group: "Carehub/Notifications" },
|
|
85
|
+
{ method: "GET", path: "/v1/carehub/notifications/medical/:episodeId", group: "Carehub/Notifications" },
|
|
86
|
+
{ method: "POST", path: "/v1/carehub/notifications/medical/:episodeId/ack", group: "Carehub/Notifications" },
|
|
87
|
+
{ method: "PATCH", path: "/v1/carehub/notifications/:id/ack", group: "Carehub/Notifications" },
|
|
88
|
+
{ method: "GET", path: "/v1/carehub/threshold", group: "Carehub/Threshold" },
|
|
89
|
+
{ method: "PUT", path: "/v1/carehub/threshold", group: "Carehub/Threshold" },
|
|
90
|
+
{ method: "GET", path: "/v1/carehub/threshold/patient/:patientId", group: "Carehub/Threshold" },
|
|
91
|
+
{ method: "PUT", path: "/v1/carehub/threshold/patient/:patientId", group: "Carehub/Threshold" },
|
|
92
|
+
{ method: "GET", path: "/v2/carehub/threshold", group: "Carehub/Threshold" },
|
|
93
|
+
{ method: "PUT", path: "/v2/carehub/threshold", group: "Carehub/Threshold" },
|
|
94
|
+
{ method: "GET", path: "/v2/carehub/threshold/patient/:patientId", group: "Carehub/Threshold" },
|
|
95
|
+
{ method: "PUT", path: "/v2/carehub/threshold/patient/:patientId", group: "Carehub/Threshold" },
|
|
96
|
+
{ method: "GET", path: "/v1/carehub/trends/graphs", group: "Carehub/Trends" },
|
|
97
|
+
{ method: "GET", path: "/v1/carehub/sleep/statistics", group: "Carehub/Sleep" },
|
|
98
|
+
{ method: "GET", path: "/v1/carehub/location", group: "Carehub/Location" },
|
|
99
|
+
{ method: "GET", path: "/v1/carehub/location/:id", group: "Carehub/Location" },
|
|
100
|
+
{ method: "POST", path: "/v1/carehub/location", group: "Carehub/Location" },
|
|
101
|
+
{ method: "PUT", path: "/v1/carehub/location/:id", group: "Carehub/Location" },
|
|
102
|
+
{ method: "DELETE", path: "/v1/carehub/location/:id", group: "Carehub/Location" },
|
|
103
|
+
{ method: "GET", path: "/v1/carehub/zones", group: "Carehub/Zones" },
|
|
104
|
+
{ method: "GET", path: "/v1/carehub/zones/:zoneId", group: "Carehub/Zones" },
|
|
105
|
+
{ method: "GET", path: "/v1/carehub/zones/device-counts", group: "Carehub/Zones" },
|
|
106
|
+
{ method: "POST", path: "/v1/carehub/export/pdf", group: "Carehub/Export" },
|
|
59
107
|
],
|
|
60
108
|
};
|
|
@@ -48,7 +48,7 @@ exports.OVOK_CORE_REQUIREMENTS = {
|
|
|
48
48
|
description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
|
|
49
49
|
software: {
|
|
50
50
|
name: "@ovok/core",
|
|
51
|
-
version: "0.3.
|
|
51
|
+
version: "0.3.7",
|
|
52
52
|
},
|
|
53
53
|
fhirVersion: "4.0.1",
|
|
54
54
|
format: ["json"],
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CapabilityStatement } from "@medplum/fhirtypes";
|
|
2
|
+
import { CarehubDeviceListItem, CarehubDeviceListQuery, CarehubDeviceTelemetry, CarehubNotificationsQuery, CarehubNotificationsResponse, CarehubPage, CarehubPatientListItem, CarehubPatientListQuery, CarehubRecentNotificationsResponse } from "../client/carehub/types";
|
|
3
|
+
import { OvokClient, OvokFhirVersion } from "../client/ovok-client";
|
|
4
|
+
import { OvokAdministeredProject, OvokProjectFeatures, OvokProjectSettings } from "../client/platform/types";
|
|
5
|
+
import { OvokPublicApiEndpoint } from "../conformance/capability";
|
|
6
|
+
export type OvokRequestState<T> = {
|
|
7
|
+
data: T | undefined;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
error: Error | undefined;
|
|
10
|
+
reload: () => void;
|
|
11
|
+
};
|
|
12
|
+
export type OvokMutationState<TParams, TData> = {
|
|
13
|
+
data: TData | undefined;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
error: Error | undefined;
|
|
16
|
+
mutate: (params: TParams) => Promise<TData>;
|
|
17
|
+
reset: () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Small request primitive for the typed Ovok hooks. It deliberately does not
|
|
21
|
+
* add a cache or retry policy: MedplumClient already owns request caching and
|
|
22
|
+
* the host app owns the retry policy appropriate to its screen.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useOvokRequest<T>(load: () => Promise<T>, enabled?: boolean): OvokRequestState<T>;
|
|
25
|
+
/** Generic mutation hook for any typed OvokClient method. */
|
|
26
|
+
export declare function useOvokMutation<TParams, TData>(mutateRequest: (client: OvokClient, params: TParams) => Promise<TData>): OvokMutationState<TParams, TData>;
|
|
27
|
+
export declare const useCapabilityStatement: (version?: OvokFhirVersion) => OvokRequestState<CapabilityStatement>;
|
|
28
|
+
export declare const usePublicApiEndpoints: (version?: OvokFhirVersion) => OvokRequestState<OvokPublicApiEndpoint[]>;
|
|
29
|
+
export declare const useAdministeredProjects: (params?: {
|
|
30
|
+
page?: number;
|
|
31
|
+
count?: number;
|
|
32
|
+
}) => OvokRequestState<CarehubPage<OvokAdministeredProject>>;
|
|
33
|
+
export declare const useProjectSettings: () => OvokRequestState<OvokProjectSettings>;
|
|
34
|
+
export declare const useProjectFeatures: () => OvokRequestState<OvokProjectFeatures>;
|
|
35
|
+
export declare const useCarehubPatients: (params?: CarehubPatientListQuery) => OvokRequestState<CarehubPage<CarehubPatientListItem>>;
|
|
36
|
+
export declare const useCarehubDevices: (params?: CarehubDeviceListQuery) => OvokRequestState<CarehubPage<CarehubDeviceListItem>>;
|
|
37
|
+
export declare const useCarehubDeviceTelemetry: (deviceId?: string) => OvokRequestState<CarehubDeviceTelemetry>;
|
|
38
|
+
export declare const useCarehubNotifications: (params?: CarehubNotificationsQuery) => OvokRequestState<CarehubNotificationsResponse>;
|
|
39
|
+
export declare const useRecentCarehubNotifications: (count?: number) => OvokRequestState<CarehubRecentNotificationsResponse>;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.useRecentCarehubNotifications = exports.useCarehubNotifications = exports.useCarehubDeviceTelemetry = exports.useCarehubDevices = exports.useCarehubPatients = exports.useProjectFeatures = exports.useProjectSettings = exports.useAdministeredProjects = exports.usePublicApiEndpoints = exports.useCapabilityStatement = void 0;
|
|
38
|
+
exports.useOvokRequest = useOvokRequest;
|
|
39
|
+
exports.useOvokMutation = useOvokMutation;
|
|
40
|
+
const React = __importStar(require("react"));
|
|
41
|
+
const index_1 = require("./index");
|
|
42
|
+
const toError = (error) => error instanceof Error ? error : new Error(String(error));
|
|
43
|
+
/**
|
|
44
|
+
* Small request primitive for the typed Ovok hooks. It deliberately does not
|
|
45
|
+
* add a cache or retry policy: MedplumClient already owns request caching and
|
|
46
|
+
* the host app owns the retry policy appropriate to its screen.
|
|
47
|
+
*/
|
|
48
|
+
function useOvokRequest(load, enabled = true) {
|
|
49
|
+
const [data, setData] = React.useState();
|
|
50
|
+
const [error, setError] = React.useState();
|
|
51
|
+
const [loading, setLoading] = React.useState(enabled);
|
|
52
|
+
const [revision, setRevision] = React.useState(0);
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
let disposed = false;
|
|
55
|
+
if (!enabled) {
|
|
56
|
+
setLoading(false);
|
|
57
|
+
setError(undefined);
|
|
58
|
+
return () => {
|
|
59
|
+
disposed = true;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
setLoading(true);
|
|
63
|
+
setError(undefined);
|
|
64
|
+
load()
|
|
65
|
+
.then((value) => {
|
|
66
|
+
if (!disposed) {
|
|
67
|
+
setData(value);
|
|
68
|
+
setLoading(false);
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
.catch((reason) => {
|
|
72
|
+
if (!disposed) {
|
|
73
|
+
setError(toError(reason));
|
|
74
|
+
setLoading(false);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return () => {
|
|
78
|
+
disposed = true;
|
|
79
|
+
};
|
|
80
|
+
}, [enabled, load, revision]);
|
|
81
|
+
const reload = React.useCallback(() => setRevision((value) => value + 1), []);
|
|
82
|
+
return { data, loading, error, reload };
|
|
83
|
+
}
|
|
84
|
+
/** Generic mutation hook for any typed OvokClient method. */
|
|
85
|
+
function useOvokMutation(mutateRequest) {
|
|
86
|
+
const client = (0, index_1.useClient)();
|
|
87
|
+
const [data, setData] = React.useState();
|
|
88
|
+
const [error, setError] = React.useState();
|
|
89
|
+
const [loading, setLoading] = React.useState(false);
|
|
90
|
+
const mutate = React.useCallback(async (params) => {
|
|
91
|
+
setLoading(true);
|
|
92
|
+
setError(undefined);
|
|
93
|
+
try {
|
|
94
|
+
const value = await mutateRequest(client, params);
|
|
95
|
+
setData(value);
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
catch (reason) {
|
|
99
|
+
const requestError = toError(reason);
|
|
100
|
+
setError(requestError);
|
|
101
|
+
throw requestError;
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
setLoading(false);
|
|
105
|
+
}
|
|
106
|
+
}, [client, mutateRequest]);
|
|
107
|
+
const reset = React.useCallback(() => {
|
|
108
|
+
setData(undefined);
|
|
109
|
+
setError(undefined);
|
|
110
|
+
setLoading(false);
|
|
111
|
+
}, []);
|
|
112
|
+
return { data, loading, error, mutate, reset };
|
|
113
|
+
}
|
|
114
|
+
const useCapabilityStatement = (version = "R4") => {
|
|
115
|
+
const client = (0, index_1.useClient)();
|
|
116
|
+
const load = React.useCallback(() => client.getCapabilityStatement(version), [client, version]);
|
|
117
|
+
return useOvokRequest(load);
|
|
118
|
+
};
|
|
119
|
+
exports.useCapabilityStatement = useCapabilityStatement;
|
|
120
|
+
const usePublicApiEndpoints = (version = "R4") => {
|
|
121
|
+
const client = (0, index_1.useClient)();
|
|
122
|
+
const load = React.useCallback(() => client.getPublicApiEndpoints(version), [client, version]);
|
|
123
|
+
return useOvokRequest(load);
|
|
124
|
+
};
|
|
125
|
+
exports.usePublicApiEndpoints = usePublicApiEndpoints;
|
|
126
|
+
const useAdministeredProjects = (params = {}) => {
|
|
127
|
+
const client = (0, index_1.useClient)();
|
|
128
|
+
const serialized = JSON.stringify(params);
|
|
129
|
+
const load = React.useCallback(() => client.listAdministeredProjects(params), [client, serialized]);
|
|
130
|
+
return useOvokRequest(load);
|
|
131
|
+
};
|
|
132
|
+
exports.useAdministeredProjects = useAdministeredProjects;
|
|
133
|
+
const useProjectSettings = () => {
|
|
134
|
+
const client = (0, index_1.useClient)();
|
|
135
|
+
const load = React.useCallback(() => client.getProjectSettings(), [client]);
|
|
136
|
+
return useOvokRequest(load);
|
|
137
|
+
};
|
|
138
|
+
exports.useProjectSettings = useProjectSettings;
|
|
139
|
+
const useProjectFeatures = () => {
|
|
140
|
+
const client = (0, index_1.useClient)();
|
|
141
|
+
const load = React.useCallback(() => client.getProjectFeatures(), [client]);
|
|
142
|
+
return useOvokRequest(load);
|
|
143
|
+
};
|
|
144
|
+
exports.useProjectFeatures = useProjectFeatures;
|
|
145
|
+
const useCarehubPatients = (params = {}) => {
|
|
146
|
+
const client = (0, index_1.useClient)();
|
|
147
|
+
const serialized = JSON.stringify(params);
|
|
148
|
+
const load = React.useCallback(() => client.listCarehubPatients(params), [client, serialized]);
|
|
149
|
+
return useOvokRequest(load);
|
|
150
|
+
};
|
|
151
|
+
exports.useCarehubPatients = useCarehubPatients;
|
|
152
|
+
const useCarehubDevices = (params = {}) => {
|
|
153
|
+
const client = (0, index_1.useClient)();
|
|
154
|
+
const serialized = JSON.stringify(params);
|
|
155
|
+
const load = React.useCallback(() => client.listCarehubDevices(params), [client, serialized]);
|
|
156
|
+
return useOvokRequest(load);
|
|
157
|
+
};
|
|
158
|
+
exports.useCarehubDevices = useCarehubDevices;
|
|
159
|
+
const useCarehubDeviceTelemetry = (deviceId) => {
|
|
160
|
+
const client = (0, index_1.useClient)();
|
|
161
|
+
const load = React.useCallback(() => deviceId
|
|
162
|
+
? client.getCarehubDeviceTelemetry(deviceId)
|
|
163
|
+
: Promise.reject(new Error("deviceId is required")), [client, deviceId]);
|
|
164
|
+
return useOvokRequest(load, deviceId !== undefined);
|
|
165
|
+
};
|
|
166
|
+
exports.useCarehubDeviceTelemetry = useCarehubDeviceTelemetry;
|
|
167
|
+
const useCarehubNotifications = (params = {}) => {
|
|
168
|
+
const client = (0, index_1.useClient)();
|
|
169
|
+
const serialized = JSON.stringify(params);
|
|
170
|
+
const load = React.useCallback(() => client.listCarehubNotifications(params), [client, serialized]);
|
|
171
|
+
return useOvokRequest(load);
|
|
172
|
+
};
|
|
173
|
+
exports.useCarehubNotifications = useCarehubNotifications;
|
|
174
|
+
const useRecentCarehubNotifications = (count) => {
|
|
175
|
+
const client = (0, index_1.useClient)();
|
|
176
|
+
const load = React.useCallback(() => client.getRecentCarehubNotifications(count), [client, count]);
|
|
177
|
+
return useOvokRequest(load);
|
|
178
|
+
};
|
|
179
|
+
exports.useRecentCarehubNotifications = useRecentCarehubNotifications;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -6,3 +6,4 @@ export declare const OvokProvider: (props: React.PropsWithChildren<{
|
|
|
6
6
|
client: OvokClient;
|
|
7
7
|
}>) => React.JSX.Element;
|
|
8
8
|
export { observationsToMeasurements, useEcgRecording, useObservations, useSaveMeasurement, useUrineTests, } from "./observation-hooks";
|
|
9
|
+
export { useAdministeredProjects, useCarehubDeviceTelemetry, useCarehubDevices, useCarehubNotifications, useCarehubPatients, useCapabilityStatement, useOvokMutation, useOvokRequest, useProjectFeatures, useProjectSettings, usePublicApiEndpoints, useRecentCarehubNotifications, } from "./api-hooks";
|
package/dist/hooks/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.useUrineTests = exports.useSaveMeasurement = exports.useObservations = exports.useEcgRecording = exports.observationsToMeasurements = exports.OvokProvider = exports.useClient = exports.useCachedBinaryUrl = exports.reactContext = exports.useSubscription = exports.useSearchResources = exports.useSearchOne = exports.useSearch = exports.useResource = exports.usePrevious = exports.useMedplumProfile = exports.useMedplumNavigate = exports.useMedplumContext = void 0;
|
|
37
|
+
exports.useRecentCarehubNotifications = exports.usePublicApiEndpoints = exports.useProjectSettings = exports.useProjectFeatures = exports.useOvokRequest = exports.useOvokMutation = exports.useCapabilityStatement = exports.useCarehubPatients = exports.useCarehubNotifications = exports.useCarehubDevices = exports.useCarehubDeviceTelemetry = exports.useAdministeredProjects = exports.useUrineTests = exports.useSaveMeasurement = exports.useObservations = exports.useEcgRecording = exports.observationsToMeasurements = exports.OvokProvider = exports.useClient = exports.useCachedBinaryUrl = exports.reactContext = exports.useSubscription = exports.useSearchResources = exports.useSearchOne = exports.useSearch = exports.useResource = exports.usePrevious = exports.useMedplumProfile = exports.useMedplumNavigate = exports.useMedplumContext = void 0;
|
|
38
38
|
/*
|
|
39
39
|
* The only React-dependent module in the package.
|
|
40
40
|
*
|
|
@@ -76,3 +76,16 @@ Object.defineProperty(exports, "useEcgRecording", { enumerable: true, get: funct
|
|
|
76
76
|
Object.defineProperty(exports, "useObservations", { enumerable: true, get: function () { return observation_hooks_1.useObservations; } });
|
|
77
77
|
Object.defineProperty(exports, "useSaveMeasurement", { enumerable: true, get: function () { return observation_hooks_1.useSaveMeasurement; } });
|
|
78
78
|
Object.defineProperty(exports, "useUrineTests", { enumerable: true, get: function () { return observation_hooks_1.useUrineTests; } });
|
|
79
|
+
var api_hooks_1 = require("./api-hooks");
|
|
80
|
+
Object.defineProperty(exports, "useAdministeredProjects", { enumerable: true, get: function () { return api_hooks_1.useAdministeredProjects; } });
|
|
81
|
+
Object.defineProperty(exports, "useCarehubDeviceTelemetry", { enumerable: true, get: function () { return api_hooks_1.useCarehubDeviceTelemetry; } });
|
|
82
|
+
Object.defineProperty(exports, "useCarehubDevices", { enumerable: true, get: function () { return api_hooks_1.useCarehubDevices; } });
|
|
83
|
+
Object.defineProperty(exports, "useCarehubNotifications", { enumerable: true, get: function () { return api_hooks_1.useCarehubNotifications; } });
|
|
84
|
+
Object.defineProperty(exports, "useCarehubPatients", { enumerable: true, get: function () { return api_hooks_1.useCarehubPatients; } });
|
|
85
|
+
Object.defineProperty(exports, "useCapabilityStatement", { enumerable: true, get: function () { return api_hooks_1.useCapabilityStatement; } });
|
|
86
|
+
Object.defineProperty(exports, "useOvokMutation", { enumerable: true, get: function () { return api_hooks_1.useOvokMutation; } });
|
|
87
|
+
Object.defineProperty(exports, "useOvokRequest", { enumerable: true, get: function () { return api_hooks_1.useOvokRequest; } });
|
|
88
|
+
Object.defineProperty(exports, "useProjectFeatures", { enumerable: true, get: function () { return api_hooks_1.useProjectFeatures; } });
|
|
89
|
+
Object.defineProperty(exports, "useProjectSettings", { enumerable: true, get: function () { return api_hooks_1.useProjectSettings; } });
|
|
90
|
+
Object.defineProperty(exports, "usePublicApiEndpoints", { enumerable: true, get: function () { return api_hooks_1.usePublicApiEndpoints; } });
|
|
91
|
+
Object.defineProperty(exports, "useRecentCarehubNotifications", { enumerable: true, get: function () { return api_hooks_1.useRecentCarehubNotifications; } });
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -59,3 +59,4 @@ __exportStar(require("./conformance/capability-requirements"), exports);
|
|
|
59
59
|
__exportStar(require("./conformance/api-requirements"), exports);
|
|
60
60
|
__exportStar(require("./conformance/capability"), exports);
|
|
61
61
|
__exportStar(require("./client/platform/types"), exports);
|
|
62
|
+
__exportStar(require("./client/carehub/types"), exports);
|