aita_core.db — Database

SQLite database for interaction logs, student feedback, and feature requests. The database auto-initializes tables on first connection.

Connection

aita_core.db.get_conn()[source]

Interactions

aita_core.db.log_interaction(student_id, week, question, response, sources)[source]
aita_core.db.get_interactions(limit=100, offset=0, student_id=None)[source]
aita_core.db.count_interactions(student_id=None)[source]
aita_core.db.rate_interaction(interaction_id, rating)[source]

Feedback

aita_core.db.add_feedback(student_id, interaction_id, rating, comment)[source]
aita_core.db.get_feedback(limit=100)[source]

Feature Requests

aita_core.db.add_feature_request(student_id, title, description)[source]
aita_core.db.get_feature_requests(status=None, limit=100)[source]
aita_core.db.update_feature_request_status(request_id, status)[source]

Analytics

aita_core.db.get_interaction_stats()[source]

Database Schema

CREATE TABLE interactions (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    timestamp TEXT NOT NULL,
    student_id TEXT NOT NULL,
    week INTEGER NOT NULL,
    question TEXT NOT NULL,
    response TEXT NOT NULL,
    sources TEXT,
    rating INTEGER
);

CREATE TABLE feedback (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    timestamp TEXT NOT NULL,
    student_id TEXT NOT NULL,
    interaction_id INTEGER REFERENCES interactions(id),
    rating INTEGER,
    comment TEXT
);

CREATE TABLE feature_requests (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    timestamp TEXT NOT NULL,
    student_id TEXT NOT NULL,
    title TEXT NOT NULL,
    description TEXT,
    status TEXT DEFAULT 'open'
);