Sleep & Wellness Manager Overview Sleep & Wellness Manager is a comprehensive Streamlit-based web application designed to help users improve their sleep quality through personalized tracking, assessment, and guidance. The application combines sleep science with AI-powered recommendations to create customized sleep improvement plans. Users can track their sleep patterns through a digital journal, participate in guided meditation sessions, listen to curated sleep music, and monitor their progress through detailed analytics dashboards.
User Preferences Preferred communication style: Simple, everyday language.
System Architecture Frontend Architecture Framework: Streamlit-based multi-page web application Page Structure: Main app.py entry point with dedicated pages for each feature (Sleep Assessment, Personalized Plan, Meditation, Journal, Music Player, Progress Dashboard, Profile) State Management: Streamlit session state for user authentication and data persistence across pages UI Components: Custom CSS styling with feature cards, responsive column layouts, and interactive forms Visualization: Plotly integration for sleep analytics charts and progress tracking graphs Backend Architecture Authentication System: Custom AuthManager class using CSV-based user storage with SHA-256 password hashing Data Management: DataManager class handling three main data files (sleep assessments, journal entries, meditation sessions) with CSV persistence Business Logic: Modular approach with separate managers for authentication, data operations, and external service integration Validation Layer: Comprehensive ValidationUtils class for user input validation including email, password strength, and sleep data validation Data Storage Solutions User Data: CSV files for user accounts (users.csv) Sleep Tracking: CSV files for assessments (sleep_assessments.csv), journal entries (sleep_journal.csv), and meditation sessions (meditation_sessions.csv) File Management: Automatic file creation and initialization with proper column structures Data Persistence: Session-based caching with file system backup for reliability Authentication and Authorization Login System: Username/password authentication with hashed password storage Session Management: Streamlit session state tracking for authentication status and user data User Registration: Account creation with email validation and user profile data collection Access Control: Page-level authentication checks preventing unauthorized access to protected features External Dependencies AI Services Google Gemini API: Integration through google.genai client for personalized sleep plan generation based on user assessment data Content Generation: AI-powered analysis of sleep patterns and custom recommendation creation Frontend Libraries Streamlit: Core web application framework with multi-page support Plotly: Interactive data visualization for sleep analytics and progress charts Pandas: Data manipulation and CSV file operations for all user data management Audio/Media Integration Sleep Music: Curated soundscape library with nature sounds, ambient music, rain sounds, classical music, and meditation audio Meditation Sessions: Timer-based guided meditation with different focus types and customizable durations Development Dependencies Python Standard Library: hashlib for password security, os for file operations, datetime for time-based features, re for input validation Data Processing: JSON handling for structured data exchange with AI services Utilities: Custom validation functions for email format, password strength, and sleep data integrity