📊 OptimAIze Progress Report";
echo "";
try {
$db = Database::getInstance();
// Get current status
$totalResult = $db->query("SELECT COUNT(*) as total FROM panel_directives");
$totalDirectives = $totalResult->fetch_assoc()['total'];
$checkedResult = $db->query("SELECT COUNT(*) as checked FROM panel_directives WHERE llm_checked = 1");
$checkedDirectives = $checkedResult->fetch_assoc()['checked'];
$uncheckedResult = $db->query("SELECT COUNT(*) as unchecked FROM panel_directives WHERE llm_checked = 0");
$uncheckedDirectives = $uncheckedResult->fetch_assoc()['unchecked'];
$impossibleResult = $db->query("SELECT COUNT(*) as impossible FROM panel_directives WHERE llm_checked = 1 AND is_impossible = 1");
$impossibleDirectives = $impossibleResult->fetch_assoc()['impossible'];
echo "
📈 Processing Progress
";
echo "✅ Total Combinations: " . number_format($totalDirectives) . "
";
echo "✅ Completed: " . number_format($checkedDirectives) . " (" . round(($checkedDirectives/$totalDirectives)*100, 1) . "%)
";
echo "⏳ Remaining: " . number_format($uncheckedDirectives) . " (" . round(($uncheckedDirectives/$totalDirectives)*100, 1) . "%)
";
echo "❌ Impossible Combinations Found: " . number_format($impossibleDirectives) . "
";
// Calculate progress made since last check
$previousCompleted = 2088; // From your earlier status
$newlyCompleted = $checkedDirectives - $previousCompleted;
if ($newlyCompleted > 0) {
echo "🎉 New Progress: " . number_format($newlyCompleted) . " combinations completed with your $10 credit!
";
}
// Cost estimation for remaining
$avgCostPerCombination = 0.0004; // Estimated cost per combination with gpt-4o-mini
$remainingCost = $uncheckedDirectives * $avgCostPerCombination;
echo "💰 Cost Analysis
";
echo "💸 Estimated cost to complete remaining: $" . number_format($remainingCost, 2) . "
";
if ($remainingCost <= 20) {
echo "✅ Recommendation: Add $" . ceil($remainingCost + 5) . " in credits to complete everything
";
} else {
echo "⚠️ Alternative: Consider processing in smaller chunks
";
}
// Recent processing activity
echo "📅 Recent Activity
";
$recentResult = $db->query("
SELECT DATE(updated_at) as date, COUNT(*) as count
FROM panel_directives
WHERE llm_checked = 1 AND updated_at >= DATE_SUB(NOW(), INTERVAL 3 DAYS)
GROUP BY DATE(updated_at)
ORDER BY date DESC
LIMIT 5
");
if ($recentResult && $recentResult->num_rows > 0) {
echo "Processing Activity (Last 3 Days):
";
while ($row = $recentResult->fetch_assoc()) {
echo "📅 {$row['date']}: {$row['count']} combinations processed
";
}
}
// Sample of impossible combinations found
echo "🔍 Sample Impossible Combinations Found
";
$sampleResult = $db->query("
SELECT attribute1_name, choice1, attribute2_name, choice2, llm_reasoning
FROM panel_directives
WHERE llm_checked = 1 AND is_impossible = 1
ORDER BY updated_at DESC
LIMIT 5
");
if ($sampleResult && $sampleResult->num_rows > 0) {
while ($row = $sampleResult->fetch_assoc()) {
echo "";
echo "❌ {$row['attribute1_name']}='{$row['choice1']}' + {$row['attribute2_name']}='{$row['choice2']}'
";
echo "Reason: " . htmlspecialchars($row['llm_reasoning']);
echo "
";
}
} else {
echo "No impossible combinations found yet (or none stored with reasoning)
";
}
} catch (Exception $e) {
echo "Error: " . htmlspecialchars($e->getMessage()) . "
";
}
echo "🚀 Next Steps
";
echo "";
echo "
To Continue Processing:
";
echo "
";
echo "- Add Credits: Go to OpenAI Billing
";
echo "- Add $20-30: This should be enough to complete all remaining combinations
";
echo "- Wait 10-15 minutes: For credits to become active
";
echo "- Restart Analysis: Go back to OptimAIze page and click 'Start Analysis'
";
echo "
";
echo "
";
echo "";
echo "
💡 Cost-Saving Tips:
";
echo "
";
echo "- Your system is working great! The processing was successful until credits ran out
";
echo "- gpt-4o-mini is very cost-effective - much cheaper than GPT-4
";
echo "- Caching is active - repeated combinations won't cost extra
";
echo "- Consider batch processing - add $10-20 at a time if budget is tight
";
echo "
";
echo "
";
?>