A comprehensive personal health management system with AI-powered insights, digital diary, face recognition, and smart event management.A comprehensive full-stack health and wellness application with AI-powered features for personal health management, journaling, and intelligent assistance.
-
Calendar-based interface - Click any date to view entries for that day- AI Health Chat with dynamic response optimization
-
AI-powered daily summaries - Get comprehensive summaries of your day- AI Health Journal for conversational mood and symptom tracking
-
Monthly insights - Receive AI-generated monthly feedback and trends- Health Profile Management with smart onboarding
-
Mood tracking - Track your emotional wellbeing- Face Recognition for secure authentication
-
Activity logging - Record daily activities automatically- Health Records tracking and visualization
-
Smart conversations - Chat with AI to reflect on your day- Notifications & Reminders for medications and appointments
-
Edit & Delete - Full CRUD operations on events
-
Status indicators - Urgent, Today, Tomorrow, Upcoming, Past```
-
Priority badges - High π₯, Medium β‘, Low πgen_ai/
-
Countdown timers - See exactly when events are happeningβββ backend/ # Node.js + Express API
-
Tab navigation - Filter by All/Upcoming/Today/Pastβ βββ src/
-
AI suggestions - Get smart event recommendationsβ β βββ routes/ # API route definitions
β β βββ controllers/ # Request handlers
3. π Notification Systemβ β βββ models/ # MongoDB models (User, HealthRecord, JournalEntry, etc.)
-
Auto-refresh - New notifications every 30 secondsβ β βββ services/ # Business logic (aiService, journalAIService, emailService)
-
Sidebar badge - Real-time unread countβ β βββ middleware/ # Auth, validation, error handling
-
Email notifications - Optional email alertsβ β βββ utils/ # Helper functions
-
Event reminders - 24h and 1h before eventsβ β βββ config/ # Configuration files
-
Medication reminders - Daily at 8 AMβ βββ uploads/ # File uploads (health images, face recognition)
-
Weekly summaries - Every Monday at 9 AMβ βββ tests/ # Backend tests
β
-
Complete health tracking - Medical conditions, medications, allergiesβ βββ src/
-
Emergency contacts - Quick access to important contactsβ β βββ components/ # React components
-
Doctor information - Primary physician detailsβ β βββ pages/ # Page components (Dashboard, Profile, Chat, Journal)
-
Blood type & vitals - Essential health informationβ β βββ services/ # API service layer
-
Health records - Upload and analyze medical documentsβ β βββ context/ # React context (AuthContext)
β β βββ hooks/ # Custom React hooks
-
Register faces - Add family members and caregiversβ βββ public/ # Public files
-
Secure identification - Enhanced security featuresβ
-
Relationship tracking - Remember who's whoβββ README.md
-
Image gallery - View all registered faces```
-
Health queries - Ask health-related questions
-
Personalized responses - Context-aware AI assistance### Prerequisites
-
Conversation history - Review past conversations- Node.js (v16+)
-
Multiple conversations - Organize by topic- MongoDB (local or Atlas)
-
Google Gemini API Key
- Install dependencies:
npm install
-
Node.js (v14 or higher)```env
-
MongoDBPORT=5000
-
Google Gemini API keyMONGODB_URI=mongodb://localhost:27017/pda
JWT_SECRET=your-secret-key
EMAIL_USER=your-email@gmail.com
-
Clone the repositoryEMAIL_PASS=your-app-password
bashgit clone 4. Start server:
npm run devcd gen_ai
-
Navigate to frontend:
cd frontend -
Install backend dependencies2. Install dependencies:
npm install```bash3. Create
.envfile:cd backend```env
npm installVITE_API_URL=http://localhost:5000/api
-
Start dev server:
npm run dev -
Install frontend dependencies
cd ../frontend npm install### 1. **AI Health Chat with Dynamic Responses** ```The AI chat intelligently adjusts response length based on question complexity: -
Set up environment variables- Minimal (1-2 sentences): "hi", "thanks", "ok"
- Brief (2-3 sentences): "what is X?", simple questions
Create
backend/.env:- Concise (3-5 sentences): "how does X work?", explanationsPORT=5000- **Detailed** (2-4 paragraphs): comprehensive guides, step-by-step explanations MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret**Implementation:** GEMINI_API_KEY=your_gemini_api_key- `backend/src/services/aiService.js` - Smart complexity detection EMAIL_SERVICE=gmail- Dynamic prompt engineering based on question type EMAIL_USER=your_email@gmail.com- Conversation history context EMAIL_PASSWORD=your_email_password FRONTEND_URL=http://localhost:5173### 2. **AI Health Journal** ```Conversational journaling with AI that extracts structured health data: Create `frontend/.env`:**Templates:** ```env- Daily Check-in (mood, energy, wellbeing) VITE_API_BASE_URL=http://localhost:5000/api- Symptom Tracker (health symptoms, severity) ```- Medication Log (medications, side effects)
- Gratitude Journal (practice gratitude)
-
Start the backend server- Food Diary (meals, nutrition)
cd backend node src/server.js**Features:** ```- Natural conversation with AI
- Automatic data extraction (mood, symptoms, activities)
-
Start the frontend development server- Pattern detection and insights
cd frontend- Weekly summaries npm run dev- Export to PDF
API Endpoints:
-
Open your browser-
POST /api/journal/entries- Start new entry```-
POST /api/journal/entries/:id/messages- Add messagehttp://localhost:5173-
POST /api/journal/entries/:id/complete- Save entry```-
GET /api/journal/entries- List entries
GET /api/journal/insights- Get AI insights
Components:
frontend/src/pages/JournalHistory.jsx- Timeline & insights
-
Navigate to Journal - Click "Journal" in the sidebarFirst-time onboarding that appears only once:
-
View Calendar - See all your entries marked on calendar
-
Click a Date - View all entries and activities for that dayUser Flow:
-
New Entry - Click "New Entry" button to start writing1. New user registers β Onboarding appears automatically
-
Chat with AI - Tell the AI about your day2. User completes OR skips β Never shows again
-
Save Entry - Click "Save Entry" when done3. All data editable later in Profile > Health tab
-
Monthly Insights - Click "Get Monthly Insights" for AI analysis
Implementation:
POST /api/users/mark-onboarding-seen- Skip endpoint
-
Add Event - Click "Add Event" button- Skip shows toast: "Complete health profile anytime from Settings"
-
Fill Details - Title, date, time, type, priority- Profile page has full health editing capabilities
-
Edit Event - Click edit button on any event card
-
Delete Event - Click delete button to remove eventTracked Data:
-
Filter Events - Use tabs to filter by status- Demographics (age, gender, height, weight, blood type)
-
AI Suggestions - Enter what you need and get smart suggestions- Medical (conditions, medications, allergies)
- Lifestyle (activity, sleep, diet, smoking, alcohol)
- Doctor information
Automatic Reminders:- Health goals
-
Hourly: System checks for upcoming events
-
24h before event: First reminder sent### 4. Health Records Management
-
1h before event: Urgent reminder sentTrack and manage health records with file uploads:
-
Daily 8 AM: Medication reminders
-
Monday 9 AM: Weekly health summaryFeatures:
-
Upload medical documents, lab results, prescriptions
View Notifications:- Image attachments for health records
-
Check sidebar badge for unread count- Categorization and tagging
-
Navigate to Notifications page- Search and filtering
-
Filter by type or status- Timeline view
-
Mark as read or delete
API Endpoints:
GET /api/health-records- List records
-
Complete Onboarding - Fill in health information on first use-
PUT /api/health-records/:id- Update record -
Update Profile - Go to Profile β Edit health details-
DELETE /api/health-records/:id- Delete record -
Upload Records - Upload medical documents for AI analysis
-
View History - See all uploaded health records### 5. Face Recognition Authentication
Secure face-based authentication:
Features:
- Face login alternative
-
Framework: Node.js with Express- Secure image storage
-
Database: MongoDB with Mongoose
-
AI: Google Gemini 2.0 FlashAPI Endpoints:
-
Authentication: JWT tokens-
POST /api/face/register- Register face -
File Storage: Local filesystem-
POST /api/face/login- Face login -
Email: Nodemailer-
GET /api/face/images- List registered faces -
Scheduling: node-cron-
DELETE /api/face/:id- Remove face
-
Framework: React 18 with ViteEmail notifications for health events:
-
Routing: React Router v6
-
Styling: Tailwind CSSFeatures:
-
Icons: Lucide React- Medication reminders
-
Notifications: React Hot Toast- Appointment notifications
-
HTTP Client: Axios- Health alerts
-
Event reminders
gen_ai/- `backend/src/services/emailService.js` - Nodemailer integration
βββ backend/- Configurable notification preferences
β βββ src/
β β βββ controllers/ # Request handlers## π οΈ Technologies
β β βββ models/ # MongoDB schemas
β β βββ routes/ # API routes### Backend
β β βββ services/ # Business logic- **Runtime:** Node.js + Express.js
β β βββ middleware/ # Auth, error handling- **Database:** MongoDB + Mongoose
β β βββ utils/ # Helper functions- **Authentication:** JWT + bcrypt
β β βββ server.js # Entry point- **AI:** Google Gemini 2.0 Flash
β βββ uploads/ # File storage- **File Upload:** Multer
β βββ package.json- **Email:** Nodemailer
β- **Validation:** express-validator
βββ frontend/
β βββ src/### Frontend
β β βββ components/ # Reusable components- **Framework:** React 18 + Vite
β β βββ pages/ # Page components- **Routing:** React Router v6
β β βββ services/ # API calls- **HTTP Client:** Axios
β β βββ context/ # React context- **Styling:** Tailwind CSS
β β βββ hooks/ # Custom hooks- **Icons:** Lucide React
β β βββ styles/ # CSS files- **Notifications:** react-hot-toast
β βββ package.json- **State Management:** React Context API
β
βββ README.md## π‘ API Documentation
---- POST /api/auth/register - User registration
POST /api/auth/login- User login
-
POST /api/auth/register- Register new user-GET /api/users/profile- Get user profile -
POST /api/auth/login- Login user-PUT /api/users/profile- Update profile -
GET /api/auth/me- Get current user-PUT /api/users/health-profile- Update health profile -
POST /api/users/mark-onboarding-seen- Mark onboarding as seen
-
POST /api/journal/entries- Create entry### AI Chat -
GET /api/journal/entries- Get all entries-POST /api/ai/chat- Send message to AI -
GET /api/journal/entries/:id- Get single entry-GET /api/ai/history- Get chat history -
POST /api/journal/entries/:id/messages- Add message -
POST /api/journal/entries/:id/complete- Complete entry### Health Journal -
GET /api/journal/daily-summary- Get daily summary-POST /api/journal/entries- Start new journal entry -
GET /api/journal/monthly-insights- Get monthly insights-POST /api/journal/entries/:id/messages- Continue conversation -
POST /api/journal/entries/:id/complete- Complete entry
-
GET /api/events- Get all events-GET /api/journal/insights- Get AI insights -
POST /api/events- Create event -
PUT /api/events/:id- Update event### Health Records -
DELETE /api/events/:id- Delete event-POST /api/health-records- Create health record -
POST /api/events/suggest- Get AI suggestions-GET /api/health-records- List health records -
PUT /api/health-records/:id- Update health record
-
GET /api/users/health-profile- Get health profile -
PUT /api/users/health-profile- Update health profile### Face Recognition -
POST /api/upload/health-record- Upload health record-POST /api/face/register- Register face -
POST /api/face/login- Login with face
-
GET /api/notifications- Get all notifications -
POST /api/notifications- Create notification### Notifications -
PUT /api/notifications/:id/read- Mark as read-POST /api/notifications- Send notification -
PUT /api/notifications/read-all- Mark all as read-GET /api/notifications- Get user notifications -
DELETE /api/notifications/:id- Delete notification
-
GET /api/faces- Get all faces### Backend (.env) -
POST /api/faces/register- Register new face```env -
DELETE /api/faces/:id- Delete face# Server
PORT=5000
---NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/pda
-
JWT Authentication - Secure token-based auth
-
Password Hashing - bcrypt for password security# Authentication
-
CORS Protection - Configured for frontend originJWT_SECRET=your-secret-key-here
-
Input Validation - Mongoose schema validationJWT_EXPIRE=7d
-
File Upload Limits - Restricted file sizes
-
Environment Variables - Sensitive data in .env# AI Service
GEMINI_API_KEY=your-gemini-api-key
π Notification ScheduleEMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
| Type | Frequency | Time | Condition |EMAIL_FROM=PDA Health noreply@pda.com
|------|-----------|------|-----------|
| Event Reminders | Every hour | On the hour | Events in next 24h |# File Upload
| Medication Reminders | Daily | 8:00 AM | Has medications |MAX_FILE_SIZE=5242880
| Weekly Summary | Weekly | Monday 9:00 AM | Has activity |UPLOAD_PATH=./uploads
---
### Frontend (.env)
## π¨ Features in Detail```env
VITE_API_URL=http://localhost:5000/api
### Calendar JournalVITE_APP_NAME=Personal Digital Assistant
What makes it special:
-
Calendar interface - See your life at a glance## π¨ Key Components
-
Daily summaries - AI combines all activities for the day
-
Monthly feedback - Get insights on patterns and trends### Frontend Pages
-
Mood tracking - Visual mood indicators- Dashboard.jsx - Main dashboard with health overview
-
Activity integration - Combines journal + events + health- Profile.jsx - User profile and health settings
-
Chat.jsx - AI health chat interface
How it works:- JournalChat.jsx - Conversational journaling
-
Write journal entries through chat interface- JournalHistory.jsx - Journal timeline and insights
-
Entries are marked on calendar- HealthRecords.jsx - Health records management
-
Click any date to see that day's summary
-
Request monthly insights for trend analysis### Backend Services
-
AI analyzes mood, activities, and patterns- aiService.js - AI chat with dynamic response optimization
- journalAIService.js - Journal conversation and data extraction
- userService.js - User management
Enhancements:
-
β Edit events after creation### Key Features Implementation
-
β Delete unwanted events
-
β Status-based filtering#### AI Response Optimization
-
β Visual priority indicators```javascript
-
β Time countdowns// Automatically detects question complexity
-
β AI-powered suggestionsconst complexity = determineQuestionComplexity(question);
// Adjusts response length accordingly
**Types:**
- π General - System updates#### Health Onboarding
- π₯ Health - Health-related alerts```javascript
- π Medication - Medicine reminders// Shows only if never seen AND not completed
- π
Appointment - Doctor visitsif (!healthProfile?.hasSeenOnboarding && !healthProfile?.isProfileComplete) {
- π― Event - Calendar events // Show onboarding
- β οΈ Alert - Urgent notifications}
Delivery:
-
In-app notifications (always)#### Journal AI Extraction
-
Email notifications (optional)```javascript
-
Auto-refresh every 30s// Extracts structured data from conversation
-
Sidebar badge with countconst data = extractStructuredData(conversation);
// Contains: mood, moodScore, symptoms, activities, etc.
---```
-
Check MongoDB connection string- Authentication (email, password)
-
Verify Gemini API key is valid- Profile (name, age, gender)
-
Ensure port 5000 is available- Health Profile (medical, lifestyle, goals)
-
Check all environment variables- Onboarding tracking (hasSeenOnboarding, isProfileComplete)
-
Verify backend is running- Type, title, description
-
Check VITE_API_BASE_URL in .env- Date, category, tags
-
Clear browser cache- File attachments
-
Check browser console for errors- User reference
-
Check email credentials in .env- Conversation messages
-
Verify user has notifications enabled- Extracted data (mood, symptoms, activities)
-
Check MongoDB connection- AI insights
-
Review backend logs for errors- Template type
-
Check journal entries exist- User reference
-
Verify API endpoints are working- Image path
-
Clear browser cache- Registration date
-
Check date filtering logic
- Health onboarding (first-time only)
-
β Calendar-based journal interface- [ ] AI chat with various question types
-
β Daily AI summaries- [ ] Journal entry creation with all templates
-
β Monthly AI insights- [ ] Health record upload
-
β Edit & delete events- [ ] Face registration and login
-
β Fixed health profile updates- [ ] Profile editing
-
β Auto-refreshing notifications- [ ] Email notifications
-
β Sidebar notification badge
-
β Enhanced event status system## π§ Roadmap
---- [x] AI Health Chat with dynamic responses
- AI Health Journal system
- Face recognition
-
Real-time WebSocket notifications- [ ] Health trends visualization (charts/graphs)
-
Browser push notifications- [ ] Emergency contact integration
-
Custom medication reminder times- [ ] Enhanced chatbot with scheduling
-
Notification snooze feature- [ ] Multi-device sync
-
Mobile responsive improvements- [ ] Role-based access (caregivers)
-
Two-factor authentication
-
Export journal as PDF
-
Voice input for journal entries## π License
-
Integration with health devices
-
Multi-language supportMIT License
-
Dark mode
-
Social features (share entries)Anil Chowdary
-
Third-party calendar sync
-
Advanced analytics dashboard## π Acknowledgments
-
Machine learning predictions
-
Mobile app (React Native)- Google Gemini AI for intelligent conversation
-
MongoDB for flexible data storage
---- React team for amazing frontend framework
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For issues, questions, or suggestions:
- Open an issue on GitHub
- Email: support@healthassistant.com
- Documentation: Check this README
- Google Gemini AI - Powering intelligent conversations
- MongoDB - Reliable database solution
- React - Building interactive UIs
- Tailwind CSS - Beautiful styling
- Open Source Community - Various libraries and tools
Version: 2.0
Last Updated: December 2024
Status: Production Ready β
# Start backend
cd backend && node src/server.js
# Start frontend
cd frontend && npm run dev
# Access application
http://localhost:5173Happy Journaling! πβ¨