Skip to content
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

Data dashboard GraphQL API #2077

Draft
wants to merge 16 commits into
base: develop
Choose a base branch
from
Draft

Conversation

caiosba
Copy link
Contributor

@caiosba caiosba commented Oct 10, 2024

Description

GraphQL API responsible for returning the workspace statistics for the data dashboard. Steps:

  • Implement GraphQL field under TeamType, which returns an object of a new GraphQL type TeamStatisticsType
  • Implement a library TeamStatistics, which is exposed in GraphQL by the type TeamStatisticsType, which implements one method for each data point
  • Implement the logic for each data point exposed in the GraphQL API:
    • number_of_articles_created_by_date
    • number_of_articles_updated_by_date
    • number_of_explainers_created
    • number_of_fact_checks_created
    • number_of_published_fact_checks
    • number_of_fact_checks_by_rating
    • top_articles_sent
    • top_articles_tags
    • number_of_messages
    • number_of_conversations
    • number_of_messages_by_date
    • number_of_conversations_by_date
    • number_of_search_results_by_type
    • average_response_time
    • number_of_unique_users
    • number_of_total_users
    • number_of_returning_users
    • number_of_subscribers
    • number_of_newsletters_sent
    • number_of_newsletters_delivered
    • top_media_tags
    • top_requested_media_clusters
    • number_of_media_received_by_type
    • number_of_articles_sent
    • number_of_matched_results
  • Make sure fields are computed in parallel
  • Check for permissions
  • Implement automated tests

References: CV2-5389, CV2-4111.

How has this been tested?

Automated tests implemented for all methods.

Checklist

  • I have performed a self-review of my own code
  • I have added unit and feature tests, if the PR implements a new feature or otherwise would benefit from additional testing
  • I have added regression tests, if the PR fixes a bug
  • I have added logging, exception reporting, and custom tracing with any additional information required for debugging
  • I considered secure coding practices when writing this code. Any security concerns are noted above.
  • I have commented my code in hard-to-understand areas, if any
  • I have made needed changes to the README
  • My changes generate no new warnings
  • If I added a third party module, I included a rationale for doing so and followed our current guidelines

lib/team_statistics.rb Fixed Show fixed Hide fixed
lib/team_statistics.rb Fixed Show fixed Hide fixed
lib/team_statistics.rb Fixed Show fixed Hide fixed
lib/team_statistics.rb Fixed Show fixed Hide fixed
@@ -0,0 +1,267 @@
class TeamStatistics
PERIODS = ['last_day', 'last_week', 'last_month', 'last_year']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've implemented the frontend period select but noticed the the ticket specifies these time windows:

  • Past Week
  • Past 2 Weeks
  • Past Month (this is the default set)
  • Past 3 Months
  • Past 6 Months
  • Year to Date

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.

2 participants