Story Models Predictions API Database
Chapter V

Database Schema

The memory of a life โ€” 15 tables, every dimension captured

Every insight AURA produces is grounded in data that persists. SQLite with ACID compliance โ€” local-first, battle-tested, holding 184 health logs, 176 activity logs, and the complete architecture of a human life across 15 tables.

health_logs
184 rows ยท Primary data source

The heartbeat of AURA. Every daily entry feeds directly into all five AI models. This table is the foundation upon which every prediction is built.

CREATE TABLE health_logs (
  id               INTEGER  PRIMARY KEY AUTOINCREMENT,
  date             DATE     NOT NULL UNIQUE,
  mood             FLOAT    NOT NULL,  -- 1.0 โ€“ 10.0
  energy           FLOAT    NOT NULL,  -- 1.0 โ€“ 10.0
  stress           FLOAT    NOT NULL,  -- 1.0 โ€“ 10.0
  sleep_hours      FLOAT    NOT NULL,
  sleep_quality    FLOAT,             -- 1.0 โ€“ 10.0
  exercise_type    STRING,
  exercise_minutes FLOAT,
  water_intake_ml  FLOAT,
  notes            TEXT,
  created_at       TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX idx_health_logs_date ON health_logs(date);
activity_logs
176 rows ยท Real-time tracking

Captures the granular texture of daily life. The before/after energy measurements are what allow AURA to learn which activities genuinely energize you versus which ones drain you โ€” regardless of what you believe about them.

CREATE TABLE activity_logs (
  id               INTEGER   PRIMARY KEY AUTOINCREMENT,
  timestamp        DATETIME  NOT NULL,
  activity         STRING    NOT NULL,
  category         STRING    NOT NULL,  -- exercise|work|social|rest
  duration_minutes FLOAT     NOT NULL,
  energy_before    FLOAT     NOT NULL,  -- 1.0 โ€“ 10.0
  energy_after     FLOAT     NOT NULL,  -- 1.0 โ€“ 10.0
  mood             FLOAT     NOT NULL,
  notes            TEXT
);

CREATE INDEX idx_activity_logs_ts ON activity_logs(timestamp);
CREATE INDEX idx_activity_logs_cat ON activity_logs(category);
activity_templates
20 templates ยท Reusable definitions

Pre-defined activity types that users can select from, ensuring consistent categorization across logs and enabling accurate pattern recognition.

CREATE TABLE activity_templates (
  id          INTEGER PRIMARY KEY AUTOINCREMENT,
  name        STRING  NOT NULL,
  category    STRING  NOT NULL,
  description TEXT,
  icon        STRING
);
goals
AI-decomposed objectives

User-defined goals that AURA automatically decomposes into measurable milestones, tracking progress against AI-predicted trajectories.

CREATE TABLE goals (
  id             INTEGER   PRIMARY KEY AUTOINCREMENT,
  title          STRING    NOT NULL,
  target_metric  STRING    NOT NULL,
  target_value   FLOAT     NOT NULL,
  current_value  FLOAT,
  deadline       DATE,
  status         STRING    DEFAULT 'active',
  milestones     TEXT,      -- JSON array
  created_at     TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
notifications
AI-triggered alerts

Intelligent notifications generated by the AI models when patterns cross thresholds โ€” burnout warnings, recovery recommendations, performance window alerts.

CREATE TABLE notifications (
  id          INTEGER   PRIMARY KEY AUTOINCREMENT,
  type        STRING    NOT NULL,  -- burnout|recovery|performance|insight
  title       STRING    NOT NULL,
  message     TEXT      NOT NULL,
  severity    STRING    DEFAULT 'info',  -- info|warning|critical
  is_read     BOOLEAN   DEFAULT FALSE,
  created_at  TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Remaining Tables

habits
Daily habit tracking with streak calculation and completion rates
tasks
Task management linked to goals with priority and due dates
journal_entries
Free-form daily journal with mood tagging and sentiment analysis
goal_templates
6 AI-powered goal decomposition templates for common objectives
dropdown_options
39 dynamic dropdown values across 7 categories for consistent input
user_profile
User preferences, timezone, notification settings, and AI parameters
webhooks
Event webhook registrations for external integrations
schedule_confirmations
Scheduled activity confirmations with completion tracking
activity_instances
Individual instances of recurring activities with outcome data
routine_plans
AI-generated daily routine recommendations based on patterns