# aimedat-solutions/health-management-backend architecture

> Architecture diagram of the GitHub repository aimedat-solutions/health-management-backend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aimedat-solutions/health-management-backend
- Repository: https://github.com/aimedat-solutions/health-management-backend

## Overview

##### Project type and purpose
- This is a backend-only RESTful Web API built with Django and Django REST Framework.
- Its purpose is to expose endpoints for managing doctors, patients, and users (authentication, permissions, profiles) in a Health-Management system.

##### File structure
- Top-level “HealthManagment” folder contains:
- Core Django project (“HealthManagment/HealthManagment”): settings.py, asgi.py, wsgi.py, urls.py
- Three Django apps:
– users: authentication (JWT, middleware), permissions, serializers, views, management commands
– doctor: models, serializers, views, URL routes
– patient: models, serializers, views, URL routes
- manage.py, .env template, requirements.txt, README.md
- Patterns:
- DRF View → Serializer → Model → Postgres
- JWT-based auth flows in users/jwt_auth.py and middleware
- Management command to bootstrap a superadmin

##### README insights
- Uses Postgres as the backing database
- Standard Django migration and runserver workflow
- .env file holds database credentials and secrets

## Diagram (Mermaid)

```mermaid
graph TB
    Client["API Consumer"]:::client

    subgraph "Django Application Server"
        direction TB
        ASGI["ASGI Entry (asgi.py)"]:::entry
        WSGI["WSGI Entry (wsgi.py)"]:::entry
        Config["Env Config (.env)"]:::config
        Middleware["Middleware Layer"]:::middleware
        Router["URL Router (urls.py)"]:::router

        subgraph "Users App"
            direction TB
            USModels["User Models"]:::model
            USSerial["User Serializers"]:::serializer
            USViews["User Views / ViewSets"]:::view
            USJWT["JWT Auth Logic"]:::logic
            USMiddle["User Middleware"]:::middleware
            USPerm["Permissions & Filters"]:::logic
            USUtils["Utils & Signals"]:::logic
            USPagin["Pagination"]:::logic
            USCmd["create_superadmin Cmd"]:::logic
        end

        subgraph "Doctor App"
            direction TB
            DrModels["Doctor Models"]:::model
            DrSerial["Doctor Serializers"]:::serializer
            DrViews["Doctor Views"]:::view
        end

        subgraph "Patient App"
            direction TB
            PtModels["Patient Models"]:::model
            PtSerial["Patient Serializers"]:::serializer
            PtViews["Patient Views"]:::view
        end

        CLI["manage.py CLI"]:::cli
    end

    DB["Postgres Database"]:::db

    Client -->|"HTTP Request"| ASGI
    Client -->|"HTTP Request"| WSGI
    ASGI --> Middleware
    WSGI --> Middleware
    Config --> Router
    Middleware --> Router

    Router --> USViews
    USViews --> USSerial
    USSerial --> USModels
    USModels --> DB
    DB --> USModels
    USModels --> USSerial
    USSerial --> USViews
    USViews -->|"HTTP Response"| Client

    Router --> DrViews
    DrViews --> DrSerial
    DrSerial --> DrModels
    DrModels --> DB
    DB --> DrModels
    DrModels --> DrSerial
    DrSerial --> DrViews
    DrViews --> Client

    Router --> PtViews
    PtViews --> PtSerial
    PtSerial --> PtModels
    PtModels --> DB
    DB --> PtModels
    PtModels --> PtSerial
    PtSerial --> PtViews
    PtViews --> Client

    CLI --> USCmd
    USCmd --> USModels

    click ASGI "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/HealthManagment/asgi.py"
    click WSGI "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/HealthManagment/wsgi.py"
    click Router "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/HealthManagment/urls.py"
    click Config "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/.env.txt"
    click CLI "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/manage.py"

    click USModels "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/users/models.py"
    click USSerial "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/users/serializers.py"
    click USViews "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/users/views.py"
    click USJWT "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/users/jwt_auth.py"
    click USMiddle "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/users/middleware.py"
    click USPerm "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/users/permissions.py"
    click USPagin "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/users/pagination.py"
    click USCmd "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/users/management/commands/create_superadmin.py"

    click DrModels "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/doctor/models.py"
    click DrSerial "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/doctor/serializers.py"
    click DrViews "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/doctor/views.py"

    click PtModels "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/patient/models.py"
    click PtSerial "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/patient/serializers.py"
    click PtViews "https://github.com/aimedat-solutions/health-management-backend/blob/main/HealthManagment/patient/views.py"

    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef entry fill:#afa,stroke:#080,stroke-width:1px
    classDef middleware fill:#ff9,stroke:#993,stroke-width:1px
    classDef router fill:#9ff,stroke:#039,stroke-width:1px
    classDef config fill:#eee,stroke:#666,stroke-width:1px
    classDef cli fill:#eef,stroke:#06f,stroke-width:1px
    classDef model fill:#ddf,stroke:#00f,stroke-width:1px
    classDef serializer fill:#dfd,stroke:#0a0,stroke-width:1px
    classDef view fill:#fdd,stroke:#a00,stroke-width:1px
    classDef logic fill:#ffd,stroke:#aa0,stroke-width:1px
    classDef db fill:#cdf,stroke:#008,stroke-width:1px,shape:cylinder
```
