Skip to content

**HealthCore API** is a secure, scalable, and high-performance backend system for complete hospital operations management. This project serves as the technological backbone for managing patients, appointments, electronic health records, and administrative processes, built upon an enterprise-grade foundation.

License

Notifications You must be signed in to change notification settings

Daniel-Q-Reis/HealthCoreAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

28 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

HealthCoreAPI

CI Python 3.12 Django 5.2 Code style: ruff Coverage: 92.41% Kubernetes Ready Helm Chart Terraform Azure AKS

HealthCore API is a secure, scalable, and high-performance backend system for comprehensive hospital operations management. This enterprise-grade healthcare platform demonstrates modern cloud-native architecture patterns, Infrastructure as Code practices, and production-ready deployment capabilities with Azure Kubernetes Service integration.


๐Ÿ† Project Highlights

Enterprise Architecture & Quality

  • 92.41% Test Coverage with 130+ comprehensive tests
  • Domain-Driven Design with 8+ bounded contexts
  • Clean Architecture principles with service/repository patterns
  • Production-ready CI/CD pipeline with automated quality gates
  • Infrastructure as Code using Terraform for Azure AKS deployment

Cloud-Native & DevOps Excellence

  • Kubernetes-native with professional Helm charts
  • Container orchestration ready for enterprise scaling
  • Observability built-in with health checks and Prometheus metrics
  • Resilience patterns including circuit breakers and caching strategies
  • Security scanning integrated with Bandit and Safety tools

Modern Development Practices

  • DevContainer environment for consistent development experience
  • Pre-commit hooks ensuring code quality standards
  • Architecture Decision Records (ADRs) documenting technical decisions
  • Comprehensive documentation for setup, deployment, and operations

๐Ÿ“ Project Structure

HealthCoreAPI/
โ”œโ”€โ”€ .devcontainer/                 # Development container configuration
โ”‚   โ”œโ”€โ”€ devcontainer.json         # VS Code devcontainer settings
โ”‚   โ””โ”€โ”€ setup.sh                  # Automated development environment setup
โ”œโ”€โ”€ .github/                      # GitHub workflows and templates
โ”‚   โ””โ”€โ”€ workflows/                # CI/CD pipelines with quality gates
โ”œโ”€โ”€ charts/                       # Production-ready Kubernetes Helm Charts
โ”‚   โ””โ”€โ”€ healthcoreapi/            # Main application Helm chart
โ”‚       โ”œโ”€โ”€ Chart.yaml            # Chart metadata and dependencies
โ”‚       โ”œโ”€โ”€ values.yaml           # Configuration values and defaults
โ”‚       โ””โ”€โ”€ templates/            # Kubernetes resource templates
โ”‚           โ”œโ”€โ”€ deployment.yaml   # Application deployment with health checks
โ”‚           โ”œโ”€โ”€ service.yaml      # Service definition and load balancing
โ”‚           โ”œโ”€โ”€ ingress.yaml      # Ingress configuration with TLS
โ”‚           โ”œโ”€โ”€ hpa.yaml          # Horizontal Pod Autoscaling
โ”‚           โ””โ”€โ”€ configmap.yaml    # Configuration management
โ”œโ”€โ”€ docs/                         # Comprehensive project documentation
โ”‚   โ”œโ”€โ”€ adr/                      # Architecture Decision Records (ADRs)
โ”‚   โ”‚   โ”œโ”€โ”€ 0001-django-rest-framework.md
โ”‚   โ”‚   โ”œโ”€โ”€ 0002-postgresql-database.md
โ”‚   โ”‚   โ”œโ”€โ”€ 0003-celery-redis-async-tasks.md
โ”‚   โ”‚   โ”œโ”€โ”€ 0004-prometheus-monitoring.md
โ”‚   โ”‚   โ”œโ”€โ”€ 0005-circuit-breaker-resilience.md
โ”‚   โ”‚   โ”œโ”€โ”€ 0006-kubernetes-helm-deployment.md
โ”‚   โ”‚   โ”œโ”€โ”€ 0007-terraform-infrastructure-code.md
โ”‚   โ”‚   โ””โ”€โ”€ 0008-rbac-implementation.md
โ”‚   โ”œโ”€โ”€ CCP_IMPLEMENTATION_STATUS.md  # Critical Control Points implementation status
โ”‚   โ”œโ”€โ”€ CRITICAL_CONTROL_POINTS.md    # HIPAA/healthcare compliance critical controls
โ”‚   โ”œโ”€โ”€ DOCKER.md                 # Docker configuration and best practices
โ”‚   โ”œโ”€โ”€ VSCODE_SETUP.md           # VS Code development environment guide
โ”‚   โ””โ”€โ”€ WSL2_OPTIMIZATION.md      # WSL2 performance optimization guide
โ”œโ”€โ”€ logs/                         # Application log files
โ”œโ”€โ”€ scripts/                      # Utility and deployment scripts
โ”œโ”€โ”€ terraform/                    # Infrastructure as Code (Azure AKS)
โ”‚   โ”œโ”€โ”€ providers.tf              # Terraform and Azure provider configuration
โ”‚   โ”œโ”€โ”€ variables.tf              # Configurable infrastructure parameters
โ”‚   โ””โ”€โ”€ main.tf                   # Azure resources (AKS, Resource Group, Monitoring)
โ”œโ”€โ”€ src/                          # Source code organized by domain
โ”‚   โ”œโ”€โ”€ apps/                     # Django applications (Bounded Contexts)
โ”‚   โ”‚   โ”œโ”€โ”€ admissions/           # Hospital admissions and bed management
โ”‚   โ”‚   โ”œโ”€โ”€ core/                 # Shared core functionality and base models
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ fixtures/         # Initial data fixtures
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ roles.json    # RBAC role definitions (Admins, Doctors, Nurses, Patients)
โ”‚   โ”‚   โ”œโ”€โ”€ departments/          # Department and medical specialty management
โ”‚   โ”‚   โ”œโ”€โ”€ experience/           # Patient experience and feedback systems
โ”‚   โ”‚   โ”œโ”€โ”€ patients/             # Patient data management and electronic records
โ”‚   โ”‚   โ”œโ”€โ”€ practitioners/        # Medical staff management and credentials
โ”‚   โ”‚   โ”œโ”€โ”€ results/              # Diagnostic results and medical imaging
โ”‚   โ”‚   โ”œโ”€โ”€ scheduling/           # Appointment scheduling and calendar management
โ”‚   โ”‚   โ””โ”€โ”€ shifts/               # Staff shift management and availability
โ”‚   โ”œโ”€โ”€ healthcoreapi/            # Django project configuration
โ”‚   โ”‚   โ”œโ”€โ”€ settings/             # Environment-specific settings (dev/test/prod)
โ”‚   โ”‚   โ”œโ”€โ”€ asgi.py               # ASGI configuration for async support
โ”‚   โ”‚   โ”œโ”€โ”€ celery.py             # Celery configuration for background tasks
โ”‚   โ”‚   โ”œโ”€โ”€ urls.py               # URL routing and API versioning
โ”‚   โ”‚   โ””โ”€โ”€ wsgi.py               # WSGI configuration for deployment
โ”‚   โ”œโ”€โ”€ static/                   # Static files and assets
โ”‚   โ”œโ”€โ”€ templates/                # HTML templates and email templates
โ”‚   โ””โ”€โ”€ conftest.py               # Pytest fixtures and test configuration
โ”œโ”€โ”€ .dockerignore                 # Docker build optimization
โ”œโ”€โ”€ .env.example                  # Environment variables template and documentation
โ”œโ”€โ”€ .gitignore                    # Git ignore patterns
โ”œโ”€โ”€ .pre-commit-config.yaml       # Automated code quality and security checks
โ”œโ”€โ”€ ARCHITECTURE.md               # System architecture and design documentation
โ”œโ”€โ”€ CONTRIBUTING.md               # Contribution guidelines and development workflow
โ”œโ”€โ”€ Dockerfile                    # Multi-stage Docker image with security hardening
โ”œโ”€โ”€ LICENSE                       # Apache-2.0 License
โ”œโ”€โ”€ Makefile                      # Development workflow automation
โ”œโ”€โ”€ README.md                     # This file
โ”œโ”€โ”€ ROADMAP.md                    # Project roadmap and feature development plan
โ”œโ”€โ”€ SECURITY.md                   # Security policies and vulnerability reporting
โ”œโ”€โ”€ STATUS.md                     # Current project status and completed features
โ”œโ”€โ”€ deploy.sh                     # Production deployment automation script
โ”œโ”€โ”€ docker-compose.yml            # Development environment orchestration
โ”œโ”€โ”€ docker-compose.prod.yml       # Production environment configuration
โ”œโ”€โ”€ docker-compose.override.yml   # Local development overrides
โ”œโ”€โ”€ manage.py                     # Django management script
โ”œโ”€โ”€ mypy.ini                      # MyPy static type checking configuration
โ”œโ”€โ”€ nginx.conf                    # Nginx configuration for production deployment
โ”œโ”€โ”€ pyproject.toml                # Python project configuration and tool settings
โ”œโ”€โ”€ pytest.ini                   # Pytest configuration and coverage settings
โ”œโ”€โ”€ requirements.in               # Production dependencies specification
โ”œโ”€โ”€ requirements.txt              # Pinned production dependencies
โ”œโ”€โ”€ requirements-dev.in           # Development dependencies specification
โ””โ”€โ”€ requirements-dev.txt          # Pinned development dependencies

๐Ÿ—๏ธ Architecture & Design

This project demonstrates Enterprise-Grade Software Architecture designed as a Modular Monolith with microservices-ready internal structure. Built with Clean Architecture principles, Domain-Driven Design, and cloud-native patterns for scalability and maintainability.

Architectural Foundations

  • Domain-Driven Design: Clear bounded contexts representing distinct business capabilities
  • Clean Architecture: Dependency inversion and separation of concerns throughout
  • Service Layer Pattern: Business logic encapsulated and decoupled from framework concerns
  • Repository Pattern: Data access abstraction enabling testability and flexibility
  • Circuit Breaker Pattern: Resilience and fault tolerance for external dependencies
  • Infrastructure as Code: Complete automation of cloud resources with Terraform

Cloud-Native Design Principles

  • Container-First: Docker-native development and deployment
  • Kubernetes-Ready: Helm charts with enterprise production standards
  • Observable: Built-in health checks, metrics, and monitoring integration
  • Scalable: Horizontal scaling capabilities with load balancing support
  • Resilient: Circuit breakers, retry logic, and graceful degradation
  • Secure: Security scanning, non-root containers, and secret management

Documentation Strategy

  • Strategic Vision: Overall architectural strategy and principles in ARCHITECTURE.md
  • Technical Decisions: Architecture Decision Records (ADRs) in docs/adr/
  • Operational Guides: Setup and optimization documentation in docs/
  • API Documentation: Auto-generated OpenAPI specs with DRF Spectacular

โœจ Core Features & Bounded Contexts

The system implements a comprehensive healthcare management platform with the following business domains:

Patient & Staff Management

  • Patients: Electronic health records, medical history, and patient data management
  • Practitioners: Medical staff credentials, specializations, and profile management
  • Departments: Hospital department organization and medical specialty management

Clinical Operations

  • Scheduling: Advanced appointment booking with conflict resolution and availability management
  • Admissions: Hospital admission workflows with bed allocation and ward management
  • Results: Diagnostic report management with imaging and laboratory result integration
  • Shifts: Staff scheduling, availability tracking, and shift management

Patient Experience & Quality

  • Experience Management: Patient feedback collection and complaint resolution systems
  • Quality Metrics: Patient satisfaction tracking and experience analytics

System Reliability & Operations

  • Health Monitoring: Comprehensive health checks for databases, cache, and external services
  • Observability: Prometheus metrics export and monitoring integration
  • Resilience: Circuit breaker patterns for fault tolerance and system stability
  • Security: Authentication, authorization, and audit logging

๐Ÿ› ๏ธ Tech Stack

Component Technology Version Purpose
Framework Django 5.2 Web Framework & ORM
API Django REST Framework 3.15+ RESTful API Development & OpenAPI Documentation
Database PostgreSQL 15+ Primary Database with ACID Compliance
Cache & Queue Redis 7+ Caching Layer & Message Broker
Background Tasks Celery 5.5+ Asynchronous Task Processing
Testing Pytest 8.4+ Test Framework with Fixtures
Code Quality Ruff + MyPy Latest Linting, Formatting & Static Type Checking
Security Bandit + Safety Latest Security Vulnerability Scanning
Error Tracking Sentry 2.10+ Production Error Monitoring & Alerting
Metrics Prometheus Latest Application Metrics Collection & Export
Resilience PyBreaker 1.2+ Circuit Breaker Pattern Implementation
Containerization Docker 24+ Application Packaging & Isolation
Orchestration Kubernetes + Helm 1.29+ Container Orchestration & Package Management
Infrastructure Terraform 1.5+ Infrastructure as Code for Azure AKS
Development VS Code + DevContainers Latest Consistent Development Environment

๐Ÿš€ Quick Start

Prerequisites

  • Local Development: Docker Desktop & Docker Compose
  • DevContainer: VS Code with Remote-Containers extension
  • Cloud Deployment: Kubernetes cluster with Helm 3+
  • Infrastructure: Terraform CLI and Azure CLI for cloud provisioning

Development Setup

Option 1: DevContainer Development (Recommended)

  1. Configure your development environment:

    cp .env.example .env
    
  2. Update .env with your personal configuration:

    # Personal configuration (required for git operations)
    GIT_AUTHOR_NAME="Your Full Name"
    GIT_AUTHOR_EMAIL="your.email@example.com"
    
    # Development settings (defaults provided)
    DEBUG=True
    DATABASE_URL=postgres://healthcore:healthcore123@postgres:5432/healthcoreapi
    CELERY_BROKER_URL=redis://redis:6379/0
    CACHE_URL=redis://redis:6379/1
    
  3. Launch DevContainer environment:

    • Install VS Code "Dev Containers" extension
    • Open project folder in VS Code
    • Select "Reopen in Container" when prompted
    • Or use Command Palette: Dev Containers: Reopen in Container
  4. Automated setup includes:

    • โœ… Python 3.12 development environment
    • โœ… All project dependencies pre-installed
    • โœ… Git configuration from environment variables
    • โœ… Kubernetes tools (kubectl + helm) for deployment testing
    • โœ… Enhanced terminal with git branch display
    • โœ… Pre-commit hooks for code quality
    • โœ… Database migrations applied automatically
    • โœ… RBAC roles loaded from fixtures

Option 2: Standard Docker Development

  1. Complete setup with single command:

    make setup
    
  2. Access your development environment:


โš™๏ธ Development Commands

All development workflows are automated through make commands. Execute make help for complete command reference.

Core Development Workflow

Command Description
make setup ๐Ÿš€ Complete initial setup: builds containers, applies migrations, creates superuser
make up โฌ†๏ธ Start services: launches all containers in background
make down โฌ‡๏ธ Stop services: gracefully stops all containers
make restart ๐Ÿ”„ Restart services: stops and starts all containers

Quality Assurance & Testing

Command Description
make test ๐Ÿงช Run test suite: executes all tests with coverage reporting
make quality โœ… Full quality check: runs linting, formatting, type checking, and tests
make lint ๐Ÿ“‹ Code linting: runs ruff linting with automatic fixes
make format ๐ŸŽจ Code formatting: formats code with ruff formatter

Development Utilities

Command Description
make shell ๐Ÿš Django shell: interactive Python shell with Django context
make superuser ๐Ÿ‘ค Create superuser: interactive superuser creation
make migrations ๐Ÿ”„ Generate migrations: creates Django database migrations
make logs ๐Ÿ“‹ View logs: streams logs from all running services

Kubernetes & Cloud Development

Command Description
k get nodes ๐Ÿ” Check cluster: validate Kubernetes cluster connectivity
helm template charts/healthcoreapi/ ๐Ÿ“‹ Render templates: preview Kubernetes manifests
helm lint charts/healthcoreapi/ โœ… Validate chart: check Helm chart for errors
helm install healthcore charts/healthcoreapi/ ๐Ÿš€ Deploy locally: install to local Kubernetes cluster

๐Ÿงช Testing & Quality Assurance

Comprehensive Testing Strategy

This project implements enterprise-grade quality assurance with multiple testing layers:

  • Unit Tests: Business logic validation with 92.41% coverage
  • Integration Tests: API endpoint testing with authentication
  • Service Tests: Domain service behavior validation
  • Repository Tests: Data access layer verification
  • Security Tests: Vulnerability scanning with Bandit and Safety

Quality Gates & Automation

Execute complete quality validation:

make quality

This automated pipeline includes:

  • pytest: 130+ tests with comprehensive coverage reporting
  • ruff: Code formatting and linting with automatic fixes
  • mypy: Static type checking for type safety
  • bandit: Security vulnerability detection
  • safety: Dependency vulnerability scanning
  • pre-commit: Automated checks on every commit

CI/CD Pipeline Integration

  • Migration Validation: Prevents production deployment failures
  • Requirements Consistency: Ensures dependency synchronization
  • Security Scanning: Automated vulnerability detection
  • Test Coverage: Enforces minimum 75% coverage threshold
  • Docker Build: Multi-architecture container build validation

โ˜ธ๏ธ Kubernetes & Cloud Deployment

Production-Ready Helm Charts

Professional Kubernetes deployment with enterprise features:

  • Health Checks: Liveness and readiness probes for reliability
  • Resource Management: CPU/memory limits and requests optimization
  • Horizontal Scaling: HPA configuration for automatic scaling
  • Security: Security contexts and non-root container execution
  • Configuration: ConfigMaps and Secrets management
  • Ingress: Load balancing with TLS termination support

Local Kubernetes Testing

# Validate Helm chart configuration
helm lint charts/healthcoreapi/

# Preview generated Kubernetes manifests
helm template healthcore charts/healthcoreapi/

# Deploy to local development cluster
helm install healthcore charts/healthcoreapi/ \
  --set image.repository=healthcoreapi \
  --set image.tag=latest \
  --set ingress.enabled=false

Azure AKS Production Deployment

# Deploy complete infrastructure with Terraform
cd terraform/
terraform init
terraform plan
terraform apply

# Deploy application to provisioned AKS cluster
helm install healthcore charts/healthcoreapi/ \
  --set image.repository=your-registry.azurecr.io/healthcoreapi \
  --set image.tag=v1.0.0 \
  --set ingress.enabled=true \
  --set ingress.hosts.host=api.yourdomain.com

๐ŸŒฉ๏ธ Infrastructure as Code

Terraform Azure Integration

Complete infrastructure automation for enterprise Azure deployment:

Infrastructure Components

  • Azure Resource Group: Logical container for all project resources
  • Azure Kubernetes Service (AKS): Managed Kubernetes cluster with latest versions
  • Log Analytics Workspace: Enterprise monitoring and observability integration
  • System Managed Identity: Secure Azure AD authentication without credential management

Configuration & Deployment

# Initialize Terraform workspace
cd terraform/
terraform init

# Review infrastructure changes
terraform plan

# Deploy complete Azure infrastructure
terraform apply

# Verify AKS cluster provisioning
az aks get-credentials --resource-group healthcore-rg-prod --name healthcore-aks-prod
kubectl get nodes

Enterprise Features

  • Production Naming: Clear -prod environment identification
  • Modern VM Series: Cost-optimized Standard_D2s_v5 virtual machines
  • Latest Kubernetes: Version 1.29.4 for security and feature support
  • Integrated Monitoring: Log Analytics workspace with OMS agent configuration

๐Ÿ”ง Development Environment

DevContainer Professional Features

The development environment provides a complete, consistent setup for all team members:

Pre-configured Development Tools

  • ๐Ÿ Python 3.12: Latest Python with optimized performance
  • ๐Ÿณ Docker-in-Docker: Container development and testing capabilities
  • โ˜ธ๏ธ Kubernetes Tools: kubectl and helm for deployment workflows
  • ๐Ÿ”ง Development Utilities: git, pre-commit, and quality assurance tools
  • ๐ŸŽจ Enhanced Terminal: Git branch display and Kubernetes context awareness
  • โšก Shell Completion: Auto-completion for kubectl and helm commands
  • ๐Ÿ”’ Security Tools: Integrated vulnerability scanning and code analysis

