Skip to content

Add Attack-Free Streak Counter & Cycle Analytics #137

@crmne

Description

@crmne

Summary

Users want to see their attack-free streaks and cycle patterns to better understand remission periods.

User Feedback

  • "Like a current cycle streak, or how many days in total you've had headaches instead of having to manually count the entries one by one"
  • "Adding cycle streak or count"
  • "Cycle information (length, triggers, etc)"

Proposed Features

  1. Attack-Free Streak Counter

    • Display current consecutive days without attacks
    • Show longest streak achieved
    • Visual calendar heatmap
  2. Cycle Detection

    • Automatically detect cluster periods vs remission
    • Show cycle start/end dates
    • Average cycle length
    • Time between cycles
  3. Statistics Enhancement

    # app/models/user.rb
    def current_streak_days
      last_attack = headache_logs.order(start_time: :desc).first
      return 0 unless last_attack
      
      (Date.current - last_attack.start_time.to_date).to_i
    end
    
    def longest_streak
      # Calculate from historical data
    end
  4. Display locations

    • Add to existing stats panel
    • New "Patterns" tab with detailed cycle analysis
    • Widget on dashboard

Technical Approach

  • Add service object for cycle detection
  • Cache computations for performance
  • Use Stimulus for live updates

Priority

High - Multiple users requested this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions