Schema reference / Tables / view MDX source
form_block
Ordered blocks within a form.
Ordered blocks within a form.
Source
| Model | Leg | Role |
|---|---|---|
form_block | openEHR | defines this table |
A form is a sequence of blocks. Narrative blocks hold their text in content; every other block type is backed by an entry row that points at it, which is what the check constraint enforces — content is present exactly when block_type is text.
Entry tables reference (form_id, id) rather than id alone, so an entry cannot be attached to a block belonging to a different form.
Columns
| Column | Type | Null | Description | Source |
|---|---|---|---|---|
id | uuid primary key | no | Primary key. | — |
form_id | uuid | no | The form this block belongs to. | — |
position | integer | no | Order of the block within the form, from zero. | — |
block_type | text | no | What kind of block this is; text blocks hold narrative, the rest are backed by an entry. | — |
content | text | yes | Narrative text, present only for text blocks. | — |
content_metadata | json | yes | Free-form metadata for the block's renderer. | — |
Constraints
check ((block_type = 'text' and content is not null) or (block_type <> 'text' and content is null))Unique
form_id, positionform_id, id
References
| Columns | Target | On delete |
|---|---|---|
form_id | form | cascade |
Referenced by
155 tables reference form_block, via form_id, form_block_id. The first 15 alphabetically:
absenceviaform_id, form_block_idacvpuviaform_id, form_block_idadvance_care_directiveviaform_id, form_block_idadvance_intervention_decisionsviaform_id, form_block_idadverse_reaction_monitoringviaform_id, form_block_idadverse_reaction_riskviaform_id, form_block_idadverse_reaction_screeningviaform_id, form_block_idage_assertionviaform_id, form_block_idalcohol_consumption_summaryviaform_id, form_block_idapgarviaform_id, form_block_idart_cycle_summaryviaform_id, form_block_idasa_statusviaform_id, form_block_idberg_balance_scaleviaform_id, form_block_idblood_pressureviaform_id, form_block_idbody_mass_indexviaform_id, form_block_id
Definition
create table form_block (
id uuid primary key default uuid_generate_v4(),
form_id uuid not null references form (id) on delete cascade,
position integer not null check (position >= 0),
block_type text not null,
content text,
content_metadata json,
check (
(block_type = 'text' and content is not null)
or
(block_type <> 'text' and content is null)
),
unique (form_id, position),
unique (form_id, id)
);