Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

87 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ₯ AI Healthcare Assessment System

CI/CD Pipeline Security Scan Code Quality Deployment

Backend Coverage Frontend Coverage Security Tests Database Tests

Python FastAPI PostgreSQL Next.js Mantine HIPAA

Deploy with Vercel Live Demo

Enterprise-grade HIPAA-compliant healthcare platform with enterprise security, database integration, and comprehensive testing. Combines Google Gemini AI with machine learning for intelligent medical risk assessment.

🎯 Live Demo

πŸš€ Try it now: ai-health-screening.vercel.app


πŸ† Project Highlights

οΏ½ Enterprise Security (Phase 10)

  • JWT Authentication - Role-based access control (RBAC)
  • Multi-Factor Authentication - TOTP-based 2FA implementation
  • Data Encryption - AES-256 field-level encryption
  • HIPAA Compliance - Full audit logging and privacy controls
  • API Security - Rate limiting, input validation, threat detection
  • Real-time Monitoring - Security event tracking and alerting

πŸ—„οΈ Database & Data Management (Phase 9)

  • PostgreSQL/Supabase - Production-grade cloud database
  • SQLAlchemy ORM - Async database operations
  • Data Models - Patient records, assessments, audit logs
  • Relationship Management - Foreign keys and data integrity
  • Migration Support - Schema versioning and updates
  • Backup & Recovery - Automated data protection

🎨 Professional Healthcare UI (Phase 8)

  • Medical-grade interface designed for healthcare workflows
  • Comprehensive form validation with real-time feedback
  • Professional assessment reports with clinical reasoning
  • Mobile-responsive design for all devices
  • Accessibility compliant (WCAG 2.1 standards)

πŸ”¬ AI/ML Integration

  • Google Gemini Pro - Advanced medical reasoning and clinical analysis
  • Scikit-learn ML - Risk scoring algorithms with demographic factors
  • Hybrid Intelligence - Combines modern LLMs with traditional ML

πŸ—οΈ Enterprise Architecture

  • FastAPI Backend - High-performance async API
  • Microservices Design - Modular, scalable architecture
  • CI/CD Pipeline with comprehensive testing
  • Production error handling and graceful fallbacks

πŸ› οΈ Tech Stack

Backend & Security

  • Python 3.13 - Modern backend language
  • FastAPI - High-performance async web framework
  • SQLAlchemy - Advanced ORM with async support
  • PostgreSQL - Production database (Supabase)
  • JWT + MFA - Enterprise authentication
  • AES-256 Encryption - Data protection at rest
  • HIPAA Compliance - Healthcare security standards

AI & Machine Learning

  • Google Gemini AI - Advanced medical AI analysis
  • Scikit-learn - Machine learning risk assessment
  • Pandas & NumPy - Data processing and analysis
  • ML Model Versioning - Production model management

Frontend

  • Next.js 15 - React framework with TypeScript
  • Mantine UI - Professional component library
  • Real-time validation - Form validation with error handling
  • Responsive design - Mobile-first approach

DevOps & Deployment

  • GitHub Actions - CI/CD automation
  • Comprehensive Testing - 41+ tests across security & database
  • Environment management - Secure configuration
  • Production monitoring - Health checks and alerting

πŸ₯ Features

πŸ”’ Enterprise Security Features

  • βœ… Role-Based Access Control - Admin, Healthcare Provider, Patient, Auditor roles
  • βœ… Multi-Factor Authentication - TOTP-based 2FA
  • βœ… Data Encryption - AES-256 encryption for sensitive data
  • βœ… Audit Logging - Comprehensive HIPAA-compliant activity tracking
  • βœ… API Security - Rate limiting, input validation, threat detection
  • βœ… Security Monitoring - Real-time threat detection and response

πŸ—„οΈ Data Management

  • βœ… Patient Records - Comprehensive medical history tracking
  • βœ… Assessment History - Complete evaluation timeline
  • βœ… ML Model Versioning - Production model management
  • βœ… Audit Trail - Full data access logging
  • βœ… Data Relationships - Referential integrity
  • βœ… Backup & Recovery - Automated data protection

πŸ”¬ Intelligent Health Assessment

  • βœ… Symptom Analysis - Advanced parsing of medical descriptions
  • βœ… Risk Stratification - ML-powered risk scoring (0-100 scale)
  • βœ… Clinical Reasoning - AI-generated medical explanations
  • βœ… Emergency Detection - Automated urgency classification
  • βœ… Demographic Factors - Age, gender, and history consideration

🎨 Professional Medical Interface

  • βœ… Healthcare-grade UI - Professional medical design patterns
  • βœ… Form Validation - Real-time input validation and feedback
  • βœ… Assessment Reports - Clinical-grade result presentation
  • βœ… Mobile Responsive - Works on all device sizes
  • βœ… Accessibility - WCAG 2.1 compliant interface

πŸ“Š Testing & Quality Assurance

Security Testing (27/27 tests passing)

  • Authentication & Authorization tests
  • Data encryption & privacy tests
  • HIPAA compliance validation
  • Input validation & sanitization
  • Rate limiting & API security
  • Security monitoring & threat detection

Database Testing (14/14 tests passing)

  • Model structure validation
  • CRUD operations testing
  • Relationship integrity
  • Audit logging verification
  • Security compliance
  • Data classification

Coverage Metrics

  • Backend: 90%+ test coverage
  • Security: 100% critical path coverage
  • Database: 100% model coverage
  • API Endpoints: Comprehensive integration tests

πŸš€ Quick Start

Prerequisites

# Required software
Python 3.13+
Node.js 18+
PostgreSQL (or Supabase account)

Backend Setup

# Clone and setup backend
git clone https://github.com/yourusername/ai-health-screening.git
cd ai-health-screening

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Setup environment variables
cp .env.example .env
# Edit .env with your API keys and database URL

# Initialize database
python -c "from database.database import init_db; import asyncio; asyncio.run(init_db())"

# Run backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000

Frontend Setup

# Setup frontend
cd frontend
npm install

# Setup environment variables
cp .env.local.example .env.local
# Edit with your backend URL

# Run frontend
npm run dev

Run Tests

# Security tests
python -m pytest tests/security/ -v

# Database tests
python -m pytest tests/test_database.py -v

# All tests
python -m pytest -v

πŸ”’ Security & Compliance

HIPAA Compliance Features

  • Administrative Safeguards: Role-based access controls, security training documentation
  • Physical Safeguards: Application-level security controls and data protection
  • Technical Safeguards: Access control, audit controls, integrity protection, transmission security

Security Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend UI   β”‚    β”‚   Security       β”‚    β”‚   Database      β”‚
β”‚                 β”‚    β”‚   Middleware     β”‚    β”‚                 β”‚
β”‚ β€’ Input Valid.  │───▢│ β€’ Authentication │───▢│ β€’ Encrypted     β”‚
β”‚ β€’ Rate Limiting β”‚    β”‚ β€’ Authorization  β”‚    β”‚ β€’ Audit Logs    β”‚
β”‚ β€’ CSRF Protect. β”‚    β”‚ β€’ Rate Limiting  β”‚    β”‚ β€’ Relationships β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Protection

  • Encryption: AES-256 for sensitive data, RSA-2048 for key exchange
  • Anonymization: Automatic PII detection and anonymization
  • Audit Trail: Complete access logging for compliance
  • Data Retention: Configurable retention policies (7 years default)

πŸ“‚ Project Structure

ai-health-screening/
β”œβ”€β”€ πŸ”’ security/                 # Enterprise security modules
β”‚   β”œβ”€β”€ auth.py                 # JWT, RBAC, MFA
β”‚   β”œβ”€β”€ privacy.py              # Encryption, HIPAA compliance
β”‚   β”œβ”€β”€ api_security.py         # Input validation, rate limiting
β”‚   β”œβ”€β”€ middleware.py           # FastAPI security middleware
β”‚   └── routes.py               # Secure API endpoints
β”‚
β”œβ”€β”€ πŸ—„οΈ database/                # Database layer
β”‚   β”œβ”€β”€ database.py             # Async database connection
β”‚   β”œβ”€β”€ models.py               # SQLAlchemy models
β”‚   └── migrations/             # Database migrations
β”‚
β”œβ”€β”€ 🧠 ml_services/             # Machine learning
β”‚   └── health_ml_service.py    # Risk assessment models
β”‚
β”œβ”€β”€ πŸ”§ services/                # Business logic
β”‚   └── ai_health_service.py    # AI integration service
β”‚
β”œβ”€β”€ πŸ§ͺ tests/                   # Comprehensive testing
β”‚   β”œβ”€β”€ security/               # Security test suite (27 tests)
β”‚   └── test_database.py        # Database tests (14 tests)
β”‚
β”œβ”€β”€ 🎨 frontend/                # Next.js frontend
β”‚   β”œβ”€β”€ src/app/                # App router
β”‚   β”œβ”€β”€ src/components/         # React components
β”‚   └── src/lib/                # Frontend utilities
β”‚
β”œβ”€β”€ πŸš€ api/                     # Serverless API endpoints
β”œβ”€β”€ πŸ“‹ docs/                    # Documentation
β”œβ”€β”€ πŸ”§ .github/workflows/       # CI/CD pipelines
└── πŸ“Š monitoring/              # Health checks & metrics

