# Patient resource

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_sdk/patient-resource

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## AppointmentsResource [#appointmentsresource]

```dart
class AppointmentsResource extends FhirRecordsResource
```

`Appointment` resources. Reached through `ovok.patient.appointments`.

### Constructors [#constructors]

#### AppointmentsResource.new [#appointmentsresourcenew]

```dart
AppointmentsResource(FhirResource fhir)
```

Built by [`PatientResource`](#patientresource); use `ovok.patient.appointments` instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `fhir` | `FhirResource` | positional |  |

### Methods [#methods]

#### AppointmentsResource.create [#appointmentsresourcecreate]

```dart
Future<JsonMap> create(JsonMap appointment)
```

Creates `appointment`. Calls `POST {fhirPath}/Appointment`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `appointment` | `JsonMap` | positional |  |

Returns `Future<Map<String, dynamic>>`.

#### AppointmentsResource.update [#appointmentsresourceupdate]

```dart
Future<JsonMap> update(String id, JsonMap appointment)
```

Replaces the appointment `id` with `appointment`.

Calls `PUT {fhirPath}/Appointment/{id}`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `id` | `String` | positional |  |
| `appointment` | `JsonMap` | positional |  |

Returns `Future<Map<String, dynamic>>`.


## FhirListResource [#fhirlistresource]

```dart
class FhirListResource
```

A listable FHIR resource type. Reached through `ovok.patient`, e.g. `ovok.patient.slots`.

### Constructors [#constructors-1]

#### FhirListResource.new [#fhirlistresourcenew]

```dart
FhirListResource(FhirResource _fhir, String _type)
```

Built by [`PatientResource`](#patientresource); use its fields instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `_fhir` | `FhirResource` | positional |  |
| `_type` | `String` | positional |  |

### Methods [#methods-1]

#### FhirListResource.list [#fhirlistresourcelist]

```dart
Future<List<JsonMap>> list([QueryParams params = const {}])
```

Searches the type with `params` and returns the first page's resources.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `params` | `QueryParams` | optional positional | `const {}` |

Returns `Future<List<Map<String, dynamic>>>`.


## FhirRecordsResource [#fhirrecordsresource]

```dart
class FhirRecordsResource extends FhirListResource
```

A FHIR resource type that can also be read by id. Reached through `ovok.patient`.

### Constructors [#constructors-2]

#### FhirRecordsResource.new [#fhirrecordsresourcenew]

```dart
FhirRecordsResource(FhirResource _fhir, String _type)
```

Built by [`PatientResource`](#patientresource); use its fields instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `_fhir` | `FhirResource` | positional |  |
| `_type` | `String` | positional |  |

### Methods [#methods-2]

#### FhirRecordsResource.retrieve [#fhirrecordsresourceretrieve]

```dart
Future<JsonMap> retrieve(String id)
```

Reads one resource by `id`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `id` | `String` | positional |  |

Returns `Future<Map<String, dynamic>>`.


## PatientResource [#patientresource]

```dart
class PatientResource
```

FHIR reads for patient apps, plus a one-call dashboard.

Reached through `ovok.patient`. Every request throws an `OvokException`
subclass when it fails.

### Constructors [#constructors-3]

#### PatientResource.new [#patientresourcenew]

```dart
PatientResource(HttpClient http, FhirResource fhir)
```

Built by `Ovok`; use `ovok.patient` instead.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `http` | `HttpClient` | positional |  |
| `fhir` | `FhirResource` | positional |  |

### Properties [#properties]

#### PatientResource.appointments [#patientresourceappointments]

```dart
final AppointmentsResource appointments
```

`Appointment` resources.

#### PatientResource.schedules [#patientresourceschedules]

```dart
final FhirListResource schedules
```

`Schedule` resources.

#### PatientResource.slots [#patientresourceslots]

```dart
final FhirListResource slots
```

`Slot` resources.

#### PatientResource.measurements [#patientresourcemeasurements]

```dart
final FhirRecordsResource measurements
```

`Observation` resources.

#### PatientResource.carePlans [#patientresourcecareplans]

```dart
final FhirRecordsResource carePlans
```

`CarePlan` resources.

#### PatientResource.questionnaires [#patientresourcequestionnaires]

```dart
final FhirRecordsResource questionnaires
```

`Questionnaire` resources.

#### PatientResource.questionnaireResponses [#patientresourcequestionnaireresponses]

```dart
final FhirRecordsResource questionnaireResponses
```

`QuestionnaireResponse` resources.

#### PatientResource.devices [#patientresourcedevices]

```dart
final FhirRecordsResource devices
```

`Device` resources.

#### PatientResource.notifications [#patientresourcenotifications]

```dart
final FhirRecordsResource notifications
```

`CommunicationRequest` resources.

### Methods [#methods-3]

#### PatientResource.latestObservations [#patientresourcelatestobservations]

```dart
Future<JsonMap> latestObservations([QueryParams params = const {}])
```

Fetches the latest observations per code. Calls `GET fhir/Observation/$lastn`.

Only the `patient`, `max` and `code` entries of `params` are sent.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `params` | `QueryParams` | optional positional | `const {}` |

Returns `Future<Map<String, dynamic>>`.

#### PatientResource.dashboard [#patientresourcedashboard]

```dart
Future<JsonMap> dashboard([JsonMap params = const {}])
```

Fetches the signed-in user's profile, latest observations, measurement
history and care plans in one call.

Calls `GET auth/me`, then the three searches in parallel. `params` may
hold `latestObservations`, `measurementHistory` and `carePlans` maps;
each defaults its `patient` to the signed-in user's.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `params` | `JsonMap` | optional positional | `const {}` |

Returns `Future<Map<String, dynamic>>`.
