-- ============================================ create table _enum_allergy_type ( id serial primary key, value varchar(32) unique not null ) ; create view vi18n_enum_allergy_type as select _enum_allergy_type.id, _(_enum_allergy_type.value) from _enum_allergy_type; -- -------------------------------------------- create table allergy ( id serial primary key, id_clin_transaction integer references clin_transaction(id), substance varchar(128) not null, generic varchar(256) default null, allergene varchar(256) default null, atc_code varchar(32) default null, description text default '', definate boolean default 0, type integer references _enum_allergy_type(id), last_observed varchar(32), had_hypo boolean default 0 ) inherits (audit_clinical); comment on table allergy is 'patient allergy details'; comment on column allergy.id_clin_transaction is 'link to transaction, provides: patient, recorded_when'; comment on column allergy.substance is 'real-world name of substance the patient reacted to, brand name if drug'; comment on column allergy.generic is 'if drug name of generic compound, brand names change/disappear, generic names do not'; comment on column allergy.allergene is 'name of allergenic ingredient in substance if known'; comment on column allergy.atc_code is 'ATC code of allergene or substance if approprate, applicable for penicilline, not so for cat fur'; comment on column allergy.description is 'free-text description of reaction such as "difficulty breathing, "skin rash", "diarrhea" etc.'; comment on column allergy.definate is 'true: definate, false: not definate'; comment on column allergy.type is 'allergy/sensitivity'; comment on column allergy.last_observed is 'when has this been observed for the last time'; comment on column allergy.had_hypo is 'true: has been treated with hyposensibilization, if true hypo data is recorded elsewhere';