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,
"aCL IgM" FLOAT,
"Diagnosis" TEXT,
"Symptoms" TEXT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"IGA" INT,
"IGM" INT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "Lupus");
INSERT INTO "Patient" VALUES ("3", "Rheumatoid Arthritis");
INSERT INTO "Patient" VALUES ("4", "Thrombosis");
INSERT INTO "Patient" VALUES ("5", "Healthy");
INSERT INTO "Patient" VALUES ("6", "Thrombosis");
INSERT INTO "Patient" VALUES ("7", "Lupus");
INSERT INTO "Patient" VALUES ("8", "Healthy");
INSERT INTO "Patient" VALUES ("9", "Rheumatoid Arthritis");
INSERT INTO "Patient" VALUES ("10", "Thrombosis");
INSERT INTO "Examination" VALUES ("1", "50.5", "Thrombosis", "Blood clots");
INSERT INTO "Examination" VALUES ("2", "15.2", "Lupus", "Joint pain");
INSERT INTO "Examination" VALUES ("3", "80.1", "Rheumatoid Arthritis", "Swollen joints");
INSERT INTO "Examination" VALUES ("4", "60.0", "Thrombosis", "Leg swelling");
INSERT INTO "Examination" VALUES ("5", "10.0", "Healthy", "None");
INSERT INTO "Examination" VALUES ("6", "75.3", "Thrombosis", "Chest pain");
INSERT INTO "Examination" VALUES ("7", "20.0", "Lupus", "Fatigue");
INSERT INTO "Examination" VALUES ("8", "8.5", "Healthy", "None");
INSERT INTO "Examination" VALUES ("9", "90.0", "Rheumatoid Arthritis", "Stiffness");
INSERT INTO "Examination" VALUES ("10", "55.0", "Thrombosis", "Shortness of breath");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "150", "30");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-15", "160", "450");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-12", "200", "50");
INSERT INTO "Laboratory" VALUES ("2", "2023-03-01", "210", "35");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-05", "180", "400");
INSERT INTO "Laboratory" VALUES ("4", "2023-02-20", "170", "25");
INSERT INTO "Laboratory" VALUES ("4", "2023-03-10", "175", "420");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-25", "100", "100");
INSERT INTO "Laboratory" VALUES ("6", "2023-02-01", "190", "38");
INSERT INTO "Laboratory" VALUES ("6", "2023-03-05", "195", "410");
INSERT INTO "Laboratory" VALUES ("7", "2023-01-18", "220", "45");
INSERT INTO "Laboratory" VALUES ("7", "2023-02-28", "225", "30");
INSERT INTO "Laboratory" VALUES ("8", "2023-01-30", "110", "90");
INSERT INTO "Laboratory" VALUES ("9", "2023-02-10", "185", "405");
INSERT INTO "Laboratory" VALUES ("10", "2023-01-01", "165", "39");
INSERT INTO "Laboratory" VALUES ("10", "2023-02-07", "168", "430");