Core Data Model ERD Mermaid

Version 1.1 by Robert Schaub on 2025/12/18 12:03

erDiagram
    USERS ||--o{ CLAIMS : creates
    CLAIMS ||--o{ EVIDENCE : has
    CLAIMS ||--o{ SCENARIO : has
    EVIDENCE }o--|| SOURCES : from
    USERS {
        uuid id PK
        text name
        text email
        text role "reader|contributor|moderator|admin"
        int contributions_count "cached"
        timestamp created_at
    }
    CLAIMS {
        uuid id PK
        uuid user_id FK
        text text
        decimal confidence "0-1"
        jsonb evidence_summary "cached: top 5 evidence"
        text_array source_names "cached: for display"
        int scenario_count "cached: count"
        timestamp cache_updated_at "cache freshness"
        timestamp created_at
        timestamp updated_at
    }
    EVIDENCE {
        uuid id PK
        uuid claim_id FK
        uuid source_id FK
        text content
        decimal relevance "0-1"
        text url
        timestamp created_at
    }
    SOURCES {
        uuid id PK
        text name
        text domain
        decimal track_record_score "0-1"
        int total_citations
        timestamp last_updated
        timestamp created_at
    }
    SCENARIO {
        uuid id PK
        uuid claim_id FK "belongs to claim"
        uuid extracted_from "references evidence_id that provided context"
        text description
        jsonb assumptions
        text verdict_summary "verdict for this scenario"
        decimal confidence "0-1"
        timestamp created_at
        timestamp updated_at
    }

Core Data Model ERD - Shows primary business entities and their relationships. Claims have Evidence (sources supporting/refuting) and Scenarios (different contexts for evaluation). Evidence comes from Sources (with track records). Scenarios belong to Claims (one-to-many via claim_id FK) and reference Evidence (extracted_from field notes which evidence provided the scenario context, but this is not an ownership relationship). Verdict is stored in scenario.verdict_summary field. Claims include denormalized cache fields for performance. Most entities created/edited by AKEL automatically. See Audit Trail ERD for edit tracking relationships.