---
title: "service"
description: "A simple health-related service or activity delivered by a clinician, organisation or agency."
---
A simple health-related service or activity delivered by a clinician, organisation or agency.
**Purpose.** To record details about a simple health-related service or activity delivered by a clinician, organisation or agency.
## Source
| Model | Leg | Role |
|---|---|---|
| `openEHR-EHR-ACTION.service.v1` | openEHR | defines this table |
## Columns
| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `form_id` | `uuid` → [`form`](/docs/tables/form) | no | The form this entry was recorded on. | — |
| `form_block_id` | `uuid` | yes | The block within the form, when the entry is bound to one. | — |
| `service_name`
`service_name_code`
`service_name_system`
`service_name_valueset_id` | coded text
`text`, `text`, `text`, `text` | yes | Service name | `/description[at0001]/items[at0011]` |
| `service_type`
`service_type_code`
`service_type_system`
`service_type_valueset_id` | coded text
`text`, `text`, `text`, `text` | yes | Service type | `/description[at0001]/items[at0014]` |
| `description` | `text` | yes | Description | `/description[at0001]/items[at0013]` |
| `planned_date_time` | `timestamptz` | yes | Planned date/time | `/description[at0001]/items[at0032]` |
| `scheduled_date_time` | `timestamptz` | yes | Scheduled date/time | `/description[at0001]/items[at0025]` |
| `sequence` | `integer` | yes | Sequence | `/description[at0001]/items[at0021]` |
| `reason` | `text` | yes | Reason | `/description[at0001]/items[at0012]` |
| `comment` | `text` | yes | Comment | `/description[at0001]/items[at0028]` |
| `requestor_identifier_value`
`requestor_identifier_system` | text, text
`text`, `text` | yes | Requestor identifier | `/protocol[at0015]/items[at0016]` |
| `service_provider_identifier_value`
`service_provider_identifier_system` | text, text
`text`, `text` | yes | Service provider identifier | `/protocol[at0015]/items[at0018]` |
## Constraints
```sql
check ((service_name_code is null and service_name_system is null and service_name_valueset_id is null) or (service_name is not null and service_name_code is not null and service_name_system is not null and service_name_valueset_id is not null))
check ((service_type_code is null and service_type_system is null and service_type_valueset_id is null) or (service_type is not null and service_type_code is not null and service_type_system is not null and service_type_valueset_id is not null))
check (sequence is null or sequence >= 1)
check (requestor_identifier_system is null or requestor_identifier_value is not null)
check (service_provider_identifier_system is null or service_provider_identifier_value is not null)
```
## Unique
- `form_block_id`
## References
| Columns | Target | On delete |
|---|---|---|
| `form_id` | [`form`](/docs/tables/form) | cascade |
| `form_id, form_block_id` | [`form_block`](/docs/tables/form_block) | cascade |
| `service_name_valueset_id, service_name_code, service_name_system, service_name` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `service_type_valueset_id, service_type_code, service_type_system, service_type` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
## Referenced by
- [`service_multimedia_representation`](/docs/tables/service_multimedia_representation) via `service_id`
- [`service_requestor`](/docs/tables/service_requestor) via `service_id`
- [`service_receiver`](/docs/tables/service_receiver) via `service_id`
## Indexes
- `service_form_id_idx` on `form_id`
## Child tables
3 tables hang off `service`, one row per repetition.
### `service_multimedia_representation`
Child table — one row per repetition, deleted with its parent.
| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `service_id` | `uuid` → [`service`](/docs/tables/service) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `attachment_id` | `uuid` | no | Multimedia representation | `/description[at0001]/items[at0029]` |
#### Unique
- `service_id, position`
- `service_id, attachment_id`
#### References
| Columns | Target | On delete |
|---|---|---|
| `service_id` | [`service`](/docs/tables/service) | cascade |
| `attachment_id` | [`attachment`](/docs/tables/attachment) | restrict |
#### Indexes
- `service_multimedia_representation_attachment_id_idx` on `attachment_id`
### `service_requestor`
Child table — one row per repetition, deleted with its parent.
| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `service_id` | `uuid` → [`service`](/docs/tables/service) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `organization_id` | `uuid` | yes | — | — |
| `person_id` | `uuid` | yes | — | — |
#### Constraints
```sql
check (num_nonnulls(organization_id, person_id) = 1)
```
#### Unique
- `service_id, position`
#### References
| Columns | Target | On delete |
|---|---|---|
| `service_id` | [`service`](/docs/tables/service) | cascade |
| `organization_id` | [`organization`](/docs/tables/organization) | no action |
| `person_id` | [`person`](/docs/tables/person) | no action |
#### Indexes
- `service_requestor_organization_id_idx` on `organization_id`
- `service_requestor_person_id_idx` on `person_id`
### `service_receiver`
Child table — one row per repetition, deleted with its parent.
| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `service_id` | `uuid` → [`service`](/docs/tables/service) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `organization_id` | `uuid` | yes | — | — |
| `person_id` | `uuid` | yes | — | — |
#### Constraints
```sql
check (num_nonnulls(organization_id, person_id) = 1)
```
#### Unique
- `service_id, position`
#### References
| Columns | Target | On delete |
|---|---|---|
| `service_id` | [`service`](/docs/tables/service) | cascade |
| `organization_id` | [`organization`](/docs/tables/organization) | no action |
| `person_id` | [`person`](/docs/tables/person) | no action |
#### Indexes
- `service_receiver_organization_id_idx` on `organization_id`
- `service_receiver_person_id_idx` on `person_id`