// Services/AIViewModel/AIAnalysisViewModels.cs namespace Services.AIViewModel { /// /// Risk severity levels for mental health assessment. /// public enum RiskLevel { Low = 1, Moderate = 2, High = 3, Critical = 4 } /// /// Sentiment analysis output with confidence breakdown. /// public class SentimentAnalysisResult { public string Sentiment { get; set; } = string.Empty; public double ConfidenceScore { get; set; } public double PositiveScore { get; set; } public double NegativeScore { get; set; } public double NeutralScore { get; set; } public DateTime AnalyzedAt { get; set; } = DateTime.UtcNow; } /// /// Key phrases extracted with workplace and emotional categorization. /// public class KeyPhrasesResult { public List KeyPhrases { get; set; } = new(); public List WorkplaceFactors { get; set; } = new(); public List EmotionalIndicators { get; set; } = new(); public DateTime ExtractedAt { get; set; } = DateTime.UtcNow; } /// /// Mental health risk assessment with indicators and recommendations. /// public class MentalHealthRiskAssessment { public RiskLevel RiskLevel { get; set; } public double RiskScore { get; set; } public List RiskIndicators { get; set; } = new(); public List ProtectiveFactors { get; set; } = new(); public bool RequiresImmediateAttention { get; set; } public string RecommendedAction { get; set; } = string.Empty; public DateTime AssessedAt { get; set; } = DateTime.UtcNow; } /// /// Workplace insight with categorized issue and intervention recommendation. /// public class WorkplaceInsight { public string Category { get; set; } = string.Empty; public string Issue { get; set; } = string.Empty; public string RecommendedIntervention { get; set; } = string.Empty; public int Priority { get; set; } public List AffectedAreas { get; set; } = new(); public DateTime IdentifiedAt { get; set; } = DateTime.UtcNow; } /// /// Complete analysis result for a single response — aggregates all AI outputs. /// public class ResponseAnalysisResult { public int ResponseId { get; set; } public int QuestionId { get; set; } public string QuestionText { get; set; } = string.Empty; public string ResponseText { get; set; } = string.Empty; public string AnonymizedResponseText { get; set; } = string.Empty; public SentimentAnalysisResult? SentimentAnalysis { get; set; } public KeyPhrasesResult? KeyPhrases { get; set; } public MentalHealthRiskAssessment? RiskAssessment { get; set; } public List Insights { get; set; } = new(); public DateTime AnalyzedAt { get; set; } = DateTime.UtcNow; public bool IsAnalysisComplete { get; set; } } /// /// Aggregated analysis overview for an entire questionnaire. /// public class QuestionnaireAnalysisOverview { public int QuestionnaireId { get; set; } public string QuestionnaireTitle { get; set; } = string.Empty; public int TotalResponses { get; set; } public int AnalyzedResponses { get; set; } // Sentiment distribution (0.0–1.0) public double OverallPositiveSentiment { get; set; } public double OverallNegativeSentiment { get; set; } public double OverallNeutralSentiment { get; set; } // Risk distribution counts public int LowRiskResponses { get; set; } public int ModerateRiskResponses { get; set; } public int HighRiskResponses { get; set; } public int CriticalRiskResponses { get; set; } // Insights public List TopWorkplaceIssues { get; set; } = new(); public List MostCommonKeyPhrases { get; set; } = new(); public DateTime LastAnalyzedAt { get; set; } public string ExecutiveSummary { get; set; } = string.Empty; } /// /// Input request for analysis pipeline. /// public class AnalysisRequest { public int ResponseId { get; set; } public int QuestionId { get; set; } public string ResponseText { get; set; } = string.Empty; public string QuestionText { get; set; } = string.Empty; public string QuestionType { get; set; } = string.Empty; public bool IncludeSentimentAnalysis { get; set; } = true; public bool IncludeKeyPhraseExtraction { get; set; } = true; public bool IncludeRiskAssessment { get; set; } = true; public bool IncludeWorkplaceInsights { get; set; } = true; } public class UserTrajectoryAnalysis { // ── Overall Trajectory ── /// /// "Improving", "Stable", "Declining", "Fluctuating", "Initial" (single response) /// public string TrajectoryDirection { get; set; } = "Initial"; /// /// Overall wellness score 0-100 /// public int TrajectoryScore { get; set; } /// /// Change from first to latest response (e.g., +15 or -20). 0 if single response. /// public int ScoreChange { get; set; } /// /// "Low", "Moderate", "High", "Critical" /// public string OverallRiskLevel { get; set; } = "Low"; /// /// 2-3 sentence overview /// public string ExecutiveSummary { get; set; } = string.Empty; /// /// Longer detailed analysis paragraph /// public string DetailedAnalysis { get; set; } = string.Empty; // ── Per-Response Snapshots ── public List ResponseSnapshots { get; set; } = new(); // ── Cross-Response Patterns ── public List PatternInsights { get; set; } = new(); // ── Strengths & Concerns ── public List StrengthFactors { get; set; } = new(); public List ConcernFactors { get; set; } = new(); // ── Recommendations ── public List Recommendations { get; set; } = new(); // ── Narrative ── /// /// A story-like professional summary suitable for reports /// public string TimelineNarrative { get; set; } = string.Empty; // ── Metadata ── public int TotalResponsesAnalyzed { get; set; } public DateTime AnalyzedAt { get; set; } = DateTime.UtcNow; public bool IsIncremental { get; set; } = false; } public class ResponseSnapshot { /// /// The database Response.Id /// public int ResponseId { get; set; } public string ResponseDate { get; set; } = string.Empty; public string QuestionnaireName { get; set; } = string.Empty; /// /// Wellness score 0-100 for this specific response /// public int WellnessScore { get; set; } /// /// "Low", "Moderate", "High", "Critical" /// public string RiskLevel { get; set; } = "Low"; /// /// "Positive", "Negative", "Mixed", "Neutral" /// public string SentimentLabel { get; set; } = "Neutral"; /// /// Key themes detected (e.g., "workload", "management", "isolation") /// public List KeyThemes { get; set; } = new(); /// /// One-sentence summary of this response /// public string BriefSummary { get; set; } = string.Empty; } public class PatternInsight { /// /// Description of the pattern (e.g., "Recurring workload concerns across all responses") /// public string Pattern { get; set; } = string.Empty; /// /// "High", "Medium", "Low" /// public string Severity { get; set; } = "Medium"; /// /// When this pattern was first observed /// public string FirstSeen { get; set; } = string.Empty; /// /// Whether this pattern is still present in the latest response /// public bool StillPresent { get; set; } = true; } public class StrengthFactor { public string Factor { get; set; } = string.Empty; } public class ConcernFactor { public string Concern { get; set; } = string.Empty; /// /// "Immediate", "Monitor", "Low" /// public string Urgency { get; set; } = "Monitor"; } public class TrajectoryRecommendation { public string Action { get; set; } = string.Empty; /// /// "Urgent", "High", "Normal" /// public string Priority { get; set; } = "Normal"; /// /// "Workplace", "Personal", "Professional Support" /// public string Category { get; set; } = "Workplace"; } }