Skip to content

Plokar/HackJakBrno

Repository files navigation

πŸ₯ MedicHub - Operating Room Management System

Modern Operating Room Management Dashboard with FHIR Integration

Features β€’ Tech Stack β€’ Getting Started β€’ Architecture β€’ API


πŸ“‹ Overview

MedicHub is a comprehensive operating room management system designed for healthcare facilities. It provides real-time monitoring of operating room utilization, cost tracking, equipment lifecycle management, and seamless integration with FHIR-compliant health information systems.

Key Capabilities

  • πŸ“Š Real-time Dashboard - Monitor all operating rooms with live status updates
  • πŸ’° Cost Analytics - Automatic calculation of operation costs (equipment depreciation, materials, staff)
  • πŸ”„ FHIR Integration - Full HL7 FHIR R4 compliance with InterSystems IRIS Health
  • πŸ“… Smart Scheduling - Intelligent operation scheduling with conflict detection
  • πŸ₯ Multi-role Access - Customized views for doctors, nurses, and administrators
  • πŸ“ˆ Advanced Analytics - Detailed reports on room utilization and resource optimization

✨ Features

For Hospital Administrators

  • Complete Dashboard Overview - Real-time visualization of all 20+ operating rooms
  • Cost Breakdown Analysis - Detailed cost tracking per operation with equipment depreciation, materials, and labor costs
  • Resource Optimization - Identify bottlenecks and optimize room scheduling
  • KPI Monitoring - Track key performance indicators and utilization metrics

For Medical Staff

  • Patient Management - Comprehensive patient records with medical history
  • Operation Scheduling - Calendar view with drag-and-drop scheduling
  • Perioperative Protocols - Digital forms for pre/during/post-operative documentation
  • Equipment Tracking - Monitor equipment usage, maintenance, and lifecycle

For Nurses

  • Room Preparation - Checklists for room setup and sterilization
  • Inventory Management - Track materials and supplies with EAN-13 barcode support
  • Real-time Updates - Live notifications for operation status changes

πŸ›  Tech Stack

Backend

  • Framework: Django 5.0 with Django REST Framework
  • Database: PostgreSQL 15
  • Cache: Redis 7
  • FHIR Server: InterSystems IRIS Health Community Edition
  • Task Queue: Celery with Redis broker
  • Architecture: Modular Monolith (easily scalable to microservices)

Frontend

  • Framework: Next.js 14 (React 18)
  • Styling: Tailwind CSS 3
  • UI Components: Headless UI, Material-UI
  • Charts: Recharts, FullCalendar
  • State Management: React Query (TanStack Query)
  • Real-time: Socket.io

Infrastructure

  • Containerization: Docker & Docker Compose
  • Web Server: Nginx (production)
  • Static Files: WhiteNoise
  • CORS: django-cors-headers

πŸš€ Getting Started

Prerequisites

  • Docker & Docker Compose
  • Git
  • (Optional) Node.js 18+ and Python 3.11+ for local development

Quick Start with Docker

  1. Clone the repository

    git clone https://github.com/Plokar/HackJakBrno.git
    cd medichub
  2. Set up environment variables

    cp .env.example .env
    # Edit .env with your configuration
  3. Start the development environment

    docker-compose -f docker-compose.dev.yml up --build
  4. Initialize the database

    docker-compose -f docker-compose.dev.yml exec backend python manage.py migrate
    docker-compose -f docker-compose.dev.yml exec backend python manage.py createsuperuser
  5. Load sample data (optional)

    docker-compose -f docker-compose.dev.yml exec backend python manage.py generate_fhir_data --load-synthea
  6. Access the application


πŸ“ Architecture

Modular Monolith Design

The backend is structured as a modular monolith, allowing for easy migration to microservices in the future:

backend/
β”œβ”€β”€ apps/                    # Domain modules (bounded contexts)
β”‚   β”œβ”€β”€ operating_rooms/     # Core operating room management
β”‚   β”œβ”€β”€ authentication/      # User authentication & authorization
β”‚   └── items/              # Generic items module
β”œβ”€β”€ services/                # Business logic layer
β”‚   β”œβ”€β”€ fhir_service.py     # FHIR server integration
β”‚   β”œβ”€β”€ fhir_mappers.py     # Django ↔ FHIR mappings
β”‚   β”œβ”€β”€ nis_integration.py  # Hospital system integration
β”‚   └── caching_service.py  # FHIR data caching
β”œβ”€β”€ core/                    # Shared utilities
└── config/                  # Django configuration

FHIR Integration Architecture

All core entities synchronize with the FHIR server:

  • Patient β†’ FHIR Patient resource
  • Doctor β†’ FHIR Practitioner resource
  • OperatingRoom β†’ FHIR Location resource
  • Operation β†’ FHIR Procedure resource
  • Equipment β†’ FHIR Device resource
  • Material β†’ FHIR SupplyDelivery resource

