Skip to content

joshcutts/MealFeel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MealFeel

A personal wellness app that helps you log meals quickly and explore connections between what you eat and how you feel.

  • Meal Tracking: Log meals in natural language or via photo. View and edit your history.
  • Insight Chatbot: Ask questions like "What did I eat last week?" or "Which foods might be linked to my bloating?"

What does MealFeel do?

Meal Tracking

  • Log meals fast: Type a natural language sentence (e.g., "For lunch today I had a hamburger, french fries and a wedge salad and afterwards felt bloated"), or upload a photo to auto-extract a description and symptoms.
  • Automatic structure: The app parses your text into date, meal type, dishes, and optional symptoms.
  • Ingredient awareness: It expands dish names into likely ingredients (e.g., hamburger → beef, tomato, onion, pickles, potatoes, vegetable oil, iceburg lettuce).
  • History and edits: Browse your logged meals, open a meal, and edit details later.

Insight Chatbot

  • Meal recall: "What did I eat yesterday?", "When did I last have eggs?"
  • Symptom patterns: "What foods make me feel bloated?", "Which ingredients show up when I have headaches?"
  • Safe guidance: Results emphasize patterns and correlations, not medical advice.

How it works (technical overview)

Architecture

  • Client (Vite + React + MUI): UI components for logging meals, viewing history, and chatting.
  • Server (Node + Express + PostgreSQL): REST API for meals and a chat endpoint that runs RAG-style analysis.
  • AI: OpenAI (GPT-4o) for structured parsing, ingredient inference, and safe response generation; OpenAI embeddings for semantic search.
  • Observability: Langfuse tracing around AI calls.

Key flows

  • Meal logging (POST /api/meals):

    1. Parse free‑text into structured fields via Instructor + GPT-4o (schema‑validated with Zod)
    2. Infer likely ingredients from dishes using GPT-4o
    3. Generate a clinically toned meal_text summary
    4. Create an embedding for semantic recall and store everything in Postgres
  • Meal recall (POST /api/chat with intent meal_recall):

    • Parses time expressions (e.g., "last week"), fetches relevant meals, uses embeddings to rank by similarity, and formats a readable summary preserving line breaks.
  • Symptom analysis (POST /api/chat with intent symptom_analysis):

    • Finds meals mentioning symptoms, runs ingredient frequency/intersection analysis, and presents possible correlations with disclaimers.

Setup

Prerequisites

  • Node.js 18+
  • PostgreSQL 14+
  • OpenAI API key

Environment variables (server)

Create a .env file in server/:

PORT=3001
OPENAI_API_KEY=your_openai_key
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=wellness_tracker
LANGFUSE_PUBLIC_KEY=optional
LANGFUSE_SECRET_KEY=optional
LANGFUSE_HOST=optional

Install & run

In two terminals:

# Terminal 1 – server
cd server
npm install
npm run dev
# Terminal 2 – client
cd client
npm install
npm run dev

Client dev server proxies '/api' to http://localhost:3001.

Database

  • Import the dump in db/wellness_tracker_dump.sql to create tables and seed sample data.
  • The meals table stores dishes and ingredients as arrays and a meal_text string. An embedding vector is stored as text in this POC and used for similarity with PostgreSQL operators in queries.
  • Proof of Concept project uses data from a single user. Data taken from kaggle and transformed using google colab

API

Meals

  • GET /api/meals → list meals (newest first)
  • GET /api/meals/:id → fetch one meal
  • POST /api/meals → create a meal
    • Body: { "text": string, "session_id?": string }
    • Response: full meal record plus debug session info
  • PATCH /api/meals/:id → update a meal

Chatbot

  • POST /api/chat
    • Body: { "query": string, "user_id?": number, "session_id?": string }
    • Intents: meal_recall, symptom_analysis, general
    • Returns: intent classification, number of meals considered, and a formatted answer

Frontend (selected components)

  • MealTracker.tsx: natural‑language input, photo upload modal, and a list of logged meals.
  • InsightFinder.tsx: chat interface to send queries and display AI responses (markdown‑rendered).

Safety & disclaimers

  • This app does not provide medical advice.
  • Pattern findings indicate correlation, not causation.
  • Consult a healthcare professional for medical concerns.

About

A personal wellness app that helps you log meals quickly and explore connections between what you eat and how you feel.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors