 DROP TABLE IF EXISTS mimic_ed.diagnosis CASCADE;
 CREATE TABLE mimic_ed.diagnosis
 (
-  subject_id INT NOT NULL,
-  stay_id INT NOT NULL,
-  seq_num INT NOT NULL,
-  icd_code VARCHAR(10) NOT NULL,
-  icd_version INT NOT NULL,
-  icd_title VARCHAR(255) NOT NULL
+  subject_id INTEGER NOT NULL,
+  stay_id INTEGER NOT NULL,
+  seq_num INTEGER NOT NULL,
+  icd_code VARCHAR(8) NOT NULL,
+  icd_version SMALLINT NOT NULL,
+  icd_title TEXT NOT NULL
 ) ;
 
 --------------------------------------------------------

DROP TABLE IF EXISTS mimic_ed.medrecon CASCADE;
CREATE TABLE mimic_ed.medrecon
(
  subject_id INT NOT NULL,
  stay_id INT NOT NULL,
  charttime TIMESTAMP(0) NOT NULL,
  name VARCHAR(255) NOT NULL,
  gsn VARCHAR(11) NOT NULL,
  ndc VARCHAR(12) NOT NULL,
  etc_rn INT NOT NULL,
  etccode VARCHAR(8),
  etcdescription VARCHAR(255)
) ;

DROP TABLE IF EXISTS mimic_ed.vitalsign CASCADE;
CREATE TABLE mimic_ed.vitalsign
(
  subject_id INTEGER NOT NULL,
  stay_id INTEGER NOT NULL,
  charttime TIMESTAMP(0),
  temperature NUMERIC,
  heartrate NUMERIC,
  resprate NUMERIC(10, 4),
  o2sat NUMERIC,
  sbp INTEGER,
  dbp INTEGER,
  rhythm TEXT,
  pain TEXT
);
