--TODO: Document and migrate to setup drop table if exists "DiseaseBurden".trial_to_icd10; drop type if exists "DiseaseBurden".validation_type; create type "DiseaseBurden".validation_type as enum ('accepted', 'rejected', 'unmatched'); comment on type "DiseaseBurden".validation_type is 'This is used to record interactions with each type. It can be accepted (yes this should be used), rejected (no this doesn`t match), or unmatched (where non of the proposed options match)'; CREATE TABLE "DiseaseBurden".trial_to_icd10 ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY, nct_id varchar NOT NULL, "condition" varchar NOT NULL, ui varchar NULL, uri varchar NULL, rootsource varchar NULL, "name" varchar NULL, "source" varchar null, approved "DiseaseBurden".validation_type, approval_timestamp timestamp, CONSTRAINT trial_to_icd10_pk PRIMARY KEY (id) ); comment on type "DiseaseBurden".trial_to_icd10 is 'This represents potential links between trials and icd10 codes. Most of the links are both automatic and wrong.'; DROP TABLE if exists "DiseaseBurden".icd10_to_cause; CREATE TABLE "DiseaseBurden".icd10_to_cause ( id SERIAL NOT NULL , code varchar NOT NULL, cause_text varchar NOT NULL, CONSTRAINT icd10_to_cause_pk PRIMARY KEY (id) );