notion_weekly_report
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v73View latest version
- A Notion database for blood sugar readings
- A Val Town script that pulls the last 7 days of entries
- Weekly stats with streaks, XP, and Praise Cage-themed badges
- A friendly email report sent on a schedule (free tier friendly)
- Tests for core logic (streaks, badges, XP)
- A SQLite rollup module stub for future storage
- We only query Notion for a small time window (fast even as Notion grows)
- We compute the rollup once per week and send it as a summary
- We can reuse the same pattern for other life areas (exercise, meals, goals)
We’ll store weekly rollups (badges, streaks, XP) in Val Town’s SQLite so we can:
- build monthly and yearly summaries without re-reading Notion
- compare across categories (e.g., blood sugar vs exercise)
- keep a long-term history even if we rename Notion pages
weekly_rollups: one row per category per weekbadge_events: a history of badges earned
Each rollup stores:
- category (e.g.,
blood_sugar) - period start/end (YYYY-MM-DD)
- streak, completion rate, XP
- badges as JSON
- summary stats as JSON
For each new Notion database:
- Add a small “collector” val that maps entries into a shared event format.
- Reuse the rollup logic and write weekly results to SQLite.
- Generate emails or dashboards from the stored rollups.
This keeps the system simple while still scaling to many life areas.
- Wire the weekly report to write rollups into SQLite after each run
- Define XP/badge rule config so new trackers can reuse it
- Add monthly and yearly rollup reports (from SQLite, not Notion)
- Add a sample “collector” val for another Notion database (e.g., exercise)
