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 "Laboratory" (
"ID" INT,
"Date" DATE,
"WBC" FLOAT,
"RBC" FLOAT,
"HGB" FLOAT,
"HCT" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"Admission" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "-");
INSERT INTO "Patient" VALUES ("2", "-");
INSERT INTO "Patient" VALUES ("3", "ICU");
INSERT INTO "Patient" VALUES ("4", "-");
INSERT INTO "Patient" VALUES ("5", "ER");
INSERT INTO "Patient" VALUES ("6", "-");
INSERT INTO "Patient" VALUES ("7", "-");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "5.0", "3.4", "13.5", "40.0");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-10", "4.8", "3.6", "14.0", "41.0");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-15", "6.0", "6.1", "15.0", "45.0");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-20", "5.5", "4.0", "14.5", "42.0");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-25", "4.0", "6.0", "13.0", "39.0");
INSERT INTO "Laboratory" VALUES ("5", "2024-01-30", "5.2", "3.0", "12.5", "38.0");
INSERT INTO "Laboratory" VALUES ("6", "2024-02-05", "5.8", "6.5", "16.0", "46.0");
INSERT INTO "Laboratory" VALUES ("7", "2024-02-10", "4.5", "3.5", "13.8", "40.5");
INSERT INTO "Laboratory" VALUES ("7", "2024-03-10", "4.7", "3.7", "14.2", "41.5");