Skip to content

PredictCare is an AI-powered health risk prediction app built with the FARM stack. Users input health metrics like age, BMI, and blood pressure to get early predictions of conditions like diabetes or heart disease, helping them manage health proactively

Notifications You must be signed in to change notification settings

Kapeilaash/PredictCare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Smart Healthcare Assistant

A comprehensive AI-powered healthcare platform that provides disease prediction, health monitoring, and intelligent chatbot assistance.

Project Structure

Backend (FastAPI + Python)

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 (React + TypeScript)

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

Key Features

🔬 AI-Powered Disease Prediction

  • 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

💬 Intelligent Health Chatbot

  • 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

📊 Comprehensive Dashboard

  • 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

🔔 Smart Alerts & Notifications

  • 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

👤 User Management

  • 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

Technology Stack

Backend (FARM Stack)

  • 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

Frontend

  • 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

Infrastructure & DevOps

  • Docker: Containerization for easy deployment
  • MongoDB Atlas: Cloud database service
  • Vercel/Netlify: Frontend deployment platforms
  • Heroku/DigitalOcean: Backend deployment options

Getting Started

Prerequisites

  • Python 3.8+
  • Node.js 16+
  • MongoDB 4.4+
  • Git

Backend Setup

  1. Navigate to the backend directory:

    cd backend
  2. Create a virtual environment:

    python -m venv .venv
  3. 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
  4. Upgrade pip (recommended):

    python -m pip install --upgrade pip
  5. Install dependencies:

    pip install -r requirements.txt
  6. Set up environment variables:

    # On Windows:
    copy .env.example .env
    
    # On macOS/Linux:
    cp .env.example .env
    
    # Edit .env with your configuration
  7. Start the development server:

    uvicorn main:app --reload

Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Start the development server:

    npm start

Database Setup

  1. Install MongoDB locally or use MongoDB Atlas
  2. Create a database named healthcare_assistant
  3. Update the MONGODB_URL in your .env file

API Documentation

The API documentation is automatically generated and available at:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Development Guidelines

Code Style

  • Backend: Follow PEP 8 guidelines for Python
  • Frontend: Use ESLint and Prettier for code formatting
  • TypeScript: Strict type checking enabled

Testing

  • Backend: Use pytest for unit and integration tests
  • Frontend: Use Jest and React Testing Library

Security Considerations

  • JWT tokens for authentication
  • Input validation and sanitization
  • CORS configuration for cross-origin requests
  • Environment variables for sensitive data
  • Rate limiting for API endpoints

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -m 'Add feature'
  4. Push to the branch: git push origin feature-name
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

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.

About

PredictCare is an AI-powered health risk prediction app built with the FARM stack. Users input health metrics like age, BMI, and blood pressure to get early predictions of conditions like diabetes or heart disease, helping them manage health proactively

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published