feat(db): lab_drafts, lab_draws, biomarkers tables
Refs PAI-91.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
import { integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
|
||||
export const settings = sqliteTable("settings", {
|
||||
key: text("key").primaryKey(),
|
||||
@@ -10,3 +10,37 @@ export const sessions = sqliteTable("sessions", {
|
||||
createdAt: integer("created_at").notNull(),
|
||||
expiresAt: integer("expires_at").notNull(),
|
||||
});
|
||||
|
||||
export const labDrafts = sqliteTable("lab_drafts", {
|
||||
id: text("id").primaryKey(),
|
||||
filename: text("filename").notNull(),
|
||||
filePath: text("file_path").notNull(),
|
||||
status: text("status").notNull(), // pending | confirmed | discarded
|
||||
extracted: text("extracted"),
|
||||
error: text("error"),
|
||||
createdAt: integer("created_at").notNull(),
|
||||
});
|
||||
|
||||
export const labDraws = sqliteTable("lab_draws", {
|
||||
id: text("id").primaryKey(),
|
||||
collectedAt: text("collected_at").notNull(), // ISO date YYYY-MM-DD
|
||||
labName: text("lab_name"),
|
||||
draftId: text("draft_id"),
|
||||
createdAt: integer("created_at").notNull(),
|
||||
});
|
||||
|
||||
export const biomarkers = sqliteTable("biomarkers", {
|
||||
id: integer("id").primaryKey({ autoIncrement: true }),
|
||||
drawId: text("draw_id").notNull(),
|
||||
panel: text("panel").notNull(),
|
||||
name: text("name").notNull(),
|
||||
marker: text("marker").notNull(),
|
||||
analyteKey: text("analyte_key"),
|
||||
value: text("value").notNull(),
|
||||
valueNum: real("value_num"),
|
||||
unit: text("unit"),
|
||||
referenceRange: text("reference_range"),
|
||||
flagged: integer("flagged").notNull().default(0),
|
||||
valueCanonical: real("value_canonical"),
|
||||
canonicalUnit: text("canonical_unit"),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user