VS Code Extension Suite

Automatically installed extensions for optimal development experience:

  • Python Development: IntelliSense, debugging, and testing support
  • Docker & Kubernetes: Container and orchestration management
  • Code Quality: Automated formatting, linting, and error detection
  • Git Integration: Advanced version control and collaboration features

Developer Experience Optimization

  • Instant Environment: Zero-configuration development setup
  • Performance Optimized: WSL2 integration with optimized I/O operations
  • Team Consistency: Identical development environment for all contributors
  • Professional Workflow: Pre-commit hooks and quality gates integrated

๐Ÿš€ Production Deployment Options

Docker Compose Production

# Build and deploy production stack
docker-compose -f docker-compose.prod.yml up -d --build

# Scale application instances
docker-compose -f docker-compose.prod.yml up -d --scale web=3

Kubernetes Enterprise Deployment

# Deploy with production-grade configuration
helm install healthcore charts/healthcoreapi/ \
  --values charts/healthcoreapi/values.prod.yaml \
  --set image.repository=your-registry.azurecr.io/healthcoreapi \
  --set image.tag=v1.0.0 \
  --set ingress.enabled=true \
  --set autoscaling.enabled=true \
  --set autoscaling.minReplicas=3 \
  --set autoscaling.maxReplicas=10

Environment Configuration Management

Production deployments require proper environment configuration:

# Critical production environment variables
DJANGO_SETTINGS_MODULE=healthcoreapi.settings.production
DATABASE_URL=postgres://user:password@your-postgres.com:5432/healthcore
REDIS_URL=redis://your-redis.com:6379/0
CELERY_BROKER_URL=redis://your-redis.com:6379/0
SENTRY_DSN=https://your-sentry-dsn
SECRET_KEY=your-production-secret-key
ALLOWED_HOSTS=api.yourdomain.com,your-load-balancer.com

๐Ÿ”ฎ Strategic Roadmap & Vision

Current Status: Phase 8 Completed โœ…

  • Enterprise Backend: Complete Django API with domain-driven design
  • Quality Assurance: 92.41% test coverage with comprehensive testing strategy
  • DevOps Pipeline: Hardened CI/CD with automated quality gates and security scanning
  • Cloud Infrastructure: Production-ready Kubernetes deployment and Terraform automation
  • Observability: Health monitoring, metrics export, and error tracking integration
  • Security & Compliance: RBAC implementation with HIPAA-aligned access controls

Upcoming Development Phases

Phase Focus Area Strategic Value
Phase 9 Advanced CI/CD & Compliance Security automation, compliance scanning, multi-environment deployment
Phase 10 Microservices Extraction Strangler Fig pattern implementation beginning with Notifications service
Phase 11 Advanced Observability Distributed tracing, APM integration, and advanced monitoring dashboards
Phase 12 Multi-Cloud Strategy Cloud provider abstraction and disaster recovery automation

Detailed roadmap: See ROADMAP.md for complete feature development timeline.


๐Ÿ“Š Quality & Performance Metrics

Code Quality Standards

  • Test Coverage: 92.41% with comprehensive unit and integration testing
  • Code Analysis: Zero critical security vulnerabilities (Bandit + Safety)
  • Type Safety: Full MyPy static type checking compliance
  • Code Style: Enforced formatting and linting standards with Ruff
  • Architecture: Clean separation of concerns with domain-driven design

Performance & Reliability

  • Response Times: Sub-200ms API response times for standard operations
  • Error Handling: Circuit breaker patterns for external service resilience
  • Caching Strategy: Redis-based caching for frequently accessed data
  • Database Optimization: Proper indexing and query optimization
  • Container Efficiency: Multi-stage Docker builds with minimal attack surface

๐Ÿ›ก๏ธ Security & Compliance

Security Implementation

  • Authentication: JWT-based authentication with refresh token support
  • Authorization: Role-based access control (RBAC) for API endpoints
  • Data Protection: Encrypted sensitive data and secure configuration management
  • Vulnerability Scanning: Automated security scanning in CI/CD pipeline
  • Container Security: Non-root containers with minimal base images

