A comprehensive AI-powered healthcare platform that provides disease prediction, health monitoring, and intelligent chatbot assistance.
backend/
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── core/
│ ├── config.py # Application configuration
│ ├── database.py # MongoDB connection and setup
│ └── ml_models.py # ML model management
├── models/ # Database models (Beanie/MongoDB)
│ ├── user.py # User model
│ ├── health_record.py # Health records model
│ ├── prediction.py # Prediction results model
│ └── chat_history.py # Chat conversation model
├── api/
│ └── routes/ # API route handlers
│ ├── auth.py # Authentication endpoints
│ ├── users.py # User management endpoints
│ ├── predictions.py # Disease prediction endpoints
│ ├── chat.py # Chatbot endpoints
│ ├── dashboard.py # Dashboard analytics endpoints
│ └── alerts.py # Notification endpoints
└── models/ # ML model files (to be created)
├── heart_disease_model.joblib
└── diabetes_model.joblib
frontend/
├── package.json # Node.js dependencies
├── public/
│ ├── index.html # Main HTML template
│ └── manifest.json # PWA manifest
├── src/
│ ├── index.tsx # Application entry point
│ ├── App.tsx # Main App component
│ ├── index.css # Global styles
│ ├── types/
│ │ └── index.ts # TypeScript type definitions
│ ├── contexts/
│ │ └── AuthContext.tsx # Authentication context
│ ├── services/
│ │ └── api.ts # API service layer
│ ├── components/
│ │ ├── common/ # Reusable components
│ │ │ └── LoadingSpinner.tsx
│ │ ├── layout/ # Layout components
│ │ │ └── Navbar.tsx
│ │ ├── forms/ # Form components
│ │ ├── charts/ # Chart components
│ │ └── prediction/ # Prediction-specific components
│ └── pages/ # Page components
│ ├── auth/ # Authentication pages
│ │ ├── LoginPage.tsx
│ │ └── RegisterPage.tsx
│ ├── dashboard/ # Dashboard page
│ │ └── DashboardPage.tsx
│ ├── predictions/ # Prediction pages
│ │ └── PredictionsPage.tsx
│ ├── chat/ # Chat page
│ │ └── ChatPage.tsx
│ ├── profile/ # Profile page
│ │ └── ProfilePage.tsx
│ └── health/ # Health records page
│ └── HealthRecordsPage.tsx
- Heart Disease Prediction: ML model trained on cardiovascular risk factors
- Diabetes Risk Assessment: Predictive model for diabetes onset
- Risk Factor Analysis: Identifies key health risks and provides recommendations
- Multiple Model Support: Extensible architecture for additional disease models
- NLP-Powered Conversations: Uses transformer models for natural language understanding
- Health Q&A: Answers medical questions with contextual awareness
- Emergency Detection: Identifies urgent health situations requiring immediate attention
- Conversation History: Maintains chat history for better context
- Health Analytics: Visual representation of health trends and predictions
- Risk Distribution: Charts showing risk levels across different health areas
- Prediction History: Timeline of all health assessments
- Personalized Insights: AI-generated health recommendations
- Risk-Based Alerts: Automatic notifications for high-risk predictions
- Email & SMS Support: Multiple delivery channels for critical alerts
- Health Reminders: Scheduled notifications for health monitoring
- Emergency Contacts: Automatic notification of emergency contacts when needed
- Secure Authentication: JWT-based authentication with role-based access
- Health Profiles: Comprehensive user health information management
- Medical History: Track allergies, medications, and past conditions
- Privacy Controls: User-controlled data sharing and privacy settings
- FastAPI: Modern, fast web framework for building APIs
- MongoDB: NoSQL database for flexible health data storage
- Beanie: MongoDB ODM for Python with Pydantic integration
- Scikit-learn: Machine learning library for predictive models
- Transformers: Hugging Face library for NLP models
- PyTorch: Deep learning framework for advanced AI models
- React 18: Modern React with hooks and concurrent features
- TypeScript: Type-safe JavaScript for better development experience
- Material-UI: Professional React component library
- React Query: Data fetching and caching library
- Recharts: Charting library for health data visualization
- React Router: Client-side routing for single-page application
- Docker: Containerization for easy deployment
- MongoDB Atlas: Cloud database service
- Vercel/Netlify: Frontend deployment platforms
- Heroku/DigitalOcean: Backend deployment options
- Python 3.8+
- Node.js 16+
- MongoDB 4.4+
- Git
-
Navigate to the backend directory:
cd backend -
Create a virtual environment:
python -m venv .venv
-
Activate the virtual environment:
# On Windows (PowerShell/CMD): .venv\Scripts\activate # On Windows (Git Bash): source .venv/Scripts/activate # On macOS/Linux: source .venv/bin/activate
-
Upgrade pip (recommended):
python -m pip install --upgrade pip
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
# On Windows: copy .env.example .env # On macOS/Linux: cp .env.example .env # Edit .env with your configuration
-
Start the development server:
uvicorn main:app --reload
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm start
- Install MongoDB locally or use MongoDB Atlas
- Create a database named
healthcare_assistant - Update the
MONGODB_URLin your.envfile
The API documentation is automatically generated and available at:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
- Backend: Follow PEP 8 guidelines for Python
- Frontend: Use ESLint and Prettier for code formatting
- TypeScript: Strict type checking enabled
- Backend: Use pytest for unit and integration tests
- Frontend: Use Jest and React Testing Library
- JWT tokens for authentication
- Input validation and sanitization
- CORS configuration for cross-origin requests
- Environment variables for sensitive data
- Rate limiting for API endpoints
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit your changes:
git commit -m 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions, please open an issue in the GitHub repository or contact the development team.
Note: This is a comprehensive healthcare platform. Always consult with healthcare professionals for medical advice. This system is designed to supplement, not replace, professional medical consultation.