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,
"ANA" INT,
"ANA Pattern" TEXT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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

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



INSERT INTO "Patient" VALUES ("1", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "No Thrombosis");
INSERT INTO "Patient" VALUES ("3", "Thrombosis");
INSERT INTO "Patient" VALUES ("4", "No Thrombosis");
INSERT INTO "Patient" VALUES ("5", "Thrombosis");
INSERT INTO "Patient" VALUES ("6", "No Thrombosis");
INSERT INTO "Patient" VALUES ("7", "Thrombosis");
INSERT INTO "Patient" VALUES ("8", "No Thrombosis");
INSERT INTO "Examination" VALUES ("1", "50", "P");
INSERT INTO "Examination" VALUES ("2", "40", "N");
INSERT INTO "Examination" VALUES ("3", "30", "P");
INSERT INTO "Examination" VALUES ("4", "45", "P");
INSERT INTO "Examination" VALUES ("5", "60", "N");
INSERT INTO "Examination" VALUES ("6", "55", "P");
INSERT INTO "Examination" VALUES ("7", "20", "P");
INSERT INTO "Examination" VALUES ("8", "38", "N");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "40", "20");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-11", "36", "18");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-12", "34", "22");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-13", "50", "25");
INSERT INTO "Laboratory" VALUES ("5", "2024-01-14", "37", "19");
INSERT INTO "Laboratory" VALUES ("6", "2024-01-15", "38", "21");
INSERT INTO "Laboratory" VALUES ("7", "2024-01-16", "33", "20");
INSERT INTO "Laboratory" VALUES ("8", "2024-01-17", "36", "23");