Internal Service β This is not an HTTP endpoint. Itβs called by the analyze-visibility orchestrator.
Purpose
Calculates visibility scores from raw platform results. Converts boolean arrays into percentages and overall scores.
Functions
def calculate_platform_scores(summary: dict) -> dict[str, int]
Converts summary counts to percentage scores per platform:
{
"chatgpt": 75, # 75% of prompts visible
"claude": 50,
"gemini": 80,
# ...
}
calculate_overall_score
def calculate_overall_score(summary: dict, total_queries: int) -> tuple[int, int]
Returns (overall_score, total_visible):
- overall_score: 0-100, weighted average across platforms
- total_visible: Total number of (prompt, platform) pairs where visible
calculate_summary_stats
def calculate_summary_stats(results: list[dict]) -> dict
Aggregates results into counts per platform:
{
"chatgpt": {"visible": 15, "total": 20},
"claude": {"visible": 10, "total": 20},
# ...
}
overall_score = (total_visible / (total_queries * 8)) * 100
Where 8 is the number of AI platforms tracked.
Code Location
src/app/apis/cron/analyze_visibility/scoring.py