Authorization (RBAC)

HealthCoreAPI implements Role-Based Access Control (RBAC) with four healthcare roles:

Role Description Permissions
Admin System administrators Full system access including user management
Doctor Licensed physicians View all patients, create appointments, diagnostics, prescriptions
Nurse Nursing staff View patients, update vitals, administer medications
Patient Registered patients View own records only (read-only)

Permission Classes

All endpoints are protected with role-based permissions:

from src.apps.core.permissions import IsDoctor, IsMedicalStaff, IsPatientOwner

# Example: Doctors only
class DiagnosticReportViewSet(viewsets.ModelViewSet):
    permission_classes = [IsAuthenticated, IsDoctor]

# Example: Medical staff (Doctors OR Nurses)
class PatientViewSet(viewsets.ModelViewSet):
    permission_classes = [IsAuthenticated, IsMedicalStaff]

# Example: Patients can only access own records
class PatientPortalViewSet(viewsets.ReadOnlyModelViewSet):
    permission_classes = [IsAuthenticated, IsPatientOwner]

    def get_queryset(self):
        return Patient.objects.filter(user=self.request.user)

Loading Roles

Roles are defined in fixtures and loaded automatically during container startup:

# Roles are loaded automatically in entrypoint.sh
# Manual loading if needed:
python manage.py loaddata roles

# Assign role to user (in Django shell)
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group

User = get_user_model()
user = User.objects.get(username='johndoe')
doctor_group = Group.objects.get(name='Doctors')
user.groups.add(doctor_group)

Testing Permissions

# Run RBAC test suite
pytest src/apps/core/tests/test_rbac_permissions.py -v

# Test specific role
pytest src/apps/core/tests/test_rbac_permissions.py::TestIsDoctorPermission -v

HIPAA Compliance

This RBAC implementation supports HIPAA Security Rule requirements:

  • ยง 164.308(a)(4): Role-based access control
  • ยง 164.308(a)(3): Minimum necessary access
  • ยง 164.312(a)(1): Access control technical safeguards

See ADR-0008 for architectural decisions and docs/CRITICAL_CONTROL_POINTS.md for compliance details.

Healthcare Compliance Readiness

  • Audit Trail: Comprehensive logging for all data access and modifications
  • Data Integrity: Database constraints and validation for medical data accuracy
  • Access Controls: Fine-grained permissions for healthcare role requirements
  • Data Retention: Configurable retention policies for compliance requirements

๐Ÿ“š Documentation & Developer Resources

Comprehensive Documentation Suite

API Documentation

  • Interactive API Docs: Swagger UI available at /api/docs/
  • OpenAPI Schema: Machine-readable API specification at /api/schema/
  • Postman Collection: Complete API collection for testing and integration

โš–๏ธ License

Licensed under the Apache-2.0 License - see LICENSE file for complete terms and conditions.


๐Ÿค Contributing

Development Workflow

  1. Fork the repository and create a feature branch
  2. Use DevContainer for consistent development environment
  3. Follow quality standards - all checks must pass (make quality)
  4. Maintain test coverage - aim for 90%+ coverage on new code
  5. Update documentation as needed for architectural changes
  6. Submit pull request with comprehensive description

Code Quality Requirements

  • All code must pass ruff linting and formatting
  • MyPy type checking must pass without errors
  • Maintain or improve overall test coverage
  • Follow existing architectural patterns and conventions
  • Update ADRs for significant architectural decisions

For detailed contribution guidelines, see CONTRIBUTING.md.


๐Ÿฅ Built with Enterprise Architecture Principles for Healthcare Technology Excellence


Author: Daniel de Queiroz Reis Email: danielqreis@gmail.com LinkedIn: Daniel Q. Reis Portfolio: Professional Healthcare Software Development & Cloud Architecture

About

**HealthCore API** is a secure, scalable, and high-performance backend system for complete hospital operations management. This project serves as the technological backbone for managing patients, appointments, electronic health records, and administrative processes, built upon an enterprise-grade foundation.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages