{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Overview","text":"
N\u00f8kken (or Nokken) is a medical tracking application built with Flutter. It is designed to work on mobile platforms (iOS / Android) with a strong focus on user privacy.
"},{"location":"#open-source-transparency","title":"Open Source Transparency","text":"N\u00f8kken is fully open source, providing transparency into how your sensitive health data is handled. This approach ensures:
N\u00f8kken embraces a strict privacy-first approach:
N\u00f8kken follows a feature-first architecture with clear separation of concerns.
"},{"location":"architecture/#project-structure","title":"Project Structure","text":"lib/\n\u251c\u2500\u2500 main.dart # Application entry point\n\u251c\u2500\u2500 src/\n \u251c\u2500\u2500 app.dart # App configuration and theme setup\n \u251c\u2500\u2500 core/ # Core functionality shared across features\n \u2502 \u251c\u2500\u2500 constants/ # App-wide constants\n \u2502 \u251c\u2500\u2500 screens/ # Core screens (main container)\n \u2502 \u251c\u2500\u2500 services/ # Shared services (database, navigation, etc.)\n \u2502 \u251c\u2500\u2500 theme/ # Theming system\n \u2502 \u2514\u2500\u2500 utils/ # Utility functions\n \u251c\u2500\u2500 features/ # Feature modules\n \u251c\u2500\u2500 medication_tracker/ # Medication tracking feature\n \u251c\u2500\u2500 bloodwork_tracker/ # Bloodwork tracking feature\n \u251c\u2500\u2500 mood_tracker/ # Mood tracking feature\n \u251c\u2500\u2500 stats/ # Statistics / Analysis\n \u251c\u2500\u2500 scheduler/ # Daily tracker and calendar\n \u2514\u2500\u2500 settings/ # Settings and preferences\n
"},{"location":"architecture/#dependency-flow","title":"Dependency Flow","text":"Nokken uses Riverpod for state management.
"},{"location":"core/","title":"Core Services","text":"Nokken's architecture is built around several core services that provide foundational functionality to the application. These services follow a singleton pattern for efficient resource usage and are designed with clear separation of concerns.
"},{"location":"core/#structure","title":"Structure","text":"lib/src/\n\u251c\u2500\u2500 app.dart # App configuration and theme setup\n\u251c\u2500\u2500 core/ # Core functionality shared across features\n\u2502 \u251c\u2500\u2500 constants/ # App-wide constants\n\u2502 \u251c\u2500\u2500 screens/ # Core screens (main container)\n\u2502 \u251c\u2500\u2500 services/ # Shared services\n\u2502 \u251c\u2500\u2500 theme/ # Theming system\n\u2502 \u2514\u2500\u2500 utils/ # Utility functions\n\u251c\u2500\u2500 features/ # Feature modules (medication, bloodwork, etc.)\n
"},{"location":"core/database/","title":"Database Service","text":"The DatabaseService is the heart of Nokken's data persistence layer, providing a structured interface to the SQLite database.
"},{"location":"core/database/#key-responsibilities","title":"Key Responsibilities","text":"DatabaseException
classValidationService
: Database operations use validation to ensure data integrityThe database consists of several tables:
medications
: Stores medication informationtaken_medications
: Records which medications have been takenbloodwork
: Stores lab results and appointment informationmood_entries
: Stores daily mood and wellness metricsThe Health Analytics Service provides advanced statistical analysis capabilities for health-related data. It's designed to identify patterns, correlations, and insights in health metrics through a high-performance native C++ implementation with a Dart interface.
This service leverages Foreign Function Interface (FFI) to bridge Dart applications with the C++ analytics engine, enabling complex health data analysis with minimal computational overhead in Flutter applications.
Key capabilities include statistical computations, correlation identification, time series analysis, anomaly detection, clustering, and health-specific analyses like medication impact and hormone level monitoring.
"},{"location":"core/health_analytics/#table-of-contents","title":"Table of Contents","text":"The Health Analytics Service provides the following core functionalities:
Calculate fundamental statistics for a health metric:
HealthStatistics stats = analyticsService.calculateStatistics(values);\n
The HealthStatistics
object provides:
Detect trends in time series data:
TrendAnalysis trend = analyticsService.detectTrend(values);\n
This returns a TrendAnalysis
with:
Find correlations between a target variable and multiple factors:
List<FactorCorrelation> correlations = analyticsService.findCorrelations(\n targetValues,\n factorData,\n);\n
Where:
targetValues
is a list of double values for the target metricfactorData
is a map of factor names to lists of double valuesReturns a list of FactorCorrelation
objects with:
Find complex relationships between multiple factors:
List<MultivariateRelationship> relationships = analyticsService.findMultivariateCorrelations(\n factorData,\n);\n
This identifies various relationship types (direct correlation, mediation, network effects) between three or more factors.
"},{"location":"core/health_analytics/#cluster-analysis","title":"Cluster Analysis","text":"Group similar data points based on multiple factors:
List<ClusterPattern> clusters = analyticsService.performClusterAnalysis(\n factorData,\n maxClusters,\n);\n
This identifies natural groupings in the data, returning:
Predict future values of a health metric:
TimeSeriesPrediction forecast = analyticsService.predictTimeSeries(\n factorName,\n timeSeriesData,\n stepsAhead,\n);\n
Returns predictions with confidence intervals and seasonality information.
"},{"location":"core/health_analytics/#anomaly-detection","title":"Anomaly Detection","text":"Identify unusual patterns or outliers in health data:
List<AnomalyResult> anomalies = analyticsService.detectAnomalies(\n factorName,\n timeSeriesData,\n dates,\n threshold,\n);\n
Detects statistical outliers, contextual anomalies, and trend changes.
"},{"location":"core/health_analytics/#factor-impact-analysis","title":"Factor Impact Analysis","text":"Determine which factors have the strongest influence on a target metric:
List<FactorImpact> impacts = analyticsService.rankFactorImpacts(\n factorData,\n targetData,\n);\n
This analyzes both direct and indirect effects of factors, returning:
Discover patterns related to specific times (day of week, month, etc.):
List<DatePattern> patterns = analyticsService.analyzeDatePatterns(\n factorName,\n values,\n dates,\n);\n
Identifies weekly, monthly, or custom periodicity patterns.
"},{"location":"core/health_analytics/#cycle-analysis","title":"Cycle Analysis","text":"Analyze cyclical patterns in health data:
CycleAnalysis cycles = analyticsService.analyzeCycles(\n factorName,\n values,\n dates,\n);\n
Returns information about:
Assess how medications affect health metrics:
MedicationImpactResult impact = analyticsService.analyzeMedicationImpact(\n medicationName,\n factorName,\n beforeData,\n afterData,\n);\n
Compares health metrics before and after medication, providing:
Evaluate hormone levels and their impact on health factors:
HormoneImpactResult hormoneImpact = analyticsService.analyzeHormoneImpact(\n hormoneName,\n hormoneLevels,\n factorData,\n minOptimalLevel,\n maxOptimalLevel,\n);\n
Provides information about:
Generate a holistic analysis combining multiple techniques:
ComprehensiveHealthAnalysis analysis = await analyticsService.generateComprehensiveAnalysis(\n moodEntries: moodEntries,\n medications: medications,\n takenMedications: takenMedications,\n bloodworkEntries: bloodworkEntries,\n timeframe: \"3 months\",\n);\n
This integrates all analysis methods to provide a complete health overview.
"},{"location":"core/health_analytics/#data-models","title":"Data Models","text":"The service uses the following core data models:
"},{"location":"core/health_analytics/#health-statistics","title":"Health Statistics","text":"class HealthStatistics {\n final double mean;\n final double median;\n final double min;\n final double max;\n final double stdDev;\n final double variance;\n final double skewness;\n final double kurtosis;\n final double q1;\n final double q3;\n final double iqr;\n}\n
"},{"location":"core/health_analytics/#trend-analysis_1","title":"Trend Analysis","text":"class TrendAnalysis {\n final TrendType type; // enum: none, increasing, decreasing, cyclic, variable\n final double strength;\n final String description;\n}\n
"},{"location":"core/health_analytics/#factor-correlation","title":"Factor Correlation","text":"class FactorCorrelation {\n final String factorName;\n final double correlation;\n final double pValue;\n final double confidence;\n}\n
"},{"location":"core/health_analytics/#multivariate-relationship","title":"Multivariate Relationship","text":"class MultivariateRelationship {\n final List<String> factorNames;\n final double correlationStrength;\n final String description;\n final double confidence;\n final List<double> factorWeights;\n final RelationshipType relationshipType;\n}\n
"},{"location":"core/health_analytics/#cluster-pattern","title":"Cluster Pattern","text":"class ClusterPattern {\n final int id;\n final String name;\n final String description;\n final int pointCount;\n final double significance;\n final List<String> keyFactors;\n final List<double> factorImportance;\n}\n
"},{"location":"core/health_analytics/#time-series-prediction","title":"Time Series Prediction","text":"class TimeSeriesPrediction {\n final String factorName;\n final List<double> predictions;\n final List<List<double>> confidenceIntervals;\n final double confidence;\n final int seasonalityPeriod;\n final TimeUnit timeUnit;\n}\n
"},{"location":"core/health_analytics/#anomaly-result","title":"Anomaly Result","text":"class AnomalyResult {\n final String factorName;\n final int dataPointIndex;\n final double anomalyScore;\n final String description;\n final double originalValue;\n final double expectedValue;\n final DateTime? date;\n final double confidence;\n final AnomalyType anomalyType;\n}\n
"},{"location":"core/health_analytics/#factor-impact","title":"Factor Impact","text":"class FactorImpact {\n final String factorName;\n final double impactScore;\n final double directEffect;\n final double indirectEffect;\n final double confidence;\n final String mechanism;\n}\n
"},{"location":"core/health_analytics/#date-pattern","title":"Date Pattern","text":"class DatePattern {\n final PatternType type;\n final int periodicity;\n final double strength;\n final String description;\n final List<double> peakValues;\n final int peakDayOfWeek;\n final int peakDayOfMonth;\n final int peakMonth;\n}\n
"},{"location":"core/health_analytics/#cycle-analysis_1","title":"Cycle Analysis","text":"class CycleAnalysis {\n final double cycleLength;\n final double cycleLengthVariance;\n final double amplitude;\n final double phaseShift;\n final double confidence;\n final String description;\n}\n
"},{"location":"core/health_analytics/#medication-impact-result","title":"Medication Impact Result","text":"class MedicationImpactResult {\n final String medicationName;\n final String factorName;\n final double beforeMean;\n final double afterMean;\n final double changeMagnitude;\n final double changeSignificance;\n final double overallImpact;\n final int daysToEffect;\n final String description;\n}\n
"},{"location":"core/health_analytics/#hormone-impact-result","title":"Hormone Impact Result","text":"class HormoneImpactResult {\n final String hormoneName;\n final double currentLevel;\n final double optimalLevel;\n final double optimalRangeLower;\n final double optimalRangeUpper;\n final double deviation;\n final double impactOnMood;\n final double impactOnEnergy;\n final Map<String, double> factorImpacts;\n final String description;\n}\n
"},{"location":"core/health_analytics/#comprehensive-health-analysis","title":"Comprehensive Health Analysis","text":"class ComprehensiveHealthAnalysis {\n final TrendAnalysis moodTrend;\n final List<MultivariateRelationship> factorCorrelations;\n final List<ClusterPattern> clusters;\n final List<AnomalyResult> anomalies;\n final List<FactorImpact> factorImpacts;\n final List<TimeSeriesPrediction> predictions;\n final List<DatePattern> datePatterns;\n final List<CycleAnalysis> cycleAnalyses;\n final List<HormoneImpactResult> hormoneImpacts;\n final List<MedicationImpactResult> medicationImpacts;\n final DateTime analysisDate;\n final String timeframe;\n}\n
"},{"location":"core/health_analytics/#example-usage","title":"Example Usage","text":"import 'package:nokken/src/features/health_analytics/health_analytics_service.dart';\nimport 'package:nokken/src/features/mood_tracker/models/mood_entry.dart';\nimport 'package:nokken/src/features/medication_tracker/models/medication.dart';\nimport 'package:nokken/src/features/bloodwork_tracker/models/bloodwork.dart';\n\nFuture<void> generateHealthInsights(\n List<MoodEntry> moodEntries,\n List<Medication> medications,\n List<Bloodwork> bloodworkEntries,\n) async {\n final analyticsService = HealthAnalyticsService();\n await analyticsService.initialize();\n\n if (!analyticsService.isInitialized) {\n print('Failed to initialize analytics service');\n return;\n }\n\n // Determine which medications the user is currently taking\n final takenMedications = medications\n .where((med) => med.isActive)\n .map((med) => med.id)\n .toSet();\n\n // Generate comprehensive analysis\n final analysis = await analyticsService.generateComprehensiveAnalysis(\n moodEntries: moodEntries,\n medications: medications,\n takenMedications: takenMedications,\n bloodworkEntries: bloodworkEntries,\n timeframe: '3 months',\n );\n\n // Present key insights\n print('=== HEALTH INSIGHTS ===');\n print('Analysis date: ${analysis.analysisDate}');\n print('Timeframe: ${analysis.timeframe}');\n\n // Mood trend\n print('\\n== Mood Trend ==');\n print(analysis.moodTrend.description);\n\n // Key correlations\n print('\\n== Key Correlations ==');\n for (final correlation in analysis.factorCorrelations.take(3)) {\n print(correlation.description);\n }\n\n // Anomalies\n print('\\n== Anomalies Detected ==');\n for (final anomaly in analysis.anomalies.take(5)) {\n print('${anomaly.factorName}: ${anomaly.description}');\n if (anomaly.date != null) {\n print('Date: ${anomaly.date}');\n }\n }\n\n // Medication impacts\n print('\\n== Medication Impacts ==');\n for (final impact in analysis.medicationImpacts) {\n print('${impact.medicationName} \u2192 ${impact.factorName}: ${impact.description}');\n }\n\n // Predictions\n print('\\n== Predictions ==');\n for (final prediction in analysis.predictions.take(3)) {\n print('${prediction.factorName} next week: ${prediction.predictions.first.toStringAsFixed(1)} (confidence: ${(prediction.confidence * 100).toStringAsFixed(1)}%)');\n }\n}\n
"},{"location":"core/health_analytics/#performance-considerations","title":"Performance Considerations","text":"The Health Analytics Service uses a high-performance C++ implementation for computation-intensive operations, but there are still important considerations for optimal usage:
Data Volume: The service performs well with typical health tracking data volumes (hundreds to thousands of data points), but very large datasets may require batching or sampling.
Memory Management: The service handles memory allocation and deallocation for native resources, but be mindful of large data structures in Dart code.
Initialization Cost: The first call to initialize()
has a one-time overhead for loading the native library.
Operation Complexity: Operations like cluster analysis and multivariate correlation have higher computational complexity.
Platform Differences: Performance may vary across platforms. iOS and Android have different native code optimization levels.
If you encounter issues loading the native library:
libhealth_analytics.so
iOS Framework or dynamic library Linux libhealth_analytics.so
build.gradle
:android {\n defaultConfig {\n ndk {\n abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'\n }\n }\n}\n
"},{"location":"core/health_analytics/#insufficient-data-errors","title":"Insufficient Data Errors","text":"Many analysis methods require minimum data points:
Always check data volumes before calling analysis methods and provide appropriate fallbacks or messages when data is insufficient.
"},{"location":"core/navigation/","title":"Navigation Service","text":"Nokken uses a centralized navigation system to handle screen transitions.
"},{"location":"core/navigation/#key-components","title":"Key Components","text":"NavigationService
: Provides methods for navigating between screensAppRouter
: Generates routes based on route names and argumentsRouteNames
: Constants for all route pathsRouteArguments
: Type-safe argument passing between screensDialogService
: Uses the navigation service for dialog-related navigationThe NotificationService
handles push notifications for medication reminders and refill alerts using the flutter_local_notifications
package.
Nokken includes several shared UI components for consistency:
"},{"location":"core/ui/#theming-system","title":"Theming System","text":""},{"location":"core/ui/#key-components","title":"Key Components","text":"AppTheme
: Base theme definitions and spacing/padding constantsAppColors
: Theme-aware color valuesAppTextStyles
: Theme-aware text stylesAppIcons
: Centralized icon managementthemeProvider
ThemeUtils
provides utility functions for theme management// Provider for the theme mode\nfinal themeProvider = StateProvider<ThemeMode>((ref) => ThemeMode.dark);\n\n// Utility functions for theme management\nclass ThemeUtils {\n static void toggleTheme(WidgetRef ref) {...}\n static void setTheme(WidgetRef ref, ThemeMode mode) {...}\n}\n
"},{"location":"core/ui/#widgets","title":"Widgets","text":""},{"location":"core/ui/#sharedwidgets","title":"SharedWidgets","text":"The SharedWidgets
class provides reusable UI components throughout the app
The DialogService
provides centralized management of dialogs and alerts.
Nokken includes several utility classes that provide shared functionality:
"},{"location":"core/utilities/#datetimeformatter","title":"DateTimeFormatter","text":"Provides methods for consistent date and time formatting throughout the app.
"},{"location":"core/utilities/#features","title":"Features","text":"Functions for returning appropriate Icon/Color for medication/appointment types.
"},{"location":"core/utilities/#features_1","title":"Features","text":"Functions for returning appropriate text labels for medication/appointment types.
"},{"location":"core/utilities/#features_2","title":"Features","text":"Additional functionality for lists, currently only the firstWhereOrNull
method.
The ValidationService
provides centralized validation logic for form inputs, ensuring consistent validation throughout the app.
ValidationResult
objects with success status and error messagesDatabaseService
: Validates data before persistenceNokken features multiple modules for tracking different aspects of health management. The application follows a feature-first architecture with clear separation of concerns.
The bloodwork tracker feature helps users manage their lab results, medical appointments, and visualize trends in hormone levels over time.
"},{"location":"features/bloodwork-tracker/#models","title":"Models","text":"Bloodwork
: Primary model for lab tests and medical appointments. class Bloodwork {\n final String id;\n final DateTime date;\n final AppointmentType appointmentType;\n final List<HormoneReading> hormoneReadings;\n final String? location;\n final String? doctor;\n final String? notes;\n}\n
HormoneReading
: Represents an individual hormone measurement with value and unit. class HormoneReading {\n final String name;\n final double value;\n final String unit;\n\n // Serialization methods\n Map<String, dynamic> toJson() {...}\n factory HormoneReading.fromJson(Map<String, dynamic> json) {...}\n}\n
AppointmentType
: Enumeration for different types of medical appointments (bloodwork, appointment, surgery).HormoneTypes
: Contains predefined hormone types with their default units.bloodworkStateProvider
: Manages bloodwork CRUD operations// Main state providers\nfinal bloodworkStateProvider = StateNotifierProvider<BloodworkNotifier, BloodworkState>\n\n// Derived providers\nfinal bloodworkRecordsProvider = Provider<List<Bloodwork>>\nfinal bloodworkLoadingProvider = Provider<bool>\nfinal bloodworkErrorProvider = Provider<String?>\nfinal sortedBloodworkProvider = Provider<List<Bloodwork>>\nfinal bloodworkTypeRecordsProvider = Provider<List<Bloodwork>>\nfinal bloodworkDatesProvider = Provider<Set<DateTime>>\nfinal groupedBloodworkProvider = Provider<Map<String, List<Bloodwork>>>\nfinal hormoneTypesProvider = Provider<List<String>>\nfinal hormoneRecordsProvider = Provider.family<List<MapEntry<DateTime, double>>, String>\nfinal latestHormoneValueProvider = Provider.family<double?, String>\n
"},{"location":"features/bloodwork-tracker/#state-notifier","title":"State Notifier","text":"class BloodworkNotifier extends StateNotifier<BloodworkState> {\n // Notifier methods\n Future<void> loadBloodwork() async {...}\n Future<void> addBloodwork(Bloodwork bloodwork) async {...}\n Future<void> updateBloodwork(Bloodwork bloodwork) async {...}\n Future<void> deleteBloodwork(String id) async {...}\n}\n
"},{"location":"features/bloodwork-tracker/#screens","title":"Screens","text":"BloodworkListScreen
: List of all appointments organized by upcoming/past/today.AddEditBloodworkScreen
: Form for adding and editing appointments and lab results.BloodLevelListScreen
: Overview display of all tracked hormone levels with mini graphs.BloodworkGraphScreen
: Visualizations of hormone levels over time with reference ranges.DatabaseService
for persistent storage of bloodwork dataValidationService
for data validationThe medication tracker feature allows users to manage their medications, track adherence, and receive refill alerts.
"},{"location":"features/medication-tracker/#models","title":"Models","text":"Medication
: Core model representing a medication with properties for name, dosage, schedule, inventory, and type-specific details.MedicationDose
: Represents a specific instance of a medication taken at a particular date and time slot. class MedicationDose {\n final String medicationId;\n final DateTime date;\n final String timeSlot;\n\n // Methods for generating unique keys\n String toKey() {...}\n static MedicationDose fromKey(String key) {...}\n}\n
InjectionDetails
: Extends medication information with injection-specific details like needle types, site rotation, and supplies tracking.InjectionSite
: Manages individual injection locations on the body.InjectionSiteRotation
: Handles the automatic rotation of injection sites.medicationStateProvider
: Manages medication CRUD operations with the database.medicationTakenProvider
: Tracks which medications have been taken on specific dates.// Main state providers\nfinal medicationStateProvider = StateNotifierProvider<MedicationNotifier, MedicationState>\nfinal medicationTakenProvider = StateNotifierProvider<MedicationTakenNotifier, Set<String>>\n\n// Derived providers\nfinal medicationsProvider = Provider<List<Medication>>\nfinal medicationsLoadingProvider = Provider<bool>\nfinal medicationsErrorProvider = Provider<String?>\nfinal medicationsByNeedRefillProvider = Provider<List<Medication>>\nfinal sortedMedicationsProvider = Provider<List<Medication>>\nfinal groupedMedicationTypeProvider = Provider<Map<String, List<Medication>>>\n
"},{"location":"features/medication-tracker/#state-notifiers","title":"State Notifiers","text":"class MedicationNotifier extends StateNotifier<MedicationState> {\n // Notifier methods\n Future<void> loadMedications() async {...}\n Future<void> addMedication(Medication medication) async {...}\n Future<void> updateMedication(Medication medication) async {...}\n Future<void> updateMedicationQuantity(Medication medication, bool taken) async {...}\n Future<void> deleteMedication(String id) async {...}\n}\n
class MedicationTakenNotifier extends StateNotifier<Set<String>> {\n // Notifier methods\n Future<void> loadTakenMedicationsForDate(DateTime date) async {...}\n Future<void> setMedicationTaken(MedicationDose dose, bool taken, {String? customKey}) async {...}\n Future<void> clearOldData(int olderThanDays) async {...}\n}\n
"},{"location":"features/medication-tracker/#screens","title":"Screens","text":"MedicationListScreen
: Displays all medications with grouping by type and refill alerts.MedicationDetailScreen
: Detailed view of medication information with adherence tracking.AddEditMedicationScreen
: Form for adding and editing medications with type-specific fields.InjectionSiteTrackerScreen
: Interface for managing and visualizing injection site rotation.InjectionSiteViewerScreen
: Visualization of the current injection site on a body diagram.DatabaseService
for persistent storage of medication dataNotificationService
for medication remindersValidationService
to ensure data integrityThe mood tracker feature allows users to record their daily moods and track various wellness metrics over time, helping users identify patterns and correlations in their wellbeing.
"},{"location":"features/mood-tracker/#models","title":"Models","text":"MoodEntry
: Primary model for daily mood records with emotional and health metrics.MoodRating
: Enumeration of mood levels (great, good, okay, meh, bad) with display names, emojis, and descriptions.Emotion
: Various emotional states that can be selected (excited, relaxed, happy, etc.) with display names and emojis.SleepQuality
, EnergyLevel
, LibidoLevel
, AppetiteLevel
, FocusLevel
, DysphoriaLevel
, ExerciseLevel
moodStateProvider
: Manages mood entry CRUD operationsmoodEntryForDateProvider
: Retrieves mood entries for specific datesmoodColorsProvider
: Defines the color scheme for different mood ratingsmoodEntriesProvider
: Provides access to the full list of mood entriesmoodEntriesLoadingProvider
: Indicates when mood entries are loadingmoodEntriesErrorProvider
: Provides access to any error messagesMoodTrackerScreen
: Form for recording detailed mood and wellness dataMoodQuickSelector
: Compact widget for quickly selecting mood from the daily tracker.MoodFieldChips
: Displays mood and wellness data as visual indicator chips.MoodUtils
: Helper functions for mood-related UI elements:DatabaseService
for persistent storage of mood dataNavigationService
for screen transitionsScheduler
to display mood indicators on calendarStats
module for analytics and visualizationsThe scheduler module provides calendar-based visualization and management of health events, including medications, medical appointments, and mood tracking. It offers multiple time-scale views (day/month/year).
"},{"location":"features/scheduler/#screens","title":"Screens","text":"DailyTrackerScreen
: Daily view combining medications, appointments, and mood trackingCalendarScreen
: Monthly calendar view with visual indicators for all health eventsYearScreen
: An annual overview showing all 365 days simultaneously with color-coded days indicating medical events or mood entriesMedical Mode
: Shows medication schedules and medical appointmentsMood Mode
: Displays mood tracking data with emotion-based color coding// Tracks the currently selected date (used in DailyTrackerScreen)\nfinal selectedDateProvider = StateProvider<DateTime>((ref) => DateTime.now());\n\n// Controls animation direction for day changes\nfinal slideDirectionProvider = StateProvider<bool>((ref) => true);\n\n// Tracks the calendar view mode (medical or mood)\nfinal calendarViewModeProvider = StateProvider<CalendarViewMode>((ref) => CalendarViewMode.medical);\n
"},{"location":"features/scheduler/#derived-data-providers","title":"Derived Data Providers","text":"// Gets bloodwork records for a specific date\nfinal bloodworkForSelectedDateProvider = Provider.family<List<Bloodwork>, DateTime>((ref, date) { ... });\n\n// Processes medication doses with indexes for uniqueness\nfinal uniqueMedicationDosesProvider = Provider.family<List<(MedicationDose, int, Medication)>, DateTime>((ref, date) { ... });\n\n// Checks if a specific medication dose is marked as taken\nfinal isUniqueDoseTakenProvider = Provider.family<bool, (MedicationDose, int)>((ref, params) { ... });\n\n// Checks if there's a mood entry for a specific date\nfinal moodEntryExistsProvider = Provider.family<bool, DateTime>((ref, date) { ... });\n
"},{"location":"features/scheduler/#integration","title":"Integration","text":"The scheduler module integrates data from: - MedicationTracker
for medication schedules - BloodworkTracker
for appointments - MoodTracker
for mood entries
The settings feature allows users to customize application preferences.
"},{"location":"features/settings/#screens","title":"Screens","text":"SettingsScreen
: Interface for changing application settings:themeProvider
: Controls dark/light mode settingsThemeUtils
for theme managementThe statistics feature provides statistical analysis and visualization of user health data. It processes information from multiple sources (mood entries, medications, bloodwork, etc.) and uses the HealthAnalyticsService
to generate insights, identify patterns, detect correlations, and predict trends.
lib/src/features/stats/\n\u251c\u2500\u2500 charts/ # Chart widgets for data visualization\n\u251c\u2500\u2500 models/ # Data models for statistical analysis\n\u251c\u2500\u2500 providers/ # Riverpod providers for state management\n\u251c\u2500\u2500 screens/ # UI screens for displaying analytics\n\u251c\u2500\u2500 tabs/ # Tab components for the main stats screen\n\u251c\u2500\u2500 utils/ # Utility functions for analysis and formatting\n\u2514\u2500\u2500 widgets/ # Reusable UI components\n
"},{"location":"features/statistics/#components","title":"Components","text":""},{"location":"features/statistics/#models","title":"Models","text":"The analytics feature uses a large set of models to represent different types of statistical insights:
ComprehensiveAnalysis
: Container for all types of analytics dataStatisticalInsight
: Basic statistical findingsFactorRelationship
: Relationships between different health factorsHealthPattern
: Detected patterns in health dataHealthPrediction
: Forecasts of future health metricsHealthAnomaly
: Unusual data pointsFactorImpactRanking
: Impacts of factors on a target variableWeekdayAnalysis
: Metrics across days of the weekHealthStreak
: Consistent periods for health metricsHormoneAnalysis
: Hormone level analysisMedicationImpact
: Effects of medications on health metrics// Basic statistical insights\nfinal statisticsInsightsProvider = FutureProvider.autoDispose\n .family<List<StatisticalInsight>, String>((ref, timeframe) async { ... });\n\n// Comprehensive analysis (More detailed/resource extensive)\nfinal comprehensiveAnalysisProvider = FutureProvider.autoDispose\n .family<ComprehensiveAnalysis, String>((ref, timeframe) async { ... });\n\n// Factor-specific analysis\nfinal factorAnalysisProvider = FutureProvider.autoDispose\n .family<Map<String, dynamic>, FactorAnalysisParams>((ref, params) async { ... });\n
"},{"location":"features/statistics/#services","title":"Services","text":"The analytics functionality relies on the HealthAnalyticsService
CorrelationsChart
: Displays relationships between factorsImpactChart
: Shows impact ranking of factorsWeekdayChart
: Visualizes metrics by day of weekThe main Stats screen is organized into tabs: - Overview
: Summary of health insights and key metrics - Correlations
: Relationships between different health factors - Patterns
: Detected trends and cyclical patterns - Factors
: Analysis of what factors affect health metrics - Predictions
: Forecasts of future health values
The feature supports detailed analysis of specific factors with the FactorAnalysisScreen
, which provides:
The Health Analytics feature consumes data from multiple sources: - Mood Tracker: Emotional state, energy levels, sleep quality, etc. - Medication Tracker: Medication adherence and effects - Bloodwork Tracker: Lab results and hormone levels
"},{"location":"features/statistics/#usage-examples","title":"Usage Examples","text":"To access the comprehensive analysis:
// Watch for analysis data with a specific timeframe\nfinal analysisAsync = ref.watch(comprehensiveAnalysisProvider('Last Month'));\n\n// Use the data when available\nanalysisAsync.when(\n data: (analysis) {\n // Access insights, relationships, patterns, etc.\n final relationships = analysis.relationships;\n final patterns = analysis.patterns;\n final predictions = analysis.predictions;\n\n // Build UI with the data\n return ListView(\n children: [\n // Display insights\n ],\n );\n },\n loading: () => const LoadingView(),\n error: (error, stack) => ErrorView(error: error),\n);\n
To analyze a specific factor:
// Watch for factor-specific analysis\nfinal factorAsync = ref.watch(\n factorAnalysisProvider(\n FactorAnalysisParams(\n factorName: 'Mood',\n timeframe: 'All Time',\n ),\n ),\n);\n\n// Use the data when available\nfactorAsync.when(\n data: (factorAnalysis) {\n // Access factor-specific data\n final relationships = factorAnalysis['relationships'];\n final patterns = factorAnalysis['patterns'];\n\n // Build UI with the data\n },\n loading: () => const LoadingView(),\n error: (error, stack) => ErrorView(error: error),\n);\n
"},{"location":"features/statistics/#implementation-details","title":"Implementation Details","text":""},{"location":"features/statistics/#correlation-analysis","title":"Correlation Analysis","text":"The service calculates Pearson correlation coefficients between different health factors to identify relationships. For example, it can detect correlations between:
Patterns are identified through statistical analysis of time series data, including:
The service identifies unusual data points using z-score analysis, which detects values that deviate significantly from normal patterns.
"},{"location":"features/statistics/#prediction-algorithm","title":"Prediction Algorithm","text":"Predictions are generated using a combination of:
# Clone the repository\ngit clone https://github.com/nokken-io/nokkenapp.git\n\n# Navigate to project directory\ncd nokken\n\n# Install dependencies\nflutter pub get\n\n# Run the app\nflutter run\n
"}]}