# ovok.patient

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

`ovok.patient` is the patient app's view of the signed-in patient's FHIR records. It needs a signed-in patient session.

## Read records [#read-records]

Each sub-resource wraps one FHIR resource type: `appointments`, `schedules`, `slots`, `measurements` (Observations), `carePlans`, `questionnaires`, `questionnaireResponses`, `devices` and `notifications` (CommunicationRequests).

```ts
const carePlans = await ovok.patient.carePlans.list();

const plan = await ovok.patient.carePlans.retrieve(carePlans[0].id!);
```

- `list` takes FHIR search parameters and resolves to the first page's resources, as an array.
- `retrieve` reads one resource by id. `schedules` and `slots` can only be listed.

## Manage appointments [#manage-appointments]

`appointments` also creates and replaces appointments.

```ts
const appointment = await ovok.patient.appointments.create(newAppointment);

await ovok.patient.appointments.update(appointment.id!, { ...appointment, comment: 'Moved' });
```

- `update` replaces the appointment with the given id.

## Load the dashboard [#load-the-dashboard]

`dashboard` reads the profile, the latest observations, the measurement history and the care plans in one call.

```ts
const { profile, latestObservations, measurementHistory, carePlans } = await ovok.patient.dashboard({
  latestObservations: { max: 5 },
});
```

- Each read is scoped to the signed-in patient unless its query names another.
- `latestObservations` alone reads `fhir/Observation/$lastn`.

## Reference [#reference]

- [patient API reference](/web-sdk/core/reference/core/patient): every method and type.
- [ovok.measurements](/web-sdk/core/namespaces/measurements) to save readings.
- [ovok.questionnaires](/web-sdk/core/namespaces/questionnaires) to submit answers.
