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" (
"ID" INT,
"Examination Date" DATE,
"Diagnosis" TEXT,
"Symptoms" TEXT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"IGG" INT,
PRIMARY KEY ("ID", "Date")
);

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



INSERT INTO "Patient" VALUES ("1", "SLE");
INSERT INTO "Patient" VALUES ("2", "SLE");
INSERT INTO "Patient" VALUES ("3", "SLE");
INSERT INTO "Patient" VALUES ("4", "Thrombosis");
INSERT INTO "Patient" VALUES ("5", "SLE");
INSERT INTO "Patient" VALUES ("6", "Healthy");
INSERT INTO "Examination" VALUES ("1", "2024-01-10", "SLE", "Fatigue");
INSERT INTO "Examination" VALUES ("1", "2024-02-15", "SLE", "Joint pain");
INSERT INTO "Examination" VALUES ("2", "2024-01-20", "SLE", "Fatigue");
INSERT INTO "Examination" VALUES ("2", "2024-03-10", "SLE", "Rash");
INSERT INTO "Examination" VALUES ("3", "2024-02-05", "SLE", "Fatigue");
INSERT INTO "Examination" VALUES ("3", "2024-04-01", "SLE", "Fever");
INSERT INTO "Examination" VALUES ("4", "2024-01-15", "Thrombosis", "Swelling");
INSERT INTO "Examination" VALUES ("5", "2024-03-20", "SLE", "Fatigue");
INSERT INTO "Examination" VALUES ("5", "2024-04-15", "SLE", "Headache");
INSERT INTO "Examination" VALUES ("6", "2024-02-25", "Healthy", "None");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "150");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-15", "160");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-20", "140");
INSERT INTO "Laboratory" VALUES ("2", "2024-03-10", "155");
INSERT INTO "Laboratory" VALUES ("3", "2024-02-05", "130");
INSERT INTO "Laboratory" VALUES ("3", "2024-04-01", "135");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-15", "120");
INSERT INTO "Laboratory" VALUES ("5", "2024-03-20", "145");
INSERT INTO "Laboratory" VALUES ("5", "2024-04-15", "150");
INSERT INTO "Laboratory" VALUES ("6", "2024-02-25", "100");