@ovok/core 0.3.9 → 0.3.11
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 +60 -2
- package/dist/client/ovok-client.d.ts +2 -1
- package/dist/client/ovok-client.js +2 -0
- package/dist/client/patient/methods.d.ts +12 -0
- package/dist/client/patient/methods.js +58 -0
- package/dist/client/patient/types.d.ts +81 -0
- package/dist/client/patient/types.js +2 -0
- package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.d.ts +1 -1
- package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.d.ts +3 -0
- package/dist/client/questionnaire-response/methods/extractQuestionnaireObservations.js +7 -0
- package/dist/client/questionnaire-response/methods/index.d.ts +3 -0
- package/dist/client/questionnaire-response/methods/index.js +3 -0
- package/dist/client/questionnaire-response/methods/populateQuestionnaire.d.ts +4 -0
- package/dist/client/questionnaire-response/methods/populateQuestionnaire.js +7 -0
- package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.d.ts +3 -0
- package/dist/client/questionnaire-response/methods/submitQuestionnaireResponse.js +6 -0
- package/dist/client/questionnaire-response/types.d.ts +3 -0
- package/dist/client/questionnaire-response/types.js +2 -0
- package/dist/conformance/api-requirements.js +6 -0
- package/dist/conformance/capability-requirements.js +38 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +12 -1
- package/dist/hooks/patient-hooks.d.ts +22 -0
- package/dist/hooks/patient-hooks.js +101 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,6 +73,58 @@ const locales = await client.getLocales();
|
|
|
73
73
|
All methods preserve the backend HTTP verbs and return the backend response shapes. Billing is
|
|
74
74
|
not included until Ovok publishes a supported billing contract.
|
|
75
75
|
|
|
76
|
+
## Patient application APIs
|
|
77
|
+
|
|
78
|
+
Patient applications can read their authenticated profile and health data through typed methods
|
|
79
|
+
backed by the existing `../ovok-core` routes. The profile response includes the Patient resource,
|
|
80
|
+
project context, menu configuration, access policy, and active sessions.
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const me = await client.getCurrentPatientProfile();
|
|
84
|
+
const latest = await client.getPatientLatestObservations({
|
|
85
|
+
patient: `Patient/${me.profile.id}`,
|
|
86
|
+
code: ["8867-4", "9279-1"],
|
|
87
|
+
max: 5,
|
|
88
|
+
});
|
|
89
|
+
const currentTelemetry = await client.getPatientDeviceTelemetry(deviceId);
|
|
90
|
+
const history = await client.getPatientDeviceTelemetryHistory(deviceId, {
|
|
91
|
+
from: "2026-09-25T00:00:00.000Z",
|
|
92
|
+
to: "2026-09-26T00:00:00.000Z",
|
|
93
|
+
pageSize: 50,
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
These helpers use bearer-authenticated `/auth/me` and `/fhir/*` contracts and are additive to the
|
|
98
|
+
native observation and offline-measurement APIs. The exported `OVOK_CORE_API_REQUIREMENTS` lists
|
|
99
|
+
the ordinary HTTP routes, while `OVOK_CORE_REQUIREMENTS` covers the FHIR operations. Billing is
|
|
100
|
+
intentionally absent.
|
|
101
|
+
|
|
102
|
+
Questionnaire applications can use the Ovok-specific patient-scoped operations and keep the
|
|
103
|
+
response write atomic with its extracted Observations:
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
const populated = await client.populateQuestionnaire(questionnaireId);
|
|
107
|
+
const saved = await client.submitQuestionnaireResponse(questionnaireResponse, observations);
|
|
108
|
+
const extracted = await client.extractQuestionnaireObservations(questionnaireResponseId);
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Scheduling uses standard FHIR resources exposed by the backend. The SDK intentionally does not
|
|
112
|
+
build on Ovok's deprecated `/appointment` or `/schedule` controllers:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const appointments = await client.listPatientAppointments({
|
|
116
|
+
patient: `Patient/${patientId}`,
|
|
117
|
+
status: "booked",
|
|
118
|
+
});
|
|
119
|
+
const schedules = await client.listPatientSchedules({
|
|
120
|
+
actor: `Practitioner/${practitionerId}`,
|
|
121
|
+
});
|
|
122
|
+
const slots = await client.listPatientSlots({
|
|
123
|
+
schedule: `Schedule/${scheduleId}`,
|
|
124
|
+
status: "free",
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
76
128
|
## CareHub APIs
|
|
77
129
|
|
|
78
130
|
CareHub methods cover the verified `/v1/carehub/*` and `/v2/carehub/*` application routes for
|
|
@@ -115,8 +167,10 @@ download elements; the backend remains responsible for authorization and signed
|
|
|
115
167
|
|
|
116
168
|
## React hooks
|
|
117
169
|
|
|
118
|
-
The package exports additive hooks for capability discovery, project configuration,
|
|
119
|
-
|
|
170
|
+
The package exports additive hooks for capability discovery, project configuration, patient profile
|
|
171
|
+
and health data, questionnaires, scheduling resources, CareHub lists, telemetry, and notifications.
|
|
172
|
+
Every request hook returns `data`, `loading`, `error`, and `reload`; questionnaire mutations expose
|
|
173
|
+
`data`, `loading`, `error`, `mutate`, and `reset`.
|
|
120
174
|
|
|
121
175
|
```tsx
|
|
122
176
|
const { data: patients, loading, error } = useCarehubPatients({
|
|
@@ -126,6 +180,10 @@ const { data: patients, loading, error } = useCarehubPatients({
|
|
|
126
180
|
const saveSettings = useOvokMutation((client, settings: OvokProjectSettings) =>
|
|
127
181
|
client.updateProjectSetting("PATIENT_LOGIN_ENABLED", settings.settings.PATIENT_LOGIN_ENABLED),
|
|
128
182
|
);
|
|
183
|
+
|
|
184
|
+
const { data: me } = useCurrentPatientProfile();
|
|
185
|
+
const { data: appointments } = usePatientAppointments({ status: "booked" });
|
|
186
|
+
const populateQuestionnaire = usePopulateQuestionnaire();
|
|
129
187
|
```
|
|
130
188
|
|
|
131
189
|
Hooks are additive to the existing `OvokProvider`, observation hooks, auth methods, and offline
|
|
@@ -10,6 +10,7 @@ import * as experienceMethods from "./experience/methods";
|
|
|
10
10
|
import * as observationMethods from "./observation/methods";
|
|
11
11
|
import { GenerateObservationBodyParams } from "./observation/types/generate-observation-body/GenerateObservationBodyParams";
|
|
12
12
|
import { OfflineMeasurementFlushOptions, OfflineMeasurementFlushResult, OfflineMeasurementQueueOptions } from "./offline";
|
|
13
|
+
import * as patientMethods from "./patient/methods";
|
|
13
14
|
import * as platformMethods from "./platform/methods";
|
|
14
15
|
import * as questionnaireResponseMethods from "./questionnaire-response/methods";
|
|
15
16
|
export declare const MAX_CONDITIONAL_OBSERVATION_ENTRIES = 8;
|
|
@@ -57,7 +58,7 @@ export declare class OvokClient extends MedplumClient {
|
|
|
57
58
|
*/
|
|
58
59
|
getSubscriptionManager(): SubscriptionManager;
|
|
59
60
|
}
|
|
60
|
-
type Methods = typeof authMethods & typeof observationMethods & typeof questionnaireResponseMethods & typeof aiMethods & typeof aiFhirMethods & typeof botMethods & typeof carehubMethods & typeof platformMethods & typeof experienceMethods;
|
|
61
|
+
type Methods = typeof authMethods & typeof observationMethods & typeof questionnaireResponseMethods & typeof aiMethods & typeof aiFhirMethods & typeof botMethods & typeof carehubMethods & typeof platformMethods & typeof experienceMethods & typeof patientMethods;
|
|
61
62
|
type Omitted<T> = Omit<T, "executeBot">;
|
|
62
63
|
declare module "./ovok-client" {
|
|
63
64
|
interface OvokClient extends Omitted<Methods> {
|
|
@@ -47,6 +47,7 @@ const experienceMethods = __importStar(require("./experience/methods"));
|
|
|
47
47
|
const observationMethods = __importStar(require("./observation/methods"));
|
|
48
48
|
const observation_bundle_utils_1 = require("./observation/observation-bundle-utils");
|
|
49
49
|
const offline_1 = require("./offline");
|
|
50
|
+
const patientMethods = __importStar(require("./patient/methods"));
|
|
50
51
|
const platformMethods = __importStar(require("./platform/methods"));
|
|
51
52
|
const questionnaireResponseMethods = __importStar(require("./questionnaire-response/methods"));
|
|
52
53
|
exports.MAX_CONDITIONAL_OBSERVATION_ENTRIES = 8;
|
|
@@ -71,6 +72,7 @@ class OvokClient extends core_1.MedplumClient {
|
|
|
71
72
|
this.bindMethods(carehubMethods);
|
|
72
73
|
this.bindMethods(platformMethods);
|
|
73
74
|
this.bindMethods(experienceMethods);
|
|
75
|
+
this.bindMethods(patientMethods);
|
|
74
76
|
this.clientStorage = config.storage;
|
|
75
77
|
this.offlineQueueOptions = (_b = config.offlineQueue) !== null && _b !== void 0 ? _b : {};
|
|
76
78
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OvokClient } from "../ovok-client";
|
|
2
|
+
import { OvokCurrentPatientProfile, OvokPatientLatestObservationsQuery, OvokPatientObservationBundle, OvokPatientAppointment, OvokPatientSchedule, OvokPatientSchedulingQuery, OvokPatientSlot, OvokPatientTelemetryHistory, OvokPatientTelemetryHistoryQuery } from "./types";
|
|
3
|
+
export declare function getCurrentPatientProfile(this: OvokClient): Promise<OvokCurrentPatientProfile>;
|
|
4
|
+
export declare function getPatientLatestObservations(this: OvokClient, params?: OvokPatientLatestObservationsQuery): Promise<OvokPatientObservationBundle>;
|
|
5
|
+
export declare function getPatientDeviceTelemetry(this: OvokClient, deviceId: string): Promise<OvokPatientObservationBundle>;
|
|
6
|
+
export declare function getPatientDeviceTelemetryHistory(this: OvokClient, deviceId: string, params?: OvokPatientTelemetryHistoryQuery): Promise<OvokPatientTelemetryHistory>;
|
|
7
|
+
export declare function listPatientAppointments(this: OvokClient, params?: OvokPatientSchedulingQuery): Promise<OvokPatientAppointment[]>;
|
|
8
|
+
export declare function getPatientAppointment(this: OvokClient, appointmentId: string): Promise<OvokPatientAppointment>;
|
|
9
|
+
export declare function createPatientAppointment(this: OvokClient, appointment: OvokPatientAppointment): Promise<OvokPatientAppointment>;
|
|
10
|
+
export declare function updatePatientAppointment(this: OvokClient, appointment: OvokPatientAppointment): Promise<OvokPatientAppointment>;
|
|
11
|
+
export declare function listPatientSchedules(this: OvokClient, params?: OvokPatientSchedulingQuery): Promise<OvokPatientSchedule[]>;
|
|
12
|
+
export declare function listPatientSlots(this: OvokClient, params?: OvokPatientSchedulingQuery): Promise<OvokPatientSlot[]>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCurrentPatientProfile = getCurrentPatientProfile;
|
|
4
|
+
exports.getPatientLatestObservations = getPatientLatestObservations;
|
|
5
|
+
exports.getPatientDeviceTelemetry = getPatientDeviceTelemetry;
|
|
6
|
+
exports.getPatientDeviceTelemetryHistory = getPatientDeviceTelemetryHistory;
|
|
7
|
+
exports.listPatientAppointments = listPatientAppointments;
|
|
8
|
+
exports.getPatientAppointment = getPatientAppointment;
|
|
9
|
+
exports.createPatientAppointment = createPatientAppointment;
|
|
10
|
+
exports.updatePatientAppointment = updatePatientAppointment;
|
|
11
|
+
exports.listPatientSchedules = listPatientSchedules;
|
|
12
|
+
exports.listPatientSlots = listPatientSlots;
|
|
13
|
+
const segment = (value) => encodeURIComponent(value);
|
|
14
|
+
const query = (params) => {
|
|
15
|
+
const values = new URLSearchParams();
|
|
16
|
+
for (const [key, value] of Object.entries(params)) {
|
|
17
|
+
if (value !== undefined) {
|
|
18
|
+
values.set(key, String(value));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const encoded = values.toString();
|
|
22
|
+
return encoded === "" ? "" : `?${encoded}`;
|
|
23
|
+
};
|
|
24
|
+
async function getCurrentPatientProfile() {
|
|
25
|
+
return this.get("/auth/me");
|
|
26
|
+
}
|
|
27
|
+
async function getPatientLatestObservations(params = {}) {
|
|
28
|
+
const code = Array.isArray(params.code) ? params.code.join(",") : params.code;
|
|
29
|
+
return this.get(`/fhir/Observation/$lastn${query({
|
|
30
|
+
patient: params.patient,
|
|
31
|
+
max: params.max,
|
|
32
|
+
code,
|
|
33
|
+
})}`);
|
|
34
|
+
}
|
|
35
|
+
async function getPatientDeviceTelemetry(deviceId) {
|
|
36
|
+
return this.get(`/fhir/Device/${segment(deviceId)}/telemetry`);
|
|
37
|
+
}
|
|
38
|
+
async function getPatientDeviceTelemetryHistory(deviceId, params = {}) {
|
|
39
|
+
return this.get(`/fhir/Device/${segment(deviceId)}/telemetry/history${query(params)}`);
|
|
40
|
+
}
|
|
41
|
+
async function listPatientAppointments(params = {}) {
|
|
42
|
+
return this.searchResources("Appointment", params);
|
|
43
|
+
}
|
|
44
|
+
async function getPatientAppointment(appointmentId) {
|
|
45
|
+
return this.readResource("Appointment", appointmentId);
|
|
46
|
+
}
|
|
47
|
+
async function createPatientAppointment(appointment) {
|
|
48
|
+
return this.createResource(appointment);
|
|
49
|
+
}
|
|
50
|
+
async function updatePatientAppointment(appointment) {
|
|
51
|
+
return this.updateResource(appointment);
|
|
52
|
+
}
|
|
53
|
+
async function listPatientSchedules(params = {}) {
|
|
54
|
+
return this.searchResources("Schedule", params);
|
|
55
|
+
}
|
|
56
|
+
async function listPatientSlots(params = {}) {
|
|
57
|
+
return this.searchResources("Slot", params);
|
|
58
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Appointment, Bundle, Observation, Schedule, Slot } from "@medplum/fhirtypes";
|
|
2
|
+
export type OvokCurrentPatientProfile = {
|
|
3
|
+
project: {
|
|
4
|
+
resourceType: "Project";
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
strictMode: boolean;
|
|
8
|
+
};
|
|
9
|
+
membership: {
|
|
10
|
+
resourceType: "ProjectMembership";
|
|
11
|
+
id: string;
|
|
12
|
+
user: {
|
|
13
|
+
reference: string;
|
|
14
|
+
display: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
profile: {
|
|
18
|
+
resourceType: "Patient";
|
|
19
|
+
id: string;
|
|
20
|
+
name: Array<{
|
|
21
|
+
given: string[];
|
|
22
|
+
family: string;
|
|
23
|
+
}>;
|
|
24
|
+
telecom: Array<{
|
|
25
|
+
system: string;
|
|
26
|
+
use: string;
|
|
27
|
+
value: string;
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
config: {
|
|
31
|
+
resourceType: "UserConfiguration";
|
|
32
|
+
menu: Array<{
|
|
33
|
+
title: string;
|
|
34
|
+
link: Array<{
|
|
35
|
+
name: string;
|
|
36
|
+
target: string;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
accessPolicy: {
|
|
41
|
+
resourceType: "AccessPolicy";
|
|
42
|
+
resource: Array<{
|
|
43
|
+
resourceType: string;
|
|
44
|
+
}>;
|
|
45
|
+
ipAccessRule: Array<{
|
|
46
|
+
ip: string;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
security: {
|
|
50
|
+
mfaEnrolled: boolean;
|
|
51
|
+
sessions: Array<{
|
|
52
|
+
id: string;
|
|
53
|
+
lastUpdated: string;
|
|
54
|
+
authMethod: string;
|
|
55
|
+
remoteAddress: string;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export type OvokPatientLatestObservationsQuery = {
|
|
60
|
+
patient?: string;
|
|
61
|
+
max?: number;
|
|
62
|
+
code?: string | string[];
|
|
63
|
+
};
|
|
64
|
+
export type OvokPatientTelemetryHistoryQuery = {
|
|
65
|
+
from?: string;
|
|
66
|
+
to?: string;
|
|
67
|
+
code?: string;
|
|
68
|
+
page?: number;
|
|
69
|
+
pageSize?: number;
|
|
70
|
+
};
|
|
71
|
+
export type OvokPatientSchedulingQuery = Record<string, string | number | boolean | undefined>;
|
|
72
|
+
export type OvokPatientAppointment = Appointment;
|
|
73
|
+
export type OvokPatientSchedule = Schedule;
|
|
74
|
+
export type OvokPatientSlot = Slot;
|
|
75
|
+
export type OvokPatientObservationBundle = Bundle<Observation>;
|
|
76
|
+
export type OvokPatientTelemetryHistory = {
|
|
77
|
+
deviceId: string;
|
|
78
|
+
patientId: string;
|
|
79
|
+
signalsPatientId: string;
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
};
|
package/dist/client/questionnaire-response/methods/createQuestionnaireResponseWithObservations.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Bundle, Observation, QuestionnaireResponse } from "@medplum/fhirtypes";
|
|
2
2
|
import { OvokClient } from "../../ovok-client";
|
|
3
|
-
export declare function createQuestionnaireResponseWithObservations(this: OvokClient, questionnaireResponse: QuestionnaireResponse, observations: Observation[]): Promise<Bundle
|
|
3
|
+
export declare function createQuestionnaireResponseWithObservations(this: OvokClient, questionnaireResponse: QuestionnaireResponse, observations: Observation[]): Promise<Bundle>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extractQuestionnaireObservations = extractQuestionnaireObservations;
|
|
4
|
+
const segment = (value) => encodeURIComponent(value);
|
|
5
|
+
async function extractQuestionnaireObservations(questionnaireResponseId) {
|
|
6
|
+
return this.post(`/fhir/QuestionnaireResponse/${segment(questionnaireResponseId)}/$extract`, {});
|
|
7
|
+
}
|
|
@@ -15,3 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./createQuestionnaireResponseWithObservations"), exports);
|
|
18
|
+
__exportStar(require("./extractQuestionnaireObservations"), exports);
|
|
19
|
+
__exportStar(require("./populateQuestionnaire"), exports);
|
|
20
|
+
__exportStar(require("./submitQuestionnaireResponse"), exports);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Parameters } from "@medplum/fhirtypes";
|
|
2
|
+
import { OvokClient } from "../../ovok-client";
|
|
3
|
+
import { OvokQuestionnaireOperationResponse } from "../types";
|
|
4
|
+
export declare function populateQuestionnaire(this: OvokClient, questionnaireId: string, parameters?: Parameters): Promise<OvokQuestionnaireOperationResponse>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.populateQuestionnaire = populateQuestionnaire;
|
|
4
|
+
const segment = (value) => encodeURIComponent(value);
|
|
5
|
+
async function populateQuestionnaire(questionnaireId, parameters = { resourceType: "Parameters", parameter: [] }) {
|
|
6
|
+
return this.post(`/fhir/Questionnaire/${segment(questionnaireId)}/$populate`, parameters);
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Bundle, Observation, QuestionnaireResponse } from "@medplum/fhirtypes";
|
|
2
|
+
import { OvokClient } from "../../ovok-client";
|
|
3
|
+
export declare function submitQuestionnaireResponse(this: OvokClient, questionnaireResponse: QuestionnaireResponse, observations?: Observation[]): Promise<Bundle>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.submitQuestionnaireResponse = submitQuestionnaireResponse;
|
|
4
|
+
async function submitQuestionnaireResponse(questionnaireResponse, observations = []) {
|
|
5
|
+
return this.createQuestionnaireResponseWithObservations(questionnaireResponse, observations);
|
|
6
|
+
}
|
|
@@ -28,6 +28,7 @@ exports.OVOK_CORE_API_REQUIREMENTS = {
|
|
|
28
28
|
{ method: "POST", path: "/v2/auth/reset-password", group: "Auth" },
|
|
29
29
|
{ method: "POST", path: "/v2/auth/reset-password/process", group: "Auth" },
|
|
30
30
|
{ method: "GET", path: "/auth/session", group: "Auth" },
|
|
31
|
+
{ method: "GET", path: "/auth/me", group: "Auth" },
|
|
31
32
|
{ method: "DELETE", path: "/auth/session/current", group: "Auth" },
|
|
32
33
|
{ method: "DELETE", path: "/auth/session/:option", group: "Auth" },
|
|
33
34
|
{ method: "DELETE", path: "/auth/delete", group: "Auth" },
|
|
@@ -87,6 +88,11 @@ exports.OVOK_CORE_API_REQUIREMENTS = {
|
|
|
87
88
|
{ method: "GET", path: "/localization/i18next/:language", group: "Localization" },
|
|
88
89
|
{ method: "PATCH", path: "/localization/i18next/:language", group: "Localization" },
|
|
89
90
|
{ method: "GET", path: "/patient/:id/observation", group: "Patient" },
|
|
91
|
+
{ method: "GET", path: "/fhir/Observation/$lastn", group: "Patient" },
|
|
92
|
+
{ method: "GET", path: "/fhir/Device/:id/telemetry", group: "Patient" },
|
|
93
|
+
{ method: "GET", path: "/fhir/Device/:id/telemetry/history", group: "Patient" },
|
|
94
|
+
{ method: "POST", path: "/fhir/Questionnaire/:id/$populate", group: "Questionnaire" },
|
|
95
|
+
{ method: "POST", path: "/fhir/QuestionnaireResponse/:id/$extract", group: "Questionnaire" },
|
|
90
96
|
{ method: "GET", path: "/v1/carehub/patient", group: "Carehub/Patient" },
|
|
91
97
|
{ method: "GET", path: "/v1/carehub/patient/:id", group: "Carehub/Patient" },
|
|
92
98
|
{ method: "GET", path: "/v1/carehub/patient/:id/$everything", group: "Carehub/Patient" },
|
|
@@ -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.10",
|
|
52
52
|
},
|
|
53
53
|
fhirVersion: "4.0.1",
|
|
54
54
|
format: ["json"],
|
|
@@ -92,6 +92,43 @@ exports.OVOK_CORE_REQUIREMENTS = {
|
|
|
92
92
|
type: "QuestionnaireResponse",
|
|
93
93
|
interaction: [{ code: "create" }],
|
|
94
94
|
documentation: "Created as an entry of the transaction Bundle above, never on its own by this library.",
|
|
95
|
+
operation: [
|
|
96
|
+
{
|
|
97
|
+
name: "extract",
|
|
98
|
+
definition: "https://fhir.ovok.com/fhir/OperationDefinition/questionnaireresponse-extract",
|
|
99
|
+
documentation: "extractQuestionnaireObservations extracts the Observations represented by a saved QuestionnaireResponse.",
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "Questionnaire",
|
|
105
|
+
operation: [
|
|
106
|
+
{
|
|
107
|
+
name: "populate",
|
|
108
|
+
definition: "https://fhir.ovok.com/fhir/OperationDefinition/questionnaire-populate",
|
|
109
|
+
documentation: "populateQuestionnaire pre-fills a QuestionnaireResponse for the authenticated patient.",
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
type: "Appointment",
|
|
115
|
+
interaction: [
|
|
116
|
+
{ code: "search-type" },
|
|
117
|
+
{ code: "read" },
|
|
118
|
+
{ code: "create" },
|
|
119
|
+
{ code: "update" },
|
|
120
|
+
],
|
|
121
|
+
documentation: "Patient scheduling helpers search, read, create, and update standard FHIR Appointment resources.",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: "Schedule",
|
|
125
|
+
interaction: [{ code: "search-type" }],
|
|
126
|
+
documentation: "Patient scheduling helpers search standard FHIR Schedule resources.",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: "Slot",
|
|
130
|
+
interaction: [{ code: "search-type" }],
|
|
131
|
+
documentation: "Patient scheduling helpers search standard FHIR Slot resources.",
|
|
95
132
|
},
|
|
96
133
|
],
|
|
97
134
|
},
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export declare const OvokProvider: (props: React.PropsWithChildren<{
|
|
|
7
7
|
}>) => React.JSX.Element;
|
|
8
8
|
export { observationsToMeasurements, useEcgRecording, useObservations, useSaveMeasurement, useUrineTests, } from "./observation-hooks";
|
|
9
9
|
export { useAdministeredProjects, useCarehubDeviceTelemetry, useCarehubDevices, useCarehubNotifications, useCarehubPatients, useCapabilityStatement, useOvokMutation, useOvokRequest, useProjectFeatures, useProjectSettings, usePublicApiEndpoints, useRecentCarehubNotifications, } from "./api-hooks";
|
|
10
|
+
export { useCurrentPatientProfile, useExtractQuestionnaireObservations, usePatientAppointments, usePatientDeviceTelemetry, usePatientDeviceTelemetryHistory, usePatientLatestObservations, usePatientSchedules, usePatientSlots, usePopulateQuestionnaire, useSubmitQuestionnaireResponse, } from "./patient-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.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;
|
|
37
|
+
exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientLatestObservations = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = 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
|
*
|
|
@@ -89,3 +89,14 @@ Object.defineProperty(exports, "useProjectFeatures", { enumerable: true, get: fu
|
|
|
89
89
|
Object.defineProperty(exports, "useProjectSettings", { enumerable: true, get: function () { return api_hooks_1.useProjectSettings; } });
|
|
90
90
|
Object.defineProperty(exports, "usePublicApiEndpoints", { enumerable: true, get: function () { return api_hooks_1.usePublicApiEndpoints; } });
|
|
91
91
|
Object.defineProperty(exports, "useRecentCarehubNotifications", { enumerable: true, get: function () { return api_hooks_1.useRecentCarehubNotifications; } });
|
|
92
|
+
var patient_hooks_1 = require("./patient-hooks");
|
|
93
|
+
Object.defineProperty(exports, "useCurrentPatientProfile", { enumerable: true, get: function () { return patient_hooks_1.useCurrentPatientProfile; } });
|
|
94
|
+
Object.defineProperty(exports, "useExtractQuestionnaireObservations", { enumerable: true, get: function () { return patient_hooks_1.useExtractQuestionnaireObservations; } });
|
|
95
|
+
Object.defineProperty(exports, "usePatientAppointments", { enumerable: true, get: function () { return patient_hooks_1.usePatientAppointments; } });
|
|
96
|
+
Object.defineProperty(exports, "usePatientDeviceTelemetry", { enumerable: true, get: function () { return patient_hooks_1.usePatientDeviceTelemetry; } });
|
|
97
|
+
Object.defineProperty(exports, "usePatientDeviceTelemetryHistory", { enumerable: true, get: function () { return patient_hooks_1.usePatientDeviceTelemetryHistory; } });
|
|
98
|
+
Object.defineProperty(exports, "usePatientLatestObservations", { enumerable: true, get: function () { return patient_hooks_1.usePatientLatestObservations; } });
|
|
99
|
+
Object.defineProperty(exports, "usePatientSchedules", { enumerable: true, get: function () { return patient_hooks_1.usePatientSchedules; } });
|
|
100
|
+
Object.defineProperty(exports, "usePatientSlots", { enumerable: true, get: function () { return patient_hooks_1.usePatientSlots; } });
|
|
101
|
+
Object.defineProperty(exports, "usePopulateQuestionnaire", { enumerable: true, get: function () { return patient_hooks_1.usePopulateQuestionnaire; } });
|
|
102
|
+
Object.defineProperty(exports, "useSubmitQuestionnaireResponse", { enumerable: true, get: function () { return patient_hooks_1.useSubmitQuestionnaireResponse; } });
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Bundle, Observation, Parameters, QuestionnaireResponse } from "@medplum/fhirtypes";
|
|
2
|
+
import { OvokCurrentPatientProfile, OvokPatientAppointment, OvokPatientLatestObservationsQuery, OvokPatientObservationBundle, OvokPatientSchedule, OvokPatientSchedulingQuery, OvokPatientSlot, OvokPatientTelemetryHistory, OvokPatientTelemetryHistoryQuery } from "../client/patient/types";
|
|
3
|
+
import { OvokQuestionnaireOperationResponse } from "../client/questionnaire-response/types";
|
|
4
|
+
import { OvokMutationState, OvokRequestState } from "./api-hooks";
|
|
5
|
+
export declare const useCurrentPatientProfile: () => OvokRequestState<OvokCurrentPatientProfile>;
|
|
6
|
+
export declare const usePatientLatestObservations: (params?: OvokPatientLatestObservationsQuery) => OvokRequestState<OvokPatientObservationBundle>;
|
|
7
|
+
export declare const usePatientDeviceTelemetry: (deviceId?: string) => OvokRequestState<OvokPatientObservationBundle>;
|
|
8
|
+
export declare const usePatientDeviceTelemetryHistory: (deviceId: string | undefined, params?: OvokPatientTelemetryHistoryQuery) => OvokRequestState<OvokPatientTelemetryHistory>;
|
|
9
|
+
export declare const usePatientAppointments: (params?: OvokPatientSchedulingQuery) => OvokRequestState<OvokPatientAppointment[]>;
|
|
10
|
+
export declare const usePatientSchedules: (params?: OvokPatientSchedulingQuery) => OvokRequestState<OvokPatientSchedule[]>;
|
|
11
|
+
export declare const usePatientSlots: (params?: OvokPatientSchedulingQuery) => OvokRequestState<OvokPatientSlot[]>;
|
|
12
|
+
export declare const usePopulateQuestionnaire: () => OvokMutationState<{
|
|
13
|
+
questionnaireId: string;
|
|
14
|
+
parameters?: Parameters;
|
|
15
|
+
}, OvokQuestionnaireOperationResponse>;
|
|
16
|
+
export declare const useSubmitQuestionnaireResponse: () => OvokMutationState<{
|
|
17
|
+
questionnaireResponse: QuestionnaireResponse;
|
|
18
|
+
observations?: Observation[];
|
|
19
|
+
}, Bundle>;
|
|
20
|
+
export declare const useExtractQuestionnaireObservations: () => OvokMutationState<{
|
|
21
|
+
questionnaireResponseId: string;
|
|
22
|
+
}, OvokQuestionnaireOperationResponse>;
|
|
@@ -0,0 +1,101 @@
|
|
|
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.useExtractQuestionnaireObservations = exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientAppointments = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientLatestObservations = exports.useCurrentPatientProfile = void 0;
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const api_hooks_1 = require("./api-hooks");
|
|
40
|
+
const index_1 = require("./index");
|
|
41
|
+
const useCurrentPatientProfile = () => {
|
|
42
|
+
const client = (0, index_1.useClient)();
|
|
43
|
+
const load = React.useCallback(() => client.getCurrentPatientProfile(), [client]);
|
|
44
|
+
return (0, api_hooks_1.useOvokRequest)(load);
|
|
45
|
+
};
|
|
46
|
+
exports.useCurrentPatientProfile = useCurrentPatientProfile;
|
|
47
|
+
const usePatientLatestObservations = (params = {}) => {
|
|
48
|
+
const client = (0, index_1.useClient)();
|
|
49
|
+
const serialized = JSON.stringify(params);
|
|
50
|
+
const load = React.useCallback(() => client.getPatientLatestObservations(params), [client, serialized]);
|
|
51
|
+
return (0, api_hooks_1.useOvokRequest)(load);
|
|
52
|
+
};
|
|
53
|
+
exports.usePatientLatestObservations = usePatientLatestObservations;
|
|
54
|
+
const usePatientDeviceTelemetry = (deviceId) => {
|
|
55
|
+
const client = (0, index_1.useClient)();
|
|
56
|
+
const load = React.useCallback(() => deviceId
|
|
57
|
+
? client.getPatientDeviceTelemetry(deviceId)
|
|
58
|
+
: Promise.reject(new Error("deviceId is required")), [client, deviceId]);
|
|
59
|
+
return (0, api_hooks_1.useOvokRequest)(load, deviceId !== undefined);
|
|
60
|
+
};
|
|
61
|
+
exports.usePatientDeviceTelemetry = usePatientDeviceTelemetry;
|
|
62
|
+
const usePatientDeviceTelemetryHistory = (deviceId, params = {}) => {
|
|
63
|
+
const client = (0, index_1.useClient)();
|
|
64
|
+
const serialized = JSON.stringify(params);
|
|
65
|
+
const load = React.useCallback(() => deviceId
|
|
66
|
+
? client.getPatientDeviceTelemetryHistory(deviceId, params)
|
|
67
|
+
: Promise.reject(new Error("deviceId is required")), [client, deviceId, serialized]);
|
|
68
|
+
return (0, api_hooks_1.useOvokRequest)(load, deviceId !== undefined);
|
|
69
|
+
};
|
|
70
|
+
exports.usePatientDeviceTelemetryHistory = usePatientDeviceTelemetryHistory;
|
|
71
|
+
const usePatientAppointments = (params = {}) => {
|
|
72
|
+
const client = (0, index_1.useClient)();
|
|
73
|
+
const serialized = JSON.stringify(params);
|
|
74
|
+
const load = React.useCallback(() => client.listPatientAppointments(params), [client, serialized]);
|
|
75
|
+
return (0, api_hooks_1.useOvokRequest)(load);
|
|
76
|
+
};
|
|
77
|
+
exports.usePatientAppointments = usePatientAppointments;
|
|
78
|
+
const usePatientSchedules = (params = {}) => {
|
|
79
|
+
const client = (0, index_1.useClient)();
|
|
80
|
+
const serialized = JSON.stringify(params);
|
|
81
|
+
const load = React.useCallback(() => client.listPatientSchedules(params), [client, serialized]);
|
|
82
|
+
return (0, api_hooks_1.useOvokRequest)(load);
|
|
83
|
+
};
|
|
84
|
+
exports.usePatientSchedules = usePatientSchedules;
|
|
85
|
+
const usePatientSlots = (params = {}) => {
|
|
86
|
+
const client = (0, index_1.useClient)();
|
|
87
|
+
const serialized = JSON.stringify(params);
|
|
88
|
+
const load = React.useCallback(() => client.listPatientSlots(params), [client, serialized]);
|
|
89
|
+
return (0, api_hooks_1.useOvokRequest)(load);
|
|
90
|
+
};
|
|
91
|
+
exports.usePatientSlots = usePatientSlots;
|
|
92
|
+
const usePopulateQuestionnaire = () => (0, api_hooks_1.useOvokMutation)((client, params) => client.populateQuestionnaire(params.questionnaireId, params.parameters));
|
|
93
|
+
exports.usePopulateQuestionnaire = usePopulateQuestionnaire;
|
|
94
|
+
const useSubmitQuestionnaireResponse = () => {
|
|
95
|
+
return (0, api_hooks_1.useOvokMutation)((client, params) => client.submitQuestionnaireResponse(params.questionnaireResponse, params.observations));
|
|
96
|
+
};
|
|
97
|
+
exports.useSubmitQuestionnaireResponse = useSubmitQuestionnaireResponse;
|
|
98
|
+
const useExtractQuestionnaireObservations = () => {
|
|
99
|
+
return (0, api_hooks_1.useOvokMutation)((client, params) => client.extractQuestionnaireObservations(params.questionnaireResponseId));
|
|
100
|
+
};
|
|
101
|
+
exports.useExtractQuestionnaireObservations = useExtractQuestionnaireObservations;
|
package/dist/index.d.ts
CHANGED
|
@@ -938,3 +938,6 @@ export * from "./conformance/capability";
|
|
|
938
938
|
export * from "./client/platform/types";
|
|
939
939
|
export * from "./client/carehub/types";
|
|
940
940
|
export * from "./client/experience/types";
|
|
941
|
+
export * from "./client/patient/types";
|
|
942
|
+
export * from "./client/questionnaire-response/methods";
|
|
943
|
+
export * from "./client/questionnaire-response/types";
|
package/dist/index.js
CHANGED
|
@@ -61,3 +61,6 @@ __exportStar(require("./conformance/capability"), exports);
|
|
|
61
61
|
__exportStar(require("./client/platform/types"), exports);
|
|
62
62
|
__exportStar(require("./client/carehub/types"), exports);
|
|
63
63
|
__exportStar(require("./client/experience/types"), exports);
|
|
64
|
+
__exportStar(require("./client/patient/types"), exports);
|
|
65
|
+
__exportStar(require("./client/questionnaire-response/methods"), exports);
|
|
66
|
+
__exportStar(require("./client/questionnaire-response/types"), exports);
|