@ovok/core 0.4.49-rc.1 → 0.4.49-rc.2
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 +27 -79
- package/dist/client/observation/measurement-fields.d.ts +1 -1
- package/dist/client/observation/methods/observationsToMeasurements.d.ts +1 -1
- package/dist/client/observation/methods/observationsToMeasurements.js +59 -59
- package/dist/client/observation/services/base-observation-service.d.ts +1 -1
- package/dist/client/observation/services/blood-oxygen.d.ts +1 -1
- package/dist/client/observation/services/blood-oxygen.js +7 -7
- package/dist/client/observation/services/blood-pressure.d.ts +1 -1
- package/dist/client/observation/services/blood-pressure.js +16 -16
- package/dist/client/observation/services/component-observation-services.d.ts +1 -1
- package/dist/client/observation/services/component-observation-services.js +3 -3
- package/dist/client/observation/services/creator.d.ts +1 -1
- package/dist/client/observation/services/creator.js +10 -10
- package/dist/client/observation/services/ecg-observation-fragments.d.ts +1 -1
- package/dist/client/observation/services/ecg.d.ts +1 -1
- package/dist/client/observation/services/ecg.js +10 -10
- package/dist/client/observation/services/lipid-panel.d.ts +1 -1
- package/dist/client/observation/services/lipid-panel.js +13 -13
- package/dist/client/observation/services/single-value-services.d.ts +1 -1
- package/dist/client/observation/services/single-value-services.js +19 -19
- package/dist/client/observation/services/step-count.d.ts +1 -1
- package/dist/client/observation/services/step-count.js +5 -5
- package/dist/client/observation/services/uric-acid-service.d.ts +1 -1
- package/dist/client/observation/services/uric-acid-service.js +7 -7
- package/dist/client/offline/offline-measurement-queue.d.ts +1 -2
- package/dist/client/signals/methods.d.ts +2 -23
- package/dist/client/signals/methods.js +10 -93
- package/dist/client/signals/types.d.ts +6 -132
- package/dist/client/wearables/types.d.ts +5 -0
- package/dist/conformance/api-requirements.js +2 -9
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -9
- package/dist/hooks/notification-invalidation.d.ts +0 -7
- package/dist/hooks/signals-hooks.d.ts +2 -23
- package/dist/hooks/signals-hooks.js +1 -15
- package/dist/next/auth/access-token.d.ts +9 -0
- package/dist/next/auth/access-token.js +18 -0
- package/dist/next/auth/client-credentials.d.ts +16 -0
- package/dist/next/auth/client-credentials.js +40 -0
- package/dist/next/auth/credentials.d.ts +5 -0
- package/dist/next/auth/credentials.js +7 -0
- package/dist/next/auth/saved-accounts-store.d.ts +26 -0
- package/dist/next/auth/saved-accounts-store.js +93 -0
- package/dist/next/auth/session-store.d.ts +12 -0
- package/dist/next/auth/session-store.js +33 -0
- package/dist/next/auth/session.d.ts +28 -0
- package/dist/next/auth/session.js +27 -0
- package/dist/next/auth/token-endpoint.d.ts +12 -0
- package/dist/next/auth/token-endpoint.js +28 -0
- package/dist/next/auth/user-session.d.ts +39 -0
- package/dist/next/auth/user-session.js +183 -0
- package/dist/next/config/ovok-config.d.ts +42 -0
- package/dist/next/config/ovok-config.js +2 -0
- package/dist/next/config/settings.d.ts +6 -0
- package/dist/next/config/settings.js +74 -0
- package/dist/next/errors/error-from-response.d.ts +2 -0
- package/dist/next/errors/error-from-response.js +35 -0
- package/dist/next/errors/ovok-account-error.d.ts +5 -0
- package/dist/next/errors/ovok-account-error.js +13 -0
- package/dist/next/errors/ovok-errors.d.ts +42 -0
- package/dist/next/errors/ovok-errors.js +74 -0
- package/dist/next/http/http-client.d.ts +36 -0
- package/dist/next/http/http-client.js +116 -0
- package/dist/next/http/retry-after.d.ts +1 -0
- package/dist/next/http/retry-after.js +16 -0
- package/dist/next/http/retry-policy.d.ts +13 -0
- package/dist/next/http/retry-policy.js +27 -0
- package/dist/next/http/transmit.d.ts +14 -0
- package/dist/next/http/transmit.js +57 -0
- package/dist/next/http/url.d.ts +6 -0
- package/dist/next/http/url.js +22 -0
- package/dist/next/index.d.ts +77 -0
- package/dist/next/index.js +35 -0
- package/dist/next/ovok.d.ts +56 -0
- package/dist/next/ovok.js +86 -0
- package/dist/next/paging/bundle-page.d.ts +4 -0
- package/dist/next/paging/bundle-page.js +25 -0
- package/dist/next/paging/cursor-pages.d.ts +7 -0
- package/dist/next/paging/cursor-pages.js +14 -0
- package/dist/next/paging/numbered-pages.d.ts +15 -0
- package/dist/next/paging/numbered-pages.js +20 -0
- package/dist/next/paging/page.d.ts +12 -0
- package/dist/next/paging/page.js +17 -0
- package/dist/next/react/context.d.ts +4 -0
- package/dist/{hooks/signals-alert-item-hooks.js → next/react/context.js} +10 -26
- package/dist/next/react/index.d.ts +14 -0
- package/dist/next/react/index.js +68 -0
- package/dist/next/react/query-hooks.d.ts +31 -0
- package/dist/next/react/query-hooks.js +160 -0
- package/dist/next/resources/accounts/accounts-resource.d.ts +8 -0
- package/dist/next/resources/accounts/accounts-resource.js +13 -0
- package/dist/next/resources/ai/ai-chat-resource.d.ts +8 -0
- package/dist/next/resources/ai/ai-chat-resource.js +12 -0
- package/dist/next/resources/ai/ai-resource.d.ts +16 -0
- package/dist/next/resources/ai/ai-resource.js +19 -0
- package/dist/next/resources/ai/chat-messages-resource.d.ts +9 -0
- package/dist/next/resources/ai/chat-messages-resource.js +18 -0
- package/dist/next/resources/ai/chat-sessions-resource.d.ts +14 -0
- package/dist/next/resources/ai/chat-sessions-resource.js +23 -0
- package/dist/next/resources/auth/auth-sessions-resource.d.ts +13 -0
- package/dist/next/resources/auth/auth-sessions-resource.js +25 -0
- package/dist/next/resources/auth/registration.d.ts +35 -0
- package/dist/next/resources/auth/registration.js +24 -0
- package/dist/next/resources/auth/social-login.d.ts +8 -0
- package/dist/next/resources/auth/social-login.js +7 -0
- package/dist/next/resources/auth-resource.d.ts +63 -0
- package/dist/next/resources/auth-resource.js +119 -0
- package/dist/next/resources/bots/bots-resource.d.ts +10 -0
- package/dist/next/resources/bots/bots-resource.js +15 -0
- package/dist/next/resources/cms/cms-delivery.d.ts +22 -0
- package/dist/next/resources/cms/cms-delivery.js +36 -0
- package/dist/next/resources/cms/cms-documents-resource.d.ts +11 -0
- package/dist/next/resources/cms/cms-documents-resource.js +17 -0
- package/dist/next/resources/cms/cms-resource.d.ts +17 -0
- package/dist/next/resources/cms/cms-resource.js +38 -0
- package/dist/next/resources/cms/payload-pages.d.ts +6 -0
- package/dist/next/resources/cms/payload-pages.js +15 -0
- package/dist/next/resources/cms/release-notes-resource.d.ts +10 -0
- package/dist/next/resources/cms/release-notes-resource.js +15 -0
- package/dist/next/resources/cms/translation-tree.d.ts +3 -0
- package/dist/next/resources/cms/translation-tree.js +45 -0
- package/dist/next/resources/consent/consent-resource.d.ts +23 -0
- package/dist/next/resources/consent/consent-resource.js +43 -0
- package/dist/next/resources/content/content-resource.d.ts +19 -0
- package/dist/next/resources/content/content-resource.js +41 -0
- package/dist/next/resources/documents/documents-resource.d.ts +26 -0
- package/dist/next/resources/documents/documents-resource.js +41 -0
- package/dist/next/resources/email/email-resource.d.ts +6 -0
- package/dist/next/resources/email/email-resource.js +10 -0
- package/dist/next/resources/email/email-templates-resource.d.ts +8 -0
- package/dist/next/resources/email/email-templates-resource.js +13 -0
- package/dist/next/resources/fhir-resource.d.ts +28 -0
- package/dist/next/resources/fhir-resource.js +64 -0
- package/dist/next/resources/health-resource.d.ts +17 -0
- package/dist/next/resources/health-resource.js +14 -0
- package/dist/next/resources/invites/invite-flow-resource.d.ts +12 -0
- package/dist/next/resources/invites/invite-flow-resource.js +19 -0
- package/dist/next/resources/invites/invites-resource.d.ts +22 -0
- package/dist/next/resources/invites/invites-resource.js +29 -0
- package/dist/next/resources/localization/i18next-resource.d.ts +10 -0
- package/dist/next/resources/localization/i18next-resource.js +18 -0
- package/dist/next/resources/localization/locales-resource.d.ts +9 -0
- package/dist/next/resources/localization/locales-resource.js +16 -0
- package/dist/next/resources/localization/localizations-resource.d.ts +17 -0
- package/dist/next/resources/localization/localizations-resource.js +27 -0
- package/dist/next/resources/measurements/measurements-resource.d.ts +58 -0
- package/dist/next/resources/measurements/measurements-resource.js +98 -0
- package/dist/next/resources/measurements/observation-builder.d.ts +5 -0
- package/dist/next/resources/measurements/observation-builder.js +57 -0
- package/dist/next/resources/measurements/offline-measurement-queue-types.d.ts +22 -0
- package/dist/next/resources/measurements/offline-measurement-queue-types.js +2 -0
- package/dist/next/resources/measurements/offline-measurement-queue.d.ts +25 -0
- package/dist/next/resources/measurements/offline-measurement-queue.js +154 -0
- package/dist/next/resources/measurements/save-error.d.ts +5 -0
- package/dist/next/resources/measurements/save-error.js +18 -0
- package/dist/next/resources/measurements/signed-in-account.d.ts +11 -0
- package/dist/next/resources/measurements/signed-in-account.js +26 -0
- package/dist/next/resources/patient/fhir-records.d.ts +19 -0
- package/dist/next/resources/patient/fhir-records.js +33 -0
- package/dist/next/resources/patient/patient-resource.d.ts +21 -0
- package/dist/next/resources/patient/patient-resource.js +38 -0
- package/dist/next/resources/projects/project-features-resource.d.ts +9 -0
- package/dist/next/resources/projects/project-features-resource.js +17 -0
- package/dist/next/resources/projects/project-members-resource.d.ts +19 -0
- package/dist/next/resources/projects/project-members-resource.js +25 -0
- package/dist/next/resources/projects/project-settings-resource.d.ts +10 -0
- package/dist/next/resources/projects/project-settings-resource.js +21 -0
- package/dist/next/resources/projects/projects-resource.d.ts +20 -0
- package/dist/next/resources/projects/projects-resource.js +21 -0
- package/dist/next/resources/questionnaires/questionnaires-resource.d.ts +18 -0
- package/dist/next/resources/questionnaires/questionnaires-resource.js +36 -0
- package/dist/next/resources/realtime/realtime-binding.d.ts +7 -0
- package/dist/next/resources/realtime/realtime-binding.js +44 -0
- package/dist/next/resources/realtime/realtime-connection.d.ts +38 -0
- package/dist/next/resources/realtime/realtime-connection.js +167 -0
- package/dist/next/resources/realtime/realtime-resource.d.ts +13 -0
- package/dist/next/resources/realtime/realtime-resource.js +39 -0
- package/dist/next/resources/realtime/realtime-socket.d.ts +23 -0
- package/dist/next/resources/realtime/realtime-socket.js +152 -0
- package/dist/next/resources/realtime/realtime-types.d.ts +6 -0
- package/dist/next/resources/realtime/realtime-types.js +2 -0
- package/dist/next/resources/session/saved-accounts-resource.d.ts +13 -0
- package/dist/next/resources/session/saved-accounts-resource.js +44 -0
- package/dist/next/resources/session/session-resource.d.ts +12 -0
- package/dist/next/resources/session/session-resource.js +19 -0
- package/dist/next/resources/sharing/sharing-invites-resource.d.ts +9 -0
- package/dist/next/resources/sharing/sharing-invites-resource.js +17 -0
- package/dist/next/resources/sharing/sharing-resource.d.ts +10 -0
- package/dist/next/resources/sharing/sharing-resource.js +14 -0
- package/dist/next/resources/sharing/sharing-settings-resource.d.ts +9 -0
- package/dist/next/resources/sharing/sharing-settings-resource.js +16 -0
- package/dist/next/resources/sharing/sharing-shares-resource.d.ts +9 -0
- package/dist/next/resources/sharing/sharing-shares-resource.js +27 -0
- package/dist/next/resources/signals/signals-gateway-resource.d.ts +14 -0
- package/dist/next/resources/signals/signals-gateway-resource.js +44 -0
- package/dist/next/resources/signals/signals-resource.d.ts +13 -0
- package/dist/next/resources/signals/signals-resource.js +19 -0
- package/dist/next/resources/signals/undeliverable-resource.d.ts +26 -0
- package/dist/next/resources/signals/undeliverable-resource.js +18 -0
- package/dist/next/resources/slim/live-reads.d.ts +13 -0
- package/dist/next/resources/slim/live-reads.js +87 -0
- package/dist/next/resources/slim/slim-alarms-resource.d.ts +13 -0
- package/dist/next/resources/slim/slim-alarms-resource.js +25 -0
- package/dist/next/resources/slim/slim-change-history-resource.d.ts +9 -0
- package/dist/next/resources/slim/slim-change-history-resource.js +19 -0
- package/dist/next/resources/slim/slim-child-projects-resource.d.ts +17 -0
- package/dist/next/resources/slim/slim-child-projects-resource.js +22 -0
- package/dist/next/resources/slim/slim-devices-resource.d.ts +29 -0
- package/dist/next/resources/slim/slim-devices-resource.js +81 -0
- package/dist/next/resources/slim/slim-exports-resource.d.ts +8 -0
- package/dist/next/resources/slim/slim-exports-resource.js +14 -0
- package/dist/next/resources/slim/slim-locations-resource.d.ts +14 -0
- package/dist/next/resources/slim/slim-locations-resource.js +30 -0
- package/dist/next/resources/slim/slim-medical-notifications-resource.d.ts +18 -0
- package/dist/next/resources/slim/slim-medical-notifications-resource.js +46 -0
- package/dist/next/resources/slim/slim-notification-notes-resource.d.ts +12 -0
- package/dist/next/resources/slim/slim-notification-notes-resource.js +34 -0
- package/dist/next/resources/slim/slim-notifications-resource.d.ts +19 -0
- package/dist/next/resources/slim/slim-notifications-resource.js +26 -0
- package/dist/next/resources/slim/slim-organizations-resource.d.ts +11 -0
- package/dist/next/resources/slim/slim-organizations-resource.js +25 -0
- package/dist/next/resources/slim/slim-out-of-bed-resource.d.ts +13 -0
- package/dist/next/resources/slim/slim-out-of-bed-resource.js +20 -0
- package/dist/next/resources/slim/slim-paths.d.ts +6 -0
- package/dist/next/resources/slim/slim-paths.js +9 -0
- package/dist/next/resources/slim/slim-patient-thresholds-resource.d.ts +10 -0
- package/dist/next/resources/slim/slim-patient-thresholds-resource.js +20 -0
- package/dist/next/resources/slim/slim-patients-resource.d.ts +20 -0
- package/dist/next/resources/slim/slim-patients-resource.js +39 -0
- package/dist/next/resources/slim/slim-policies-resource.d.ts +12 -0
- package/dist/next/resources/slim/slim-policies-resource.js +29 -0
- package/dist/next/resources/slim/slim-practitioners-resource.d.ts +8 -0
- package/dist/next/resources/slim/slim-practitioners-resource.js +14 -0
- package/dist/next/resources/slim/slim-projects-resource.d.ts +16 -0
- package/dist/next/resources/slim/slim-projects-resource.js +35 -0
- package/dist/next/resources/slim/slim-queries.d.ts +34 -0
- package/dist/next/resources/slim/slim-queries.js +2 -0
- package/dist/next/resources/slim/slim-resource.d.ts +39 -0
- package/dist/next/resources/slim/slim-resource.js +44 -0
- package/dist/next/resources/slim/slim-sleep-resource.d.ts +9 -0
- package/dist/next/resources/slim/slim-sleep-resource.js +15 -0
- package/dist/next/resources/slim/slim-thresholds-resource.d.ts +11 -0
- package/dist/next/resources/slim/slim-thresholds-resource.js +18 -0
- package/dist/next/resources/slim/slim-trends-resource.d.ts +11 -0
- package/dist/next/resources/slim/slim-trends-resource.js +19 -0
- package/dist/next/resources/slim/slim-users-resource.d.ts +11 -0
- package/dist/next/resources/slim/slim-users-resource.js +15 -0
- package/dist/next/resources/slim/slim-zones-resource.d.ts +12 -0
- package/dist/next/resources/slim/slim-zones-resource.js +24 -0
- package/dist/next/resources/video-calls/video-call-access-resource.d.ts +11 -0
- package/dist/next/resources/video-calls/video-call-access-resource.js +19 -0
- package/dist/next/resources/video-calls/video-call-appointments-resource.d.ts +10 -0
- package/dist/next/resources/video-calls/video-call-appointments-resource.js +21 -0
- package/dist/next/resources/video-calls/video-call-emails-resource.d.ts +10 -0
- package/dist/next/resources/video-calls/video-call-emails-resource.js +19 -0
- package/dist/next/resources/video-calls/video-calls-resource.d.ts +14 -0
- package/dist/next/resources/video-calls/video-calls-resource.js +20 -0
- package/dist/next/resources/wearables/wearable-connections-resource.d.ts +12 -0
- package/dist/next/resources/wearables/wearable-connections-resource.js +25 -0
- package/dist/next/resources/wearables/wearable-providers-resource.d.ts +12 -0
- package/dist/next/resources/wearables/wearable-providers-resource.js +27 -0
- package/dist/next/resources/wearables/wearables-resource.d.ts +8 -0
- package/dist/next/resources/wearables/wearables-resource.js +14 -0
- package/dist/next/storage/ovok-storage.d.ts +11 -0
- package/dist/next/storage/ovok-storage.js +19 -0
- package/dist/types/MeasurementTypes.d.ts +5 -0
- package/dist/types/MeasurementTypes.js +21 -0
- package/dist/types/index.d.ts +1 -5
- package/dist/types/index.js +1 -5
- package/next/index.d.ts +1 -0
- package/next/index.js +3 -0
- package/next/react/index.d.ts +1 -0
- package/next/react/index.js +1 -0
- package/package.json +14 -2
- package/dist/hooks/signals-alert-hooks.d.ts +0 -22
- package/dist/hooks/signals-alert-hooks.js +0 -166
- package/dist/hooks/signals-alert-item-hooks.d.ts +0 -19
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Core TypeScript SDK for healthcare applications. Provides authentication, AI-FHI
|
|
|
17
17
|
- 🧭 Runtime discovery of the backend FHIR and public API capabilities
|
|
18
18
|
- 🧩 Typed accounts, projects, localization, and patient-observation APIs
|
|
19
19
|
- 🏥 Typed Slim patient, device, telemetry, notification, and monitoring APIs
|
|
20
|
-
- 🚨 Typed Signals
|
|
20
|
+
- 🚨 Typed Signals enrollment and delivery-repair APIs
|
|
21
21
|
- ⌚ Typed cloud wearable-provider configuration and patient connections
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
@@ -30,6 +30,16 @@ yarn add @ovok/core
|
|
|
30
30
|
pnpm add @ovok/core
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
### Release channels
|
|
34
|
+
|
|
35
|
+
| Channel | Branch | Install |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| Stable | `main` | `npm install @ovok/core` |
|
|
38
|
+
| Release candidate | `staging` | `npm install @ovok/core@next` |
|
|
39
|
+
| Development | `development` | `npm install @ovok/core@dev` |
|
|
40
|
+
|
|
41
|
+
Development builds are versioned `X.Y.Z-dev.<commit count>`. Their git tag and GitHub release add the commit as `+<short sha>`.
|
|
42
|
+
|
|
33
43
|
## Quick Start
|
|
34
44
|
|
|
35
45
|
```typescript
|
|
@@ -210,95 +220,33 @@ const slots = await client.listPatientSlots({
|
|
|
210
220
|
|
|
211
221
|
## Signals APIs
|
|
212
222
|
|
|
213
|
-
The Signals client methods and hooks cover
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
submit the same readings to Signals separately.
|
|
223
|
+
The Signals client methods and hooks cover patient enrollment and delivery repair. Ovok forwards
|
|
224
|
+
eligible observations for enabled patients; continue saving readings through the existing
|
|
225
|
+
Observation APIs and do not submit the same readings to Signals separately.
|
|
217
226
|
|
|
218
227
|
```ts
|
|
219
|
-
const thresholds = await client.getSignalsThresholds(patientId);
|
|
220
228
|
const enrollment = await client.enableSignalsForPatient(patientId);
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
high: 120,
|
|
224
|
-
reason: "Updated after review",
|
|
225
|
-
});
|
|
226
|
-
const alerts = await client.listSignalsAlerts({
|
|
227
|
-
status: "OPEN",
|
|
228
|
-
codes: ["8867-4"],
|
|
229
|
-
limit: 25,
|
|
230
|
-
});
|
|
231
|
-
await client.acknowledgeSignalsAlert(alerts.items[0].id);
|
|
232
|
-
const settings = await client.getSignalsSettings();
|
|
229
|
+
const undeliverable = await client.listUnconfirmedLimits();
|
|
230
|
+
const repair = await client.repushUnconfirmedLimits();
|
|
233
231
|
```
|
|
234
232
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
`
|
|
239
|
-
be checked with `isSignalsError`.
|
|
233
|
+
`listUnconfirmedLimits` reads `/signals/config/undeliverable`; `repushUnconfirmedLimits` posts to
|
|
234
|
+
`/signals/config/undeliverable/repair`. The response reports attempted, repaired,
|
|
235
|
+
still-undeliverable, skipped, and not-reached counts. React applications can use
|
|
236
|
+
`useUnconfirmedLimits()` and `useRepushUnconfirmedLimits()` for these operations.
|
|
240
237
|
|
|
241
238
|
Use `enableSignalsForPatient` to enroll an existing patient. It is idempotent, always returns
|
|
242
239
|
`enabled: true` on success, and requires the caller to have `signals_config:update` and update
|
|
243
240
|
access to that patient. A 409 conflict and 503 failures (including `signals_mint_failed`) are
|
|
244
241
|
retryable; use a bounded retry with backoff and do not retry other statuses automatically. The
|
|
245
242
|
SDK maps backend responses to `SignalsError`; read the `code`, `status`, `fieldErrors`, and
|
|
246
|
-
`message` properties
|
|
247
|
-
|
|
248
|
-
`loading`, `error`, and `data` state.
|
|
249
|
-
|
|
250
|
-
`useSignalsAlerts` accumulates pages through `loadMore`. Check `hasMore` rather than the current
|
|
251
|
-
item count: access filtering can produce a short or empty page with another cursor. Query changes
|
|
252
|
-
and `reload` start again at the first page. The hook exposes `reload` so a screen can refresh its
|
|
253
|
-
alert list after `useAcknowledgeSignalsAlert` succeeds.
|
|
254
|
-
|
|
255
|
-
### Raw Signals alerts
|
|
256
|
-
|
|
257
|
-
`listSignalsAlerts` reads episodes and needs the project's `episodicAlerts` (409
|
|
258
|
-
`signals_episodes_disabled` otherwise). To work with individual alerts instead, whether or not
|
|
259
|
-
`episodicAlerts` is on, use the raw alert methods:
|
|
260
|
-
|
|
261
|
-
```ts
|
|
262
|
-
const open = await client.listSignalsRawAlerts({
|
|
263
|
-
acknowledged: false,
|
|
264
|
-
codes: ["8867-4", "9279-1"],
|
|
265
|
-
since: "2026-10-01T00:00:00Z",
|
|
266
|
-
limit: 50,
|
|
267
|
-
});
|
|
268
|
-
const alert = await client.getSignalsRawAlert(open.items[0].id);
|
|
269
|
-
const acked = await client.acknowledgeSignalsRawAlert(alert.id);
|
|
270
|
-
// acked.acknowledgedAt and acked.acknowledgedActor record when and by whom.
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
The alert hooks take the same switch: `episodes` is optional and defaults to episodes, so existing
|
|
274
|
-
calls are unchanged; `episodes: false` reads and acknowledges raw alerts, typed as `SignalsRawAlert`.
|
|
275
|
-
|
|
276
|
-
```tsx
|
|
277
|
-
const worklist = useSignalsAlerts({ episodes: false, acknowledged: false, codes: ["8867-4"] });
|
|
278
|
-
const one = useSignalsAlert(alertId, { episodes: false });
|
|
279
|
-
const { mutate: acknowledge } = useAcknowledgeSignalsAlert({ episodes: false });
|
|
280
|
-
```
|
|
243
|
+
`message` properties. React applications can call
|
|
244
|
+
`useEnableSignalsForPatient().mutate(patientId)`.
|
|
281
245
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
alert, and the next breaching reading opens a new one. It is idempotent: an acknowledged alert keeps
|
|
287
|
-
its first `acknowledgedAt` and `acknowledgedActor`.
|
|
288
|
-
|
|
289
|
-
Filters: `status`, `acknowledged`, `patientId` (a FHIR Patient id), `codes` (LOINC codes), and
|
|
290
|
-
`since` (inclusive) and `until` (exclusive) on `createdAt`, as date-times with `Z` or an offset.
|
|
291
|
-
Pages hold at most 50 alerts. As with episodes, a page can be short or empty and still have a
|
|
292
|
-
`nextCursor`, because alerts of residents the caller can't read are left out; page until
|
|
293
|
-
`nextCursor` is null, and pass it back unchanged: it is sealed to the project.
|
|
294
|
-
|
|
295
|
-
Alerts raised before a project starts acknowledging are unacknowledged too, so a new worklist
|
|
296
|
-
should bound its history with `since`. Each row also carries the breaching reading (`valueNumber`
|
|
297
|
-
or `valueString`), the rule's `message` and the alert's `reason`. Acknowledging a raw alert does not
|
|
298
|
-
acknowledge an episode: with `episodicAlerts` on, keep a screen to one of the two. Every request is scoped to the
|
|
299
|
-
caller's project and the residents their access policy allows: an alert outside that scope answers
|
|
300
|
-
404, and acknowledging needs `signals_alerts:update` and update access to the resident (403 when the
|
|
301
|
-
caller can only read them).
|
|
246
|
+
Use `listNotificationNotes`, `createNotificationNote`, `updateNotificationNote`,
|
|
247
|
+
`patchNotificationNote`, and `deleteNotificationNote` for notification notes. The `alarm` target
|
|
248
|
+
represents an alert episode, and `alert` represents an individual raw alert. These methods use the
|
|
249
|
+
`/v1/slim/notifications` routes.
|
|
302
250
|
|
|
303
251
|
## Slim APIs
|
|
304
252
|
|
|
@@ -512,7 +460,7 @@ create a second copy of the same observation. The queue is opt-in and requires d
|
|
|
512
460
|
Ovok-defined methods, including measurement saves, reject with `RateLimitError` when the server
|
|
513
461
|
returns 429. A 429 or 503 with a retry delay is returned without an automatic retry; wait for
|
|
514
462
|
`retryAfterMs` before trying again. Use `isRateLimitError(error)` and `retryAfterMs` to show a
|
|
515
|
-
translated wait message without parsing backend text. Inherited
|
|
463
|
+
translated wait message without parsing backend text. Inherited FHIR methods keep their
|
|
516
464
|
`OperationOutcomeError`; use `readOvokError(error)` to read their status and delay.
|
|
517
465
|
|
|
518
466
|
## Session management
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MeasurementTypeKey } from "../../types";
|
|
1
|
+
import { MeasurementTypeKey } from "../../types/MeasurementTypes";
|
|
2
2
|
import { MeasurementField } from "./types/service/MeasurementField";
|
|
3
3
|
/**
|
|
4
4
|
* For each measurement type the SDK stores, its properties as their Observations store them: the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observation } from "@medplum/fhirtypes";
|
|
2
|
-
import { BabySleepMeasurement, BloodGlucoseMeasurement, BloodPressureMeasurement, BodyTemperatureMeasurement, BodyWeightMeasurement, EcgMeasurement, HeartRateMeasurement, HeartRateVariabilityMeasurement, LipidPanelMeasurement, Measurement, MeasurementTypeKey, PulseOximeterMeasurement, RespiratoryRateMeasurement, RespiratoryTherapyMeasurement, RestingHeartRateMeasurement, StepCountMeasurement, UrineAnalyzeMeasurement, Vo2MaxMeasurement, WalkingHeartRateAverageMeasurement } from "../../../types";
|
|
2
|
+
import { BabySleepMeasurement, BloodGlucoseMeasurement, BloodPressureMeasurement, BodyTemperatureMeasurement, BodyWeightMeasurement, EcgMeasurement, HeartRateMeasurement, HeartRateVariabilityMeasurement, LipidPanelMeasurement, Measurement, MeasurementTypeKey, PulseOximeterMeasurement, RespiratoryRateMeasurement, RespiratoryTherapyMeasurement, RestingHeartRateMeasurement, StepCountMeasurement, UrineAnalyzeMeasurement, Vo2MaxMeasurement, WalkingHeartRateAverageMeasurement } from "../../../types/MeasurementTypes";
|
|
3
3
|
export type SupportedMeasurement = BloodGlucoseMeasurement | BabySleepMeasurement | BloodPressureMeasurement | BodyTemperatureMeasurement | BodyWeightMeasurement | EcgMeasurement | HeartRateMeasurement | HeartRateVariabilityMeasurement | LipidPanelMeasurement | PulseOximeterMeasurement | RespiratoryRateMeasurement | RespiratoryTherapyMeasurement | RestingHeartRateMeasurement | StepCountMeasurement | UrineAnalyzeMeasurement | Vo2MaxMeasurement | WalkingHeartRateAverageMeasurement | Measurement;
|
|
4
4
|
type SupportedType = Exclude<MeasurementTypeKey, MeasurementTypeKey.symptomQuestionnaire>;
|
|
5
5
|
export type ObservationGrouping = "hasMember" | "time" | ((observation: Observation, index: number, observations: readonly Observation[]) => string);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable max-lines */
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.observationsToMeasurements = exports.observationCodesForTypes = void 0;
|
|
5
|
-
const
|
|
5
|
+
const MeasurementTypes_1 = require("../../../types/MeasurementTypes");
|
|
6
6
|
const fhir_systems_1 = require("../fhir-systems");
|
|
7
7
|
const single_value_services_1 = require("../services/single-value-services");
|
|
8
8
|
const DEFAULT_OBSERVATION_TIME_TOLERANCE_MS = 1000;
|
|
@@ -19,16 +19,16 @@ const irregularHeartbeatOf = (observations) => {
|
|
|
19
19
|
var _a, _b, _c;
|
|
20
20
|
const rhythm = observations.find((observation) => {
|
|
21
21
|
var _a, _b;
|
|
22
|
-
return (_b = (_a = observation.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b.some((coding) => coding.system ===
|
|
23
|
-
coding.code ===
|
|
22
|
+
return (_b = (_a = observation.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b.some((coding) => coding.system === MeasurementTypes_1.PulseRhythmCoding.system &&
|
|
23
|
+
coding.code === MeasurementTypes_1.PulseRhythmCoding.observation);
|
|
24
24
|
});
|
|
25
|
-
const result = (_c = (_b = (_a = rhythm === null || rhythm === void 0 ? void 0 : rhythm.valueCodeableConcept) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b.find((coding) => coding.system ===
|
|
26
|
-
if (result ===
|
|
27
|
-
result ===
|
|
28
|
-
result ===
|
|
25
|
+
const result = (_c = (_b = (_a = rhythm === null || rhythm === void 0 ? void 0 : rhythm.valueCodeableConcept) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b.find((coding) => coding.system === MeasurementTypes_1.PulseRhythmCoding.system)) === null || _c === void 0 ? void 0 : _c.code;
|
|
26
|
+
if (result === MeasurementTypes_1.PulseRhythmCoding.irregular ||
|
|
27
|
+
result === MeasurementTypes_1.PulseRhythmCoding.irregularlyIrregular ||
|
|
28
|
+
result === MeasurementTypes_1.PulseRhythmCoding.regularlyIrregular) {
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
|
-
return result ===
|
|
31
|
+
return result === MeasurementTypes_1.PulseRhythmCoding.regular ? false : undefined;
|
|
32
32
|
};
|
|
33
33
|
const recordedAtOf = (observation) => {
|
|
34
34
|
var _a, _b;
|
|
@@ -53,14 +53,14 @@ const ecgGroupKey = (observation, observations) => {
|
|
|
53
53
|
if (parent) {
|
|
54
54
|
return groupKey(parent);
|
|
55
55
|
}
|
|
56
|
-
if (codeOf(observation) ===
|
|
56
|
+
if (codeOf(observation) === MeasurementTypes_1.ObservationCode.ECG) {
|
|
57
57
|
return groupKey(observation);
|
|
58
58
|
}
|
|
59
59
|
const recordedAt = recordedAtOf(observation);
|
|
60
60
|
const root = observations.find((candidate) => {
|
|
61
61
|
var _a;
|
|
62
62
|
const start = (_a = candidate.effectivePeriod) === null || _a === void 0 ? void 0 : _a.start;
|
|
63
|
-
return (codeOf(candidate) ===
|
|
63
|
+
return (codeOf(candidate) === MeasurementTypes_1.ObservationCode.ECG &&
|
|
64
64
|
start &&
|
|
65
65
|
recordedAt &&
|
|
66
66
|
new Date(start).toISOString().slice(0, 16) ===
|
|
@@ -206,11 +206,11 @@ const firstValue = (observations, code) => {
|
|
|
206
206
|
return match ? valueOf(match) : undefined;
|
|
207
207
|
};
|
|
208
208
|
const LIPID_FIELDS = [
|
|
209
|
-
{ key: "totalCholesterol", codes: [
|
|
210
|
-
{ key: "hdlCholesterol", codes: [
|
|
211
|
-
{ key: "ldlCholesterol", codes: [
|
|
212
|
-
{ key: "triglycerides", codes: [
|
|
213
|
-
{ key: "totalCholesterolHdlRatio", codes: [
|
|
209
|
+
{ key: "totalCholesterol", codes: [MeasurementTypes_1.ObservationCode.TOTAL_CHOLESTEROL_MASS, MeasurementTypes_1.ObservationCode.TOTAL_CHOLESTEROL_MOLAR] },
|
|
210
|
+
{ key: "hdlCholesterol", codes: [MeasurementTypes_1.ObservationCode.HDL_CHOLESTEROL_MASS, MeasurementTypes_1.ObservationCode.HDL_CHOLESTEROL_MOLAR] },
|
|
211
|
+
{ key: "ldlCholesterol", codes: [MeasurementTypes_1.ObservationCode.LDL_CHOLESTEROL_MASS, MeasurementTypes_1.ObservationCode.LDL_CHOLESTEROL_MOLAR] },
|
|
212
|
+
{ key: "triglycerides", codes: [MeasurementTypes_1.ObservationCode.TRIGLYCERIDES_MASS, MeasurementTypes_1.ObservationCode.TRIGLYCERIDES_MOLAR] },
|
|
213
|
+
{ key: "totalCholesterolHdlRatio", codes: [MeasurementTypes_1.ObservationCode.TOTAL_CHOLESTEROL_HDL_RATIO] },
|
|
214
214
|
];
|
|
215
215
|
const lipidValue = (observations, field) => {
|
|
216
216
|
var _a, _b, _c;
|
|
@@ -224,16 +224,16 @@ const lipidValue = (observations, field) => {
|
|
|
224
224
|
return undefined;
|
|
225
225
|
};
|
|
226
226
|
const MOLAR_LIPID_CODES = [
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
MeasurementTypes_1.ObservationCode.TOTAL_CHOLESTEROL_MOLAR,
|
|
228
|
+
MeasurementTypes_1.ObservationCode.HDL_CHOLESTEROL_MOLAR,
|
|
229
|
+
MeasurementTypes_1.ObservationCode.LDL_CHOLESTEROL_MOLAR,
|
|
230
|
+
MeasurementTypes_1.ObservationCode.TRIGLYCERIDES_MOLAR,
|
|
231
231
|
];
|
|
232
232
|
const MASS_LIPID_CODES = [
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
233
|
+
MeasurementTypes_1.ObservationCode.TOTAL_CHOLESTEROL_MASS,
|
|
234
|
+
MeasurementTypes_1.ObservationCode.HDL_CHOLESTEROL_MASS,
|
|
235
|
+
MeasurementTypes_1.ObservationCode.LDL_CHOLESTEROL_MASS,
|
|
236
|
+
MeasurementTypes_1.ObservationCode.TRIGLYCERIDES_MASS,
|
|
237
237
|
];
|
|
238
238
|
/** The unit a lipid code implies, else the quantity's own unit when it is a lipid unit. */
|
|
239
239
|
const lipidUnitOf = (code, unit) => {
|
|
@@ -282,34 +282,34 @@ const inverseGroup = (type, observations) => {
|
|
|
282
282
|
return { ...measurement, measurementTypeKey: type, [single.valueKey]: value(single.code) };
|
|
283
283
|
}
|
|
284
284
|
switch (type) {
|
|
285
|
-
case
|
|
285
|
+
case MeasurementTypes_1.MeasurementTypeKey.bloodPressure:
|
|
286
286
|
return {
|
|
287
287
|
...measurement,
|
|
288
288
|
measurementTypeKey: type,
|
|
289
|
-
systolic: value(
|
|
290
|
-
diastolic: value(
|
|
291
|
-
meanArterialPressure: value(
|
|
292
|
-
heartRate: value(
|
|
289
|
+
systolic: value(MeasurementTypes_1.ObservationCode.SYSTOLIC_BLOOD_PRESSURE),
|
|
290
|
+
diastolic: value(MeasurementTypes_1.ObservationCode.DIASTOLIC_BLOOD_PRESSURE),
|
|
291
|
+
meanArterialPressure: value(MeasurementTypes_1.ObservationCode.MEAN_BLOOD_PRESSURE),
|
|
292
|
+
heartRate: value(MeasurementTypes_1.ObservationCode.BLOOD_PRESSURE_HEART_RATE),
|
|
293
293
|
irregularHeartbeat: irregularHeartbeatOf(observations),
|
|
294
294
|
};
|
|
295
|
-
case
|
|
295
|
+
case MeasurementTypes_1.MeasurementTypeKey.bloodOxygenPulseRate:
|
|
296
296
|
return {
|
|
297
297
|
...measurement,
|
|
298
298
|
measurementTypeKey: type,
|
|
299
|
-
bloodOxygen: value(
|
|
300
|
-
pulseRate: value(
|
|
299
|
+
bloodOxygen: value(MeasurementTypes_1.ObservationCode.OXYGEN_SATURATION),
|
|
300
|
+
pulseRate: value(MeasurementTypes_1.ObservationCode.OXYGEN_SATURATION_HEART_RATE),
|
|
301
301
|
};
|
|
302
|
-
case
|
|
302
|
+
case MeasurementTypes_1.MeasurementTypeKey.stepCount:
|
|
303
303
|
return {
|
|
304
304
|
...measurement,
|
|
305
305
|
measurementTypeKey: type,
|
|
306
|
-
stepCount: value(
|
|
306
|
+
stepCount: value(MeasurementTypes_1.ObservationCode.STEPS),
|
|
307
307
|
...(((_a = first.effectivePeriod) === null || _a === void 0 ? void 0 : _a.start) ? { start: new Date(first.effectivePeriod.start) } : {}),
|
|
308
308
|
...(((_b = first.effectivePeriod) === null || _b === void 0 ? void 0 : _b.end) ? { end: new Date(first.effectivePeriod.end) } : {}),
|
|
309
309
|
};
|
|
310
|
-
case
|
|
310
|
+
case MeasurementTypes_1.MeasurementTypeKey.ecg: {
|
|
311
311
|
const sampled = observations
|
|
312
|
-
.filter((observation) => codeOf(observation) ===
|
|
312
|
+
.filter((observation) => codeOf(observation) === MeasurementTypes_1.ObservationCode.ECG)
|
|
313
313
|
.sort((left, right) => { var _a, _b, _c, _d; return ((_b = (_a = left.effectivePeriod) === null || _a === void 0 ? void 0 : _a.start) !== null && _b !== void 0 ? _b : "").localeCompare((_d = (_c = right.effectivePeriod) === null || _c === void 0 ? void 0 : _c.start) !== null && _d !== void 0 ? _d : ""); });
|
|
314
314
|
const points = sampled.flatMap((observation) => {
|
|
315
315
|
var _a;
|
|
@@ -327,14 +327,14 @@ const inverseGroup = (type, observations) => {
|
|
|
327
327
|
...measurement,
|
|
328
328
|
measurementTypeKey: type,
|
|
329
329
|
diagramPoints: points,
|
|
330
|
-
heartRate: (_e = value(
|
|
330
|
+
heartRate: (_e = value(MeasurementTypes_1.ObservationCode.ECG_HEART_RATE)) !== null && _e !== void 0 ? _e : value(MeasurementTypes_1.ObservationCode.HEART_RATE),
|
|
331
331
|
...(diagnosticResult ? { diagnosticResult } : {}),
|
|
332
332
|
...(duration > 0 ? { duration } : {}),
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
|
-
case
|
|
336
|
-
case
|
|
337
|
-
const analyteByCode = Object.fromEntries(
|
|
335
|
+
case MeasurementTypes_1.MeasurementTypeKey.urineAnalysis:
|
|
336
|
+
case MeasurementTypes_1.MeasurementTypeKey.uricAcid: {
|
|
337
|
+
const analyteByCode = Object.fromEntries(MeasurementTypes_1.URINE_ANALYTE_DEFINITIONS.map((analyte) => [analyte.code, analyte.key]));
|
|
338
338
|
const result = {
|
|
339
339
|
...measurement,
|
|
340
340
|
measurementTypeKey: type,
|
|
@@ -354,7 +354,7 @@ const inverseGroup = (type, observations) => {
|
|
|
354
354
|
}
|
|
355
355
|
return result;
|
|
356
356
|
}
|
|
357
|
-
case
|
|
357
|
+
case MeasurementTypes_1.MeasurementTypeKey.lipidPanel:
|
|
358
358
|
return {
|
|
359
359
|
...measurement,
|
|
360
360
|
measurementTypeKey: type,
|
|
@@ -364,8 +364,8 @@ const inverseGroup = (type, observations) => {
|
|
|
364
364
|
return value === undefined ? [] : [[key, value]];
|
|
365
365
|
})),
|
|
366
366
|
};
|
|
367
|
-
case
|
|
368
|
-
case
|
|
367
|
+
case MeasurementTypes_1.MeasurementTypeKey.respiratoryTherapy:
|
|
368
|
+
case MeasurementTypes_1.MeasurementTypeKey.babySleep:
|
|
369
369
|
return {
|
|
370
370
|
...measurement,
|
|
371
371
|
measurementTypeKey: type,
|
|
@@ -375,27 +375,27 @@ const inverseGroup = (type, observations) => {
|
|
|
375
375
|
return measurement;
|
|
376
376
|
}
|
|
377
377
|
};
|
|
378
|
-
const COMPONENT_TYPES = new Set([
|
|
378
|
+
const COMPONENT_TYPES = new Set([MeasurementTypes_1.MeasurementTypeKey.respiratoryTherapy, MeasurementTypes_1.MeasurementTypeKey.babySleep]);
|
|
379
379
|
const codesForType = {
|
|
380
380
|
...Object.fromEntries([...single_value_services_1.singleValueFields].map(([type, { code }]) => [type, [code]])),
|
|
381
|
-
[
|
|
382
|
-
[
|
|
383
|
-
[
|
|
384
|
-
[
|
|
385
|
-
[
|
|
386
|
-
|
|
387
|
-
...
|
|
381
|
+
[MeasurementTypes_1.MeasurementTypeKey.bloodPressure]: [MeasurementTypes_1.ObservationCode.SYSTOLIC_BLOOD_PRESSURE, MeasurementTypes_1.ObservationCode.DIASTOLIC_BLOOD_PRESSURE, MeasurementTypes_1.ObservationCode.MEAN_BLOOD_PRESSURE, MeasurementTypes_1.ObservationCode.BLOOD_PRESSURE_HEART_RATE, MeasurementTypes_1.PulseRhythmCoding.observation],
|
|
382
|
+
[MeasurementTypes_1.MeasurementTypeKey.bloodOxygenPulseRate]: [MeasurementTypes_1.ObservationCode.OXYGEN_SATURATION, MeasurementTypes_1.ObservationCode.OXYGEN_SATURATION_HEART_RATE],
|
|
383
|
+
[MeasurementTypes_1.MeasurementTypeKey.stepCount]: [MeasurementTypes_1.ObservationCode.STEPS],
|
|
384
|
+
[MeasurementTypes_1.MeasurementTypeKey.ecg]: [MeasurementTypes_1.ObservationCode.ECG, MeasurementTypes_1.ObservationCode.ECG_HEART_RATE, MeasurementTypes_1.ObservationCode.HEART_RATE],
|
|
385
|
+
[MeasurementTypes_1.MeasurementTypeKey.uricAcid]: [
|
|
386
|
+
MeasurementTypes_1.ObservationCode.URIC_ACID,
|
|
387
|
+
...MeasurementTypes_1.URINE_ANALYTE_DEFINITIONS.map((analyte) => analyte.code),
|
|
388
388
|
],
|
|
389
|
-
[
|
|
390
|
-
|
|
391
|
-
...
|
|
389
|
+
[MeasurementTypes_1.MeasurementTypeKey.urineAnalysis]: [
|
|
390
|
+
MeasurementTypes_1.ObservationCode.URIC_ACID,
|
|
391
|
+
...MeasurementTypes_1.URINE_ANALYTE_DEFINITIONS.map((analyte) => analyte.code),
|
|
392
392
|
],
|
|
393
|
-
[
|
|
394
|
-
|
|
393
|
+
[MeasurementTypes_1.MeasurementTypeKey.lipidPanel]: [
|
|
394
|
+
MeasurementTypes_1.ObservationCode.LIPID_PANEL,
|
|
395
395
|
...LIPID_FIELDS.flatMap(({ codes }) => codes),
|
|
396
396
|
],
|
|
397
|
-
[
|
|
398
|
-
[
|
|
397
|
+
[MeasurementTypes_1.MeasurementTypeKey.respiratoryTherapy]: [MeasurementTypes_1.ObservationCode.RESPIRATORY_THERAPY],
|
|
398
|
+
[MeasurementTypes_1.MeasurementTypeKey.babySleep]: [MeasurementTypes_1.ObservationCode.BABY_SLEEP],
|
|
399
399
|
};
|
|
400
400
|
const observationCodesForTypes = (types) => [...new Set(types.flatMap((type) => { var _a; return (_a = codesForType[type]) !== null && _a !== void 0 ? _a : []; }))].join(",");
|
|
401
401
|
exports.observationCodesForTypes = observationCodesForTypes;
|
|
@@ -406,11 +406,11 @@ const observationsToMeasurements = (observations, types, options = {}) => {
|
|
|
406
406
|
var _a;
|
|
407
407
|
const codes = (_a = codesForType[type]) !== null && _a !== void 0 ? _a : [];
|
|
408
408
|
const matching = observations.filter((observation) => { var _a; return codes.includes((_a = codeOf(observation)) !== null && _a !== void 0 ? _a : ""); });
|
|
409
|
-
const groups = groupObservations(matching, options, type ===
|
|
409
|
+
const groups = groupObservations(matching, options, type === MeasurementTypes_1.MeasurementTypeKey.ecg
|
|
410
410
|
? (observation, index) => ecgGroupKey(observation, matching) || `ecg:${index}`
|
|
411
411
|
: undefined);
|
|
412
412
|
groups.forEach((group) => {
|
|
413
|
-
if (type ===
|
|
413
|
+
if (type === MeasurementTypes_1.MeasurementTypeKey.lipidPanel &&
|
|
414
414
|
!LIPID_FIELDS.some((field) => lipidValue(group.observations, field) !== undefined)) {
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeableConcept, Observation } from "@medplum/fhirtypes";
|
|
2
|
-
import { MeasurementTypeKey } from "../../../types";
|
|
2
|
+
import { MeasurementTypeKey } from "../../../types/MeasurementTypes";
|
|
3
3
|
import { RecordResult, RecordType } from "../types/generate-measurement/HealthConnectTypes";
|
|
4
4
|
import { Sample } from "../types/generate-measurement/Sample";
|
|
5
5
|
import { ObservationValue } from "../types/generate-observation-body/ObservationValue";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Measurement, MeasurementTypeKey } from "../../../types";
|
|
1
|
+
import { Measurement, MeasurementTypeKey } from "../../../types/MeasurementTypes";
|
|
2
2
|
import { RecordResult, RecordType } from "../types/generate-measurement/HealthConnectTypes";
|
|
3
3
|
import { Sample } from "../types/generate-measurement/Sample";
|
|
4
4
|
import { PulseOximeterMeasurement } from "../types/measurement/PulseOximeterMeasurement";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BloodOxygenService = void 0;
|
|
4
|
-
const
|
|
4
|
+
const MeasurementTypes_1 = require("../../../types/MeasurementTypes");
|
|
5
5
|
const base_observation_service_1 = require("./base-observation-service");
|
|
6
6
|
class BloodOxygenService extends base_observation_service_1.BaseObservationService {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
|
-
this.measurementTypeKey =
|
|
9
|
+
this.measurementTypeKey = MeasurementTypes_1.MeasurementTypeKey.bloodOxygenPulseRate;
|
|
10
10
|
this.measurementTypeName = "blood oxygen";
|
|
11
11
|
this.observationMetadata = [
|
|
12
12
|
{
|
|
13
|
-
primaryCode:
|
|
13
|
+
primaryCode: MeasurementTypes_1.ObservationCode.OXYGEN_SATURATION,
|
|
14
14
|
additionalCodes: [],
|
|
15
15
|
display: "Oxygen Saturation",
|
|
16
16
|
unit: "%",
|
|
@@ -18,8 +18,8 @@ class BloodOxygenService extends base_observation_service_1.BaseObservationServi
|
|
|
18
18
|
toFixed: 0,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
primaryCode:
|
|
22
|
-
additionalCodes: [
|
|
21
|
+
primaryCode: MeasurementTypes_1.ObservationCode.OXYGEN_SATURATION_HEART_RATE,
|
|
22
|
+
additionalCodes: [MeasurementTypes_1.ObservationCode.HEART_RATE],
|
|
23
23
|
display: "Heart Rate",
|
|
24
24
|
unit: "bpm",
|
|
25
25
|
valueKey: "pulseRate",
|
|
@@ -42,7 +42,7 @@ class BloodOxygenService extends base_observation_service_1.BaseObservationServi
|
|
|
42
42
|
return {
|
|
43
43
|
pulseRate,
|
|
44
44
|
bloodOxygen,
|
|
45
|
-
measurementTypeKey:
|
|
45
|
+
measurementTypeKey: MeasurementTypes_1.MeasurementTypeKey.bloodOxygenPulseRate,
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
convertRecordToMeasurement(record) {
|
|
@@ -50,7 +50,7 @@ class BloodOxygenService extends base_observation_service_1.BaseObservationServi
|
|
|
50
50
|
return {
|
|
51
51
|
pulseRate: 0,
|
|
52
52
|
bloodOxygen: pulseOximeterRecord.percentage,
|
|
53
|
-
measurementTypeKey:
|
|
53
|
+
measurementTypeKey: MeasurementTypes_1.MeasurementTypeKey.bloodOxygenPulseRate,
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeableConcept, Observation } from "@medplum/fhirtypes";
|
|
2
|
-
import { BloodPressureMeasurement, Measurement, MeasurementTypeKey } from "../../../types";
|
|
2
|
+
import { BloodPressureMeasurement, Measurement, MeasurementTypeKey } from "../../../types/MeasurementTypes";
|
|
3
3
|
import { RecordResult, RecordType } from "../types/generate-measurement/HealthConnectTypes";
|
|
4
4
|
import { Sample } from "../types/generate-measurement/Sample";
|
|
5
5
|
import { ObservationValue } from "../types/generate-observation-body/ObservationValue";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BloodPressureService = void 0;
|
|
4
|
-
const
|
|
4
|
+
const MeasurementTypes_1 = require("../../../types/MeasurementTypes");
|
|
5
5
|
const base_observation_service_1 = require("./base-observation-service");
|
|
6
6
|
class BloodPressureService extends base_observation_service_1.BaseObservationService {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
|
-
this.measurementTypeKey =
|
|
9
|
+
this.measurementTypeKey = MeasurementTypes_1.MeasurementTypeKey.bloodPressure;
|
|
10
10
|
this.measurementTypeName = "blood pressure";
|
|
11
11
|
this.observationMetadata = [
|
|
12
12
|
{
|
|
13
|
-
primaryCode:
|
|
13
|
+
primaryCode: MeasurementTypes_1.ObservationCode.SYSTOLIC_BLOOD_PRESSURE,
|
|
14
14
|
additionalCodes: [],
|
|
15
15
|
display: "Systolic Blood Pressure",
|
|
16
16
|
unit: "mmHg",
|
|
@@ -18,7 +18,7 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
18
18
|
toFixed: 0,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
primaryCode:
|
|
21
|
+
primaryCode: MeasurementTypes_1.ObservationCode.DIASTOLIC_BLOOD_PRESSURE,
|
|
22
22
|
additionalCodes: [],
|
|
23
23
|
display: "Diastolic Blood Pressure",
|
|
24
24
|
unit: "mmHg",
|
|
@@ -26,7 +26,7 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
26
26
|
toFixed: 0,
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
primaryCode:
|
|
29
|
+
primaryCode: MeasurementTypes_1.ObservationCode.MEAN_BLOOD_PRESSURE,
|
|
30
30
|
additionalCodes: [],
|
|
31
31
|
display: "Mean Arterial Pressure",
|
|
32
32
|
unit: "mmHg",
|
|
@@ -34,8 +34,8 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
34
34
|
toFixed: 0,
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
primaryCode:
|
|
38
|
-
additionalCodes: [
|
|
37
|
+
primaryCode: MeasurementTypes_1.ObservationCode.BLOOD_PRESSURE_HEART_RATE,
|
|
38
|
+
additionalCodes: [MeasurementTypes_1.ObservationCode.HEART_RATE],
|
|
39
39
|
display: "Blood Pressure Heart Rate",
|
|
40
40
|
unit: "bpm",
|
|
41
41
|
valueKey: "heartRate",
|
|
@@ -48,9 +48,9 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
48
48
|
...super.getObservationCodes(),
|
|
49
49
|
{
|
|
50
50
|
coding: [{
|
|
51
|
-
code:
|
|
51
|
+
code: MeasurementTypes_1.PulseRhythmCoding.observation,
|
|
52
52
|
display: "Pulse rhythm",
|
|
53
|
-
system:
|
|
53
|
+
system: MeasurementTypes_1.PulseRhythmCoding.system,
|
|
54
54
|
}],
|
|
55
55
|
text: "Pulse rhythm",
|
|
56
56
|
},
|
|
@@ -61,8 +61,8 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
61
61
|
const rhythmCode = castedMeasurement.irregularHeartbeat === undefined
|
|
62
62
|
? undefined
|
|
63
63
|
: castedMeasurement.irregularHeartbeat
|
|
64
|
-
?
|
|
65
|
-
:
|
|
64
|
+
? MeasurementTypes_1.PulseRhythmCoding.irregular
|
|
65
|
+
: MeasurementTypes_1.PulseRhythmCoding.regular;
|
|
66
66
|
return [
|
|
67
67
|
...super.generateValues(measurement),
|
|
68
68
|
rhythmCode
|
|
@@ -70,7 +70,7 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
70
70
|
valueCodeableConcept: {
|
|
71
71
|
coding: [{
|
|
72
72
|
code: rhythmCode,
|
|
73
|
-
system:
|
|
73
|
+
system: MeasurementTypes_1.PulseRhythmCoding.system,
|
|
74
74
|
}],
|
|
75
75
|
},
|
|
76
76
|
}
|
|
@@ -91,8 +91,8 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
91
91
|
}
|
|
92
92
|
getObservationDisplay(observations) {
|
|
93
93
|
var _a, _b, _c, _d;
|
|
94
|
-
const systolic = (_b = (_a = observations === null || observations === void 0 ? void 0 : observations.find((x) => { var _a, _b, _c; return ((_c = (_b = (_a = x.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) ===
|
|
95
|
-
const diastolic = (_d = (_c = observations === null || observations === void 0 ? void 0 : observations.find((x) => { var _a, _b, _c; return ((_c = (_b = (_a = x.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) ===
|
|
94
|
+
const systolic = (_b = (_a = observations === null || observations === void 0 ? void 0 : observations.find((x) => { var _a, _b, _c; return ((_c = (_b = (_a = x.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) === MeasurementTypes_1.ObservationCode.SYSTOLIC_BLOOD_PRESSURE; })) === null || _a === void 0 ? void 0 : _a.valueQuantity) === null || _b === void 0 ? void 0 : _b.value;
|
|
95
|
+
const diastolic = (_d = (_c = observations === null || observations === void 0 ? void 0 : observations.find((x) => { var _a, _b, _c; return ((_c = (_b = (_a = x.code) === null || _a === void 0 ? void 0 : _a.coding) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.code) === MeasurementTypes_1.ObservationCode.DIASTOLIC_BLOOD_PRESSURE; })) === null || _c === void 0 ? void 0 : _c.valueQuantity) === null || _d === void 0 ? void 0 : _d.value;
|
|
96
96
|
if (!systolic || !diastolic) {
|
|
97
97
|
return undefined;
|
|
98
98
|
}
|
|
@@ -104,7 +104,7 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
104
104
|
return {
|
|
105
105
|
systolic: systolic === null || systolic === void 0 ? void 0 : systolic.quantity,
|
|
106
106
|
diastolic: diastolic === null || diastolic === void 0 ? void 0 : diastolic.quantity,
|
|
107
|
-
measurementTypeKey:
|
|
107
|
+
measurementTypeKey: MeasurementTypes_1.MeasurementTypeKey.bloodPressure,
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
convertRecordToMeasurement(record) {
|
|
@@ -112,7 +112,7 @@ class BloodPressureService extends base_observation_service_1.BaseObservationSer
|
|
|
112
112
|
return {
|
|
113
113
|
systolic: bloodPressureRecord.systolic.inMillimetersOfMercury,
|
|
114
114
|
diastolic: bloodPressureRecord.diastolic.inMillimetersOfMercury,
|
|
115
|
-
measurementTypeKey:
|
|
115
|
+
measurementTypeKey: MeasurementTypes_1.MeasurementTypeKey.bloodPressure,
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeableConcept, Observation, ObservationComponent } from "@medplum/fhirtypes";
|
|
2
|
-
import { Measurement, MeasurementTypeKey, ObservationCode } from "../../../types";
|
|
2
|
+
import { Measurement, MeasurementTypeKey, ObservationCode } from "../../../types/MeasurementTypes";
|
|
3
3
|
import { RecordResult, RecordType } from "../types/generate-measurement/HealthConnectTypes";
|
|
4
4
|
import { Sample } from "../types/generate-measurement/Sample";
|
|
5
5
|
import { ObservationFragment } from "../types/generate-observation-body/ObservationFragment";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.respiratoryTherapyService = exports.babySleepService = void 0;
|
|
4
|
-
const
|
|
4
|
+
const MeasurementTypes_1 = require("../../../types/MeasurementTypes");
|
|
5
5
|
const base_observation_service_1 = require("./base-observation-service");
|
|
6
6
|
const measurement_time_1 = require("./measurement-time");
|
|
7
7
|
const MEASUREMENT_TYPE_SYSTEM = "https://sdk.ovok.com/fhir/CodeSystem/measurement-type";
|
|
@@ -63,7 +63,7 @@ class ComponentObservationService extends base_observation_service_1.BaseObserva
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
const babySleepService = () => new ComponentObservationService(
|
|
66
|
+
const babySleepService = () => new ComponentObservationService(MeasurementTypes_1.MeasurementTypeKey.babySleep, "baby sleep", MeasurementTypes_1.ObservationCode.BABY_SLEEP);
|
|
67
67
|
exports.babySleepService = babySleepService;
|
|
68
|
-
const respiratoryTherapyService = () => new ComponentObservationService(
|
|
68
|
+
const respiratoryTherapyService = () => new ComponentObservationService(MeasurementTypes_1.MeasurementTypeKey.respiratoryTherapy, "respiratory therapy", MeasurementTypes_1.ObservationCode.RESPIRATORY_THERAPY);
|
|
69
69
|
exports.respiratoryTherapyService = respiratoryTherapyService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MeasurementTypeKey } from "../../../types";
|
|
1
|
+
import { MeasurementTypeKey } from "../../../types/MeasurementTypes";
|
|
2
2
|
import { IObservationService } from "../types/IObservationService";
|
|
3
3
|
export declare class ObservationServiceCreator {
|
|
4
4
|
private static instance;
|