Add AI mood report feature with PDF export for therapist sharing

Adds a Reports tab to the Insights view with date range selection, two report
types (Quick Summary / Detailed), Foundation Models AI generation with batched
concurrent processing, and clinical PDF export via WKWebView HTML rendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-03-11 10:13:54 -05:00
parent 31fb2a7fe2
commit 19b4c8b05b
9 changed files with 2149 additions and 148 deletions

View File

@@ -368,6 +368,7 @@ extension AnalyticsManager {
case specialThanks = "special_thanks"
case reminderTimePicker = "reminder_time_picker"
case exportView = "export_view"
case reports = "reports"
}
}
@@ -463,6 +464,12 @@ extension AnalyticsManager {
// MARK: Sharing
case shareTemplateViewed(template: String)
// MARK: Reports
case reportGenerated(type: String, entryCount: Int, daySpan: Int)
case reportExported(type: String, entryCount: Int)
case reportGenerationFailed(error: String)
case reportCancelled
// MARK: Error
case storageFallbackActivated
@@ -627,6 +634,16 @@ extension AnalyticsManager {
case .shareTemplateViewed(let template):
return ("share_template_viewed", ["template": template])
// Reports
case .reportGenerated(let type, let entryCount, let daySpan):
return ("report_generated", ["type": type, "entry_count": entryCount, "day_span": daySpan])
case .reportExported(let type, let entryCount):
return ("report_exported", ["type": type, "entry_count": entryCount])
case .reportGenerationFailed(let error):
return ("report_generation_failed", ["error": error])
case .reportCancelled:
return ("report_cancelled", nil)
// Error
case .storageFallbackActivated:
return ("storage_fallback_activated", nil)