About the Project — TarHeelEats: UNC Dining Nutrition Recommender
Inspiration
At UNC, students have access to over a dozen dining locations—from Top of Lenoir and Chase to Café 1789—but knowing which meals align with your nutrition goals can be difficult.
Menus rotate daily, labels can be inconsistent, and students often have unique dietary preferences and health objectives.
We wanted to simplify that process. TarHeelEats was created to help UNC students make informed dining choices by combining real menu data, nutrition science, and intelligent recommendations.
Our vision: to make campus dining both healthier and smarter.
What It Does
TarHeelEats is a personalized nutrition dashboard that provides data-driven dining recommendations.
It lets users:
- Input personal stats (age, height, weight, and activity level).
- Choose dietary preferences (vegan, halal, gluten-free, etc.).
- Select their goal: maintain, lose, or gain weight.
- Receive optimized meal suggestions based on BMR and TDEE calculations.
- View calories, macronutrients, and progress through interactive analytics dashboards.
Using data scraped from the UNC Dining Services website, TarHeelEats dynamically analyzes menu options from all campus locations and recommends meals that best align with the user’s goals.
How We Built It
Architecture
UNC Dining Website → Web Scraper (BeautifulSoup4 + Requests) ↓ SQLite Database → FastAPI Backend → React Frontend ↓ Streamlit Analytics Dashboard
Components
- Frontend: Built with React 18 and Vite, styled using Tailwind CSS and Shadcn UI, with animations via Framer Motion for a modern, UNC-branded interface.
- Backend: Developed with FastAPI, serving endpoints for menus, nutrition data, and AI-based recommendations.
- Database: SQLite stores scraped dining data and nutritional values.
- Data Pipeline: A BeautifulSoup4 + Requests scraper collects and updates menus daily, including allergen and tag information.
- Analytics Dashboard: Created in Streamlit using Plotly for calorie, macro, and meal-tracking visualizations.
- AI Integration: The OpenAI API powers the LLM that generates personalized meal suggestions using structured JSON prompts.
Nutrition Science & Math (LaTeX)
Basal Metabolic Rate (Mifflin–St Jeor Equation)
$$ \text{BMR} = \begin{cases} 10W + 6.25H - 5A + 5 & \text{(male)} \ 10W + 6.25H - 5A - 161 & \text{(female)} \end{cases} $$ where ( W ) = weight (kg), ( H ) = height (cm), ( A ) = age (years).
Total Daily Energy Expenditure (TDEE)
$$ \text{TDEE} = \text{BMR} \times \text{ActivityMultiplier} $$
| Activity Level | Multiplier |
|---|---|
| Sedentary | 1.2 |
| Lightly Active | 1.375 |
| Moderately Active | 1.55 |
| Very Active | 1.725 |
Calorie Target by Goal
$$ \text{TargetCalories} = \begin{cases} \text{TDEE} - 500, & \text{for fat loss} \ \text{TDEE}, & \text{for maintenance} \ \text{TDEE} + 300, & \text{for muscle gain} \end{cases} $$
Protein Target
$$ \text{ProteinGoal} = \text{Weight}_{kg} \times \begin{cases} 2.0, & \text{gain} \ 1.6, & \text{lose} \ 1.2, & \text{maintain} \end{cases} $$
Meal Scoring Function
Each menu item receives a numerical score based on its macronutrient profile and dietary tags: $$ \text{Score} = (\text{Protein}_g \times p_w)
- (\text{CalorieFit})
- (\text{FiberBonus})
- (\text{SodiumPenalty}) $$ where ( p_w ) (protein weighting) varies depending on the user’s goal.
What We Learned
- Integrating nutrition science with AI: Translating BMR and TDEE calculations into actionable, data-driven recommendations improved usability and accuracy.
- Prompt engineering matters: Using structured JSON outputs significantly reduced LLM hallucinations.
- Web scraping is challenging: Dining site structures change frequently, requiring adaptable, modular scraping logic.
- Visuals drive engagement: Streamlit dashboards helped users intuitively understand their daily nutrition progress.
- Cross-stack collaboration: Bridging FastAPI, React, and Streamlit required consistent database schema design and real-time data syncing.
Challenges
- Frequent menu structure changes in UNC Dining’s website required resilient scraping code.
- Incomplete nutritional data forced fallback lookups from the USDA Food Data Central database.
- Integrating multiple frameworks (React, FastAPI, Streamlit) demanded tight version and API consistency.
- Performance optimization was critical to handle live scraping while keeping UI responses under one second.
What’s Next
- Expand TarHeelEats to other campuses (Duke, NC State, UVA).
- Add mobile app support (React Native).
- Integrate fitness data (Apple Health, Fitbit) for adaptive goal tracking.
- Include meal cost and sustainability metrics.
- Implement user accounts with meal history and weekly progress reports.
Tech Stack
React, FastAPI, Python, SQLite, Streamlit, Plotly, Requests/BeautifulSoup4 (scraper), OpenAI API (LLM), Tailwind CSS, Shadcn UI, Vite, Framer Motion.


Log in or sign up for Devpost to join the conversation.