@ovok/core 0.4.2 → 0.4.3

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 CHANGED
@@ -154,13 +154,14 @@ const slots = await client.listPatientSlots({
154
154
 
155
155
  ## Signals APIs
156
156
 
157
- The Signals client methods and hooks cover resident thresholds, the project's alert feed, and
158
- Signals tenant settings. Ovok forwards observations for enabled residents to Signals on the
159
- backend; continue saving readings through the existing Observation APIs and do not submit the
160
- same readings to Signals separately.
157
+ The Signals client methods and hooks cover enrolling an existing patient, resident thresholds, the
158
+ project's alert feed, and Signals tenant settings. Ovok forwards observations for enabled residents
159
+ to Signals on the backend; continue saving readings through the existing Observation APIs and do not
160
+ submit the same readings to Signals separately.
161
161
 
162
162
  ```ts
163
163
  const thresholds = await client.getSignalsThresholds(patientId);
164
+ const enrollment = await client.enableSignalsForPatient(patientId);
164
165
  const updated = await client.setSignalsThreshold(patientId, "8867-4", {
165
166
  low: 50,
166
167
  high: 120,
@@ -181,6 +182,11 @@ non-empty `reason`; the backend decides whether the caller has the required capa
181
182
  `shared` settings tenant is read-only. Signal errors are exposed as `SignalsError` values and can
182
183
  be checked with `isSignalsError`.
183
184
 
185
+ Use `enableSignalsForPatient` to enroll an existing patient. It is idempotent and requires the caller to have
186
+ `signals_config:update` and update access to that patient. A `signals_mint_failed` `SignalsError` is a retryable
187
+ 503. React applications can call `useEnableSignalsForPatient().mutate(patientId)`; the hook exposes the standard
188
+ mutation `loading`, `error`, and `data` state.
189
+
184
190
  `useSignalsAlerts` accumulates pages through `loadMore`. Check `hasMore` rather than the current
185
191
  item count: access filtering can produce a short or empty page with another cursor. Query changes
186
192
  and `reload` start again at the first page. The hook exposes `reload` so a screen can refresh its
@@ -17,6 +17,7 @@ const SIGNALS_ERROR_STATUSES = {
17
17
  signals_write_mismatch: 503,
18
18
  signals_unavailable: 503,
19
19
  signals_undo_failed: 503,
20
+ signals_mint_failed: 503,
20
21
  signals_forbidden: 403,
21
22
  signals_not_found: 404,
22
23
  validation_error: 422,
@@ -1,5 +1,10 @@
1
1
  import { OvokClient } from "../ovok-client";
2
- import { SetSignalsThresholdBody, SignalsAlert, SignalsAlertsPage, SignalsAlertsQuery, SignalsSettingsPatch, SignalsSettingsResponse, SignalsThreshold, SignalsThresholds } from "./types";
2
+ import { EnableSignalsResponse, SetSignalsThresholdBody, SignalsAlert, SignalsAlertsPage, SignalsAlertsQuery, SignalsSettingsPatch, SignalsSettingsResponse, SignalsThreshold, SignalsThresholds } from "./types";
3
+ /**
4
+ * Enables Signals for an existing patient. The operation is idempotent; observations saved through Ovok are
5
+ * forwarded by the backend, so callers should not submit the same readings to Signals separately.
6
+ */
7
+ export declare function enableSignalsForPatient(this: OvokClient, patientId: string): Promise<EnableSignalsResponse>;
3
8
  export declare function getSignalsThresholds(this: OvokClient, patientId: string): Promise<SignalsThresholds>;
4
9
  export declare function setSignalsThreshold(this: OvokClient, patientId: string, code: string, body: SetSignalsThresholdBody): Promise<SignalsThreshold>;
5
10
  export declare function removeSignalsThreshold(this: OvokClient, patientId: string, code: string, reason: string): Promise<void>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enableSignalsForPatient = enableSignalsForPatient;
3
4
  exports.getSignalsThresholds = getSignalsThresholds;
4
5
  exports.setSignalsThreshold = setSignalsThreshold;
5
6
  exports.removeSignalsThreshold = removeSignalsThreshold;
@@ -10,6 +11,13 @@ exports.acknowledgeSignalsAlert = acknowledgeSignalsAlert;
10
11
  exports.getSignalsSettings = getSignalsSettings;
11
12
  exports.updateSignalsSettings = updateSignalsSettings;
12
13
  const segment = (value) => encodeURIComponent(value);
14
+ /**
15
+ * Enables Signals for an existing patient. The operation is idempotent; observations saved through Ovok are
16
+ * forwarded by the backend, so callers should not submit the same readings to Signals separately.
17
+ */
18
+ function enableSignalsForPatient(patientId) {
19
+ return this.post(`/fhir/Patient/${segment(patientId)}/$enable-signals`);
20
+ }
13
21
  function getSignalsThresholds(patientId) {
14
22
  return this.get(`/v1/signals/patients/${segment(patientId)}/thresholds`);
15
23
  }
@@ -50,5 +50,10 @@ export type SignalsSettingsResponse = {
50
50
  settings: SignalsSettings;
51
51
  };
52
52
  export type SignalsSettingsPatch = Partial<SignalsSettings>;
53
- export type SignalsErrorCode = "signals_threshold_not_editable" | "signals_patient_not_enrolled" | "signals_conflict" | "signals_code_not_medical" | "signals_reason_required" | "signals_episodes_disabled" | "signals_bad_request" | "signals_shared_tenant" | "signals_audit_failed" | "signals_write_mismatch" | "signals_unavailable" | "signals_undo_failed" | "signals_forbidden" | "signals_not_found" | "validation_error";
53
+ export type EnableSignalsResponse = {
54
+ patientId: string;
55
+ signalsPatientId: string;
56
+ enabled: boolean;
57
+ };
58
+ export type SignalsErrorCode = "signals_threshold_not_editable" | "signals_patient_not_enrolled" | "signals_conflict" | "signals_code_not_medical" | "signals_reason_required" | "signals_episodes_disabled" | "signals_bad_request" | "signals_shared_tenant" | "signals_audit_failed" | "signals_write_mismatch" | "signals_unavailable" | "signals_undo_failed" | "signals_mint_failed" | "signals_forbidden" | "signals_not_found" | "validation_error";
54
59
  export type SignalsFieldError = ValidationError;
@@ -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.4.2",
51
+ version: "0.4.3",
52
52
  },
53
53
  fhirVersion: "4.0.1",
54
54
  format: ["json"],
@@ -92,6 +92,16 @@ exports.OVOK_CORE_REQUIREMENTS = {
92
92
  },
93
93
  ],
94
94
  },
95
+ {
96
+ type: "Patient",
97
+ operation: [
98
+ {
99
+ name: "enable-signals",
100
+ definition: "https://fhir.ovok.com/fhir/OperationDefinition/patient-enable-signals",
101
+ documentation: "enableSignalsForPatient enrolls an existing patient in Signals. The operation is idempotent.",
102
+ },
103
+ ],
104
+ },
95
105
  {
96
106
  type: "QuestionnaireResponse",
97
107
  interaction: [
@@ -11,4 +11,4 @@ export { useConsentSignature, useContent, useCreateVideoCallAppointment, useCrea
11
11
  export { useI18nextDocument, useLocales, useLocalizations, useUpdateI18nextDocument, useUpdateLocalization, } from "./platform-hooks";
12
12
  export { useCurrentPatientProfile, useExtractQuestionnaireObservations, usePatientAppointments, usePatientCarePlans, usePatientDevices, usePatientDeviceTelemetry, usePatientDeviceTelemetryHistory, usePatientMeasurement, usePatientMeasurementHistory, usePatientDashboard, usePatientLatestObservations, usePatientNotifications, usePatientQuestionnaireResponses, usePatientQuestionnaires, usePatientSchedules, usePatientSlots, usePopulateQuestionnaire, useSubmitQuestionnaireResponse, } from "./patient-hooks";
13
13
  export { useCreatePatientSharingInvite, usePatientSharing, usePatientSharingSettings, useRedeemPatientSharingInvite, useRevokePatientSharing, useUpdatePatientSharingSettings, } from "./patient-sharing-hooks";
14
- export { useAcknowledgeSignalsAlert, useRemoveSignalsThreshold, useSetSignalsThreshold, useSignalsAlert, useSignalsAlerts, useSignalsSettings, useSignalsThresholds, useUpdateSignalsSettings, } from "./signals-hooks";
14
+ export { useAcknowledgeSignalsAlert, useEnableSignalsForPatient, useRemoveSignalsThreshold, useSetSignalsThreshold, useSignalsAlert, useSignalsAlerts, useSignalsSettings, useSignalsThresholds, useUpdateSignalsSettings, } from "./signals-hooks";
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.usePatientMeasurement = exports.usePatientDeviceTelemetryHistory = exports.usePatientDeviceTelemetry = exports.usePatientDevices = exports.usePatientCarePlans = exports.usePatientAppointments = exports.useExtractQuestionnaireObservations = exports.useCurrentPatientProfile = exports.useUpdateLocalization = exports.useUpdateI18nextDocument = exports.useLocalizations = exports.useLocales = exports.useI18nextDocument = exports.useVideoCallAppointments = exports.useVideoCallAccess = exports.useDocuments = exports.useCreateVideoCallUserAccess = exports.useCreateVideoCallAppointment = exports.useContent = exports.useConsentSignature = 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
- exports.useUpdateSignalsSettings = exports.useSignalsThresholds = exports.useSignalsSettings = exports.useSignalsAlerts = exports.useSignalsAlert = exports.useSetSignalsThreshold = exports.useRemoveSignalsThreshold = exports.useAcknowledgeSignalsAlert = exports.useUpdatePatientSharingSettings = exports.useRevokePatientSharing = exports.useRedeemPatientSharingInvite = exports.usePatientSharingSettings = exports.usePatientSharing = exports.useCreatePatientSharingInvite = exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientQuestionnaires = exports.usePatientQuestionnaireResponses = exports.usePatientNotifications = exports.usePatientLatestObservations = exports.usePatientDashboard = exports.usePatientMeasurementHistory = void 0;
38
+ exports.useUpdateSignalsSettings = exports.useSignalsThresholds = exports.useSignalsSettings = exports.useSignalsAlerts = exports.useSignalsAlert = exports.useSetSignalsThreshold = exports.useRemoveSignalsThreshold = exports.useEnableSignalsForPatient = exports.useAcknowledgeSignalsAlert = exports.useUpdatePatientSharingSettings = exports.useRevokePatientSharing = exports.useRedeemPatientSharingInvite = exports.usePatientSharingSettings = exports.usePatientSharing = exports.useCreatePatientSharingInvite = exports.useSubmitQuestionnaireResponse = exports.usePopulateQuestionnaire = exports.usePatientSlots = exports.usePatientSchedules = exports.usePatientQuestionnaires = exports.usePatientQuestionnaireResponses = exports.usePatientNotifications = exports.usePatientLatestObservations = exports.usePatientDashboard = exports.usePatientMeasurementHistory = void 0;
39
39
  /*
40
40
  * The only React-dependent module in the package.
41
41
  *
@@ -132,6 +132,7 @@ Object.defineProperty(exports, "useRevokePatientSharing", { enumerable: true, ge
132
132
  Object.defineProperty(exports, "useUpdatePatientSharingSettings", { enumerable: true, get: function () { return patient_sharing_hooks_1.useUpdatePatientSharingSettings; } });
133
133
  var signals_hooks_1 = require("./signals-hooks");
134
134
  Object.defineProperty(exports, "useAcknowledgeSignalsAlert", { enumerable: true, get: function () { return signals_hooks_1.useAcknowledgeSignalsAlert; } });
135
+ Object.defineProperty(exports, "useEnableSignalsForPatient", { enumerable: true, get: function () { return signals_hooks_1.useEnableSignalsForPatient; } });
135
136
  Object.defineProperty(exports, "useRemoveSignalsThreshold", { enumerable: true, get: function () { return signals_hooks_1.useRemoveSignalsThreshold; } });
136
137
  Object.defineProperty(exports, "useSetSignalsThreshold", { enumerable: true, get: function () { return signals_hooks_1.useSetSignalsThreshold; } });
137
138
  Object.defineProperty(exports, "useSignalsAlert", { enumerable: true, get: function () { return signals_hooks_1.useSignalsAlert; } });
@@ -1,4 +1,4 @@
1
- import { SetSignalsThresholdBody, SignalsAlert, SignalsAlertsQuery, SignalsSettingsPatch, SignalsSettingsResponse, SignalsThreshold, SignalsThresholds } from "../client/signals";
1
+ import { EnableSignalsResponse, SetSignalsThresholdBody, SignalsAlert, SignalsAlertsQuery, SignalsSettingsPatch, SignalsSettingsResponse, SignalsThreshold, SignalsThresholds } from "../client/signals";
2
2
  import { OvokMutationState, OvokRequestState } from "./api-hooks";
3
3
  type SetSignalsThresholdParams = {
4
4
  patientId: string;
@@ -23,6 +23,7 @@ export type SignalsAlertsHookState = {
23
23
  hasMore: boolean;
24
24
  loadMore: () => Promise<void>;
25
25
  };
26
+ export declare const useEnableSignalsForPatient: () => OvokMutationState<string, EnableSignalsResponse>;
26
27
  export declare const useSignalsThresholds: (patientId?: string) => OvokRequestState<SignalsThresholds>;
27
28
  export declare const useSetSignalsThreshold: () => OvokMutationState<SetSignalsThresholdParams, SignalsThreshold>;
28
29
  export declare const useRemoveSignalsThreshold: () => OvokMutationState<RemoveSignalsThresholdParams, void>;
@@ -34,10 +34,12 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  };
35
35
  })();
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useUpdateSignalsSettings = exports.useSignalsSettings = exports.useAcknowledgeSignalsAlert = exports.useSignalsAlert = exports.useSignalsAlerts = exports.useRemoveSignalsThreshold = exports.useSetSignalsThreshold = exports.useSignalsThresholds = void 0;
37
+ exports.useUpdateSignalsSettings = exports.useSignalsSettings = exports.useAcknowledgeSignalsAlert = exports.useSignalsAlert = exports.useSignalsAlerts = exports.useRemoveSignalsThreshold = exports.useSetSignalsThreshold = exports.useSignalsThresholds = exports.useEnableSignalsForPatient = void 0;
38
38
  const React = __importStar(require("react"));
39
39
  const api_hooks_1 = require("./api-hooks");
40
40
  const index_1 = require("./index");
41
+ const useEnableSignalsForPatient = () => (0, api_hooks_1.useOvokMutation)((client, patientId) => client.enableSignalsForPatient(patientId));
42
+ exports.useEnableSignalsForPatient = useEnableSignalsForPatient;
41
43
  const useSignalsThresholds = (patientId) => {
42
44
  const client = (0, index_1.useClient)();
43
45
  const load = React.useCallback(() => client.getSignalsThresholds(patientId), [client, patientId]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/core",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",