Skip to content

feat: add pie chart visualization for top 5 crowdsourced slurs #785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025

Conversation

Mahimahto
Copy link
Collaborator

Overview

This PR adds a pie chart visualization to the dashboard that displays the top 5 most frequently reported crowdsourced slurs.

What’s Included

  • Seed Script for Testing
    Added dummy data using UserContribution.create_crowdsourced_slur_seed/1 in priv/repo/seeds.exs to test the chart effectively.

  • Top 5 Slurs Function
    Implemented get_top_5_slurs/0 in the UserContribution module. It:

    • Groups slurs by label
    • Counts their frequency
    • Sorts them in descending order
    • Returns the top 5 in %{label, count} format
  • Dashboard Integration

    • Called get_top_5_slurs/0 from DashboardController
    • Assigned the result to @pie_data
  • Frontend Integration

    • Embedded @pie_data in the dashboard.html.heex template using Jason.encode!
    • Rendered a pie chart using JavaScript (with either D3.js or native SVG)
    • Automatically draws the chart on DOMContentLoaded

Related Issue

Fixes #777

Sreenshot :-
Screenshot from 2025-05-29 15-12-55

@aatmanvaidya aatmanvaidya merged commit 13fe7a0 into tattle-made:main May 30, 2025
2 checks passed
@Mahimahto Mahimahto deleted the visualize-top-slurs branch May 30, 2025 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a pie chart of top 5 slurs contributed
2 participants