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 Nephritis");
INSERT INTO "Patient" VALUES ("5", "Minimal Change Disease");
INSERT INTO "Patient" VALUES ("6", "Focal Segmental Glomerulosclerosis");
INSERT INTO "Patient" VALUES ("7", "IgA Nephropathy");
INSERT INTO "Patient" VALUES ("8", "Membranous Nephropathy");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "15");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-10", "35");
INSERT INTO "Laboratory" VALUES ("1", "2024-03-10", "28");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-15", "30");
INSERT INTO "Laboratory" VALUES ("2", "2024-02-15", "45");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-20", "10");
INSERT INTO "Laboratory" VALUES ("3", "2024-02-20", "12");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-25", "50");
INSERT INTO "Laboratory" VALUES ("4", "2024-02-25", "55");
INSERT INTO "Laboratory" VALUES ("5", "2024-01-30", "5");
INSERT INTO "Laboratory" VALUES ("5", "2024-02-28", "8");
INSERT INTO "Laboratory" VALUES ("6", "2024-03-01", "30");
INSERT INTO "Laboratory" VALUES ("6", "2024-04-01", "29");
INSERT INTO "Laboratory" VALUES ("7", "2024-03-05", "31");
INSERT INTO "Laboratory" VALUES ("7", "2024-04-05", "33");
INSERT INTO "Laboratory" VALUES ("8", "2024-03-10", "20");
INSERT INTO "Laboratory" VALUES ("8", "2024-04-10", "25");
INSERT INTO "Examination" VALUES ("2024-01-10", "Hypertension", "0");
INSERT INTO "Examination" VALUES ("2024-02-10", "Hypertension", "0");
INSERT INTO "Examination" VALUES ("2024-01-15", "Diabetes", "1");
INSERT INTO "Examination" VALUES ("2024-02-15", "Diabetes", "1");
INSERT INTO "Examination" VALUES ("2024-01-20", "Chronic Kidney Disease", "1");
INSERT INTO "Examination" VALUES ("2024-02-20", "Chronic Kidney Disease", "0");
INSERT INTO "Examination" VALUES ("2024-01-25", "Lupus Nephritis", "1");
INSERT INTO "Examination" VALUES ("2024-02-25", "Lupus Nephritis", "1");
INSERT INTO "Examination" VALUES ("2024-01-30", "Minimal Change Disease", "0");
INSERT INTO "Examination" VALUES ("2024-02-28", "Minimal Change Disease", "0");
INSERT INTO "Examination" VALUES ("2024-03-01", "Focal Segmental Glomerulosclerosis", "1");
INSERT INTO "Examination" VALUES ("2024-04-01", "Focal Segmental Glomerulosclerosis", "0");
INSERT INTO "Examination" VALUES ("2024-03-05", "IgA Nephropathy", "0");
INSERT INTO "Examination" VALUES ("2024-04-05", "IgA Nephropathy", "1");
INSERT INTO "Examination" VALUES ("2024-03-10", "Membranous Nephropathy", "0");
INSERT INTO "Examination" VALUES ("2024-04-10", "Membranous Nephropathy", "0");