Skip to content

Latest commit

ย 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ง AI Water Tracker โ€” Powered by Agentic AI

AI Water Tracker is an intelligent hydration assistant built with Python and Streamlit.

Unlike a traditional tracking dashboard, this system includes an autonomous AI agent that evaluates hydration input, selects a reasoning strategy, and delivers personalized guidance in real time.

The application is designed to function reliably across environments:

โ€ข Full LLM-powered reasoning (local development)
โ€ข Autonomous fallback reasoning (cloud deployment)

The agent adapts automatically based on system capabilities.

๐Ÿง  Why This Is an Agent-Based System

Most dashboards collect data and display results.

This project introduces a dedicated reasoning layer โ€” WaterIntakeAgent.

The agent is responsible for:

โ€ข Receiving hydration input
โ€ข Interpreting intake in context
โ€ข Selecting an appropriate reasoning method
โ€ข Generating tailored advice
โ€ข Adapting to runtime conditions

The UI does not make decisions.

All evaluation flows through the agent.


โš™๏ธ What This Application Does

The dashboard allows users to:

โ€ข Log daily water intake (in ml)
โ€ข Automatically calculate recommended hydration based on weight and gender
โ€ข Track daily goal completion
โ€ข Monitor hydration streaks
โ€ข View historical trends and a calendar heatmap
โ€ข Download a PDF hydration summary
โ€ข Receive optional email reminders

Each intake log triggers the AI agent for contextual feedback.


๐Ÿ” How the Agent Works

At the core of this project is:

WaterIntakeAgent

An autonomous reasoning module that evaluates hydration input.

Step-by-Step Flow

  1. User logs water intake (e.g., 800 ml)
  2. WaterIntakeAgent.analyze_intake() is triggered
  3. Agent checks if Ollama (Llama3) is available
  4. Agent selects reasoning strategy
  5. Personalized hydration advice is returned

๐Ÿ” Decision Architecture

User logs intake (e.g., 800ml)
        |
        v
WaterIntakeAgent.analyze_intake()
        |
        v
Is Ollama (Llama3) available?
        |
        +---------------------------+
        |                           |
       YES                         NO
(Local Development)       (Cloud / No Ollama)
        |                           |
        v                           v
LLM contextual reasoning     Rule-based reasoning
        |                           |
        v                           v
Personalized AI advice        Smart fallback advice

The system is environment-aware.

It always returns a response, regardless of deployment constraints.


๐Ÿง  Dual Reasoning Modes

Local Mode (Full AI Reasoning)

โ€ข Uses Ollama
โ€ข Uses Llama3 model
โ€ข Performs contextual language reasoning
โ€ข Generates natural-language personalized advice

Cloud Mode (Autonomous Fallback)

Streamlit Cloud does not support Ollama.

Instead of failing, the agent:

โ€ข Detects LLM unavailability
โ€ข Switches to deterministic hydration logic
โ€ข Continues functioning without interruption

This ensures the application never breaks during deployment.


๐Ÿ—๏ธ System Architecture

The application is structured into clear layers:

System Architecture

        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚        dashboard.py          โ”‚
        โ”‚  UI + Visualization +        โ”‚
        โ”‚        Interaction           โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
                        โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚         src/agent.py         โ”‚
        โ”‚     Agent reasoning logic    โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
                        โ–ผ
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚        src/database.py       โ”‚
        โ”‚     SQLite persistence layer โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

The UI and reasoning layers are separated intentionally.

The dashboard never performs reasoning directly.

All hydration logic flows through the agent.

This makes the system modular and extendable.


๐Ÿ“Š Core Features

Hydration Tracking
Users log intake throughout the day.

Daily Progress Calculation
Percentage completion toward recommended goal.

Streak System
Tracks consecutive days meeting hydration target.

Gamification Layer
Hydration levels based on streak performance.

Calendar Heatmap
Monthly hydration visualization using Plotly.

PDF Report Export
Generates a structured hydration summary.

Email Reminder System
Optional hourly hydration reminders using Gmail SMTP.

Agent-Based Advice
Every intake log triggers reasoning logic.


๐Ÿ› ๏ธ Tech Stack

Technology Role in System
Python 3.10 Core language
Streamlit Frontend UI layer
SQLite Lightweight persistence
Ollama + Llama3 Local LLM reasoning
Plotly Data visualization
ReportLab PDF generation
GitHub Version control
Streamlit Cloud Deployment

๐Ÿš€ Running Locally

1. Clone the repository

git clone https://github.com/ManaliRathod9/AI-Water-Tracker.git
cd AI-Water-Tracker

2. Create a virtual environment

Mac/Linux:

python -m venv venv
source venv/bin/activate

Windows:

python -m venv venv
venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Run the application

streamlit run dashboard.py

Open:

http://localhost:8501

โ˜๏ธ Deployment (Streamlit Cloud)

  1. Push code to GitHub
  2. Go to streamlit.io/cloud
  3. Connect your repository
  4. Set entry file to:
dashboard.py
  1. Deploy

The agent will automatically switch to fallback reasoning in cloud mode.

No additional configuration required.


๐Ÿ“ Project Structure

AI-Water-Tracker/
โ”‚
โ”œโ”€โ”€ dashboard.py
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ agent.py
โ”‚   โ””โ”€โ”€ database.py
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

๐Ÿ’ก Agent Capabilities

Capability Description
๐Ÿง  LLM Reasoning Uses Llama3 to reason about hydration context
๐Ÿ” Autonomous Fallback Switches reasoning mode based on environment
๐Ÿ’ฌ Natural Language Output Delivers advice in a human-friendly way
โšก Real-time Response Agent responds instantly on every log

๐Ÿ”ฎ Future Agent Enhancements

Planned improvements:

โ€ข Agent memory across days
โ€ข Trend-based reasoning
โ€ข Proactive low-hydration alerts
โ€ข Multi-agent architecture
โ€ข Adaptive daily goal generation
โ€ข Behavioral pattern detection


๐ŸŒ Live Demo

๐Ÿ‘‰ Streamlit App: https://your-streamlit-link-here

๐Ÿ‘ฉโ€๐Ÿ’ป Author

Manali Rathod

About

Agent-based hydration tracker that uses Llama3 locally and fallback reasoning in the cloud to give personalized water intake guidance.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages