# Quick Reference Guide - Herbal Wellness Dashboard

## 🚀 Quick Start

### View the Dashboard
```
http://localhost/herbal-wellness/dashboard/user/
```

### Key Features at a Glance

#### 1. Wellness Score (Stat Card)
- **Location**: Top of dashboard
- **Shows**: Overall wellness score out of 100
- **Color Coded**:
  - 🟢 Green (70-100): Excellent wellness
  - 🟡 Amber (40-70): Moderate wellness
  - 🔴 Red (0-40): Low wellness
- **Updates**: On page load, no manual refresh needed

#### 2. Wellness Breakdown Section
- **Location**: Below stat cards
- **Shows**: 6 category scores
  - 😴 Sleep Quality (0-20)
  - 🏃 Physical Activity (0-20)
  - 💓 Health Metrics (0-20)
  - 🧘 Stress Management (0-20)
  - 📅 Appointments (0-10)
  - ⭐ Engagement (0-10)
- **Visual**: Progress bars with color coding
- **Updates**: Automatically when you load/interact with dashboard

#### 3. Notifications
- **Location**: Right sidebar of dashboard
- **Shows**: Recent reminders and alerts
- **Types**:
  - 📅 Appointment reminders
  - 💪 Health recommendations
  - 💬 Coach notes
- **Auto-Updates**: Every 30 seconds

#### 4. Coach Recommendations
- **Location**: Below notifications
- **Shows**: Personalized insights from your coach
- **Updates**: Every 60 seconds

#### 5. Activity Feed
- **Location**: Bottom of dashboard
- **Shows**: Recent wellness activities
- **Activity Types**:
  - 📅 Appointments
  - 🛒 Store purchases
  - 💪 Health logs
  - 📄 Uploaded documents
  - 📋 Intake forms
- **Filtering**: Click type buttons to filter
- **Pagination**: Navigate through activities

#### 6. Health Data Form
- **Location**: Under "Health Data & Session Notes"
- **Accepts**:
  - Blood pressure (systolic/diastolic)
  - Heart rate (bpm)
  - Sleep hours
  - Weight (lbs)
- **Submit**: Adds data to wellness calculation

#### 7. Medical Report Upload
- **Location**: Under "Health Data & Session Notes"
- **Accepts**: PDF, DOC, DOCX files
- **Limit**: 10MB per file
- **Purpose**: Store medical documents with your profile

## 📊 How Wellness Score Works

### Scoring Breakdown
Each wellness dimension contributes to your overall score:

| Category | Max Points | What It Measures |
|----------|-----------|-----------------|
| Sleep | 20 | Hours slept per night (ideal: 7-9 hrs) |
| Activity | 20 | Exercise + coaching sessions |
| Health | 20 | Blood pressure, heart rate, weight |
| Stress | 20 | Stress level from intake form |
| Appointments | 10 | Sessions completed + scheduled |
| Engagement | 10 | Logs, documents, purchases |

### Score Range
- **90-100**: Excellent - Keep up the great habits!
- **70-89**: Good - You're on the right track
- **50-69**: Fair - Focus on weak areas
- **30-49**: Poor - Prioritize health improvements
- **0-29**: Critical - Seek professional guidance

## 🔧 Technical Details

### API Endpoints

**Get Wellness Score**
```
GET /api/wellness/history.php
```
Returns current score and 30-day history

**Calculate New Score**
```
GET /api/wellness/calculate.php
```
Calculates fresh wellness score from current data

**Share Health Data**
```
POST /api/users/share-health-data.php
```
Submit blood pressure, heart rate, sleep, weight

**Upload Medical Report**
```
POST /api/users/upload-medical-report.php
```
Upload PDF/DOC medical documents

**Get Notifications**
```
GET /api/notifications/dashboard.php
```
Fetch recent notifications and alerts

**Get Coach Recommendations**
```
GET /api/recommendations/coach.php
```
Fetch personalized coach insights

**Get Activity Feed**
```
GET /api/users/activity-feed.php?type=all&limit=10&offset=0
```
Fetch activity history with filtering

## ⚙️ Admin Configuration

### Modify Wellness Scoring Weights
Edit `/api/wellness/calculate.php` lines ~150-250

### Change Auto-Refresh Intervals
Edit `/dashboard/user/index.php`:
- Notifications: Change `setInterval(..., 30000)` (line ~573)
- Recommendations: Change `setInterval(..., 60000)` (line ~574)

### Customize Wellness Breakdown Colors
Edit `/dashboard/user/index.php` `renderWellnessBreakdown()` function (~820)

## 🐛 Troubleshooting

### Dashboard Not Loading
- ✅ Check authentication (must be logged in)
- ✅ Clear browser cache (Ctrl+Shift+R)
- ✅ Check browser console for errors (F12)

### Wellness Score Shows "No data yet"
- ✅ Submit health metrics through the form
- ✅ Schedule an appointment with a coach
- ✅ Wait 30 seconds for auto-refresh
- ✅ Manually refresh page (F5)

### Notifications Not Updating
- ✅ Check notification count badge (top right)
- ✅ Wait for 30-second refresh interval
- ✅ Check if you have scheduled appointments
- ✅ Submit an intake form to generate health recommendations

### File Upload Not Working
- ✅ Check file size (must be < 10MB)
- ✅ Check file type (only PDF, DOC, DOCX allowed)
- ✅ Check browser console for error messages
- ✅ Try uploading a different file

### Activity Feed Not Showing
- ✅ Create some activities (appointments, health logs, etc.)
- ✅ Check filter buttons (make sure "all" is selected)
- ✅ Manually refresh page
- ✅ Check browser console for errors

## 📱 Mobile Compatibility

The dashboard is responsive and works on:
- ✅ Desktop browsers (Chrome, Firefox, Safari, Edge)
- ✅ Tablets (iPad, Android tablets)
- ✅ Mobile phones (portrait and landscape)

**Best Experience**: Desktop or tablet view

## 🔒 Privacy & Security

All dashboard data:
- ✅ Requires authentication
- ✅ Only shows your personal data
- ✅ Uses secure HTTPS connections
- ✅ Medical files stored securely
- ✅ No data sharing without consent

## 📈 Improving Your Wellness Score

### To Increase Sleep Score
- Aim for 7-9 hours per night
- Log your sleep hours in the health form

### To Increase Activity Score
- Schedule coaching sessions
- Log exercise frequency in intake form
- Book more appointments

### To Improve Health Metrics
- Monitor blood pressure and heart rate
- Maintain stable weight
- Log metrics regularly

### To Boost Stress Management
- Rate your stress level in intake
- Work with your coach on stress reduction
- Use recommended wellness products

### To Increase Appointment Score
- Schedule upcoming sessions
- Complete scheduled sessions
- Follow through on coaching plans

### To Maximize Engagement
- Log health data regularly
- Upload medical documents
- Make wellness product purchases
- Complete intake forms

## 📚 Full Documentation

For detailed technical documentation, see:
- `WELLNESS_SCORING_IMPLEMENTATION.md` - Detailed scoring algorithm
- `HEALTH_DATA_IMPLEMENTATION.md` - Health metrics API
- `NOTIFICATIONS_IMPLEMENTATION.md` - Notifications system
- `ACTIVITY_FEED_IMPLEMENTATION.md` - Activity tracking
- `IMPLEMENTATION_SUMMARY.md` - Project overview

## ❓ FAQ

**Q: How often is my wellness score updated?**
A: On every page load. Schedule automated daily updates in cron jobs for future.

**Q: Can I see my wellness history?**
A: Yes, the API stores 30 days of history by default.

**Q: What if I disagree with my score?**
A: The score is based on objective data (appointments, logs, metrics). Update your data to improve.

**Q: How private is my health data?**
A: Completely private - only you and authenticated coaches can view it.

**Q: Can I export my wellness data?**
A: Not yet - feature coming soon!

**Q: Who can see my wellness score?**
A: Only you unless you explicitly share with coaches.

## 🚀 Getting Help

1. **Check the documentation** in the root directory
2. **Review the implementation guides** for technical details
3. **Check browser console** (F12) for error messages
4. **Contact your coach** for wellness guidance

---

**Last Updated**: 2024
**Version**: 1.0
**Status**: Production Ready ✅
