feat: Implement Analytics API for protocol statistics - #315
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #279
Analytics API Implementation
Overview
This PR implements the Analytics API (BE-002, BE-003, BE-004, BE-005, BE-011 dependencies), which provides the central interface for accessing protocol analytics across the TruthBounty ecosystem. It aggregates indexed blockchain events and backend metrics into efficient, queryable endpoints with Redis caching and standardized responses.
Technical Scope
GET /analytics/protocolfor system-wide metrics (total claims, active disputes, registered contributors, etc.).GET /analytics/contributorsto expose reputation growth, verification accuracy, and rewards earned.GET /analytics/claimsfor submission trends, verification rates, and durations.GET /analytics/governanceto track proposal statistics and participation rates.GET /analytics/rewardsto track distributed rewards and contributor earnings.GET /analytics/trendsto generate periodic analytics over configurable timeframes.RedisService) directly into theAnalyticsServicelayer to optimize expensive aggregation queries.AnalyticsResponseinterface, ensuring all analytical datasets return standard metadata, timestamps, and request identifiers.Testing & Verification
AnalyticsQueryDto).Related Issues
Closes [Issue Number]