Diet Assistant

What it is

A diet and lifestyle assistant my wife and I use through Telegram. You type what you ate or send a photo of the plate, and it returns calories and macros. It tracks weight and water against a daily target and sends a summary each morning.

Why I built it

We had both given up on calorie trackers because the logging takes too long. Telegram was already open on our phones, so a message is the shortest path to a log entry.

Running it on my own machine also keeps the food and weight history there.

How it works

Text is parsed into structured items. A line like two eggs and a paratha comes back as a list with quantities, calories and macros, which you can correct before saving.

Photo estimates are shown as editable drafts. Calorie estimates from a single image are biased low and get worse as the portion grows, so the app applies a correction, and it asks for a one line note when the photo is a drink or a mixed dish.

Weight is reported as an exponential moving average over daily weigh-ins. The raw number moves too much with water, salt and time of day to be worth reading on its own.

Model calls return typed objects validated against a schema, never parsed free text. Each task has a small labelled eval set, so a prompt change can be scored before it ships.

Parsed food passes a plausibility check before storage. Items with impossible calorie counts are dropped and the item count is capped, so a bad parse cannot write unbounded rows.

The nutrition, metrics, storage and core modules cannot import the Telegram layer. A test walks the imports and fails if that boundary is crossed, which keeps the core portable to another front end.

It runs under launchd or systemd with restart on failure. Startup fails on a broken database instead of half working, an error handler catches anything a single bad message throws, and a nightly script takes a WAL-safe snapshot and keeps the last fourteen.

Status

Running daily for two users. Text and photo logging, weight and water tracking, daily summaries and scheduled check-ins are working, with 119 tests over the core. Meal suggestions are next.

Related