{"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:

"},{"location":"#uncompromising-privacy","title":"Uncompromising Privacy","text":"

N\u00f8kken embraces a strict privacy-first approach:

"},{"location":"architecture/","title":"Architecture","text":"

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":""},{"location":"architecture/#state-management","title":"State Management","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":""},{"location":"core/database/#interactions-with-other-services","title":"Interactions with Other Services","text":""},{"location":"core/database/#database-schema","title":"Database Schema","text":"

The database consists of several tables:

"},{"location":"core/health_analytics/","title":"Health Analytics Service","text":"

The 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":""},{"location":"core/health_analytics/#core-features","title":"Core Features","text":"

The Health Analytics Service provides the following core functionalities:

"},{"location":"core/health_analytics/#api-reference","title":"API Reference","text":""},{"location":"core/health_analytics/#basic-statistics","title":"Basic Statistics","text":"

Calculate fundamental statistics for a health metric:

HealthStatistics stats = analyticsService.calculateStatistics(values);\n

The HealthStatistics object provides:

"},{"location":"core/health_analytics/#trend-analysis","title":"Trend Analysis","text":"

Detect trends in time series data:

TrendAnalysis trend = analyticsService.detectTrend(values);\n

This returns a TrendAnalysis with:

"},{"location":"core/health_analytics/#correlation-analysis","title":"Correlation Analysis","text":"

Find correlations between a target variable and multiple factors:

List<FactorCorrelation> correlations = analyticsService.findCorrelations(\n  targetValues,\n  factorData,\n);\n

Where:

Returns a list of FactorCorrelation objects with:

"},{"location":"core/health_analytics/#multivariate-analysis","title":"Multivariate Analysis","text":"

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:

"},{"location":"core/health_analytics/#time-series-forecasting","title":"Time Series Forecasting","text":"

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:

"},{"location":"core/health_analytics/#date-pattern-analysis","title":"Date Pattern Analysis","text":"

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:

"},{"location":"core/health_analytics/#medication-impact-analysis","title":"Medication Impact Analysis","text":"

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:

"},{"location":"core/health_analytics/#hormone-analysis","title":"Hormone Analysis","text":"

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:

"},{"location":"core/health_analytics/#comprehensive-analysis","title":"Comprehensive Analysis","text":"

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:

  1. 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.

  2. Memory Management: The service handles memory allocation and deallocation for native resources, but be mindful of large data structures in Dart code.

  3. Initialization Cost: The first call to initialize() has a one-time overhead for loading the native library.

  4. Operation Complexity: Operations like cluster analysis and multivariate correlation have higher computational complexity.

  5. Platform Differences: Performance may vary across platforms. iOS and Android have different native code optimization levels.

"},{"location":"core/health_analytics/#troubleshooting","title":"Troubleshooting","text":""},{"location":"core/health_analytics/#common-issues","title":"Common Issues","text":""},{"location":"core/health_analytics/#native-library-loading-failures","title":"Native Library Loading Failures","text":"

If you encounter issues loading the native library:

  1. Verify the native libraries are correctly placed in platform-specific directories
  2. Check that library names match expected platform conventions:
Platform Library Android libhealth_analytics.so iOS Framework or dynamic library Linux libhealth_analytics.so
  1. For Android, ensure the correct ABIs are supported in your 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":""},{"location":"core/navigation/#interactions-with-other-services","title":"Interactions with Other Services","text":""},{"location":"core/notifications/","title":"Notification Service","text":"

The NotificationService handles push notifications for medication reminders and refill alerts using the flutter_local_notifications package.

"},{"location":"core/notifications/#key-features","title":"Key Features","text":""},{"location":"core/notifications/#interactions-with-other-services","title":"Interactions with Other Services","text":""},{"location":"core/ui/","title":"UI Components","text":"

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":""},{"location":"core/ui/#theme-management","title":"Theme Management","text":"
// 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

"},{"location":"core/ui/#dialog-service","title":"Dialog Service","text":"

The DialogService provides centralized management of dialogs and alerts.

"},{"location":"core/ui/#features","title":"Features","text":""},{"location":"core/utilities/","title":"Utilities","text":"

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":""},{"location":"core/utilities/#geticonscolors","title":"GetIconsColors","text":"

Functions for returning appropriate Icon/Color for medication/appointment types.

"},{"location":"core/utilities/#features_1","title":"Features","text":""},{"location":"core/utilities/#getlabels","title":"GetLabels","text":"

Functions for returning appropriate text labels for medication/appointment types.

"},{"location":"core/utilities/#features_2","title":"Features","text":""},{"location":"core/utilities/#list-extensions","title":"List Extensions","text":"

Additional functionality for lists, currently only the firstWhereOrNull method.

"},{"location":"core/validation/","title":"Validation Service","text":"

The ValidationService provides centralized validation logic for form inputs, ensuring consistent validation throughout the app.

"},{"location":"core/validation/#key-features","title":"Key Features","text":""},{"location":"core/validation/#interactions-with-other-services","title":"Interactions with Other Services","text":""},{"location":"features/","title":"Feature Modules","text":"

Nokken features multiple modules for tracking different aspects of health management. The application follows a feature-first architecture with clear separation of concerns.

"},{"location":"features/bloodwork-tracker/","title":"Bloodwork Tracker","text":"

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":""},{"location":"features/bloodwork-tracker/#providers","title":"Providers","text":"
// 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":""},{"location":"features/bloodwork-tracker/#interactions","title":"Interactions","text":""},{"location":"features/medication-tracker/","title":"Medication Tracker","text":"

The medication tracker feature allows users to manage their medications, track adherence, and receive refill alerts.

"},{"location":"features/medication-tracker/#models","title":"Models","text":""},{"location":"features/medication-tracker/#providers","title":"Providers","text":"
// 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":""},{"location":"features/medication-tracker/#interactions","title":"Interactions","text":""},{"location":"features/mood-tracker/","title":"Mood Tracker","text":"

The 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":""},{"location":"features/mood-tracker/#providers","title":"Providers","text":""},{"location":"features/mood-tracker/#screens","title":"Screens","text":""},{"location":"features/mood-tracker/#widgets","title":"Widgets","text":""},{"location":"features/mood-tracker/#utilities","title":"Utilities","text":""},{"location":"features/mood-tracker/#interactions","title":"Interactions","text":""},{"location":"features/scheduler/","title":"Scheduler","text":"

The 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":""},{"location":"features/scheduler/#view-modes","title":"View Modes","text":""},{"location":"features/scheduler/#providers","title":"Providers","text":""},{"location":"features/scheduler/#core-providers","title":"Core Providers","text":"
// 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

"},{"location":"features/settings/","title":"Settings","text":"

The settings feature allows users to customize application preferences.

"},{"location":"features/settings/#screens","title":"Screens","text":""},{"location":"features/settings/#providers","title":"Providers","text":""},{"location":"features/settings/#interactions","title":"Interactions","text":""},{"location":"features/statistics/","title":"Statistics","text":"

The 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.

"},{"location":"features/statistics/#architecture","title":"Architecture","text":"
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:

"},{"location":"features/statistics/#providers","title":"Providers","text":"
// 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

"},{"location":"features/statistics/#charts","title":"Charts","text":""},{"location":"features/statistics/#ui-organization","title":"UI Organization","text":"

The 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

"},{"location":"features/statistics/#factor-analysis","title":"Factor Analysis","text":"

The feature supports detailed analysis of specific factors with the FactorAnalysisScreen, which provides:

"},{"location":"features/statistics/#data-sources","title":"Data Sources","text":"

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:

"},{"location":"features/statistics/#pattern-detection","title":"Pattern Detection","text":"

Patterns are identified through statistical analysis of time series data, including:

"},{"location":"features/statistics/#anomaly-detection","title":"Anomaly Detection","text":"

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:

"},{"location":"getting-started/","title":"Getting Started","text":""},{"location":"getting-started/#prerequisites","title":"Prerequisites","text":""},{"location":"getting-started/#installation","title":"Installation","text":"
# 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
"}]}