User Dashboard & Analytics
Relevant source files
The following files were used as context for generating this wiki page:
The User Dashboard & Analytics system serves as the central management hub for users to monitor their content verification activities within the TrueLens platform. It provides a comprehensive overview of scan history, real-time statistics on content authenticity, and deep-dive analytics into individual scan results.
The system is designed to consolidate data from various analysis modules—including URL, text, and document scans—into a unified interface. Users can track aggregate metrics such as average trust scores and the distribution of "Authentic" versus "Flagged" content. This module is critical for users to manage their verification workflows and for developers to monitor API usage and scan results across different signal types.
Sources: truelens-app/src/app/dashboard/page.tsx, truelens-app/src/app/page.tsx:254-266
Dashboard Architecture & Data Acquisition
The dashboard is implemented as a client-side React component that orchestrates data fetching from the TrueLens API backend. Upon mounting, the dashboard triggers a request to retrieve both historical scan records and computed aggregate statistics.
Data Flow for Analytics Retrieval
The following sequence diagram illustrates the process of populating the dashboard with user-specific analytics and scan history.
The dashboard retrieves a list of ScanType objects and a stats object containing summary metrics.
Sources: truelens-app/src/app/dashboard/page.tsx:21-39, truelens-app/src/lib/types.ts:21-35
Statistical Analytics & Metrics
The dashboard visualizes performance and authenticity metrics through a series of "Stat Cards." These cards provide immediate feedback on the health and nature of the content being scanned.
Key Metrics Tracked
| Metric | Source Field | Description |
|---|---|---|
| Total Scans | stats.totalScans | The cumulative number of analysis requests submitted by the user. |
| Avg Trust Score | stats.avgScore | The mean authenticity score across all successful scans. |
| Authentic | stats.authenticCount | Count of scans resulting in an "Authentic" verdict (Trust Score ≥ 70). |
| Flagged | stats.flaggedCount | Count of scans resulting in "Suspicious" or "AI-Generated" verdicts (Trust Score < 70). |
Sources: truelens-app/src/app/dashboard/page.tsx:41-65, truelens-app/src/lib/analysis.ts:254-258
Trust Score Logic
Trust scores are derived from an ensemble of signals. The dashboard uses utility functions to map these numerical scores to visual indicators:
- Authentic: High scores, typically rendered in green (
#10B981). - Suspicious: Mid-range scores, typically rendered in orange/warning colors (
#F59E0B). - AI-Generated/Flagged: Low scores, rendered in red (
#EF4444).
Sources: truelens-app/src/app/dashboard/page.tsx:41-65, truelens-app/src/lib/types.ts:29-30
Scan History & Detailed Results
The scan history provides a temporal view of analysis activities. Each entry in the history acts as a navigation point to a detailed results page.
History Entry Structure
Each scan record in the dashboard includes:
- Content Type Icon: Distinguishes between
urlanalysis (Globe icon) andtext/fileanalysis (File icon). - Preview Content: Shows the analyzed URL or a truncated snippet of the analyzed text.
- Metadata: Displays the creation date (formatted via
formatDate) and the number of signals processed. - Verdict Badge: A visual label summarizing the trust score category.
Sources: truelens-app/src/app/dashboard/page.tsx:120-155, truelens-app/src/app/results/[id]/page.tsx:88-115
Analytics Signal Breakdown
When a user navigates from the dashboard to a specific scan result (/results/[id]), the system provides a breakdown of individual signals used to calculate the final score.
API Performance Analytics
For developers, the analytics extend to API usage monitoring. The Developer Portal provides insights into the performance and availability of the analysis endpoints.
API Endpoint Metrics
Users can monitor the performance of different analysis pathways:
- Scan Duration: The time taken to process a request (measured in seconds).
- Confidence Scores: Each signal provides a confidence metric (0.0 to 1.0) indicating the reliability of that specific analysis.
- Quota Tracking: Monitoring usage against plan tiers (Free, Pro, Enterprise).
Sources: truelens-app/src/app/developers/page.tsx:13-58, truelens-app/src/app/results/[id]/page.tsx:114-116, truelens-app/src/lib/types.ts:18
User Plan Tiers and Limits
| Tier | Scan Limit | Analytics History | Signal Access |
|---|---|---|---|
| Free | 50 scans/month | 7-day history | Text + URL only |
| Pro | 5,000 scans/month | 1-year history | Full (Image + Document) |
| Enterprise | Unlimited | Custom | Dedicated Support |
Sources: truelens-app/src/app/developers/page.tsx:183-225
Document Verification Analytics
The dashboard also tracks document-specific verification tasks. Unlike standard content scans, document analytics focus on cryptographic integrity and tamper detection.
Document Status Tracking
Documents uploaded via the /documents interface follow a specific lifecycle tracked in the dashboard:
- Pending/Analyzing: The document is undergoing initial SHA-256 hashing and tamper detection.
- Verified: No manipulation detected; document is cryptographically signed.
- Flagged: Tampering detected (e.g., font inconsistency, pixel manipulation).
Sources: truelens-app/src/app/documents/page.tsx:69-79, truelens-app/src/lib/types.ts:43
Analysis Logic Snippet
// lib/analysis.ts:311-325
// Example logic for finding document anomalies
if (fileType === "application/pdf") {
if (fileSize > 5000000) {
findings.push({
type: "File Size",
severity: "medium",
message: "Large file size may indicate embedded high-resolution images",
});
}
}
Sources: truelens-app/src/lib/analysis.ts:311-325
Summary
The User Dashboard & Analytics module provides a centralized view of authenticity across the TrueLens platform. By combining high-level statistical summaries with granular signal-level breakdowns and document integrity tracking, it enables users to make informed decisions about the trustworthiness of digital content. The system bridges the gap between complex machine learning analysis and actionable human insights through structured visualization and historical data management.