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" (
"Examination Date" DATE,
"Diagnosis" TEXT,
"Thrombosis" INT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"U-PRO" TEXT,
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", "Hypertension");
INSERT INTO "Patient" VALUES ("2", "Diabetes");
INSERT INTO "Patient" VALUES ("3", "Chronic Kidney Disease");
INSERT INTO "Patient" VALUES ("4", "Lupus");
INSERT INTO "Patient" VALUES ("5", "Nephrotic Syndrome");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "15");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-10", "35");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-15", "10");
INSERT INTO "Laboratory" VALUES ("2", "2024-03-20", "5");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-12", "30");
INSERT INTO "Laboratory" VALUES ("3", "2024-02-12", "28");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-18", "45");
INSERT INTO "Laboratory" VALUES ("5", "2024-01-25", "29");
INSERT INTO "Laboratory" VALUES ("5", "2024-02-25", "31");
INSERT INTO "Examination" VALUES ("2024-01-10", "Hypertension", "0");
INSERT INTO "Examination" VALUES ("2024-02-10", "Hypertension", "1");
INSERT INTO "Examination" VALUES ("2024-01-15", "Diabetes", "0");
INSERT INTO "Examination" VALUES ("2024-03-20", "Diabetes", "0");
INSERT INTO "Examination" VALUES ("2024-01-12", "Chronic Kidney Disease", "1");
INSERT INTO "Examination" VALUES ("2024-02-12", "Chronic Kidney Disease", "1");
INSERT INTO "Examination" VALUES ("2024-01-18", "Lupus", "0");
INSERT INTO "Examination" VALUES ("2024-01-25", "Nephrotic Syndrome", "1");
INSERT INTO "Examination" VALUES ("2024-02-25", "Nephrotic Syndrome", "1");