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" (
"Thrombosis" INT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"WBC" FLOAT,
"HGB" FLOAT,
"PLT" 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", "MCTD");
INSERT INTO "Patient" VALUES ("2", "MCTD");
INSERT INTO "Patient" VALUES ("3", "Lupus");
INSERT INTO "Patient" VALUES ("4", "MCTD");
INSERT INTO "Patient" VALUES ("5", "Rheumatoid Arthritis");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "6.5", "13.2", "150");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-15", "7.0", "12.8", "98");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-12", "5.8", "14.0", "399");
INSERT INTO "Laboratory" VALUES ("2", "2024-03-20", "6.1", "13.5", "401");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-05", "6.0", "13.0", "250");
INSERT INTO "Laboratory" VALUES ("4", "2024-02-01", "7.2", "12.5", "100");
INSERT INTO "Laboratory" VALUES ("4", "2024-02-28", "6.9", "12.9", "399");
INSERT INTO "Laboratory" VALUES ("5", "2024-01-15", "5.5", "13.8", "350");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");