@* Views/Admin/SurveyAnalysis/Dashboard.cshtml *@ @model Services.AIViewModel.QuestionnaireAnalysisOverview @{ ViewData["Title"] = $"Executive Dashboard - {Model.QuestionnaireTitle}"; }

Executive Mental Health Dashboard

Strategic overview of workplace mental health metrics

@Model.TotalResponses

Total Participants

@Model.AnalyzedResponses AI Analyzed

@GetOverallHealthScore()%

Mental Health Score

@GetOverallHealthStatus()

@(Model.HighRiskResponses + Model.CriticalRiskResponses)

High Risk Cases

@if (Model.CriticalRiskResponses > 0) { @Model.CriticalRiskResponses Critical } else if (Model.HighRiskResponses > 0) { Immediate Attention } else { No Critical Cases }

@Math.Round(Model.OverallPositiveSentiment * 100, 0)%

Positive Sentiment

Employee Satisfaction
Mental Health Risk Distribution

@Model.LowRiskResponses

Low Risk

@Model.ModerateRiskResponses

Moderate

@Model.HighRiskResponses

High Risk

@Model.CriticalRiskResponses

Critical
Sentiment Overview
Positive @Math.Round(Model.OverallPositiveSentiment * 100, 1)%
Neutral @Math.Round(Model.OverallNeutralSentiment * 100, 1)%
Negative @Math.Round(Model.OverallNegativeSentiment * 100, 1)%
Strategic Workplace Interventions
@if (Model.TopWorkplaceIssues?.Any() == true) { @foreach (var issue in Model.TopWorkplaceIssues.Take(4)) {
@issue.Category

@issue.Issue

Action: @issue.RecommendedIntervention

Priority @issue.Priority
@issue.IdentifiedAt.ToString("MMM dd")
} } else {
No Major Issues Identified

The AI analysis indicates a generally healthy workplace mental health environment.

}
Key Metrics
Mental Health Score @GetOverallHealthScore()%
Response Rate @Math.Round((double)Model.AnalyzedResponses / Model.TotalResponses * 100, 1)%
Cases Requiring Attention @(Model.HighRiskResponses + Model.CriticalRiskResponses)
Last Analysis @Model.LastAnalyzedAt.ToString("MMM dd, HH:mm")
@if (!string.IsNullOrEmpty(Model.ExecutiveSummary)) {
Executive Summary for Leadership
C-Level Summary
@Html.Raw(Model.ExecutiveSummary.Replace("\n", "
"))
}
Immediate Action Items
@if (Model.CriticalRiskResponses > 0 || Model.HighRiskResponses > 0) {
URGENT: Mental Health Interventions Required

@(Model.CriticalRiskResponses + Model.HighRiskResponses) employees require immediate professional attention.

Review High Risk Cases
} @if (Model.TopWorkplaceIssues?.Any() == true) { @foreach (var issue in Model.TopWorkplaceIssues.Where(i => i.Priority >= 4).Take(3)) {
@issue.Category

@issue.RecommendedIntervention

Priority @issue.Priority
} } @if (Model.CriticalRiskResponses == 0 && Model.HighRiskResponses == 0 && !Model.TopWorkplaceIssues.Any(i => i.Priority >= 4)) {
No Immediate Actions Required

Mental health status is stable with no urgent interventions needed.

}
Strategic Recommendations
@{ var strategicActions = GetStrategicRecommendations(); } @foreach (var action in strategicActions) {
@action.Title
@action.Timeline

@action.Description

}
@if (Model.MostCommonKeyPhrases?.Any() == true) {
Most Common Employee Concerns
@foreach (var phrase in Model.MostCommonKeyPhrases.Take(12)) { @phrase }
}
Dashboard Summary: Analysis of @Model.TotalResponses employee responses shows @GetOverallHealthStatus().ToLower() workplace mental health with @(Model.HighRiskResponses + Model.CriticalRiskResponses) cases requiring attention.
@functions { private string GetOverallHealthCardClass() { var score = GetOverallHealthScore(); if (score >= 75) return "bg-gradient-success"; if (score >= 50) return "bg-gradient-warning"; return "bg-gradient-danger"; } private string GetOverallHealthIcon() { var score = GetOverallHealthScore(); if (score >= 75) return "fa-heart"; if (score >= 50) return "fa-heartbeat"; return "fa-heart-broken"; } private string GetOverallHealthTextClass() { var score = GetOverallHealthScore(); if (score >= 75) return "text-success"; if (score >= 50) return "text-warning"; return "text-danger"; } private string GetOverallHealthProgressClass() { var score = GetOverallHealthScore(); if (score >= 75) return "bg-success"; if (score >= 50) return "bg-warning"; return "bg-danger"; } private int GetOverallHealthScore() { // Calculate overall health score based on positive sentiment and low risk var sentimentScore = Model.OverallPositiveSentiment * 100; var riskPenalty = (Model.HighRiskResponses + Model.CriticalRiskResponses * 2) * 10; return Math.Max(0, (int)(sentimentScore - riskPenalty)); } private string GetOverallHealthStatus() { var score = GetOverallHealthScore(); if (score >= 75) return "Excellent"; if (score >= 50) return "Good"; if (score >= 25) return "Concerning"; return "Critical"; } private string GetIssueBackgroundClass(int priority) { switch (priority) { case 5: return "bg-danger bg-opacity-10"; case 4: return "bg-warning bg-opacity-10"; default: return "bg-primary bg-opacity-10"; } } private string GetPriorityBadgeClass(int priority) { switch (priority) { case 5: return "bg-danger"; case 4: return "bg-warning text-dark"; case 3: return "bg-primary"; case 2: return "bg-info"; default: return "bg-secondary"; } } private double GetTagSize(string phrase) { // Vary tag size based on importance (simple implementation) return phrase.Length > 10 ? 1.1 : 0.9; } private List GetStrategicRecommendations() { var recommendations = new List(); if (Model.HighRiskResponses + Model.CriticalRiskResponses > 0) { recommendations.Add(new { Title = "Immediate Mental Health Support", Description = "Deploy emergency mental health resources and professional counseling", Timeline = "24-48 Hours", BadgeClass = "bg-danger" }); } if (Model.OverallNegativeSentiment > 0.4) { recommendations.Add(new { Title = "Workplace Culture Assessment", Description = "Conduct comprehensive review of workplace environment and management practices", Timeline = "2-4 Weeks", BadgeClass = "bg-warning text-dark" }); } recommendations.Add(new { Title = "Preventive Mental Health Program", Description = "Implement ongoing mental health awareness and stress management programs", Timeline = "1-3 Months", BadgeClass = "bg-info" }); recommendations.Add(new { Title = "Regular Mental Health Monitoring", Description = "Establish quarterly mental health assessments and trend monitoring", Timeline = "Ongoing", BadgeClass = "bg-success" }); return recommendations; } } @section Scripts { } @section Styles { }