Skip to content

Database Schema

erDiagram
    USERS ||--o{ INTERACTIONS : has
    USERS ||--o{ USER_EMBEDDINGS : has
    CONTENT ||--o{ CONTENT_EMBEDDINGS : has
    CONTENT ||--o{ INTERACTIONS : receives

    USERS {
        uuid id PK
        string username
        jsonb preferences
        timestamp created_at
    }

    INTERACTIONS {
        uuid id PK
        uuid user_id FK
        uuid content_id FK
        string action
        int duration_seconds
        jsonb context
        timestamp created_at
    }

    USER_EMBEDDINGS {
        uuid id PK
        uuid user_id FK
        vector embedding
        timestamp updated_at
    }

    CONTENT {
        uuid id PK
        string type
        string title
        jsonb metadata
        float quality_score
        timestamp created_at
    }

    CONTENT_EMBEDDINGS {
        uuid id PK
        uuid content_id FK
        vector embedding
        timestamp created_at
    }

    THOMPSON_SAMPLING {
        uuid id PK
        uuid content_id FK
        uuid user_id FK
        float alpha
        float beta
        timestamp updated_at
    }

Qdrant Collections

content_embeddings

  • Dimensions: 384 (Sentence-BERT)
  • Distance: Cosine
  • Payload: content_id, type, quality_score, region

user_embeddings

  • Dimensions: 128 (Foundation model output)
  • Distance: Cosine
  • Payload: user_id, interaction_count, last_updated