# ishaq-bm/patient-management-system architecture

> Architecture diagram of the GitHub repository ishaq-bm/patient-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ishaq-bm/patient-management-system
- Repository: https://github.com/ishaq-bm/patient-management-system

## Overview

##### Main Components

A. Frontend (Angular Application):
- Authentication Module
- Administrative Dashboard
- Doctor Dashboard
- Pharmacy Dashboard
- Patient Management Module
- Consultation Module
- Base Module (Shared Components)

B. Backend (Django Application):
- Authentication Service
- Medical Patient Management
- Care & Examinations Management
- DPI (Patient Digital Record) Management

**Client Layer (Top)**
**↓**
**API Layer (Middle)**
**↓**
**Data Layer (Bottom)**

##### Component Relationships to Highlight

Frontend Architecture:
- Clean architecture implementation with:
- Presentation Layer (Components)
- Domain Layer (Use Cases)
- Data Layer (Repositories)
- Entity Layer (Models)

Backend Architecture:
- Django Apps Structure:
- Authentication
- Med_Patient
- Soins_Exams_Patient
- Core Application

##### Specific Elements

a) Frontend Section:
- Module structure (Auth, Admin, Doctor, Pharmacy)
- Clean architecture layers
- Routing flow
- Shared services and components

b) Backend Section:
- Django apps and their relationships
- Model relationships
- API endpoints
- Authentication flow

c) Database Section:
- Main entities (User, Patient, Consultation, Medication)
- Relationships between entities
- Data flow directions

##### Additional Details

Specific notations for:
- REST API endpoints
- Authentication tokens flow
- User role permissions
- Data validation points
- Error handling paths

##### Implementation Notes

Use standardized symbols:
- Rectangles: Components/Modules
- Diamonds: Decision Points
- Clouds: External Services

##### Architectural Patterns to Highlight

- Clean Architecture in Frontend
- MVT Pattern in Django Backend
- Repository Pattern
- Use Case Pattern
- Service Layer Pattern

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef auth fill:#e74c3c,stroke:#c0392b,color:white
    classDef business fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Frontend Layer
    subgraph Frontend
        Auth["Authentication Module"]:::frontend
        AdminDash["Administrative Dashboard"]:::frontend
        DocDash["Doctor Dashboard"]:::frontend
        PharmDash["Pharmacy Dashboard"]:::frontend
        PatientMgmt["Patient Management"]:::frontend
        ConsultMod["Consultation Module"]:::frontend
        BaseModule["Base Module"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        AuthService["Authentication Service"]:::backend
        MedPatient["Medical Patient Management"]:::backend
        CareExams["Care & Examinations"]:::backend
        DPIManagement["DPI Management"]:::backend
    end

    %% Database Layer
    subgraph Database
        DB[(SQLite Database)]:::database
    end

    %% Relationships
    Auth --> AuthService
    AdminDash --> DPIManagement
    DocDash --> MedPatient
    PharmDash --> CareExams
    PatientMgmt --> MedPatient
    ConsultMod --> MedPatient
    BaseModule --> DPIManagement

    AuthService --> DB
    MedPatient --> DB
    CareExams --> DB
    DPIManagement --> DB

    %% Click Events
    click Auth "https://github.com/ISHAQ-BM/patient-management-system/tree/main/clientApp/src/auth/"
    click AdminDash "https://github.com/ISHAQ-BM/patient-management-system/blob/main/clientApp/src/administratif/presentation/administratif-dashboard.component.ts"
    click DocDash "https://github.com/ISHAQ-BM/patient-management-system/blob/main/clientApp/src/doctor/presentation/doctor-dashboard.component.ts"
    click PharmDash "https://github.com/ISHAQ-BM/patient-management-system/blob/main/clientApp/src/pharmacy/presentation/pharmacy-dashboard.component.ts"
    click PatientMgmt "https://github.com/ISHAQ-BM/patient-management-system/tree/main/clientApp/src/patients/"
    click ConsultMod "https://github.com/ISHAQ-BM/patient-management-system/tree/main/clientApp/src/consult/"
    click BaseModule "https://github.com/ISHAQ-BM/patient-management-system/tree/main/clientApp/src/base/"
    click AuthService "https://github.com/ISHAQ-BM/patient-management-system/tree/main/ServerApp/Gestion_DPI/authentification/"
    click MedPatient "https://github.com/ISHAQ-BM/patient-management-system/tree/main/ServerApp/Gestion_DPI/Med_Patient/"
    click CareExams "https://github.com/ISHAQ-BM/patient-management-system/tree/main/ServerApp/Gestion_DPI/Soins_Exams_Patient/"
    click DPIManagement "https://github.com/ISHAQ-BM/patient-management-system/tree/main/ServerApp/Gestion_DPI/"

    %% Legend
    subgraph Legend
        FE["Frontend Component"]:::frontend
        BE["Backend Service"]:::backend
        DB2["Database"]:::database
        AU["Authentication"]:::auth
        BL["Business Logic"]:::business
        EX["External Service"]:::external
    end
```
