feat(backend): Build escrow analytics aggregation service#463
Merged
KuchiMercy merged 1 commit intoJun 30, 2026
Merged
Conversation
…es#424) Implements comprehensive admin analytics with caching across four endpoints: - GET /admin/analytics/summary — combined volume/activity/performance/user/dispute metrics (5 min cache) - GET /admin/analytics/volume — time-series with chart-friendly labels+values (15 min cache) - GET /admin/analytics/users — total/active(30d)/new(7/30/90d) metrics + weekly active 12w chart (5 min cache) - GET /admin/analytics/disputes — dispute rate, resolution rate, win rate, avg resolution time (5 min cache) Key additions: - VolumeMetrics: total, average, median escrow amounts - ActivityMetrics: counts per EscrowStatus (created/active/completed/disputed/cancelled/expired) - PerformanceMetrics: avg days to funding, completion, and dispute resolution - UserMetrics: total, active30d, new7d/30d/90d users - DisputeMetrics: dispute rate, resolution rate, win rate, outcome distribution - ChartData: { labels, values } format for all time-series responses - In-memory cache: 5 min TTL for summaries, 15 min TTL for time-series - Cache-Control response headers on all endpoints - Date range filtering support on volume endpoints Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@patopatrish Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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 #424
Summary
AnalyticsServicewith comprehensive metrics covering volume, activity, performance, users, and disputesGET /admin/analytics/{summary,volume,users,disputes}withCache-ControlheadersChartData({ labels, values }) for all time-series responses consumed by the frontend (F-20)Changes
analytics.service.tstotalVolume,averageAmount,medianAmountover completed escrowsjulianday()total,active30d,new7d,new30d,new90ddisputeRate,resolutionRate,winRate,avgResolutionTimeDays,outcomeDistributionChartDatafrom/toparams on volume time-seriesanalytics.controller.tsGET /admin/analytics/summarymax-age=300GET /admin/analytics/volumemax-age=900daily/weekly/monthly)GET /admin/analytics/usersmax-age=300GET /admin/analytics/disputesmax-age=300GET /admin/analytics/top-usersmax-age=300Test plan
GET /admin/analytics/summaryreturns all five metric groupsGET /admin/analytics/volume?period=dailyreturnsseries+charts.daily30d/daily90d/monthly12mwithlabelsandvaluesarraysGET /admin/analytics/usersreturnsmetricsandcharts.weeklyActive12wGET /admin/analytics/disputesreturnsdisputeRate,resolutionRate,winRate,avgResolutionTimeDaysCache-Controlheader is present on all responses?from=2026-01-01&to=2026-06-30) narrows volume results🤖 Generated with Claude Code