--- title: "valueset_code" description: "The codes a value set admits, with the display text that must accompany them." --- The codes a value set admits, with the display text that must accompany them. ## Source | Model | Leg | Role | |---|---|---| | `valueset_code` | openEHR | defines this table | A coded column group carries a four-column foreign key into this table on `(value_set_id, code, system, text)`. Including the text in the key is deliberate: the display string stored on the row has to be one the value set actually defines, so a row cannot claim `at1001` means "standing" when the value set says "Standing". ## Columns | Column | Type | Null | Description | Source | |---|---|---|---|---| | `value_set_id` | `text` | no | The value set this code belongs to. | — | | `code` | `text` | no | The code itself — an at-code for openEHR, a terminology code for FHIR. | — | | `system` | `text` | no | Code system the code is drawn from. | — | | `text` | `text` | no | Display text. Part of the key, so a stored row must use the text defined here. | — | | `description` | `text` | yes | — | — | | `numeric` | `numeric` | yes | Ordinal value, where the archetype defines one (scales and scores). | — | | `preferred` | `boolean` | no | Whether this is the preferred term for the code. | — | Primary key: `value_set_id, code, system, text` ## Unique - `value_set_id, code, system, text, numeric` ## References | Columns | Target | On delete | |---|---|---| | `value_set_id` | [`valueset`](/docs/tables/valueset) | cascade | ## Referenced by 868 tables reference `valueset_code`, via `reason_for_absence_valueset_id, reason_for_absence_code, reason_for_absence_system, reason_for_absence`. The first 15 alphabetically: - [`absence`](/docs/tables/absence) via `reason_for_absence_valueset_id, reason_for_absence_code, reason_for_absence_system, reason_for_absence` - [`acvpu`](/docs/tables/acvpu) via `acvpu_valueset_id, acvpu_code, acvpu_system, acvpu` - [`advance_care_directive`](/docs/tables/advance_care_directive) via `type_of_directive_valueset_id, type_of_directive_code, type_of_directive_system, type_of_directive` - [`advance_care_directive`](/docs/tables/advance_care_directive) via `status_valueset_id, status_code, status_system, status` - [`advance_care_directive`](/docs/tables/advance_care_directive) via `condition_valueset_id, condition_code, condition_system, condition` - [`advance_intervention_decisions`](/docs/tables/advance_intervention_decisions) via `intent_of_care_valueset_id, intent_of_care_code, intent_of_care_system, intent_of_care` - [`advance_intervention_decisions`](/docs/tables/advance_intervention_decisions) via `cpr_decision_valueset_id, cpr_decision_code, cpr_decision_system, cpr_decision` - [`advance_intervention_decisions_per_intervention`](/docs/tables/advance_intervention_decisions_per_intervention) via `intervention_valueset_id, intervention_code, intervention_system, intervention` - [`advance_intervention_decisions_per_intervention`](/docs/tables/advance_intervention_decisions_per_intervention) via `decision_valueset_id, decision_code, decision_system, decision` - [`adverse_reaction_event`](/docs/tables/adverse_reaction_event) via `specific_substance_valueset_id, specific_substance_code, specific_substance_system, specific_substance` - [`adverse_reaction_event`](/docs/tables/adverse_reaction_event) via `certainty_valueset_id, certainty_code, certainty_system, certainty` - [`adverse_reaction_event`](/docs/tables/adverse_reaction_event) via `manifestation_valueset_id, manifestation_code, manifestation_system, manifestation` - [`adverse_reaction_event`](/docs/tables/adverse_reaction_event) via `severity_of_reaction_valueset_id, severity_of_reaction_code, severity_of_reaction_system, severity_of_reaction` - [`adverse_reaction_event`](/docs/tables/adverse_reaction_event) via `route_of_exposure_valueset_id, route_of_exposure_code, route_of_exposure_system, route_of_exposure` - [`adverse_reaction_monitoring`](/docs/tables/adverse_reaction_monitoring) via `purpose_valueset_id, purpose_code, purpose_system, purpose` ## Definition ```sql create table valueset_code ( value_set_id text not null references valueset (id) on delete cascade, code text not null, system text not null, text text not null, description text, numeric numeric, preferred boolean not null default false, primary key (value_set_id, code, system, text), unique (value_set_id, code, system, text, numeric) ); ```