Interactive visualization of the midpoint + 6h sleep-grouping rule#10
Merged
Merged
Conversation
…Pages deploy Co-authored-by: Greg <gsbernstein@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a self-contained static web visualization (hosted via GitHub Pages) to demonstrate how Bedger assigns a sleep session to a calendar day using the “midpoint + 6 hours” grouping rule.
Changes:
- Added
docs/index.html: interactive SVG/JS timeline + controls showing midpoint, shifted midpoint, and assigned day. - Added GitHub Actions workflow to deploy
docs/to GitHub Pages on pushes affectingdocs/**. - Updated README to link to the visualization and briefly explain the grouping rule.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| README.md | Links to the new visualization and explains where it lives/how it’s hosted |
| docs/index.html | New interactive, no-deps visualization implementing the midpoint+6h grouping concept |
| .github/workflows/pages.yml | GitHub Pages deployment workflow for docs/ |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div class="card"> | ||
| <h2>Timeline</h2> | ||
| <div class="timeline-shell"> | ||
| <svg id="viz" viewBox="0 0 1000 320" preserveAspectRatio="xMidYMid meet" aria-label="Sleep grouping timeline"></svg> |
Comment on lines
+388
to
+390
| document.getElementById("dayVal").innerHTML = | ||
| DAY_NAMES[di] + | ||
| (rolled ? '<span class="badge">rolled to next day (midpoint after 6 PM)</span>' : ''); |
Comment on lines
+287
to
+291
| const end = start + dur; | ||
| const mid = start + dur / 2; | ||
| const shifted = mid + SHIFT; | ||
| const assignedDay = Math.floor(shifted / DAY) * DAY; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a self-contained, interactive web visualization of the "midpoint + 6 hours" rule that Bedger uses to assign a sleep session to a calendar day (
SleepSession.dateForGroupinginBedtime/Bedtime/Models/SleepData.swift).The visualization shows, for any sleep session:
startOfDay(shiftedMidpoint)),making it clear that the "new day" for sleep grouping effectively begins at 6:00 PM.
Try it
Hosting
docs/index.html(no build step, no dependencies)..github/workflows/pages.yml) uploadsdocs/and deploys on push tomaster, and can be triggered manually viaworkflow_dispatch.Notes