---
title: "medication"
description: "Any activity related to the planning, scheduling, prescription management, dispensing, administration, cessation and other use of a medication, vaccine, nutritional product or oth…"
---

Any activity related to the planning, scheduling, prescription management, dispensing, administration, cessation and other use of a medication, vaccine, nutritional product or other therapeutic item.

**Purpose.** For recording details about any activity related to the planning, scheduling, prescription management, dispensing, administration, cessation and other use of a medication, vaccine, nutritional product or other therapeutic item.

## Source

| Model | Leg | Role |
|---|---|---|
| `openEHR-EHR-ACTION.medication.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. | — |
| `medication_item`<br />`medication_item_code`<br />`medication_item_system`<br />`medication_item_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Medication item | `/description[at0017]/items[at0020]` |
| `medication_details` | `uuid` | yes | Medication details | `/description[at0017]/items[at0104]` |
| `amount` | `uuid` | yes | Amount | `/description[at0017]/items[at0131]` |
| `clinical_indication`<br />`clinical_indication_code`<br />`clinical_indication_system`<br />`clinical_indication_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Clinical indication | `/description[at0017]/items[at0156]` |
| `substitution`<br />`substitution_code`<br />`substitution_system`<br />`substitution_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Substitution | `/description[at0017]/items[at0132]` |
| `substitution_reason`<br />`substitution_reason_code`<br />`substitution_reason_system`<br />`substitution_reason_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Substitution reason | `/description[at0017]/items[at0133]` |
| `original_scheduled_date_time` | `timestamptz` | yes | Original scheduled date/time | `/description[at0017]/items[at0043]` |
| `restart_date_time` | `timestamptz` | yes | Restart date/time | `/description[at0017]/items[at0154]` |
| `restart_criterion` | `text` | yes | Restart criterion | `/description[at0017]/items[at0155]` |
| `reason` | `text` | yes | Reason | `/description[at0017]/items[at0021]` |
| `administration_details_route`<br />`administration_details_route_code`<br />`administration_details_route_system`<br />`administration_details_route_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Route | `/description[at0017]/items[at0140]/items[at0147]` |
| `administration_details_body_site`<br />`administration_details_body_site_code`<br />`administration_details_body_site_system`<br />`administration_details_body_site_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Body site | `/description[at0017]/items[at0140]/items[at0141]` |
| `administration_details_structured_body_site_anatomical_location` | `uuid` | yes | — | — |
| `administration_details_structured_body_site_anatomical_l_afc7f9` | `uuid` | yes | — | — |
| `administration_details_structured_body_site_anatomical_l_009789` | `uuid` | yes | — | — |
| `administration_details_administration_method`<br />`administration_details_administration_method_code`<br />`administration_details_administration_method_system`<br />`administration_details_administration_method_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Administration method | `/description[at0017]/items[at0140]/items[at0143]` |
| `patient_guidance`<br />`patient_guidance_code`<br />`patient_guidance_system`<br />`patient_guidance_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Patient guidance | `/description[at0017]/items[at0033]` |
| `double_checked` | `boolean` | yes | Double-checked? | `/description[at0017]/items[at0149]` |
| `sequence_number` | `integer` | yes | Sequence number | `/description[at0017]/items[at0025]` |
| `comment` | `text` | yes | Comment | `/description[at0017]/items[at0024]` |
| `order_id_value`<br />`order_id_system` | text, text<br />`text`, `text` | yes | Order ID | `/protocol[at0030]/items[at0103]` |

## Constraints

```sql
check ((medication_item_code is null and medication_item_system is null and medication_item_valueset_id is null) or (medication_item is not null and medication_item_code is not null and medication_item_system is not null and medication_item_valueset_id is not null))
check ((clinical_indication_code is null and clinical_indication_system is null and clinical_indication_valueset_id is null) or (clinical_indication is not null and clinical_indication_code is not null and clinical_indication_system is not null and clinical_indication_valueset_id is not null))
check ((substitution_code is null and substitution_system is null and substitution_valueset_id is null and substitution is null) or (substitution is not null and substitution_code is not null and substitution_system is not null and substitution_valueset_id is not null))
check ((substitution_reason_code is null and substitution_reason_system is null and substitution_reason_valueset_id is null) or (substitution_reason is not null and substitution_reason_code is not null and substitution_reason_system is not null and substitution_reason_valueset_id is not null))
check ((administration_details_route_code is null and administration_details_route_system is null and administration_details_route_valueset_id is null) or (administration_details_route is not null and administration_details_route_code is not null and administration_details_route_system is not null and administration_details_route_valueset_id is not null))
check ((administration_details_body_site_code is null and administration_details_body_site_system is null and administration_details_body_site_valueset_id is null) or (administration_details_body_site is not null and administration_details_body_site_code is not null and administration_details_body_site_system is not null and administration_details_body_site_valueset_id is not null))
check (num_nonnulls(administration_details_structured_body_site_anatomical_location, administration_details_structured_body_site_anatomical_l_afc7f9, administration_details_structured_body_site_anatomical_l_009789) <= 1)
check ((administration_details_administration_method_code is null and administration_details_administration_method_system is null and administration_details_administration_method_valueset_id is null) or (administration_details_administration_method is not null and administration_details_administration_method_code is not null and administration_details_administration_method_system is not null and administration_details_administration_method_valueset_id is not null))
check ((patient_guidance_code is null and patient_guidance_system is null and patient_guidance_valueset_id is null) or (patient_guidance is not null and patient_guidance_code is not null and patient_guidance_system is not null and patient_guidance_valueset_id is not null))
check (order_id_system is null or order_id_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 |
| `medication_item_valueset_id, medication_item_code, medication_item_system, medication_item` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `clinical_indication_valueset_id, clinical_indication_code, clinical_indication_system, clinical_indication` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `substitution_valueset_id, substitution_code, substitution_system, substitution` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `substitution_reason_valueset_id, substitution_reason_code, substitution_reason_system, substitution_reason` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `administration_details_route_valueset_id, administration_details_route_code, administration_details_route_system, administration_details_route` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `administration_details_body_site_valueset_id, administration_details_body_site_code, administration_details_body_site_system, administration_details_body_site` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `administration_details_administration_method_valueset_id, administration_details_administration_method_code, administration_details_administration_method_system, administration_details_administration_method` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `patient_guidance_valueset_id, patient_guidance_code, patient_guidance_system, patient_guidance` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `medication_details` | [`medication_detail`](/docs/tables/medication_detail) | no action |
| `amount` | [`dosage`](/docs/tables/dosage) | no action |
| `administration_details_structured_body_site_anatomical_location` | [`anatomical_location`](/docs/tables/anatomical_location) | no action |
| `administration_details_structured_body_site_anatomical_l_afc7f9` | [`anatomical_location_circle`](/docs/tables/anatomical_location_circle) | no action |
| `administration_details_structured_body_site_anatomical_l_009789` | [`anatomical_location_relative`](/docs/tables/anatomical_location_relative) | no action |

## Referenced by

- [`medication_administration_details_administration_device`](/docs/tables/medication_administration_details_administration_device) via `medication_id`

## Indexes

- `medication_form_id_idx` on `form_id`
- `medication_medication_details_idx` on `medication_details`
- `medication_amount_idx` on `amount`
- `medication_administration_details_structured_body_site_a_ded596` on `administration_details_structured_body_site_anatomical_location`
- `medication_administration_details_structured_body_site_a_deabec` on `administration_details_structured_body_site_anatomical_l_afc7f9`
- `medication_administration_details_structured_body_site_a_561f00` on `administration_details_structured_body_site_anatomical_l_009789`

## Child tables

1 table hang off `medication`, one row per repetition.

### `medication_administration_details_administration_device`

Child table — one row per repetition, deleted with its parent.

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `medication_id` | `uuid` → [`medication`](/docs/tables/medication) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `device_id` | `uuid` | no | Administration device | `/description[at0017]/items[at0140]/items[at0144]` |

#### Unique

- `medication_id, position`
- `medication_id, device_id`

#### References

| Columns | Target | On delete |
|---|---|---|
| `medication_id` | [`medication`](/docs/tables/medication) | cascade |
| `device_id` | [`device`](/docs/tables/device) | no action |

#### Indexes

- `medication_administration_details_administration_device__f8a3a2` on `device_id`

## Value sets

| Value set | Codes |
|---|---|
| `org.openehr::openEHR-EHR-ACTION.medication.v1/substitution` | 2 |

