Skip to content

AmineMekki01/healthcare_management_platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TBIBI Healthcare Management Platform

Bridging Healthcare Gaps with Technology

A comprehensive, full-stack healthcare management platform featuring a Go backend API, React frontend, Python RAG system, and search services. Designed to streamline healthcare access and delivery for patients, doctors, and administrative staff.

πŸ—οΈ System Architecture

The platform follows a microservices architecture with clear separation of concerns:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   Backend API   β”‚    β”‚   RAG Service   β”‚    β”‚  Search Service β”‚
β”‚   (React)       │◄──►│     (Go)        │◄──►│   (Python)      │◄──►│   (Python)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                       β”‚                       β”‚                     
    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”         
    β”‚Material β”‚             β”‚PostgreSQLβ”‚             β”‚ Vector  β”‚         
    β”‚   UI    β”‚             β”‚Database  β”‚             β”‚Database β”‚            
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            

🎯 Core Principles

  • Domain-Driven Design: Features organized by business domains
  • Microservices: Loosely coupled, independently deployable services
  • API-First: RESTful APIs with comprehensive documentation
  • Real-time: WebSocket integration for instant communication
  • Scalable: Containerized deployment with Docker

πŸ“ Project Structure

healthcare_management_platform/
β”œβ”€β”€ backend_go/                       # Go Backend API
β”‚   β”œβ”€β”€ main.go                       # Application entry point
β”‚   β”œβ”€β”€ pkg/
β”‚   β”‚   β”œβ”€β”€ config/                   # Configuration management
β”‚   β”‚   β”œβ”€β”€ database/                 # Database layer & migrations
β”‚   β”‚   β”œβ”€β”€ auth/                     # JWT authentication utilities
β”‚   β”‚   β”œβ”€β”€ middleware/               # HTTP middleware (auth, CORS)
β”‚   β”‚   β”œβ”€β”€ models/                   # Data models & structures
β”‚   β”‚   β”œβ”€β”€ handlers/                 # HTTP request handlers
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/                 # Authentication endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ appointment/          # Appointment management
β”‚   β”‚   β”‚   β”œβ”€β”€ doctor/               # Doctor-specific endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ patient/              # Patient-specific endpoints
β”‚   β”‚   β”‚   β”œβ”€β”€ chat/                 # Real-time messaging
β”‚   β”‚   β”‚   └── receptionist/         # Receptionist management
β”‚   β”‚   β”œβ”€β”€ services/                 # Business logic layer
β”‚   β”‚   β”œβ”€β”€ routes/                   # Route definitions
β”‚   β”‚   β”œβ”€β”€ utils/                    # Utility functions
β”‚   β”‚   └── validators/               # Input validation
β”‚   β”œβ”€β”€ docker-compose.yml            # Docker services configuration
β”‚   β”œβ”€β”€ Dockerfile                    # Container build instructions
β”‚   β”œβ”€β”€ go.mod                        # Go module definition
β”‚   └── go.sum                        # Dependency checksums
β”œβ”€β”€ frontend/                         # React Frontend Application
β”‚   β”œβ”€β”€ public/                       # Static assets
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ features/                 # Feature-based architecture
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/                 # Authentication & authorization
β”‚   β”‚   β”‚   β”œβ”€β”€ appointments/         # Appointment management
β”‚   β”‚   β”‚   β”œβ”€β”€ chat/                 # Real-time messaging
β”‚   β”‚   β”‚   β”œβ”€β”€ medical-records/      # Document management
β”‚   β”‚   β”‚   β”œβ”€β”€ user-management/      # User profiles
β”‚   β”‚   β”‚   └── ...                   # Other features
β”‚   β”‚   β”œβ”€β”€ components/               # Shared UI components
β”‚   β”‚   β”œβ”€β”€ contexts/                 # React contexts
β”‚   β”‚   β”œβ”€β”€ hooks/                    # Custom React hooks
β”‚   β”‚   └── pages/                    # Top-level pages
β”‚   β”œβ”€β”€ package.json                  # Dependencies & scripts
β”‚   └── tailwind.config.js            # Tailwind CSS configuration
β”œβ”€β”€ rag_app_python/                   # Python RAG Service
β”‚   β”œβ”€β”€ src/app/                      # FastAPI application
β”‚   β”œβ”€β”€ db/                           # Database migrations & queries
β”‚   β”œβ”€β”€ requirements/                 # Python dependencies
β”‚   └── pyproject.toml                # Project configuration
β”œβ”€β”€ search_service_python/            # Python Search Service
β”‚   β”œβ”€β”€ src/                          # Search API implementation
β”‚   β”œβ”€β”€ requirements/                 # Python dependencies
β”‚   └── Dockerfile                    # Container build instructions
β”œβ”€β”€ generate_test_data.py             # Test data generation script
└── README.md                         # This documentation

