DayMood replaces dominant mood #7

Closed
opened 2026-08-26 09:13:41 +00:00 by GKaszewski · 0 comments
Owner

What to build

DayMood is the mean of every MoodEntry mood on one Date — the single mood value used wherever a Date needs one, for analysis and calendar alike. A Date with no MoodEntrys has no DayMood.

This replaces find_dominant_mood, which has a systematic bias: it picks the most frequent mood using max_by_key, and max_by_key returns the last element when several are equally maximum. Because the counts array is indexed Awful through Rad, every tie resolves to the happier mood. A day with one Awful and one Rad currently reports Rad.

Beyond the bias, frequency discards magnitude — four Meh and one Awful looks identical to five Meh — and correlation needs a continuous variable, not a five-level ordinal.

The calendar keeps showing a single mood per day by rounding the mean, so one rule serves both surfaces.

Acceptance criteria

  • DayMood is computed as the mean of a Date's entry moods
  • find_dominant_mood is gone, not merely fixed
  • A day with one Awful and one Rad no longer reports Rad
  • Calendar display derives from DayMood by rounding
  • A Date with no entries yields no DayMood, and the calendar renders that correctly
  • Grouping uses the Date rule from #2, not the entry's raw offset

Blocked by

## What to build `DayMood` is the mean of every `MoodEntry` mood on one `Date` — the single mood value used wherever a `Date` needs one, for analysis and calendar alike. A `Date` with no `MoodEntry`s has no `DayMood`. This replaces `find_dominant_mood`, which has a systematic bias: it picks the most frequent mood using `max_by_key`, and `max_by_key` returns the **last** element when several are equally maximum. Because the counts array is indexed Awful through Rad, every tie resolves to the happier mood. A day with one Awful and one Rad currently reports Rad. Beyond the bias, frequency discards magnitude — four Meh and one Awful looks identical to five Meh — and correlation needs a continuous variable, not a five-level ordinal. The calendar keeps showing a single mood per day by rounding the mean, so one rule serves both surfaces. ## Acceptance criteria - [ ] `DayMood` is computed as the mean of a `Date`'s entry moods - [ ] `find_dominant_mood` is gone, not merely fixed - [ ] A day with one Awful and one Rad no longer reports Rad - [ ] Calendar display derives from `DayMood` by rounding - [ ] A `Date` with no entries yields no `DayMood`, and the calendar renders that correctly - [ ] Grouping uses the `Date` rule from #2, not the entry's raw offset ## Blocked by - #2
GKaszewski added the ready-for-agent label 2026-08-26 09:13:41 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: GKaszewski/k-mood#7