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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"LDH" INT,
"UN" INT,
"CRE" FLOAT,
"WBC" FLOAT,
"CRP" TEXT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "M");
INSERT INTO "Patient" VALUES ("2", "F");
INSERT INTO "Patient" VALUES ("3", "M");
INSERT INTO "Patient" VALUES ("4", "F");
INSERT INTO "Examination" VALUES ("1", "PSS", "1");
INSERT INTO "Examination" VALUES ("2", "Other", "0");
INSERT INTO "Examination" VALUES ("3", "PSS", "0");
INSERT INTO "Examination" VALUES ("4", "PSS", "1");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "123", "15", "1.0", "6.5", "2+");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-11", "130", "20", "0.9", "7.0", "1+");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-12", "123", "18", "1.1", "5.5", "3+");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-13", "120", "17", "1.0", "6.0", "2+");