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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
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 ("30609", "Deep Vein Thrombosis");
INSERT INTO "Patient" VALUES ("10001", "Pulmonary Embolism");
INSERT INTO "Patient" VALUES ("20002", "Myocardial Infarction");
INSERT INTO "Patient" VALUES ("40004", "Stroke");
INSERT INTO "Patient" VALUES ("50005", "Peripheral Artery Disease");
INSERT INTO "Examination" VALUES ("30609", "2023-01-15", "Deep Vein Thrombosis", "Leg swelling, pain", "1");
INSERT INTO "Examination" VALUES ("30609", "2023-01-20", "Deep Vein Thrombosis", "Leg swelling, pain", "1");
INSERT INTO "Examination" VALUES ("10001", "2023-02-01", "Pulmonary Embolism", "Shortness of breath, chest pain", "1");
INSERT INTO "Examination" VALUES ("20002", "2023-03-10", "Myocardial Infarction", "Chest pain, arm pain", "0");
INSERT INTO "Examination" VALUES ("40004", "2023-04-05", "Stroke", "Weakness on one side, speech difficulty", "0");
INSERT INTO "Examination" VALUES ("50005", "2023-05-12", "Peripheral Artery Disease", "Leg pain on walking", "0");
INSERT INTO "Laboratory" VALUES ("30609", "2023-01-10");
INSERT INTO "Laboratory" VALUES ("30609", "2023-01-16");
INSERT INTO "Laboratory" VALUES ("30609", "2023-01-21");
INSERT INTO "Laboratory" VALUES ("10001", "2023-01-28");
INSERT INTO "Laboratory" VALUES ("20002", "2023-03-08");
INSERT INTO "Laboratory" VALUES ("40004", "2023-04-03");
INSERT INTO "Laboratory" VALUES ("50005", "2023-05-10");