Leaderboards ~ ERD - uchicago-cs/chigame GitHub Wiki

Entity-Relationship Diagram for Leaderboards

Entity-Relationship Diagram (Visual Diagram)

Note: This visual diagram was created in a Google Drawing.

Note: This is the ERD as of 5-6-25 : 10:15 PM

Entity-Relationship Diagram (Written)

Note: For the entities that are already existing, I am just writing down the new relationships that they will have with the new entities. I am not going to describe the already existing entities again.

Leaderboard

  • Attributes
    • ID - PK
    • Name - String
    • Description - String
  • Relationships
    • Leaderboard to Game (N:1) - ForeignKey for Game
    • Leaderboard to Leaderboard_Entry (1:N)
    • Leaderboard to Leaderboard_Privacy_Setting (1:N)

Leaderboard_Entry

  • Attributes
    • ID - PK
    • Rank - Integer
  • Relationships
    • Leaderboard_Entry to User (N:1) - ForeignKey for User
    • Leaderboard_Entry to Leaderboard (N:1) - ForeignKey for Leaderboard
    • Leaderboard_Entry to Metric_Score (1:N)

Metric

  • Attributes
    • ID - PK
    • Name - String
    • Unit - String
    • Description - String
  • Relationships
    • Metric to Game (N:1) - ForeignKey for Game
    • Metric to Metric_Score (1:N)

Metric_Score

  • Attributes
    • ID - PK
    • Score - Integer
  • Relationships
    • Metric_Score to Leaderboard_Entry (N:1) - ForeignKey for Leaderboard_Entry
    • Metric_Score to User (N:1) - ForeignKey for User
    • Metric_Score to Metric (N:1) - ForeignKey for Metric
    • Metric_Score to Match (N:1) - ForeignKey for Match

Region

  • Attributes
    • ID - PK
    • Continent - String
    • Country - String
    • Region - String
  • Relationships
    • Region to User (1:N)

Leaderboard_Privacy_Setting

  • Attributes
    • ID - PK
    • Complete_Opt_out - Boolean // completely opt out of the leaderboard
    • Display_As_Anonymous - Boolean // appear as anonymous on the leaderboard
  • Relationships
    • Leaderboard_Privacy_Setting to User (N:1) - ForeignKey for User
    • Leaderboard_Privacy_Setting to Leaderboard (N:1) - ForeignKey for Leaderboard - nullable
    • Leaderboard_Privacy_Setting to Game (N:1) - ForeignKey for Game - nullable

Game (Existing Entity)

  • Relationships
    • Game to Leaderboard (1:N)
    • Game to Metric (1:N)
    • Game to Leaderboard_Privacy_Setting (1:N)

User (Existing Entity)

  • Relationships
    • User to Leaderboard_Entry (1:N)
    • User to Metric_Score (1:N)
    • User to Leaderboard_Privacy_Setting (1:N)
    • User to Region (N:1) - ForeignKey for Region

Match (Existing Entity)

  • Relationships
    • Match to Metric_Score (1:N)