Skip to content

feat: Implement Analytics API for protocol statistics - #315

Merged
dDevAhmed merged 3 commits into
DigiNodes:mainfrom
martinshub-tech:feature/analytics-api
Jul 29, 2026
Merged

feat: Implement Analytics API for protocol statistics#315
dDevAhmed merged 3 commits into
DigiNodes:mainfrom
martinshub-tech:feature/analytics-api

Conversation

@martinshub-tech

Copy link
Copy Markdown
Contributor

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

  • Protocol Statistics: Added GET /analytics/protocol for system-wide metrics (total claims, active disputes, registered contributors, etc.).
  • Contributor Analytics: Added GET /analytics/contributors to expose reputation growth, verification accuracy, and rewards earned.
  • Claim Analytics: Added GET /analytics/claims for submission trends, verification rates, and durations.
  • Governance Analytics: Added GET /analytics/governance to track proposal statistics and participation rates.
  • Reward Analytics: Added GET /analytics/rewards to track distributed rewards and contributor earnings.
  • Trend Reporting: Added GET /analytics/trends to generate periodic analytics over configurable timeframes.
  • Caching & Performance: Integrated Redis caching (RedisService) directly into the AnalyticsService layer to optimize expensive aggregation queries.
  • API Standardization: Implemented the AnalyticsResponse interface, ensuring all analytical datasets return standard metadata, timestamps, and request identifiers.

Testing & Verification

  • Unit and integration endpoints are fully structured with appropriate DTO validations (AnalyticsQueryDto).
  • Search and filtering via query parameters are active for filtering by date ranges, contributors, categories, and governance cycles.
  • Validated performance enhancements with localized Redis storage mechanisms.

Related Issues

Closes [Issue Number]

@dDevAhmed
dDevAhmed merged commit 63a1d56 into DigiNodes:main Jul 29, 2026
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.

BE-012 — Implement Analytics API

2 participants