Data Flow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Next.js   β”‚ ←──→ β”‚    Django    β”‚ ←──→ β”‚ IRIS FHIR    β”‚
β”‚   Frontend  β”‚      β”‚   REST API   β”‚      β”‚   Server     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             ↕
                     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                     β”‚  PostgreSQL  β”‚
                     β”‚   Database   β”‚
                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“‘ API Documentation

Core Endpoints

Operating Rooms

GET    /api/operating-rooms/          # List all operating rooms
POST   /api/operating-rooms/          # Create new room
GET    /api/operating-rooms/{id}/     # Get room details
PUT    /api/operating-rooms/{id}/     # Update room
DELETE /api/operating-rooms/{id}/     # Delete room

Operations

GET    /api/operations/               # List operations
POST   /api/operations/               # Schedule new operation
GET    /api/operations/{id}/          # Operation details
GET    /api/operations/{id}/costs/    # Cost breakdown

FHIR Integration

GET    /api/operating-rooms/fhir/patients/search/         # Search FHIR patients
POST   /api/operating-rooms/fhir/patients/generate/       # Generate test data
POST   /api/operating-rooms/fhir/patients/sync_from_fhir/ # Sync from FHIR
POST   /api/operating-rooms/fhir/patients/{id}/sync_to_fhir/ # Sync to FHIR
GET    /api/operating-rooms/fhir/server/                  # FHIR server status

Dashboard

GET    /api/medic/dashboard/stats/    # Real-time dashboard statistics
GET    /api/medic/rooms/{id}/status/  # Individual room status

πŸ”§ Development

Local Development (without Docker)

Backend Setup

cd backend
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements-dev.txt
python manage.py migrate
python manage.py runserver

Frontend Setup

cd frontend
npm install
npm run dev

Running Tests

# Backend tests
docker-compose -f docker-compose.dev.yml exec backend pytest

# Frontend tests (if configured)
cd frontend
npm test

Code Quality

# Backend linting
cd backend
flake8 .
black .

# Frontend linting
cd frontend
npm run lint

🌟 Advanced Features

FHIR Extensions

Custom extensions for hospital-specific data:

  • procedure-cost-breakdown - Detailed operation cost tracking
  • device-cost - Equipment purchase price
  • device-lifetime-hours - Equipment expected lifetime
  • device-used-hours - Equipment usage tracking
  • material-unit-price - Material cost per unit
  • doctor-hourly-rate - Practitioner hourly rate

Equipment Lifecycle Management

Automatic tracking of:

  • Purchase price and acquisition date
  • Expected lifetime in hours
  • Current usage hours
  • Calculated depreciation per hour
  • Remaining lifetime percentage

EAN-13 Barcode Support

Materials can be tracked with EAN-13 barcodes for:

  • Inventory management
  • Quick material lookup
  • Supply chain integration

πŸ“Š Data Model

Core Entities

  • OperatingRoom - Operating room details with capacity and status
  • Patient - Patient demographic and medical history
  • Doctor - Practitioner information and specializations
  • Operation - Scheduled procedures with assigned resources
  • Equipment - Medical devices with lifecycle tracking
  • Material - Consumables and supplies
  • PerioperativeProtocol - Pre/intra/post-operative documentation

Relationships

  • Operations are performed in OperatingRooms by Doctors on Patients
  • Equipment and Materials are consumed during Operations
  • PerioperativeProtocols document each Operation phase
  • All entities sync bidirectionally with FHIR server

πŸ” Security

  • Authentication: JWT-based authentication with refresh tokens
  • Authorization: Role-based access control (RBAC)
  • GDPR Compliance: Data anonymization and audit logging
  • FHIR Security: OAuth2 integration ready
  • API Security: CORS configuration, rate limiting

πŸ“ Environment Variables

Create a .env file in the root directory:

# Django
DJANGO_SECRET_KEY=your-secret-key-here
DJANGO_DEBUG=False
ALLOWED_HOSTS=localhost,127.0.0.1

# Database
POSTGRES_DB=medichub
POSTGRES_USER=medichub_user
POSTGRES_PASSWORD=secure_password

# FHIR Server
FHIR_SERVER_URL=http://fhir-server:52773/fhir/r4
IRIS_USERNAME=SuperUser
IRIS_PASSWORD=SYS

# Redis
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0

# Frontend
NEXT_PUBLIC_API_URL=http://localhost:8000/api

πŸ™ Acknowledgments

  • Built for FakultnΓ­ nemocnice u svatΓ© Anny v BrnΔ› (St. Anne's University Hospital Brno)
  • FHIR integration powered by InterSystems IRIS Health
  • Test data generated with Syntheaβ„’

Made with ❀️ for healthcare professionals

About

comprehensive operating room management system designed for healthcare facilities. It provides real-time monitoring of operating room utilization, cost tracking, equipment lifecycle management, and seamless integration with FHIR-compliant health information systems.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors