$i, 'name' => "Resident #$i", 'risk_score' => $risk_score, 'progress' => rand(-20, 20), 'domain_scores' => $domain_scores, 'last_check_in' => date('Y-m-d', time() - rand(0, 30) * 86400), 'has_critical_alert' => $risk_score > 85 ]; } // --- Aggregate Calculations --- $total_residents = count($residents); $high_risk_alerts = array_reduce($residents, function($carry, $res) { return $carry + ($res['risk_score'] > 75 ? 1 : 0); }, 0); $avg_progress = array_reduce($residents, function($carry, $res) { return $carry + $res['progress']; }, 0) / $total_residents; // Filter for search query $search_query = isset($_GET['search']) ? trim($_GET['search']) : ''; if ($search_query) { $residents = array_filter($residents, function($res) use ($search_query) { return stripos($res['name'], $search_query) !== false; }); } // Get residents with critical alerts for the dedicated section $alert_residents = array_filter($residents, function($res) { return $res['has_critical_alert']; }); ?>
Total Residents
High-Risk Alerts
Avg. Progress Change
| Name | Risk Score | Progress | Last Check-In | |
|---|---|---|---|---|
| No residents found. | ||||
| % | % | View | ||