--- title: "form" description: "The clinical spine — every entry belongs to a form." --- The clinical spine — every entry belongs to a form. ## Source | Model | Leg | Role | |---|---|---| | `form` | openEHR | defines this table | An ENTRY-derived table (an observation, evaluation, instruction or action) is always recorded on a form, which carries the patient and encounter context for everything on it. Deleting a form cascades to every entry recorded against it. `patient_id` and `encounter_id` are plain `uuid` columns here and gain their foreign keys at the very end of the apply order, because `form` is created before the administrative tables exist. A build without an administrative Patient or Encounter leaves them unconstrained and says so in the compile report. ## Columns | Column | Type | Null | Description | Source | |---|---|---|---|---| | `id` | `uuid primary key` | no | Primary key. | — | | `template_id` | `text` | no | Identifier of the form template this was captured with. | — | | `patient_id` | `uuid` | yes | Patient the form was recorded for; foreign key added at the end of the apply order. | — | | `encounter_id` | `uuid` | yes | Encounter the form was recorded in; foreign key added at the end of the apply order. | — | | `name` | `text` | yes | Display name of the form. | — | | `created_at` | `timestamptz` | no | Row creation timestamp. | — | | `updated_at` | `timestamptz` | no | Row update timestamp; maintained by the application. | — | | `created_by` | `text` | no | Actor who created the row. | — | | `updated_by` | `text` | no | Actor who last updated the row. | — | ## Referenced by 156 tables reference `form`, via `form_id`. The first 15 alphabetically: - [`absence`](/docs/tables/absence) via `form_id` - [`acvpu`](/docs/tables/acvpu) via `form_id` - [`advance_care_directive`](/docs/tables/advance_care_directive) via `form_id` - [`advance_intervention_decisions`](/docs/tables/advance_intervention_decisions) via `form_id` - [`adverse_reaction_monitoring`](/docs/tables/adverse_reaction_monitoring) via `form_id` - [`adverse_reaction_risk`](/docs/tables/adverse_reaction_risk) via `form_id` - [`adverse_reaction_screening`](/docs/tables/adverse_reaction_screening) via `form_id` - [`age_assertion`](/docs/tables/age_assertion) via `form_id` - [`alcohol_consumption_summary`](/docs/tables/alcohol_consumption_summary) via `form_id` - [`apgar`](/docs/tables/apgar) via `form_id` - [`art_cycle_summary`](/docs/tables/art_cycle_summary) via `form_id` - [`asa_status`](/docs/tables/asa_status) via `form_id` - [`berg_balance_scale`](/docs/tables/berg_balance_scale) via `form_id` - [`blood_pressure`](/docs/tables/blood_pressure) via `form_id` - [`body_mass_index`](/docs/tables/body_mass_index) via `form_id` ## Definition ```sql create table form ( id uuid primary key default uuid_generate_v4(), template_id text not null, -- context links into the administrative layer; the foreign keys land in -- 900_foreign_keys.sql because form is created before the admin tables exist patient_id uuid, encounter_id uuid, name text, created_at timestamptz not null default current_timestamp, updated_at timestamptz not null default current_timestamp, created_by text not null, updated_by text not null ); ```