olivas/backend/app/schemas/analysis.py
DJP c1b80eb9a7 Replace entropy score with composite Design Effectiveness Score
The pure Shannon entropy score penalized well-designed ads with multiple
intentional visual elements (e.g. hero product + text + logo scored ~8/100).

New composite score (0-100) weights four components:
- Peak Dominance (30%): strength of #1 hotspot vs rest
- Hierarchy Clarity (25%): monotonic intensity ordering
- Gaze Coherence (25%): smooth spatial gaze path
- Entropy Concentration (20%): sqrt-softened entropy

The raw entropy score is preserved as entropy_score for users who want it,
visible in the ScoreCard hover tooltip and PDF report.

Also adds auto-create DB tables on startup for fresh Docker deploys.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 22:50:12 -05:00

55 lines
1.1 KiB
Python

from datetime import datetime
from pydantic import BaseModel
class AnalysisSummary(BaseModel):
id: str
name: str
model_used: str
status: str
original_filename: str
image_width: int
image_height: int
overall_score: float | None = None
entropy_score: float | None = None
created_at: datetime
model_config = {"from_attributes": True}
class GazePoint(BaseModel):
rank: int
x: int
y: int
x_pct: float
y_pct: float
probability: float
class Insight(BaseModel):
type: str # "info" | "success" | "warning"
title: str
description: str
class AnalysisDetail(AnalysisSummary):
file_format: str
gaze_sequence: list[GazePoint] | None = None
hotspots: list[dict] | None = None
insights: list[Insight] | None = None
ai_insights: list[Insight] | None = None
ai_score: int | None = None
ai_score_reason: str | None = None
ai_cost_usd: float | None = None
aoi_count: int = 0
class AnalysisCreate(BaseModel):
name: str | None = None
model: str = "deepgaze_iie"
class AnalysisStatus(BaseModel):
id: str
status: str