Card Sorting

erDiagram
    Projects {
        int ProjectID PK
        string Title
        text Description
        int CreatedBy FK
        string CardSortType
        datetime CreatedAt
        datetime UpdatedAt
    }
    
    Cards {
        int CardID PK
        int ProjectID FK
        string CardText
        text Notes
    }
    
    Categories {
        int CategoryID PK
        int ProjectID FK
        string CategoryName
        text Description
        int CreatedBy FK
    }
    
    Responses {
        int ResponseID PK
        int ProjectID FK
        int ParticipantID FK
        json CardsPlaced
        array UnsortedCards
        datetime Timestamp
    }
    
    Participants {
        int ParticipantID PK
        string FullName
        string Email
        json Demographics
        text Notes
    }
    
    Users {
        int UserID PK
        string FullName
        string Role
        string Email
        hashed Password
    }
    
    Projects ||--o{ Cards : "contains"
    Projects ||--o{ Categories : "has"
    Projects ||--o{ Responses : "records"
    Participants ||--o{ Responses : "provides"
    Users ||--o{ Projects : "creates"
    Categories ||--o{ Responses : "assigned to"
flowchart LR
    Start([Start: Researcher initiates card sort study])
    CreateProject([Researcher creates a new project])
    SelectType([Researcher selects card sort type: Open, Closed, or Hybrid])
    AddCards([Researcher adds cards to the study])
    DefineCategories([Define categories if Closed or Hybrid sort])
    SavePublish([Save and publish the study])
    InviteParticipants([Invite participants to join])
    ParticipantSort([Participants perform card sorting])
    ReviewResults([Researcher reviews sorting results])
    AnalyzeExport([Analyze and export results])
    End([End: Share insights with stakeholders])

    Start --> CreateProject --> SelectType --> AddCards
    AddCards --> DefineCategories --> SavePublish
    SavePublish --> InviteParticipants --> ParticipantSort
    ParticipantSort --> ReviewResults --> AnalyzeExport --> End

    %% Style adjustments
    style Start fill:#b3e5fc,stroke:#0288d1,stroke-width:2px
    style End fill:#b3e5fc,stroke:#0288d1,stroke-width:2px