Skip to main content

tuitbot_core/automation/analytics_loop/
reporter.rs

1//! Score computation and analytics summary types.
2
3/// Summary of an analytics iteration.
4#[derive(Debug, Default)]
5pub struct AnalyticsSummary {
6    pub follower_count: i64,
7    pub replies_measured: usize,
8    pub tweets_measured: usize,
9    pub forge_synced: bool,
10}
11
12/// Compute the performance score for content engagement.
13///
14/// Formula: `(likes * 3 + replies * 5 + retweets * 4) / max(impressions, 1) * 1000`
15pub fn compute_performance_score(likes: i64, replies: i64, retweets: i64, impressions: i64) -> f64 {
16    let numerator = (likes * 3 + replies * 5 + retweets * 4) as f64;
17    let denominator = impressions.max(1) as f64;
18    numerator / denominator * 1000.0
19}