G1 — Design System: 14 UI primitives (Button, Card, Modal, Sheet, Input, Textarea, Select, EmptyState, LoadingShimmer, ConfirmDialog, WashiTape, Badge, Avatar, Tabs), PageTransition with Framer Motion, sun/moon CSS vars, Caveat font, /dev/components visual showcase. G2 — Memories Pipeline: R2 presigned uploads, Sharp thumbnail generation, LiteLLM vision captions + pgvector embeddings, CSS masonry gallery with infinite scroll, private toggle, semantic search fallback to ILIKE. G3 — Medical: dose log + correction audit trail, IAP vaccine bulk import, emergency escalation page, pediatrician phone in settings. G4 — AI Brain: keyword guardrail → LLM classifier → structured DB tool-use (7 tools) → memory search → general parenting handler; ai_usage table; 22-case medical bypass safety test suite. DB migrations: 0011_memories, 0012_medical_doses, 0013_ai_usage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
1.1 KiB
SQL
28 lines
1.1 KiB
SQL
-- G3.2: Medication dose log
|
|
CREATE TABLE IF NOT EXISTS medication_doses (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
medicine_id UUID NOT NULL,
|
|
family_id UUID NOT NULL,
|
|
administered_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
administered_by UUID,
|
|
amount_given TEXT,
|
|
notes TEXT,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS medication_doses_medicine_idx ON medication_doses (medicine_id);
|
|
CREATE INDEX IF NOT EXISTS medication_doses_family_idx ON medication_doses (family_id);
|
|
|
|
-- G3.4: Log corrections (audit trail for edited doses)
|
|
CREATE TABLE IF NOT EXISTS log_corrections (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
family_id UUID NOT NULL,
|
|
dose_id UUID NOT NULL REFERENCES medication_doses(id) ON DELETE CASCADE,
|
|
original_value JSONB NOT NULL,
|
|
corrected_value JSONB NOT NULL,
|
|
reason TEXT,
|
|
corrected_by UUID,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS log_corrections_dose_idx ON log_corrections (dose_id);
|