PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "Examination" (
"Diagnosis" TEXT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"RBC" FLOAT,
"HGB" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"Admission" TEXT,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Examination" VALUES ("Thrombosis");
INSERT INTO "Examination" VALUES ("Anemia");
INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("Infection");
INSERT INTO "Examination" VALUES ("Diabetes");
INSERT INTO "Patient" VALUES ("1", "-", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "Inpatient", "Anemia");
INSERT INTO "Patient" VALUES ("3", "-", "Normal");
INSERT INTO "Patient" VALUES ("4", "-", "Infection");
INSERT INTO "Patient" VALUES ("5", "Inpatient", "Thrombosis");
INSERT INTO "Patient" VALUES ("6", "-", "Anemia");
INSERT INTO "Patient" VALUES ("7", "-", "Normal");
INSERT INTO "Patient" VALUES ("8", "Inpatient", "Diabetes");
INSERT INTO "Patient" VALUES ("9", "-", "Thrombosis");
INSERT INTO "Patient" VALUES ("10", "-", "Anemia");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "3.2", "11.5");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-01", "6.1", "17.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-20", "4.5", "14.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-25", "3.0", "10.0");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-28", "6.5", "18.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-02-05", "4.0", "13.0");
INSERT INTO "Laboratory" VALUES ("6", "2023-02-10", "3.4", "11.0");
INSERT INTO "Laboratory" VALUES ("7", "2023-02-12", "5.0", "15.0");
INSERT INTO "Laboratory" VALUES ("8", "2023-02-15", "6.2", "17.5");
INSERT INTO "Laboratory" VALUES ("9", "2023-02-18", "3.1", "10.5");
INSERT INTO "Laboratory" VALUES ("10", "2023-02-20", "5.8", "16.0");
INSERT INTO "Laboratory" VALUES ("1", "2023-03-01", "4.8", "14.5");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-05", "5.5", "15.5");
INSERT INTO "Laboratory" VALUES ("4", "2023-03-10", "3.3", "10.8");
INSERT INTO "Laboratory" VALUES ("6", "2023-03-15", "6.0", "16.8");