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)
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.
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.
At the core of this project is:
WaterIntakeAgent
An autonomous reasoning module that evaluates hydration input.
- User logs water intake (e.g., 800 ml)
WaterIntakeAgent.analyze_intake()is triggered- Agent checks if Ollama (Llama3) is available
- Agent selects reasoning strategy
- Personalized hydration advice is returned
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.
โข Uses Ollama
โข Uses Llama3 model
โข Performs contextual language reasoning
โข Generates natural-language personalized advice
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.
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.
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.
| 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 |
git clone https://github.com/ManaliRathod9/AI-Water-Tracker.git
cd AI-Water-Tracker
Mac/Linux:
python -m venv venv
source venv/bin/activate
Windows:
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
streamlit run dashboard.py
Open:
http://localhost:8501
- Push code to GitHub
- Go to streamlit.io/cloud
- Connect your repository
- Set entry file to:
dashboard.py
- Deploy
The agent will automatically switch to fallback reasoning in cloud mode.
No additional configuration required.
AI-Water-Tracker/
โ
โโโ dashboard.py
โโโ src/
โ โโโ agent.py
โ โโโ database.py
โโโ requirements.txt
โโโ README.md
| 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 |
Planned improvements:
โข Agent memory across days
โข Trend-based reasoning
โข Proactive low-hydration alerts
โข Multi-agent architecture
โข Adaptive daily goal generation
โข Behavioral pattern detection
๐ Streamlit App: https://your-streamlit-link-here
Manali Rathod