---
title: "medication_detail"
description: "Details about a medication or component of a medication, including strength, form and details of any specific constituents."
---

Details about a medication or component of a medication, including strength, form and details of any specific constituents.

**Purpose.** To record details about a medication or component of a medication, including strength, form and details of any specific constituents.

## Source

| Model | Leg | Role |
|---|---|---|
| `openEHR-EHR-CLUSTER.medication.v2` | openEHR | defines this table |

## Columns

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `name`<br />`name_code`<br />`name_system`<br />`name_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Name | `/items[at0132]` |
| `form`<br />`form_code`<br />`form_system`<br />`form_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Form | `/items[at0071]` |
| `category`<br />`category_code`<br />`category_system`<br />`category_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Category | `/items[at0142]` |
| `strength_presentation_strength_numerator_magnitude`<br />`strength_presentation_strength_numerator_units` | quantity<br />`numeric`, `text` | yes | Strength numerator | `/items[at0152]/items[at0153]` |
| `strength_presentation_strength_denominator_magnitude`<br />`strength_presentation_strength_denominator_units` | quantity<br />`numeric`, `text` | yes | Strength denominator | `/items[at0152]/items[at0157]` |
| `strength_concentration_magnitude`<br />`strength_concentration_units` | quantity<br />`numeric`, `text` | yes | Strength (concentration) | `/items[at0115]` |
| `manufacturer` | `text` | yes | Manufacturer | `/items[at0151]` |
| `batch_id_value`<br />`batch_id_system` | text, text<br />`text`, `text` | yes | Batch ID | `/items[at0150]` |
| `expiry` | `timestamptz` | yes | Expiry | `/items[at0003]` |
| `amount_magnitude`<br />`amount_units` | quantity<br />`numeric`, `text` | yes | Amount | `/items[at0139]` |
| `alternate_amount_magnitude`<br />`alternate_amount_units` | quantity<br />`numeric`, `text` | yes | Alternate amount | `/items[at0148]` |
| `role`<br />`role_code`<br />`role_system`<br />`role_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Role | `/items[at0127]` |
| `description` | `text` | yes | Description | `/items[at0133]` |

## Constraints

```sql
check ((name_code is null and name_system is null and name_valueset_id is null) or (name is not null and name_code is not null and name_system is not null and name_valueset_id is not null))
check ((form_code is null and form_system is null and form_valueset_id is null) or (form is not null and form_code is not null and form_system is not null and form_valueset_id is not null))
check ((category_code is null and category_system is null and category_valueset_id is null) or (category is not null and category_code is not null and category_system is not null and category_valueset_id is not null))
check ((strength_presentation_strength_numerator_magnitude is null and strength_presentation_strength_numerator_units is null) or (strength_presentation_strength_numerator_magnitude is not null and strength_presentation_strength_numerator_units is not null))
check ((strength_presentation_strength_denominator_magnitude is null and strength_presentation_strength_denominator_units is null) or (strength_presentation_strength_denominator_magnitude is not null and strength_presentation_strength_denominator_units is not null))
check ((strength_concentration_magnitude is null and strength_concentration_units is null) or (strength_concentration_magnitude is not null and strength_concentration_units is not null))
check (batch_id_system is null or batch_id_value is not null)
check ((amount_magnitude is null and amount_units is null) or (amount_magnitude is not null and amount_units is not null))
check ((alternate_amount_magnitude is null and alternate_amount_units is null) or (alternate_amount_magnitude is not null and alternate_amount_units is not null))
check ((role_code is null and role_system is null and role_valueset_id is null) or (role is not null and role_code is not null and role_system is not null and role_valueset_id is not null))
```

## References

| Columns | Target | On delete |
|---|---|---|
| `name_valueset_id, name_code, name_system, name` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `form_valueset_id, form_code, form_system, form` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `category_valueset_id, category_code, category_system, category` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `role_valueset_id, role_code, role_system, role` | [`valueset_code`](/docs/tables/valueset_code) | restrict |

## Referenced by

- [`adverse_reaction_monitoring_substance_details`](/docs/tables/adverse_reaction_monitoring_substance_details) via `medication_detail_id`
- [`medication`](/docs/tables/medication) via `medication_details`
- [`medication_detail_constituent`](/docs/tables/medication_detail_constituent) via `medication_detail_id`
- [`medication_detail_constituent`](/docs/tables/medication_detail_constituent) via `constituent_id`
- [`medication_order_medication_details`](/docs/tables/medication_order_medication_details) via `medication_detail_id`
- [`medication_summary_episode_additional_details`](/docs/tables/medication_summary_episode_additional_details) via `medication_detail_id`

## Child tables

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

### `medication_detail_constituent`

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

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `medication_detail_id` | `uuid` → [`medication_detail`](/docs/tables/medication_detail) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `constituent_id` | `uuid` | no | Constituent | `/items[at0138]` |

#### Unique

- `medication_detail_id, position`
- `medication_detail_id, constituent_id`

#### References

| Columns | Target | On delete |
|---|---|---|
| `medication_detail_id` | [`medication_detail`](/docs/tables/medication_detail) | cascade |
| `constituent_id` | [`medication_detail`](/docs/tables/medication_detail) | no action |

#### Indexes

- `medication_detail_constituent_constituent_id_idx` on `constituent_id`

## Value sets

| Value set | Codes |
|---|---|
| `org.openehr::openEHR-EHR-CLUSTER.medication.v2/category` | 5 |
| `org.openehr::openEHR-EHR-CLUSTER.medication.v2/role` | 3 |

