This repo contains Val Town-ready scripts that:
Think of this as two simple helpers:
Even though this feels simple, it uses a few classic CS ideas:
If you can build or understand this, you’re already practicing real CS thinking—just without the scary jargon.
This project includes playful, Praise Cage-themed badges:
You can rename or swap these in collectors/blood_sugar_report.cron.tsx.
This report is for informational purposes only and is not medical advice. Healthy blood sugar ranges referenced here come from: https://www.ynhhs.org/articles/what-is-healthy-blood-sugar
Create a new database in Notion (table view is easiest) with these properties:
You can name the database anything (e.g., "Blood Sugar Log").
Create another Notion database with these properties (exact names expected):
food (Title or Text)Created time (Created time)calories (Number)protein (Number)carbs (Number)fats (Number)fiber (Number)sugar (Number)sodium (Number)Only food and Created time are required for reading. The rest are written by the val.
The food val uses OpenAI to normalize entries and infer a reasonable serving size, then pulls detailed
nutrition from FatSecret (food.get) for calories, protein, carbs, fat, fiber, sugar, and sodium.
Macros are scaled by the inferred serving size using FatSecret's default serving.
Example:
shrimp lo mein{ "items": [{ "name": "shrimp lo mein", "servings": 1 }] }2 slices pepperoni pizza and salad{ "items": [{ "name": "pepperoni pizza", "servings": 2 }, { "name": "salad", "servings": 1 }] }Open each database in the browser and copy the 32‑character ID in the URL.
Create new Vals with the vt CLI, then sync from this repo:
vt create blood_sugar_report
vt create food_report
vt create monthly_report_page
Replace each generated Val file with the corresponding script from this repo:
collectors/blood_sugar_report.cron.tsxcollectors/food_report.cron.tsxservices/monthly_report_page.http.tsxThen push each Val:
vt push
Shared:
NOTION_TOKENBlood sugar val:
NOTION_BLOOD_SUGAR_DB_IDREPORT_FROM_EMAIL (optional, must be your_username.valname@valtown.email)REPORT_FROM_NAME (optional)REPORT_REPLY_TO (optional)Food log val:
NOTION_FOOD_DB_IDFree tier note: the blood sugar val emails the account owner by default.
The food val uses Val Town's std/openai proxy with gpt-5-nano, so no OpenAI API key is required.
The monthly report val renders a Memphis-inspired report page from SQLite rollups, with a month selector and partial-week toggle (auto-refresh).
In Val Town, schedule the Val to run weekly at 9:30am on Tuesdays (EST).
Suggested cron (set Val Town timezone to EST):
30 9 * * 2
Cron is a simple way to say “run this on a schedule.” It has five fields:
minute hour day-of-month month day-of-week
So 30 9 * * 2 means:
In other words: every Tuesday at 9:30am.
collectors/blood_sugar_report.cron.tsx.?month=YYYY-MM (defaults to previous month)?partial=true to include overlapping weeksRun tests:
deno test --allow-import --reporter=dot
Run lint:
deno lint
Made with 🖖 by Paul Chin Jr. and Markal.