Scan Upload & Results Visualization
Relevant source files
The following files were used as context for generating this wiki page:
The Scan Upload and Results Visualization system is the core user-facing workflow of the TrueLens platform. It enables users to submit digital content—either via a URL or direct text input—for automated authenticity analysis. The system orchestrates a multi-signal Machine Learning pipeline to evaluate content against AI generation, domain reputation, and stylistic patterns.
Once processing is complete, the system provides a comprehensive visualization of the findings. This includes a high-level "Trust Score," a categorical verdict (e.g., Authentic, AI-Generated), and a granular breakdown of the individual signals used to reach that conclusion. This transparency allows users to understand the specific evidence, such as vocabulary richness or domain age, that influenced the final assessment.
Content Submission Architecture
The submission process is handled by a tabbed interface that allows for two primary types of analysis: URL and Text. The interface performs client-side validation, ensuring URLs are well-formed and text inputs meet a minimum character threshold (50 characters) before initiating the backend request.
Data Flow and Request Handling
When a user submits content, the frontend sends a POST request to the Next.js API route, which acts as a proxy to the FastAPI backend. The backend then initializes a scan record and triggers an asynchronous ML pipeline.
Input Specifications
| Field | Type | Description | Validation |
|---|---|---|---|
url | string | The public URL of an article or webpage. | Must be a valid URL format. |
text | string | Raw text content to be analyzed. | Minimum 50 characters. |
contentType | string | Specifies the input mode: "url" or "text". | Required. |
Sources: truelens-app/src/app/scan/page.tsx:27-44, truelens-app/src/lib/types.ts:114-117
Multi-Signal Analysis Pipeline
The analysis logic resides in an ensemble engine that evaluates different "signals" to compute a probability of authenticity. Each signal contributes a score (0-100) and a confidence level.
Textual Signal Processing
The system extracts stylistic features (Stylometry) from text content, such as:
- Vocabulary Richness: Ratio of unique words to total words.
- Burstiness: Variation in paragraph and sentence lengths (human text typically exhibits higher variance).
- Punctuation Density: Frequency of punctuation marks relative to word count.
- Repetition Score: Detection of uniform word usage patterns often found in AI outputs.
Sources: truelens-app/src/lib/analysis.ts:11-73, truelens-backend/app/tasks/ml_pipeline.py:151-160
Domain and Metadata Analysis
For URL-based scans, the pipeline evaluates the hosting infrastructure:
- TLD Reputation: Suspicious TLDs (e.g.,
.xyz,.click) lower the score, while trusted ones (e.g.,.edu,.gov) increase it. - Protocol Security: Presence of HTTPS encryption.
- Subdomain Depth: Excessive nesting is flagged as a potential phishing or low-quality signal.
Sources: truelens-app/src/lib/analysis.ts:153-200, truelens-backend/app/tasks/ml_pipeline.py:175-180
Ensemble Scoring Weights
The final Trust Score is a weighted average of active signals, adjusted by their individual confidence levels.
| Signal Type | Weight | Focus Area |
|---|---|---|
text | 0.40 | Stylometry and AI generation detection. |
metadata | 0.25 | Domain age, TLD, and SSL status. |
image | 0.20 | Forensic analysis of visual assets. |
review | 0.10 | Behavioral patterns in e-commerce reviews. |
provenance | 0.05 | Historical presence via Google Cache or Wayback Machine. |
Sources: truelens-app/src/lib/analysis.ts:245-251, truelens-backend/app/tasks/ml_pipeline.py:42-49
Results Visualization
The Results Page (/results/[id]) provides a detailed breakdown of the analysis performed by the backend. It transitions from a global verdict to specific technical evidence.
Components of the Visualization
- Trust Score Gauge: A circular visualization displaying the 0-100 score, color-coded based on the verdict (Green for Authentic, Yellow for Suspicious, Red for AI-Generated).
- Scan Source Information: Displays the analyzed URL or a truncated version of the raw text, along with timestamps and analysis duration.
- Signal Cards: Individual modules for each analysis type (e.g., Text, Domain, Provenance) showing the signal-specific score, confidence, and specific "Evidence" highlights.
Data Models for Results
The visualization relies on the Scan and Signal interfaces to populate the UI.
// truelens-app/src/lib/types.ts
export interface Signal {
id: string;
type: "text" | "image" | "metadata" | "review" | "domain" | "provenance";
score: number;
label: string;
confidence: number;
evidence: Record<string, unknown>;
highlights?: string[];
}
export interface Scan {
id: string;
url?: string;
text?: string;
trustScore: number;
verdict: "Authentic" | "Suspicious" | "AI-Generated";
signals: Signal[];
scanDuration?: number;
}
Sources: truelens-app/src/lib/types.ts:11-39
Summary
The Scan Upload & Results Visualization system bridges the gap between complex ML analysis and end-user understanding. By decomposing content into multi-dimensional signals—ranging from sentence variance to domain TLD reputation—the system provides an explainable authenticity verdict. The architecture ensures that users can quickly transition from inputting a suspicious link to receiving a cryptographically-backed or stylistically-analyzed trust assessment.