πŸš€ Quick Start

Prerequisites

  • Go 1.24.4 (for backend)
  • Node.js 16+ (v22.14.0+ recommended)
  • React 18.2.0 (included with Create React App)
  • Python 3.11+ (for RAG and search services)
  • Docker & Docker Compose (recommended)
  • PostgreSQL 15+ (or use Docker)

Manual Setup

Backend Setup

cd backend_go

# Create environment file
cp .env.example .env
# Edit .env with your configuration

# Install dependencies and run
go mod tidy
go run main.go # or u can build and run executable

Frontend Setup

cd frontend

# Install dependencies
npm install

# Start development server
npm start

Python Services Setup

# RAG Service
cd rag_app_python
pip install -r requirements/requirements.txt
python -m uvicorn src.app.main:app --reload --port 8000

# Search Service
cd search_service_python
pip install -r requirements/requirements.txt
python src/api.py

Environment Configuration

Create .env files in respective directories:

Backend (.env)

# Database
DATABASE_HOST=your_database_host
DATABASE_PORT=your_database_port
DATABASE_USER=your_database_user
DATABASE_PASSWORD=your_database_password
DATABASE_NAME=your_database_name

# Server
SERVER_PORT=your_server_port

# JWT
JWT_SECRET_KEY=your_super_secret_jwt_key
REFRESH_SECRET=your_refresh_token_secret

# AWS S3 (optional)
S3_BUCKET_NAME=your-s3-bucket
AWS_REGION=your-aws-region
AWS_ACCESS_KEY=your_access_key
AWS_SECRET_KEY=your_secret_key

# Email (optional)
SMTP_EMAIL=[email protected]
SMTP_EMAIL_PASSWORD=your_app_password

Frontend (.env)

REACT_APP_API_URL=http://localhost:3001
REACT_APP_WEBSOCKET_URL=ws://localhost:3001
REACT_APP_GOOGLE_MAPS_API_KEY=your_google_maps_key

πŸ₯ Core Features

🎯 Multi-Role Platform

User Types & Capabilities:

πŸ‘¨β€βš•οΈ Doctors

  • Complete practice management dashboard
  • Patient appointment scheduling and management
  • Medical report creation and diagnosis tracking
  • AI-powered chatbot for patient data analysis
  • Content creation (health articles and blog posts)
  • Staff management (hire and manage receptionists)
  • Real-time chat with patients and staff

πŸ‘€ Patients

  • Doctor search and discovery with advanced filters
  • Online appointment booking with real-time availability
  • Medical records and document management
  • Secure messaging with healthcare providers
  • Health content feed and educational resources
  • Appointment history and medical timeline

πŸ‘©β€πŸ’Ό Receptionists

  • Patient management and registration
  • Appointment scheduling for assigned doctors
  • Patient search and information management
  • Administrative dashboard with key metrics
  • Communication tools for patient coordination

πŸ” Authentication & Security

  • Multi-role Authentication: Role-based login system
  • JWT Security: Secure token-based authentication with refresh tokens
  • Email Verification: Account activation and password reset
  • Role-based Access Control: Feature access based on user permissions
  • Session Management: Automatic logout and token refresh

πŸ“… Advanced Appointment System

  • Smart Scheduling: AI-enhanced appointment booking
  • Real-time Availability: Live calendar updates
  • Conflict Prevention: Automatic double-booking prevention
  • Cancellation Management: Reason tracking and rescheduling
  • Statistics Dashboard: Appointment analytics and insights
  • Notification System: Email and in-app appointment reminders

πŸ₯ Comprehensive Medical Records

  • Digital Health Records: Complete patient medical history
  • Document Management: Secure file upload and sharing
  • Medical Reports: Detailed appointment reports with diagnosis
  • Prescription Tracking: Medication history and current prescriptions
  • Referral System: Seamless doctor-to-doctor patient referrals
  • Medical Timeline: Chronological health event tracking

πŸ’¬ Real-time Communication

  • WebSocket Chat: Instant messaging between all user types
  • Media Sharing: Image and file sharing capabilities
  • Chat History: Persistent message storage and search
  • User Discovery: Find and connect with healthcare providers
  • Group Messaging: Multi-participant conversations

πŸ€– AI-Powered Features

  • Medical Chatbot: AI assistant for symptom analysis and doctor recommendations
  • Smart Search: AI-enhanced doctor discovery with specialty matching
  • Document Analysis: Automated medical document processing
  • Predictive Analytics: Health trend analysis and insights
  • RAG System: Retrieval-Augmented Generation for medical queries

