DEV Community

Cover image for PlateMate — Dietary Safety & Allergen Intelligence Powered by TabPFN
Sanjay Kumar Sah
Sanjay Kumar Sah Subscriber

Posted on Originally published at plate-mate-alpha.vercel.app

PlateMate — Dietary Safety & Allergen Intelligence Powered by TabPFN

Hacktoberfest: Maintainer Spotlight

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

I built PlateMate, a dietary safety intelligence platform designed for my close friend and roommate, Alex.

The Problem

Alex lives with two life-altering dietary restrictions:

  1. Strict Celiac Disease: Ingesting even 20 parts per million of gluten (a microscopic crumb from a shared toaster or frying oil) triggers an autoimmune attack that damages their small intestine.
  2. Peanut Anaphylaxis: Exposure to trace peanut proteins or cross-contact causes acute airway constriction requiring an emergency EpiPen.

Dining out or ordering takeout with friends was always an ordeal of anxiety, awkward interrogations of busy restaurant servers, and squinting at cryptic ingredient labels.

The Solution

PlateMate gives Alex instant, mathematically calibrated safety confidence before taking a single bite:

  • Diagnostic Food Scanner: Evaluates full meals, recipe ingredients, and packaged goods against Alex’s specific allergy rules.
  • Calibrated Risk Index (0–100): Displays an exact probability of safety versus hazard.
  • Hidden Chemical Derivative Detection: Catches sneaky gluten and peanut additives (e.g., modified wheat starch in balsamic glaze, barley malt extract in granola bars).
  • Kitchen Substitution Engine: Automatically suggests chef-friendly swaps (e.g., swapping soy sauce for gluten-free tamari).
  • Multilingual Dining Passports: Instantly creates printable and mobile-ready chef instruction cards in 5 languages (English, Spanish, Italian, Japanese, and French) to ensure safe dining when traveling.

Demo

Application Highlights

  • Real-Time Scanner: Select any curated dish or enter raw ingredients to see the TabPFN neural risk score update instantaneously.
  • TabPFN AI Laboratory: Inspect raw in-context tabular feature vectors, calibrated posterior distributions ($P(\text{Safe})$, $P(\text{Caution})$, $P(\text{Dangerous})$), and anomaly scores.
  • Medical Defense Matrix: Fine-tune allergen sensitivity weights (anaphylaxis vs. intolerance) and maintain custom banned ingredients.
  • Server Dining Pass: Generate emergency chef cards ready to hand to restaurant staff.

Code

GitHub logo sanjaysah101 / PlateMate

PlateMate — Dietary Safety & Allergen Intelligence Powered by TabPFN

platemate

A production-ready Next.js project scaffolded with create-notils — Bun + Tailwind v4 + shadcn/ui on Base UI + Biome. Every file is yours to edit.

Getting started

bun install
bun dev
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:3000.

Quality gate

bun lint
bun typecheck
bun build
Enter fullscreen mode Exit fullscreen mode

What's included

  • ui — shadcn/ui component kit on Base UI, with the Tailwind v4 theme
  • api-client — Platform-neutral HTTP transport core (createHttpClient, HttpError)

This is a fresh app — no example pages or demo flows. Add capabilities as you need them.

Structure

  • src/app — routes (App Router)
  • src/components/ui — shadcn/ui components (Base UI)
  • src/lib/utils.ts — the cn() helper
  • src/app/globals.css — the theme (tokens + dark mode)

Add or update UI components from the project root:

bun run ui:add button
Enter fullscreen mode Exit fullscreen mode

Environments

One environment, configured in .env.local. .env.example is the only committed env file — the reference list of every variable this project reads with no real values;…

Note: Replace your-username/dev-weekend-challenge with your GitHub repo URL.

  • Framework: Next.js 16 (App Router, Turbopack, React 19)
  • Design System: OKLCH semantic tokens, Tailwind CSS v4, shadcn/ui & Base UI
  • Language: TypeScript (strict mode)
  • Deployment: Vercel

How I Built It

Why Prior Labs' TabPFN Foundation Model?

Standard generative LLMs are prone to conversational hallucinations and confabulate safety figures, while static keyword matching completely misses non-linear chemical synonyms.

Medical allergen safety is fundamentally a structured tabular prediction and anomaly detection problem. PlateMate is built around Prior Labs' TabPFN (Tabular Prior-Data Fitted Network).

The 6-Dimensional Tabular Feature Space

Every ingredient in a meal is vectorized into a structured numerical feature space:

  1. concentrationPct: Estimated volumetric percentage in the recipe (0–100%).
  2. processingLevel: Processing index (raw = 0.0, ultra-processed/hydrolyzed = 1.0).
  3. facilityCrossContact: Shared equipment and commercial fryer probability (0.0–1.0).
  4. molecularDistance: Biochemical derivative distance from raw trigger allergen.
  5. friendSensitivityWeight: Alex's customized clinical sensitivity (anaphylactic vs. mild).
  6. hiddenAdditiveScore: Risk rating for deceptive chemical synonyms.

In-Context Learning Without Gradient Training

TabPFN evaluates these vectors against synthetic prior exemplars in milliseconds, computing exact Bayesian posterior probabilities:
$$P(\text{Safe}) \quad|\quad P(\text{Caution}) \quad|\quad P(\text{Dangerous})$$

It also calculates an Anomaly Score to isolate suspicious ingredients that fall outside normal food matrices, alerting Alex to contaminated batch risks or unusual emulsifiers.


Why Does Open Innovation Matter?

1. Health Privacy is Sacred

Dietary medical records and allergy queries are sensitive personal health information. Proprietary closed-source APIs log and harvest user prompts on corporate servers. By building with open-source foundation models and local in-context architectures, Alex's health profile and dining queries never leave the device.

2. Edge Reliability Where it Counts

Grocery store basements, subway food courts, and remote restaurants frequently suffer from zero cellular connectivity. Closed-source APIs fail in the exact moments when allergy verification is most critical. Open innovation enables resilient, local-first inference that works anywhere, anytime.

3. Transparent, Verifiable Mathematics

When an autoimmune flare or anaphylactic shock is on the line, an AI that says "Trust me, it's probably fine" is dangerous. Open tabular foundation models like TabPFN provide mathematically calibrated confidence intervals rather than black-box guesses.


Prize Categories

  • Best Use of TabPFN ($200 USD): PlateMate vectorizes culinary ingredients into structured 6D feature spaces, using Prior Labs' TabPFN in-context tabular foundation model to compute calibrated safety posteriors, cross-contact probabilities, and additive anomaly detection.

Top comments (1)

Collapse
 
respect17 profile image
Kudzai Murimi •

I built something close to this for the same challenge, an allergy-safe recipe tool. Learned fast that the model alone can't be trusted with allergy calls, you need a hard rule check behind it too. Good to see someone else caught that.