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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"ALB" FLOAT,
"HGB" FLOAT,
"PLT" INT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "F", "1980-05-10", "SLE");
INSERT INTO "Patient" VALUES ("2", "M", "1975-11-22", "SLE");
INSERT INTO "Patient" VALUES ("3", "F", "1990-03-15", "RA");
INSERT INTO "Patient" VALUES ("4", "F", "1988-07-01", "SLE");
INSERT INTO "Patient" VALUES ("5", "M", "1965-01-20", "Lupus");
INSERT INTO "Patient" VALUES ("6", "F", "1992-09-05", "SLE");
INSERT INTO "Patient" VALUES ("7", "F", "1970-04-18", "SLE");
INSERT INTO "Patient" VALUES ("8", "M", "1985-12-03", "RA");
INSERT INTO "Patient" VALUES ("9", "F", "1995-06-25", "SLE");
INSERT INTO "Patient" VALUES ("10", "F", "1983-02-14", "Fibromyalgia");
INSERT INTO "Examination" VALUES ("1", "SLE", "Joint pain, fatigue");
INSERT INTO "Examination" VALUES ("2", "SLE", "Rash, fever");
INSERT INTO "Examination" VALUES ("3", "RA", "Joint swelling");
INSERT INTO "Examination" VALUES ("4", "SLE", "Hair loss, photosensitivity");
INSERT INTO "Examination" VALUES ("5", "Lupus", "Kidney issues");
INSERT INTO "Examination" VALUES ("6", "SLE", "Chest pain");
INSERT INTO "Examination" VALUES ("7", "SLE", "Anemia");
INSERT INTO "Examination" VALUES ("8", "RA", "Morning stiffness");
INSERT INTO "Examination" VALUES ("9", "SLE", "Oral ulcers");
INSERT INTO "Examination" VALUES ("10", "Fibromyalgia", "Widespread pain");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "3.5", "12.0", "450");
INSERT INTO "Laboratory" VALUES ("1", "2023-03-15", "3.8", "11.5", "420");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-01", "4.0", "13.0", "380");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-20", "4.2", "14.0", "300");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-05", "3.2", "10.5", "500");
INSERT INTO "Laboratory" VALUES ("4", "2023-06-01", "3.0", "10.0", "480");
INSERT INTO "Laboratory" VALUES ("5", "2023-03-10", "3.9", "12.5", "350");
INSERT INTO "Laboratory" VALUES ("6", "2023-05-20", "3.7", "11.8", "410");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-12", "3.6", "11.0", "430");
INSERT INTO "Laboratory" VALUES ("7", "2023-09-01", "3.4", "10.8", "405");
INSERT INTO "Laboratory" VALUES ("9", "2023-08-01", "3.3", "10.2", "460");
INSERT INTO "Laboratory" VALUES ("10", "2023-06-15", "4.1", "13.5", "280");