πŸ“± Social Health Platform

  • Health Feed: Curated medical content and articles
  • Doctor Blogging: Healthcare professionals can publish content
  • Community Engagement: Comments, likes, and social interactions
  • Follow System: Patients can follow trusted healthcare providers
  • Content Discovery: Specialty-based content filtering

πŸ” AI-Powered Search Services

  • OpenAI Integration: Intelligent symptom analysis and specialty matching
  • Smart Doctor Recommendations: AI-driven doctor suggestions based on symptoms
  • Multi-criteria Filtering: Location, specialty, availability filtering
  • Natural Language Processing: Symptom-to-specialty mapping

πŸ”§ Technical Implementation

πŸ—οΈ Backend Architecture (Go)

Technology Stack:

  • Framework: Gin HTTP framework
  • Database: PostgreSQL with pgx driver
  • Authentication: JWT with refresh tokens
  • Real-time: WebSocket for chat functionality
  • File Storage: AWS S3 integration
  • Email: SMTP for notifications
  • Containerization: Docker & Docker Compose

βš›οΈ Frontend Architecture (React)

Technology Stack:

  • Framework: React 18.2.0 with Create React App
  • UI Library: Material-UI (MUI) 5.16.7
  • Styling: Tailwind CSS 3.3.3 + Flowbite components
  • State Management: React Context API + Recoil
  • Routing: React Router DOM 6.16.0
  • HTTP Client: Axios with interceptors
  • Real-time: WebSocket integration
  • Charts: Chart.js with React Chart.js 2
  • File Management: Syncfusion File Manager

Key Features:

  • Feature-first architecture
  • Role-based navigation and access control
  • Responsive design (mobile-first)
  • Real-time updates via WebSocket
  • Comprehensive form validation
  • Advanced data visualization

🐍 Python Services

RAG Service (FastAPI):

  • Vector database integration
  • Document processing and indexing
  • Natural language query processing
  • Medical knowledge retrieval

Search Service (FastAPI):

  • OpenAI integration for symptom analysis
  • Intelligent specialty recommendation
  • Direct API integration with backend
  • Natural language symptom processing

πŸ—„οΈ Database Schema

Core Tables:

-- User Management
doctor_info, patient_info, receptionist_info
verification_tokens, password_reset_tokens

-- Appointments & Scheduling
appointments, availabilities, appointment_cancellations

-- Medical Records
medical_reports, prescribed_medications
medical_diagnosis_history, patient_medical_files

-- Communication
chats, messages, participants

-- Content & Social
blog_posts, comments, likes, follows

-- File Management
folder_file_info, shared_items

πŸ”„ API Architecture

RESTful Endpoints:

/api/v1/
β”œβ”€β”€ auth/                    # Authentication
β”‚   β”œβ”€β”€ login, register, refresh
β”‚   └── forgot-password, reset-password
β”œβ”€β”€ doctors/                 # Doctor management
β”œβ”€β”€ patients/                # Patient management
β”œβ”€β”€ appointments/            # Appointment system
β”œβ”€β”€ chats/                   # Real-time messaging
β”œβ”€β”€ medical-records/         # Document management
β”œβ”€β”€ feed/                    # Social features
└── search/                  # Search functionality

TODO: Still gotta fix some of them

πŸ›‘οΈ Security & Compliance

πŸ” Authentication & Authorization

  • Multi-layer Security: JWT access tokens + refresh tokens
  • Role-based Access Control (RBAC): Granular permissions per user type
  • Session Management: Automatic token refresh and secure logout
  • Password Security: Bcrypt hashing with salt
  • Email Verification: Two-factor account activation
  • Rate Limiting: API endpoint protection against abuse

πŸ›‘οΈ Data Protection

  • Input Validation: Comprehensive request sanitization
  • SQL Injection Prevention: Parameterized queries and ORM protection
  • XSS Protection: Content Security Policy and input sanitization
  • CORS Configuration: Controlled cross-origin resource sharing
  • File Upload Security: Type validation, size limits, and virus scanning
  • Data Encryption: Sensitive data encryption at rest and in transit

πŸ”§ Development Workflow

Local Development:

cd backend_go && go run main.go
cd frontend && npm start
cd rag_app_python && uvicorn src.app.main:app --reload

Built with ❀️ using Go, React, Python, PostgreSQL, and modern cloud technologies

TBIBI Healthcare Management Platform - Bridging Healthcare Gaps with Technology

About

Healthcare Management Platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published