Skip to main content

Trust Score Algorithm (v2.0)

The Trust Score is Vartovii's employer reputation metric on a 0-100 scale. It is calculated through the canonical backend scoring seam in backend/services/scoring_engine.py using a source-weighted aggregation layer and a 6-factor scoring model.

Note: As of the latest update, the canonical Trust Score and its exact 6-factor breakdown are returned directly via the /api/stats endpoint.

Overview

The model combines review data from three sources:

  • Kununu (0.50 quality weight)
  • Google Reviews (0.30 quality weight)
  • Glassdoor (0.20 quality weight)

The final score is the sum of six capped factors:

Trust Score = rating_quality + sentiment + volume + source_diversity + consistency + recency

Max contribution per factor:

  • rating_quality: 25 points
  • sentiment: 25 points
  • volume: 15 points
  • source_diversity: 15 points
  • consistency: 10 points
  • recency: 10 points

Total max: 100 points.

Risk Classification Thresholds

For API and chat interpretation, Trust Score maps to risk levels using:

  • LOW: 80..100
  • MEDIUM: 60..79
  • HIGH: 40..59
  • CRITICAL: 0..39

Source-Weighted Aggregation

Before computing factor scores, the service builds weighted aggregates:

weighted_value = sum(value * source_weight * reviews_count) / sum(source_weight * reviews_count)

This is applied to:

  • avg_rating
  • avg_positive_pct

Result: higher-quality sources (for this use case) influence the combined rating more than raw volume alone.

The 6 Factors (Exact Runtime Logic)

1) Rating Quality (0..25)

rating_score = int((avg_rating / 5) * 25)

2) Sentiment (0..25)

avg_positive_pct is a percentage in 0..100.

sentiment_score = int(avg_positive_pct * 0.25)

3) Volume (0..15)

volume_score = int(min(total_reviews / 1000, 1) * 15)

4) Source Diversity (5, 10, 15)

if source_count >= 3:
source_score = 15
elif source_count >= 2:
source_score = 10
else:
source_score = 5

5) Consistency (0..10)

Uses weighted rating standard deviation (rating_stddev):

avg_stddev = sum(rating_stddev * reviews_count) / total_reviews
normalized_stddev = min(avg_stddev / 2.0, 1.0)
consistency_score = int((1 - normalized_stddev) * 10)

Lower volatility in ratings leads to higher consistency points.

6) Recency (0..10)

Primary tiering by count of recent reviews (total_recent):

if total_recent >= 50:
recency_score = 10
elif total_recent >= 20:
recency_score = 8
elif total_recent >= 5:
recency_score = 5
else:
recency_score = 3

Temporal decay penalty:

if (total_recent / total_reviews) < 0.05 and total_reviews > 100:
recency_score = max(0, recency_score - 2)

Confidence Signal

confidence_level and confidence_score are computed from source coverage and volume:

  • High: total_reviews >= 200 and source_count >= 2
    • confidence_score = min(100, 70 + source_count * 10)
  • Medium: total_reviews >= 50
    • confidence_score = min(80, 40 + int(total_reviews / 5))
  • Low: otherwise
    • confidence_score = min(40, int(total_reviews * 0.8))

API Endpoint

Use the details endpoint for transparent breakdown:

curl "https://sentryanalytic.com/api/corporate/trust-score-details/BMW"

Typical response shape:

{
"status": "success",
"version": "2.0",
"company_name": "BMW",
"trust_score": 72,
"score_breakdown": {
"rating_quality": 19,
"sentiment": 13,
"volume": 15,
"source_diversity": 10,
"consistency": 7,
"recency": 8
},
"confidence_level": "high",
"confidence_score": 90,
"source_weights": {
"kununu": 0.5,
"google": 0.3,
"glassdoor": 0.2
}
}

Operational Notes

  • If no sources are available, the service returns score 0 with zeroed breakdown and confidence_level = "low".
  • data_freshness and calculated_at are emitted for observability.
  • Sentiment values come from the review ingestion/sentiment pipeline and are consumed as structured fields during score calculation.

Runtime Contract (Updated 2026-03-09)

The canonical runtime helper in backend/services/scoring_engine.py::calculate_corporate_trust_score(...) returns a dictionary:

{
"score": 0,
"breakdown": {
"rating_quality": 0.0,
"sentiment": 0.0,
"volume": 0.0,
"source_diversity": 0.0,
"consistency": 0.0,
"recency": 0.0
}
}

Implementation alignment notes:

  • backend/services/scoring_engine.py is the source of truth for employer score math and backend risk mapping seams.
  • Consumers such as backend/api/agent_tools.py, backend/ai/services/chat_service.py, backend/ai/tools/corporate_tools.py, backend/ai/tools/db_utils.py, backend/api_services/analytics_service.py, and backend/routers/public_api.py consume the canonical {score, breakdown} structure instead of embedding local formulas.
  • Legacy hardcoded sentiment assumptions (for example fixed 60%) were removed in favor of real computed sentiment percentages from query results.
  • Hardcoded breakdown placeholders were removed in favor of formula-derived values at runtime.