Skip to content

axixatechnologies/NutriLens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 

Repository files navigation

πŸ“„ NutriLens

πŸ“Έ NutriLens

Focus your lens on nutrition.

Your AI-powered packaged food nutrition analyzer: Upload, Scan, Decode, Eat Smart.


πŸ“‹ Table of Contents

  1. Project Overview
  2. Goals & Objectives
  3. Use Cases
  4. Functional Requirements
  5. Non-Functional Requirements
  6. Technical Architecture
  7. User Flow Diagram
  8. API Flow
  9. Database Schema
  10. Security & Privacy
  11. Future Scope
  12. Glossary

1️⃣ Project Overview

NutriLens is a mobile app (React Native) that helps users understand packaged food nutrition by simply uploading an image of the food or its nutrition label.
It uses Gemini Vision API to extract ingredients, macros, vitamins, and gives AI-powered insights like benefits, risks, body effects, and recommendations.


2️⃣ Goals & Objectives

  • βœ… Make it easy for consumers to decode complex food labels.
  • βœ… Enable healthier food choices.
  • βœ… Store and track user scans for awareness.
  • βœ… Provide actionable insights: how the food affects body parts, weight, immunity, bones, etc.
  • βœ… Send reminders and smart nudges via push notifications.
  • βœ… Maintain secure user data with Supabase.

3️⃣ Use Cases

Use Case Description
Sign Up/Login User creates account with email/password or Google.
Upload Food Image User uploads packaged food image or nutrition label.
AI Nutrition Report Backend processes image, calls Gemini, returns nutrition breakdown + body impact.
History User sees past scans, reports, images, and AI suggestions.
In-App Notification User gets notified when a new scan report is ready.
Push Notification User gets reminders, weekly health tips, or insights.
Profile Settings Edit profile, manage push tokens, delete account.
Security All API calls require valid JWT token; no public access.

4️⃣ Functional Requirements

πŸ‘€ Authentication

  • Supabase Auth for signup/login.
  • JWT token used for secure API calls.
  • FCM/Expo Push Token stored in Supabase users table.

πŸ“Έ Food Image Upload

  • Upload image from gallery or camera.
  • Image uploaded via API to Python backend.
  • Image optionally stored in Supabase Storage.

πŸ”¬ Gemini Vision API

  • Backend forwards image to Gemini Vision.
  • Gemini extracts nutrition facts & generates structured data:
    • Macros (Protein, Fat, Carbs, Sugar)
    • Vitamins & Minerals
    • Benefits & Risks
    • Body impact: weight, bones, immunity, skin, etc.
    • Recommendations (good/bad, frequency, alternatives)

πŸ“š Food Scan Storage

  • Processed data saved in food_scans table:
    • user_id
    • image_url
    • nutrition_json
    • AI summary
    • created_at

πŸ›ŽοΈ Notifications

  • In-App:
    • notifications table stores status messages.
    • Bell icon with unread badge.
  • Push:
    • Backend uses Expo Push API or FCM.
    • Send β€œScan Complete”, β€œWeekly Tips”, etc.

πŸ“– History & Reports

  • Home screen shows recent scans.
  • History screen lists all scans.
  • Food detail screen shows full AI report for each scan.

5️⃣ Non-Functional Requirements

  • Security: JWT token verification on every API.
  • Performance: Average response time < 2 seconds for scanning.
  • Scalability: Gemini API usage should handle multiple users.
  • Reliability: Store raw Gemini output for audit/debug.
  • Privacy: User data encrypted at rest (Supabase).

6️⃣ Technical Architecture


User (React Native + Expo)
|
[ HTTPS + JWT ]
|
Python Backend (FastAPI)
|
Gemini Vision API
|
Supabase (Auth, DB, Storage)
|
Firebase Cloud Messaging (Push)


7️⃣ User Flow Diagram


Signup/Login ──> Home ──> Upload Image ──> Gemini Scan
β”‚
Save to DB
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              β”‚             β”‚
Send Push Create In-App Show Report
Notification Notification + History


8️⃣ API Flow Example

πŸ”— Image Upload Request

POST /analyze Headers: Authorization: Bearer <supabase_jwt> Body:

{
  "image_url": "https://..."
}

πŸ”— Response

{
  "status": "success",
  "food_scan_id": "uuid",
  "nutrition": {
    "macros": {...},
    "vitamins": {...},
    "benefits": "...",
    "risks": "...",
    "body_impact": "...",
    "recommendations": "..."
  }
}

9️⃣ Database Schema

βœ… users (Supabase)

  • id (uuid)
  • email
  • name
  • mobile nullable
  • fcm_token
  • created_at

βœ… food_scans

  • id (uuid)
  • user_id (FK)
  • image_url (text)
  • nutrition_json (jsonb)
  • summary (text)
  • created_at (timestamp)

βœ… notifications

  • id (uuid)
  • user_id (FK)
  • type (enum: info, warning, reminder)
  • title (text)
  • message (text)
  • is_read (boolean)
  • created_at (timestamp)

πŸ”’ 1️⃣0️⃣ Security & Privacy

  • All backend routes are JWT protected.
  • Use Supabase JWKS to verify tokens in Python.
  • Images stored securely (Supabase Storage or S3).
  • Sensitive user info encrypted at rest.
  • No AI API key exposed on frontend.

πŸš€ 1️⃣1️⃣ Future Scope

  • Barcode scanner integration.
  • Meal planner based on daily goals.
  • Apple Health / Google Fit sync.
  • AI chatbot: ask about foods.
  • Smart reminders: β€œScan before you eat”.
  • Premium plan: advanced reports & unlimited scans.

πŸ“– 1️⃣2️⃣ Glossary

Term Meaning
JWT JSON Web Token for secure user auth
Supabase Backend-as-a-Service (Auth, DB, Storage)
Gemini Vision Google’s AI API for image to text extraction
FCM Firebase Cloud Messaging for push notifications
Expo React Native dev framework for iOS & Android
In-App Notification Shown inside app UI, not device push

βœ… NutriLens β€” Eat Smart, Live Smart!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published