# ovok.slim

Canonical page: https://docs.ovok.com/web-sdk/core/namespaces/slim

`ovok.slim` calls the `v1/slim` routes that power a care-home dashboard. Practitioner apps call it with a signed-in user whose project role allows it. It has many sub-resources; this page groups them by task.

Lists that the server pages (`patients`, `devices`, `locations`, `zones`, `changeHistory`, medical notifications) return a `PagePromise`: await it for the first page, or `for await` for every item.

## Residents and devices [#residents-and-devices]

```ts
for await (const resident of ovok.slim.patients.list({ search: 'smith' })) {
  console.log(resident);
}

const resident = await ovok.slim.patients.retrieve(patientId);
const vitals = await ovok.slim.patients.currentVitals(patientId);
```

- `patients` has `list`, `retrieve`, `create`, `update`, `delete`, `everything` (the `$everything` bundle) and `currentVitals`.
- `update` replaces the editable fields: leaving out `locationId` unassigns the resident's devices. `delete` returns 409 while the resident still has a device.
- `devices` has `list`, `retrieve`, `create`, `update`, `delete` and `assignToProject`. `create` returns 409 when another customer holds the serial.

## Live values and telemetry [#live-values-and-telemetry]

```ts
const telemetry = await ovok.slim.devices.liveTelemetry({ count: 50 });

for await (const row of ovok.slim.devices.live({ count: 50 })) {
  console.log(row);
}
```

- `live` and `liveTelemetry` take `count` from 1 to 100; anything else throws `OvokValidationError` before any request.
- Identical concurrent live reads share one request, and it is aborted only once every caller has aborted.
- `telemetry(deviceId)` reads one device. `effectiveObservationIds` and `lastObservationIds` have per-device and all-device variants.

## Notifications and notes [#notifications-and-notes]

```ts
const page = await ovok.slim.notifications.outOfBed.list({ patient: patientId });

await ovok.slim.notifications.alarms.acknowledge(notificationId);

await ovok.slim.notifications.notes.create({ kind: 'alarm', id: notificationId, text: 'Checked on the resident' });
```

- `notifications` groups `alarms`, `outOfBed`, `medical` and `notes`. Each of the first three has `list` and `recent`; `alarms` and `medical` also `acknowledge`.
- `medical.list` pages with a cursor and `medical.retrieve` reads one episode. `acknowledge` can take about 12 seconds, and the client retries a 503 because the server makes it safe to repeat.
- Note `kind` is `'oob'`, `'alarm'`, `'medical'` or `'alert'`.
- `notifications.list` is deprecated: use `outOfBed.list`, `alarms.list` or `medical.list`.

## Thresholds, trends and sleep [#thresholds-trends-and-sleep]

```ts
const home = await ovok.slim.thresholds.retrieve();

await ovok.slim.patients.thresholds.update(patientId, {
  settings: { heartRate: { deviationPercent: 20 } },
});

const trends = await ovok.slim.trends.realtime({
  patientId,
  startTime,
  endTime,
  graphType: 'heartRate',
});
```

- `thresholds` is the home default; `patients.thresholds` is per resident. A home with no stored limits reads as the default template.
- Threshold updates are never retried. A 502 means Signals did not take every resident's limits and nothing was written; a 409 on a resident means another save is running.
- `trends.graphs` reads history by day range; `trends.realtime` is limited to 20 calls per minute per caller, so load once per view and wait `retryAfterMs` after a 503.
- `sleep.statistics` takes `patientId`, `endDate` and optional `lastDayCount`.

## Places, projects and staff [#places-projects-and-staff]

- `locations` and `zones`: `locations` has `list`, `retrieve`, `create`, `update`, `delete`; `zones` has `list`, `retrieve` and `deviceCounts`.
- `projects` reads and replaces a project, lists its `users` and counts `deviceCounts` and `patientCounts`. `projects.children` lists, creates and deletes child projects.
- `policies` and `organizations` are CRUD resources over access policies and organizations.
- `practitioners.invite` invites a practitioner by email, and `users.delete` deletes a user by profile type and id.
- `exports.patientPdf` generates a resident PDF, and `changeHistory.list` pages the change history.
- `ovok.slim.health()` checks the slim API.

## Reference [#reference]

- [slim API reference](/web-sdk/core/reference/core/slim): every method and type.
- [ovok.signals](/web-sdk/core/namespaces/signals) for Signals repair and the gateway.
- [Errors and retries](/web-sdk/core/errors-and-retries)