πŸ₯ API Endpoints

Public Endpoints

  • GET /health - System health check
  • POST /assess-health - Health assessment (rate limited)

Authentication Endpoints

  • POST /auth/login - User login with JWT
  • POST /auth/logout - Session termination
  • POST /auth/mfa/verify - Multi-factor authentication
  • POST /auth/refresh - Token refresh

Protected Endpoints

  • GET /assessment/history - User's assessment history
  • POST /assessment/submit - Submit new assessment
  • GET /admin/users - User management (admin only)
  • GET /audit/logs - Audit trail access (auditor role)

Health Endpoints

  • GET /health - Application health status
  • GET /metrics - Performance metrics
  • GET /security/status - Security monitoring

πŸ”§ Configuration

Environment Variables

# Database
DATABASE_URL=postgresql://user:pass@host:5432/db

# AI Services
GEMINI_API_KEY=your_gemini_api_key

# Security
JWT_SECRET_KEY=your_super_secure_secret_key
JWT_ALGORITHM=HS256
JWT_EXPIRATION_HOURS=24

# API Security
RATE_LIMIT_REQUESTS_PER_MINUTE=100
API_KEY_EXPIRATION_DAYS=30

# HIPAA Compliance
AUDIT_LOG_RETENTION_DAYS=2555  # 7 years
ENCRYPTION_KEY=your_encryption_key

Database Configuration

# Production database settings
DATABASE_SETTINGS = {
    "pool_size": 20,
    "max_overflow": 0,
    "pool_pre_ping": True,
    "pool_recycle": 300,
    "echo": False  # Set True for SQL debugging
}

πŸš€ Deployment

Production Deployment

# Database migration
alembic upgrade head

# Security check
python -m pytest tests/security/ -v

# Deploy to production
git push origin main  # Triggers CI/CD pipeline

Docker Deployment

# Build container
docker build -t ai-health-screening .

# Run with environment
docker run -d \
  -p 8000:8000 \
  -e DATABASE_URL=$DATABASE_URL \
  -e GEMINI_API_KEY=$GEMINI_API_KEY \
  --name health-app \
  ai-health-screening

πŸ“ˆ Performance & Monitoring

Performance Metrics

  • Response Time: <200ms for health assessments
  • Throughput: 1000+ requests/minute with rate limiting
  • Uptime: 99.9% availability target
  • Security: Real-time threat monitoring

Monitoring Stack

  • Health Checks: Automated endpoint monitoring
  • Security Alerts: Real-time threat detection
  • Performance Metrics: Request timing and throughput
  • Audit Logging: Complete compliance tracking

🀝 Contributing

Development Setup

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Run tests: python -m pytest -v
  4. Commit changes: git commit -m 'Add amazing feature'
  5. Push to branch: git push origin feature/amazing-feature
  6. Open Pull Request

Testing Requirements

  • All new features must include tests
  • Security tests must pass: pytest tests/security/
  • Database tests must pass: pytest tests/test_database.py
  • Code coverage must remain above 90%

πŸ“‹ License

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


πŸ† Achievements

Enterprise Features Completed

  • βœ… Phase 8: Professional Healthcare UI
  • βœ… Phase 9: Database Integration & Data Management
  • βœ… Phase 10: Enterprise Security & HIPAA Compliance

Test Coverage

  • βœ… 41+ Tests: Comprehensive testing suite
  • βœ… Security: 27/27 tests passing
  • βœ… Database: 14/14 tests passing
  • βœ… 90%+ Coverage: High code coverage standards

Production Ready

  • βœ… HIPAA Compliant: Healthcare security standards
  • βœ… Enterprise Security: JWT, MFA, encryption, audit logging
  • βœ… Scalable Database: PostgreSQL with async operations
  • βœ… Professional UI: Healthcare-grade interface design

Built with ❀️ for healthcare innovation

About

AI Healthcare Assessment System - Professional medical analysis with Google Gemini AI + ML risk scoring. Python backend, Next.js frontend, always-on Vercel deployment.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages