---
title: "ecg_result"
description: "Measurement of the electrical activity generated by the heart."
---

Measurement of the electrical activity generated by the heart.

**Purpose.** To record the measurements of electrical activity generated by the heart over a short period of time and its associated clinical interpretation.

## Source

| Model | Leg | Role |
|---|---|---|
| `openEHR-EHR-OBSERVATION.ecg_result.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. | — |
| `ecg_type`<br />`ecg_type_code`<br />`ecg_type_system`<br />`ecg_type_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | ECG type | `/data[at0001]/events[at0002]/data[at0005]/items[at0100]` |
| `atrial_heart_rate_magnitude`<br />`atrial_heart_rate_units` | quantity<br />`numeric`, `text` | yes | Atrial heart rate | `/data[at0001]/events[at0002]/data[at0005]/items[at0094]` |
| `ventricular_heart_rate_magnitude`<br />`ventricular_heart_rate_units` | quantity<br />`numeric`, `text` | yes | Ventricular heart rate | `/data[at0001]/events[at0002]/data[at0005]/items[at0013]` |
| `qt_interval_global_magnitude`<br />`qt_interval_global_units` | quantity<br />`numeric`, `text` | yes | QT interval global | `/data[at0001]/events[at0002]/data[at0005]/items[at0007]` |
| `qtc_interval_global_magnitude`<br />`qtc_interval_global_units` | quantity<br />`numeric`, `text` | yes | QTc interval global | `/data[at0001]/events[at0002]/data[at0005]/items[at0008]` |
| `pr_interval_global_magnitude`<br />`pr_interval_global_units` | quantity<br />`numeric`, `text` | yes | PR interval global | `/data[at0001]/events[at0002]/data[at0005]/items[at0012]` |
| `qrs_duration_global_magnitude`<br />`qrs_duration_global_units` | quantity<br />`numeric`, `text` | yes | QRS duration global | `/data[at0001]/events[at0002]/data[at0005]/items[at0014]` |
| `rr_interval_global_magnitude`<br />`rr_interval_global_units` | quantity<br />`numeric`, `text` | yes | RR interval global | `/data[at0001]/events[at0002]/data[at0005]/items[at0105]` |
| `clinical_information_provided` | `text` | yes | Clinical information provided | `/data[at0001]/events[at0002]/data[at0005]/items[at0096]` |
| `device_interpretation`<br />`device_interpretation_code`<br />`device_interpretation_system`<br />`device_interpretation_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Device interpretation | `/data[at0001]/events[at0002]/data[at0005]/items[at0009]` |
| `finding`<br />`finding_code`<br />`finding_system`<br />`finding_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Finding | `/data[at0001]/events[at0002]/data[at0005]/items[at0101]` |
| `ecg_diagnosis`<br />`ecg_diagnosis_code`<br />`ecg_diagnosis_system`<br />`ecg_diagnosis_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | ECG diagnosis | `/data[at0001]/events[at0002]/data[at0005]/items[at0081]` |
| `conclusion` | `text` | yes | Conclusion | `/data[at0001]/events[at0002]/data[at0005]/items[at0089]` |
| `comment` | `text` | yes | Comment | `/data[at0001]/events[at0002]/data[at0005]/items[at0090]` |
| `p_axis_magnitude`<br />`p_axis_units` | quantity<br />`numeric`, `text` | yes | P axis | `/data[at0001]/events[at0002]/data[at0005]/items[at0020]` |
| `qrs_axis_magnitude`<br />`qrs_axis_units` | quantity<br />`numeric`, `text` | yes | QRS axis | `/data[at0001]/events[at0002]/data[at0005]/items[at0021]` |
| `t_axis_magnitude`<br />`t_axis_units` | quantity<br />`numeric`, `text` | yes | T axis | `/data[at0001]/events[at0002]/data[at0005]/items[at0022]` |
| `confounding_factors` | `text` | yes | Confounding factors | `/data[at0001]/events[at0002]/state[at0077]/items[at0079]` |
| `pacemaker_stimulation`<br />`pacemaker_stimulation_code`<br />`pacemaker_stimulation_system`<br />`pacemaker_stimulation_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Pacemaker stimulation | `/data[at0001]/events[at0002]/state[at0077]/items[at0116]` |
| `position`<br />`position_code`<br />`position_system`<br />`position_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | Position | `/data[at0001]/events[at0002]/state[at0077]/items[at0107]` |
| `tilt_magnitude`<br />`tilt_units` | quantity<br />`numeric`, `text` | yes | Tilt | `/data[at0001]/events[at0002]/state[at0077]/items[at0078]` |
| `technical_quality` | `text` | yes | Technical quality | `/protocol[at0003]/items[at0102]` |
| `ecg_lead_placement`<br />`ecg_lead_placement_code`<br />`ecg_lead_placement_system`<br />`ecg_lead_placement_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | ECG lead placement | `/protocol[at0003]/items[at0097]` |
| `qtc_algorithm`<br />`qtc_algorithm_code`<br />`qtc_algorithm_system`<br />`qtc_algorithm_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | QTc algorithm | `/protocol[at0003]/items[at0025]` |
| `device_interpretation_comment` | `text` | yes | Device interpretation comment | `/protocol[at0003]/items[at0095]` |
| `recording_device` | `uuid` | yes | Recording device | `/protocol[at0003]/items[at0076]` |
| `viewing_device` | `uuid` | yes | Viewing device | `/protocol[at0003]/items[at0082]` |

## Constraints

```sql
check ((ecg_type_code is null and ecg_type_system is null and ecg_type_valueset_id is null) or (ecg_type is not null and ecg_type_code is not null and ecg_type_system is not null and ecg_type_valueset_id is not null))
check ((atrial_heart_rate_magnitude is null and atrial_heart_rate_units is null) or (atrial_heart_rate_magnitude is not null and atrial_heart_rate_units is not null))
check (atrial_heart_rate_magnitude is null or (atrial_heart_rate_units = '/min' and atrial_heart_rate_magnitude >= 0))
check ((ventricular_heart_rate_magnitude is null and ventricular_heart_rate_units is null) or (ventricular_heart_rate_magnitude is not null and ventricular_heart_rate_units is not null))
check (ventricular_heart_rate_magnitude is null or (ventricular_heart_rate_units = '/min' and ventricular_heart_rate_magnitude >= 0))
check ((qt_interval_global_magnitude is null and qt_interval_global_units is null) or (qt_interval_global_magnitude is not null and qt_interval_global_units is not null))
check (qt_interval_global_magnitude is null or (qt_interval_global_units = 'ms' and qt_interval_global_magnitude >= 0))
check ((qtc_interval_global_magnitude is null and qtc_interval_global_units is null) or (qtc_interval_global_magnitude is not null and qtc_interval_global_units is not null))
check (qtc_interval_global_magnitude is null or (qtc_interval_global_units = 'ms' and qtc_interval_global_magnitude >= 0))
check ((pr_interval_global_magnitude is null and pr_interval_global_units is null) or (pr_interval_global_magnitude is not null and pr_interval_global_units is not null))
check (pr_interval_global_magnitude is null or (pr_interval_global_units = 'ms' and pr_interval_global_magnitude >= 0))
check ((qrs_duration_global_magnitude is null and qrs_duration_global_units is null) or (qrs_duration_global_magnitude is not null and qrs_duration_global_units is not null))
check (qrs_duration_global_magnitude is null or (qrs_duration_global_units = 'ms' and qrs_duration_global_magnitude >= 0))
check ((rr_interval_global_magnitude is null and rr_interval_global_units is null) or (rr_interval_global_magnitude is not null and rr_interval_global_units is not null))
check ((device_interpretation_code is null and device_interpretation_system is null and device_interpretation_valueset_id is null) or (device_interpretation is not null and device_interpretation_code is not null and device_interpretation_system is not null and device_interpretation_valueset_id is not null))
check ((finding_code is null and finding_system is null and finding_valueset_id is null) or (finding is not null and finding_code is not null and finding_system is not null and finding_valueset_id is not null))
check ((ecg_diagnosis_code is null and ecg_diagnosis_system is null and ecg_diagnosis_valueset_id is null) or (ecg_diagnosis is not null and ecg_diagnosis_code is not null and ecg_diagnosis_system is not null and ecg_diagnosis_valueset_id is not null))
check ((p_axis_magnitude is null and p_axis_units is null) or (p_axis_magnitude is not null and p_axis_units is not null))
check ((qrs_axis_magnitude is null and qrs_axis_units is null) or (qrs_axis_magnitude is not null and qrs_axis_units is not null))
check ((t_axis_magnitude is null and t_axis_units is null) or (t_axis_magnitude is not null and t_axis_units is not null))
check ((pacemaker_stimulation_code is null and pacemaker_stimulation_system is null and pacemaker_stimulation_valueset_id is null) or (pacemaker_stimulation is not null and pacemaker_stimulation_code is not null and pacemaker_stimulation_system is not null and pacemaker_stimulation_valueset_id is not null))
check ((position_code is null and position_system is null and position_valueset_id is null and position is null) or (position is not null and position_code is not null and position_system is not null and position_valueset_id is not null))
check ((tilt_magnitude is null and tilt_units is null) or (tilt_magnitude is not null and tilt_units is not null))
check (tilt_magnitude is null or (tilt_units = 'deg' and tilt_magnitude between -90 and 90))
check ((ecg_lead_placement_code is null and ecg_lead_placement_system is null and ecg_lead_placement_valueset_id is null) or (ecg_lead_placement is not null and ecg_lead_placement_code is not null and ecg_lead_placement_system is not null and ecg_lead_placement_valueset_id is not null))
check ((qtc_algorithm_code is null and qtc_algorithm_system is null and qtc_algorithm_valueset_id is null) or (qtc_algorithm is not null and qtc_algorithm_code is not null and qtc_algorithm_system is not null and qtc_algorithm_valueset_id 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 |
| `ecg_type_valueset_id, ecg_type_code, ecg_type_system, ecg_type` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `device_interpretation_valueset_id, device_interpretation_code, device_interpretation_system, device_interpretation` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `finding_valueset_id, finding_code, finding_system, finding` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `ecg_diagnosis_valueset_id, ecg_diagnosis_code, ecg_diagnosis_system, ecg_diagnosis` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `pacemaker_stimulation_valueset_id, pacemaker_stimulation_code, pacemaker_stimulation_system, pacemaker_stimulation` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `position_valueset_id, position_code, position_system, position` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `ecg_lead_placement_valueset_id, ecg_lead_placement_code, ecg_lead_placement_system, ecg_lead_placement` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `qtc_algorithm_valueset_id, qtc_algorithm_code, qtc_algorithm_system, qtc_algorithm` | [`valueset_code`](/docs/tables/valueset_code) | restrict |
| `recording_device` | [`device`](/docs/tables/device) | no action |
| `viewing_device` | [`device`](/docs/tables/device) | no action |

## Referenced by

- [`ecg_result_multimedia_representation`](/docs/tables/ecg_result_multimedia_representation) via `ecg_result_id`
- [`ecg_result_per_lead`](/docs/tables/ecg_result_per_lead) via `ecg_result_id`

## Indexes

- `ecg_result_form_id_idx` on `form_id`
- `ecg_result_recording_device_idx` on `recording_device`
- `ecg_result_viewing_device_idx` on `viewing_device`

## Child tables

2 tables hang off `ecg_result`, one row per repetition.

### `ecg_result_multimedia_representation`

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

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `ecg_result_id` | `uuid` → [`ecg_result`](/docs/tables/ecg_result) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `attachment_id` | `uuid` | no | Multimedia representation | `/data[at0001]/events[at0002]/data[at0005]/items[at0083]` |

#### Unique

- `ecg_result_id, position`
- `ecg_result_id, attachment_id`

#### References

| Columns | Target | On delete |
|---|---|---|
| `ecg_result_id` | [`ecg_result`](/docs/tables/ecg_result) | cascade |
| `attachment_id` | [`attachment`](/docs/tables/attachment) | restrict |

#### Indexes

- `ecg_result_multimedia_representation_attachment_id_idx` on `attachment_id`

### `ecg_result_per_lead`

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

| Column | Type | Null | Description | Source |
|---|---|---|---|---|
| `id` | `uuid primary key` | no | Primary key. | — |
| `ecg_result_id` | `uuid` → [`ecg_result`](/docs/tables/ecg_result) | no | — | — |
| `position` | `integer` | no | Order of this row within its parent, from zero. | — |
| `description` | `text` | yes | Description | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0098]` |
| `p_amplitude_magnitude`<br />`p_amplitude_units` | quantity<br />`numeric`, `text` | yes | P amplitude | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0041]` |
| `p_duration_magnitude`<br />`p_duration_units` | quantity<br />`numeric`, `text` | yes | P duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0028]` |
| `p_area_magnitude`<br />`p_area_units` | quantity<br />`numeric`, `text` | yes | P area | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0042]` |
| `p_amplitude_at0043_magnitude`<br />`p_amplitude_at0043_units` | quantity<br />`numeric`, `text` | yes | P' amplitude | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0043]` |
| `p_duration_at0044_magnitude`<br />`p_duration_at0044_units` | quantity<br />`numeric`, `text` | yes | P' duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0044]` |
| `p_area_at0046_magnitude`<br />`p_area_at0046_units` | quantity<br />`numeric`, `text` | yes | P' area | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0046]` |
| `q_amplitude_magnitude`<br />`q_amplitude_units` | quantity<br />`numeric`, `text` | yes | Q amplitude | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0048]` |
| `q_duration_magnitude`<br />`q_duration_units` | quantity<br />`numeric`, `text` | yes | Q duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0049]` |
| `r_amplitude_magnitude`<br />`r_amplitude_units` | quantity<br />`numeric`, `text` | yes | R amplitude | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0050]` |
| `r_duration_magnitude`<br />`r_duration_units` | quantity<br />`numeric`, `text` | yes | R duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0051]` |
| `s_amplitude_magnitude`<br />`s_amplitude_units` | quantity<br />`numeric`, `text` | yes | S amplitude | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0053]` |
| `s_duration_magnitude`<br />`s_duration_units` | quantity<br />`numeric`, `text` | yes | S duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0054]` |
| `r_amplitude_at0055_magnitude`<br />`r_amplitude_at0055_units` | quantity<br />`numeric`, `text` | yes | R' amplitude | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0055]` |
| `r_duration_at0056_magnitude`<br />`r_duration_at0056_units` | quantity<br />`numeric`, `text` | yes | R' duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0056]` |
| `s_amplitude_at0057_magnitude`<br />`s_amplitude_at0057_units` | quantity<br />`numeric`, `text` | yes | S' amplitude | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0057]` |
| `s_duration_at0058_magnitude`<br />`s_duration_at0058_units` | quantity<br />`numeric`, `text` | yes | S' duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0058]` |
| `ventricular_activation_time_vat_magnitude`<br />`ventricular_activation_time_vat_units` | quantity<br />`numeric`, `text` | yes | Ventricular Activation Time (VAT) | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0059]` |
| `qrs_p_p_magnitude`<br />`qrs_p_p_units` | quantity<br />`numeric`, `text` | yes | QRS p-p | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0060]` |
| `qrs_duration_magnitude`<br />`qrs_duration_units` | quantity<br />`numeric`, `text` | yes | QRS duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0061]` |
| `qrs_area_magnitude`<br />`qrs_area_units` | quantity<br />`numeric`, `text` | yes | QRS area | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0062]` |
| `st_onset_magnitude`<br />`st_onset_units` | quantity<br />`numeric`, `text` | yes | ST onset | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0063]` |
| `st_midpoint_magnitude`<br />`st_midpoint_units` | quantity<br />`numeric`, `text` | yes | ST midpoint | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0064]` |
| `st_80ms_magnitude`<br />`st_80ms_units` | quantity<br />`numeric`, `text` | yes | ST 80ms | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0065]` |
| `st_60ms_magnitude`<br />`st_60ms_units` | quantity<br />`numeric`, `text` | yes | ST 60ms | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0106]` |
| `st_end_magnitude`<br />`st_end_units` | quantity<br />`numeric`, `text` | yes | ST end | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0066]` |
| `st_duration_magnitude`<br />`st_duration_units` | quantity<br />`numeric`, `text` | yes | ST duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0067]` |
| `st_slope_magnitude`<br />`st_slope_units` | quantity<br />`numeric`, `text` | yes | ST slope | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0068]` |
| `st_segment_morphology`<br />`st_segment_morphology_code`<br />`st_segment_morphology_system`<br />`st_segment_morphology_valueset_id` | coded text<br />`text`, `text`, `text`, `text` | yes | ST segment morphology | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0069]` |
| `t_amplitude_magnitude`<br />`t_amplitude_units` | quantity<br />`numeric`, `text` | yes | T amplitude | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0073]` |
| `t_duration_magnitude`<br />`t_duration_units` | quantity<br />`numeric`, `text` | yes | T duration | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0074]` |
| `t_area_magnitude`<br />`t_area_units` | quantity<br />`numeric`, `text` | yes | T area | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0075]` |
| `lead_comment` | `text` | yes | Lead comment | `/data[at0001]/events[at0002]/data[at0005]/items[at0027]/items[at0115]` |

#### Constraints

```sql
check ((p_amplitude_magnitude is null and p_amplitude_units is null) or (p_amplitude_magnitude is not null and p_amplitude_units is not null))
check ((p_duration_magnitude is null and p_duration_units is null) or (p_duration_magnitude is not null and p_duration_units is not null))
check (p_duration_magnitude is null or (p_duration_units = 'ms' and p_duration_magnitude >= 0))
check ((p_area_magnitude is null and p_area_units is null) or (p_area_magnitude is not null and p_area_units is not null))
check ((p_amplitude_at0043_magnitude is null and p_amplitude_at0043_units is null) or (p_amplitude_at0043_magnitude is not null and p_amplitude_at0043_units is not null))
check ((p_duration_at0044_magnitude is null and p_duration_at0044_units is null) or (p_duration_at0044_magnitude is not null and p_duration_at0044_units is not null))
check (p_duration_at0044_magnitude is null or (p_duration_at0044_units = 'ms' and p_duration_at0044_magnitude >= 0))
check ((p_area_at0046_magnitude is null and p_area_at0046_units is null) or (p_area_at0046_magnitude is not null and p_area_at0046_units is not null))
check ((q_amplitude_magnitude is null and q_amplitude_units is null) or (q_amplitude_magnitude is not null and q_amplitude_units is not null))
check ((q_duration_magnitude is null and q_duration_units is null) or (q_duration_magnitude is not null and q_duration_units is not null))
check (q_duration_magnitude is null or (q_duration_units = 'ms' and q_duration_magnitude >= 0))
check ((r_amplitude_magnitude is null and r_amplitude_units is null) or (r_amplitude_magnitude is not null and r_amplitude_units is not null))
check ((r_duration_magnitude is null and r_duration_units is null) or (r_duration_magnitude is not null and r_duration_units is not null))
check (r_duration_magnitude is null or (r_duration_units = 'ms' and r_duration_magnitude >= 0))
check ((s_amplitude_magnitude is null and s_amplitude_units is null) or (s_amplitude_magnitude is not null and s_amplitude_units is not null))
check ((s_duration_magnitude is null and s_duration_units is null) or (s_duration_magnitude is not null and s_duration_units is not null))
check (s_duration_magnitude is null or (s_duration_units = 'ms' and s_duration_magnitude >= 0))
check ((r_amplitude_at0055_magnitude is null and r_amplitude_at0055_units is null) or (r_amplitude_at0055_magnitude is not null and r_amplitude_at0055_units is not null))
check ((r_duration_at0056_magnitude is null and r_duration_at0056_units is null) or (r_duration_at0056_magnitude is not null and r_duration_at0056_units is not null))
check (r_duration_at0056_magnitude is null or (r_duration_at0056_units = 'ms' and r_duration_at0056_magnitude >= 0))
check ((s_amplitude_at0057_magnitude is null and s_amplitude_at0057_units is null) or (s_amplitude_at0057_magnitude is not null and s_amplitude_at0057_units is not null))
check ((s_duration_at0058_magnitude is null and s_duration_at0058_units is null) or (s_duration_at0058_magnitude is not null and s_duration_at0058_units is not null))
check (s_duration_at0058_magnitude is null or (s_duration_at0058_units = 'ms' and s_duration_at0058_magnitude >= 0))
check ((ventricular_activation_time_vat_magnitude is null and ventricular_activation_time_vat_units is null) or (ventricular_activation_time_vat_magnitude is not null and ventricular_activation_time_vat_units is not null))
check (ventricular_activation_time_vat_magnitude is null or (ventricular_activation_time_vat_units = 'ms' and ventricular_activation_time_vat_magnitude >= 0))
check ((qrs_p_p_magnitude is null and qrs_p_p_units is null) or (qrs_p_p_magnitude is not null and qrs_p_p_units is not null))
check (qrs_p_p_magnitude is null or (qrs_p_p_units = 'mV' and qrs_p_p_magnitude >= 0))
check ((qrs_duration_magnitude is null and qrs_duration_units is null) or (qrs_duration_magnitude is not null and qrs_duration_units is not null))
check (qrs_duration_magnitude is null or (qrs_duration_units = 'ms' and qrs_duration_magnitude >= 0))
check ((qrs_area_magnitude is null and qrs_area_units is null) or (qrs_area_magnitude is not null and qrs_area_units is not null))
check ((st_onset_magnitude is null and st_onset_units is null) or (st_onset_magnitude is not null and st_onset_units is not null))
check ((st_midpoint_magnitude is null and st_midpoint_units is null) or (st_midpoint_magnitude is not null and st_midpoint_units is not null))
check ((st_80ms_magnitude is null and st_80ms_units is null) or (st_80ms_magnitude is not null and st_80ms_units is not null))
check ((st_60ms_magnitude is null and st_60ms_units is null) or (st_60ms_magnitude is not null and st_60ms_units is not null))
check ((st_end_magnitude is null and st_end_units is null) or (st_end_magnitude is not null and st_end_units is not null))
check ((st_duration_magnitude is null and st_duration_units is null) or (st_duration_magnitude is not null and st_duration_units is not null))
check (st_duration_magnitude is null or (st_duration_units = 'ms' and st_duration_magnitude >= 0))
check ((st_slope_magnitude is null and st_slope_units is null) or (st_slope_magnitude is not null and st_slope_units is not null))
check (st_slope_magnitude is null or (st_slope_units = 'deg' and st_slope_magnitude between -90 and 90))
check ((st_segment_morphology_code is null and st_segment_morphology_system is null and st_segment_morphology_valueset_id is null) or (st_segment_morphology is not null and st_segment_morphology_code is not null and st_segment_morphology_system is not null and st_segment_morphology_valueset_id is not null))
check ((t_amplitude_magnitude is null and t_amplitude_units is null) or (t_amplitude_magnitude is not null and t_amplitude_units is not null))
check ((t_duration_magnitude is null and t_duration_units is null) or (t_duration_magnitude is not null and t_duration_units is not null))
check (t_duration_magnitude is null or (t_duration_units = 'ms' and t_duration_magnitude >= 0))
check ((t_area_magnitude is null and t_area_units is null) or (t_area_magnitude is not null and t_area_units is not null))
```

#### Unique

- `ecg_result_id, position`

#### References

| Columns | Target | On delete |
|---|---|---|
| `ecg_result_id` | [`ecg_result`](/docs/tables/ecg_result) | cascade |
| `st_segment_morphology_valueset_id, st_segment_morphology_code, st_segment_morphology_system, st_segment_morphology` | [`valueset_code`](/docs/tables/valueset_code) | restrict |

## Value sets

| Value set | Codes |
|---|---|
| `org.openehr::openEHR-EHR-OBSERVATION.ecg_result.v1/position` | 5 |
| `org.openehr::openEHR-EHR-OBSERVATION.ecg_result.v1/st_segment_morphology` | 5 |

