Skip to content
Case 06 · 7 min read

Case 06 · Health · Claude on Bedrock · Solo build

VitalLog — a health almanac that writes nothing until you confirm.

Role
Solo · designed and built
Stack
Next.js 14 · FastAPI · Supabase (RLS) · AWS Bedrock (Claude Sonnet 4.5, Haiku 4.5) · USDA FNDDS
Ships
66 commits in about 6 days · invite-only installable web app on free-tier hosting
Result
~6 days / to build, 124 tests

A personal health almanac that reads your blood tests, checks its food numbers against a real nutrient database, and writes nothing until you confirm.

~61
days to build
1242
tests
~453
canonical biomarkers
0.554
food match threshold

01 — The problem

Lab PDFs nobody reopens

My bloodwork lived in PDFs, my diet in one app and my supplements in my head. Nothing read them together, and nothing showed whether a number was moving. I wanted one place that could read a lab report, log a meal from a sentence or a photo, and chart all of it over time.

Health data is where AI shortcuts hurt most. Published research I reviewed found that language models identify food well but misjudge its weight in 76% of photos. Grounding food in a nutrient database cut the error to about 48 kcal per dish, against 169–277 kcal for commercial apps. That shaped the whole design: let the model read, but check its numbers against real data.

02 — What I built

One app, three AI jobs, one rule

VitalLog is a privacy-first health dashboard I designed and built alone in about six days. You upload blood tests as PDFs or photos, log meals, track weight, supplements and workouts, and an assistant reads all of it together. It installs as a web app and is invite-only.

Claude does three jobs: it reads lab reports, it estimates meals from text or photos, and it runs the assistant. Sonnet 4.5 handles anything visual and Haiku 4.5 the text, both through AWS Bedrock at temperature 0. The rule across all three is the same: the model proposes, and real data or the user decides.

VitalLog is not a medical device and does not give medical advice. A disclaimer runs throughout the app, and the AI prompts require one in their answers. The job is to make your own results legible over time, not to diagnose anything.

  1. Lab parsing with sex- and age-aware reference ranges
  2. Food grounded in the USDA FNDDS database plus a curated table of Pakistani dishes
  3. Energy expenditure back-calculated from your own weight trend
  4. The AHA PREVENT cardiovascular-risk equations, checked against the paper's worked examples
  5. Full export and hard delete

03 — The hard part

Reading a lab report

An upload is parsed in the background. PDFs go to Claude as documents and photos as images, with one instruction above all: copy values exactly as printed and never invent one. You review the result before it is saved.

Labs print the same test under different names, so every name passes through a canonical synonym table of about 45 biomarkers. "SGPT" becomes ALT, "25-OH" becomes vitamin D, "TLC" becomes white blood cells. Longest match wins, so MCHC never collapses into MCH. When a report has no panel title, the parser infers one: CBC, liver, lipid or renal.

Each value is then checked against ranges that depend on sex and age, with a borderline band and room for your own custom ranges. Regression tests cover real mismaps, such as VLDL and non-HDL being confused. Long AI analyses once ran out of tokens and broke the JSON, showing a false "AI unavailable", so I raised the output limit from 1,800 to 4,096 tokens.

04 — Grounding, not guessing

Karahi must never become chicken kiev

For a meal, the model returns each item with a name, a canonical name and an estimated weight in grams. Each item is then looked up by trigram similarity in the USDA FNDDS database and a curated table of Pakistani dishes. The prompt splits a combined dish like daal chawal into lentil curry and rice first.

Only a confident match, with similarity of at least 0.55, replaces the nutrients: the database's values per 100 g are scaled to the estimated weight. Anything below the threshold stays labelled as an AI estimate. A comment in the code explains the bar: karahi must never silently become chicken kiev. This is a structured lookup, not retrieval-augmented generation.

Energy needs are grounded the same way. VitalLog back-calculates expenditure from average intake and a least-squares fit of your weight trend, only after at least 14 days, 3 weigh-ins and 7 logged days. The result is clamped to 0.65–1.5× the Mifflin-St Jeor estimate and shown with a confidence level.

05 — Asks before it writes

An assistant that only proposes

The assistant can log food, workouts, supplement doses and weight, or add a supplement, from a chat message. It has five tools, but it never writes. Each tool call becomes a card describing the change, and nothing is saved until you confirm. Its instructions forbid it from saying it has saved anything, it uses one tool per turn, and it asks when a supplement name could match more than one of yours.

The data underneath gets the same care. Row-level security is forced on for every table, with one explicit policy per operation. The backend takes the user only from the verified token, never from the request. Files sit in private buckets behind ten-minute signed links, and prompt and response bodies are never logged.

Pasting a supplement link makes the backend fetch it, and the backend holds cloud credentials. So it resolves every address the host points to, rejects private, loopback and link-local ones, checks again after each redirect, and stops at 1.5 MB or 8 seconds.

06 — What I'd change

Next

Grounding fixes the nutrients per gram, but the grams still come from the model's estimate. That is exactly where the research says models are weakest. The next real gain is in portion size, not in a better food match.

The lab parser is tested against the report formats I had. I would grow that set with more labs and more layouts, because a synonym table is only as good as the names it has already seen.

Notes

  1. 66 commits, from schema to deployed app.
  2. Backend test functions across 18 files.
  3. Printed lab names such as "SGPT" or "25-OH" map to one biomarker each.
  4. Minimum trigram similarity before a USDA FNDDS match replaces the AI's estimate.

Ask my portfolio