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,
"WBC" FLOAT,
"RBC" FLOAT,
"HGB" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Examination" VALUES ("SLE");
INSERT INTO "Examination" VALUES ("Lupus");
INSERT INTO "Examination" VALUES ("Rheumatoid Arthritis");
INSERT INTO "Examination" VALUES ("Multiple Sclerosis");
INSERT INTO "Examination" VALUES ("Crohns Disease");
INSERT INTO "Patient" VALUES ("1", "SLE");
INSERT INTO "Patient" VALUES ("2", "Lupus");
INSERT INTO "Patient" VALUES ("3", "SLE");
INSERT INTO "Patient" VALUES ("4", "Rheumatoid Arthritis");
INSERT INTO "Patient" VALUES ("5", "SLE");
INSERT INTO "Patient" VALUES ("6", "Multiple Sclerosis");
INSERT INTO "Patient" VALUES ("7", "SLE");
INSERT INTO "Patient" VALUES ("8", "Crohns Disease");
INSERT INTO "Patient" VALUES ("9", "SLE");
INSERT INTO "Patient" VALUES ("10", "Lupus");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "7.2", "4.8", "14.5");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-01", "2.1", "4.5", "13.8");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-20", "8.5", "5.1", "15.2");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-25", "4.0", "4.2", "12.9");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-10", "9.5", "4.3", "13.1");
INSERT INTO "Laboratory" VALUES ("4", "2023-02-05", "6.8", "4.9", "14.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-02-10", "3.0", "4.0", "12.5");
INSERT INTO "Laboratory" VALUES ("5", "2023-03-01", "5.5", "4.1", "12.7");
INSERT INTO "Laboratory" VALUES ("6", "2023-02-15", "10.1", "5.0", "15.0");
INSERT INTO "Laboratory" VALUES ("7", "2023-02-20", "3.8", "4.6", "13.5");
INSERT INTO "Laboratory" VALUES ("8", "2023-02-25", "7.0", "4.7", "14.2");
INSERT INTO "Laboratory" VALUES ("9", "2023-03-05", "8.9", "4.4", "13.3");
INSERT INTO "Laboratory" VALUES ("10", "2023-03-15", "3.6", "4.9", "14.8");
INSERT INTO "Laboratory" VALUES ("10", "2023-04-01", "9.0", "5.0", "15.0");