AI Studio
Routing Review
Execution Dashboard
SMS Live Control
declare(strict_types=1); require_once __DIR__ . '/../includes/db_master.php'; $pdo = db_master(); $providerId = isset($_GET['provider_id']) ? (int)$_GET['provider_id'] : 0; $routeFilter = isset($_GET['route']) ? trim((string)$_GET['route']) : ''; $queueStatusFilter = isset($_GET['queue_status']) ? trim((string)$_GET['queue_status']) : ''; $decisionBandFilter = isset($_GET['decision_band']) ? trim((string)$_GET['decision_band']) : ''; $limit = isset($_GET['limit']) ? max(10, min(500, (int)$_GET['limit'])) : 100; $where = []; $params = []; if ($providerId > 0) { $where[] = 'e.provider_id = :provider_id'; $params[':provider_id'] = $providerId; } if ($routeFilter !== '') { $where[] = 'e.route_recommendation = :route_recommendation'; $params[':route_recommendation'] = $routeFilter; } if ($queueStatusFilter !== '') { $where[] = 'e.queue_status = :queue_status'; $params[':queue_status'] = $queueStatusFilter; } if ($decisionBandFilter !== '') { $where[] = 'd.decision_band = :decision_band'; $params[':decision_band'] = $decisionBandFilter; } $whereSql = $where ? ('WHERE ' . implode(' AND ', $where)) : ''; $summarySql = " SELECT COUNT(*) AS total_rows, SUM(CASE WHEN e.queue_status = 'pending' THEN 1 ELSE 0 END) AS pending_rows, SUM(CASE WHEN e.queue_status = 'queued' THEN 1 ELSE 0 END) AS queued_rows, SUM(CASE WHEN e.queue_status = 'sent' THEN 1 ELSE 0 END) AS sent_rows, SUM(CASE WHEN e.queue_status = 'delivered' THEN 1 ELSE 0 END) AS delivered_rows, SUM(CASE WHEN e.queue_status = 'failed' THEN 1 ELSE 0 END) AS failed_rows, SUM(CASE WHEN e.route_recommendation = 'sms' THEN 1 ELSE 0 END) AS sms_rows, SUM(CASE WHEN e.route_recommendation = 'social' THEN 1 ELSE 0 END) AS social_rows FROM campaign_execution_log e LEFT JOIN decision_engine_outputs d ON d.id = e.decision_id {$whereSql} "; $summaryStmt = $pdo->prepare($summarySql); $summaryStmt->execute($params); $summary = $summaryStmt->fetch(PDO::FETCH_ASSOC) ?: [ 'total_rows' => 0, 'pending_rows' => 0, 'queued_rows' => 0, 'sent_rows' => 0, 'delivered_rows' => 0, 'failed_rows' => 0, 'sms_rows' => 0, 'social_rows' => 0, ]; $listSql = " SELECT e.id AS execution_log_id, e.decision_id, e.routing_log_id, e.provider_id, e.route_recommendation, e.queue_table, e.queue_id, e.queue_status, e.external_reference, e.recipient_mobile, e.message_text, e.created_at AS execution_created_at, r.action_taken, r.status AS routing_status, r.notes AS routing_notes, d.decision_type, d.decision_code, d.title, d.priority_level, d.decision_score, d.decision_band, d.recommendation_text FROM campaign_execution_log e LEFT JOIN decision_routing_log r ON r.id = e.routing_log_id LEFT JOIN decision_engine_outputs d ON d.id = e.decision_id {$whereSql} ORDER BY e.id DESC LIMIT " . (int)$limit; $listStmt = $pdo->prepare($listSql); $listStmt->execute($params); $rows = $listStmt->fetchAll(PDO::FETCH_ASSOC); function ehtml(string $value): string { return htmlspecialchars($value, ENT_QUOTES, 'UTF-8'); } function badgeClass(string $value): string { $value = strtolower($value); return match ($value) { 'delivered', 'sent', 'sms', 'high' => 'badge good', 'pending', 'queued', 'medium', 'review', 'social' => 'badge warn', 'failed', 'error' => 'badge bad', default => 'badge', }; } ?>
DCME Campaign Execution Dashboard
Campaign Execution Dashboard
Track routed decisions through queue and execution logging, including mobile, status, and message content.
Source tables:
decision_engine_outputs
+
decision_routing_log
+
campaign_execution_log
Total Executions
0
Pending
0
Queued
0
Sent
0
Delivered
0
Failed
0
SMS
0
Social
0
Provider ID
Route
All
SMS
Social
Review
Email
Queue Status
All
Pending
Queued
Sent
Delivered
Failed
Decision Band
All
High
Medium
Low
Limit
Apply
Reset
No execution log rows found for the current filters.