# openmrs/openmrs-contrib-performance-test architecture

> Architecture diagram of the GitHub repository openmrs/openmrs-contrib-performance-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openmrs/openmrs-contrib-performance-test
- Repository: https://github.com/openmrs/openmrs-contrib-performance-test

## Overview

a. Primary Flow:
- Simulation Controller → Personas → Scenarios → Registries → HTTP Services → OpenMRS System

b. Data Flow:
- Demo Data Generation → Database → Test Scenarios

c. Load Distribution Flow:
- Population Distribution → Personas → Scenarios

##### Specific elements

a. Load Distribution Calculator (show formulas):
- Total Users * Persona Share * Scenario Share

b. Simulation Tiers (show as a stepped graph):
- Ramp-up periods (1 min)
- Tier durations
- User increments

##### Important Details

a. Configuration Options:
- Simulation presets (standard, commit, pull_request, dev)
- Environment variables
- Load distribution percentages

b. Integration Points:
- Docker container connections
- Database interaction points
- HTTP service endpoints

##### Additional Elements

a. Monitoring Points:
- Performance metrics collection
- Report generation endpoints
- Debug logging points

b. Test Data Flow:
- Demo patient data generation
- UUID management
- Database dump processes

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Components
    SimController["Simulation Controller"]:::core
    Config["Configuration Management"]:::core
    TestEngine["Test Execution Engine"]:::core

    %% Persona Layer
    subgraph Personas
        BasePersona["Persona Base"]:::persona
        DoctorPersona["Doctor Persona (50%)"]:::persona
        ClerkPersona["Clerk Persona (50%)"]:::persona
    end

    %% Scenario Layer
    subgraph Scenarios
        BaseScenario["Scenario Base"]:::scenario
        PatientReg["Patient Registration"]:::scenario
        VisitPatient["Visit Patient"]:::scenario
    end

    %% Registry Layer
    subgraph Registries
        BaseRegistry["Registry Base"]:::registry
        ClerkRegistry["Clerk Registry"]:::registry
        DoctorRegistry["Doctor Registry"]:::registry
    end

    %% HTTP Services Layer
    subgraph HTTPServices
        BaseHttp["HTTP Service Base"]:::http
        ClerkHttp["Clerk HTTP Service"]:::http
        DoctorHttp["Doctor HTTP Service"]:::http
    end

    %% Infrastructure
    subgraph Infrastructure
        Docker["Docker Environment"]:::infra
        DemoGen["Demo Data Generation"]:::infra
        DB[(Database)]:::db
    end

    %% Relationships
    SimController --> BasePersona
    BasePersona --> DoctorPersona
    BasePersona --> ClerkPersona
    
    DoctorPersona --> VisitPatient
    ClerkPersona --> PatientReg
    
    BaseScenario --> BaseRegistry
    PatientReg --> ClerkRegistry
    VisitPatient --> DoctorRegistry
    
    BaseRegistry --> BaseHttp
    ClerkRegistry --> ClerkHttp
    DoctorRegistry --> DoctorHttp
    
    Config --> SimController
    TestEngine --> SimController
    
    DemoGen --> DB
    DB --> BaseRegistry
    
    %% Click Events
    click SimController "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/simulations/OpenMRSClinic.java"
    click Config "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/resources/gatling.conf"
    click BasePersona "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/personas/Persona.java"
    click DoctorPersona "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/personas/DoctorPersona.java"
    click ClerkPersona "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/personas/ClerkPersona.java"
    click BaseScenario "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/scenarios/Scenario.java"
    click PatientReg "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/scenarios/PatientRegistrationScenario.java"
    click VisitPatient "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/scenarios/VisitPatientScenario.java"
    click BaseRegistry "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/registries/Registry.java"
    click ClerkRegistry "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/registries/ClerkRegistry.java"
    click DoctorRegistry "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/registries/DoctorRegistry.java"
    click BaseHttp "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/http/HttpService.java"
    click ClerkHttp "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/http/ClerkHttpService.java"
    click DoctorHttp "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/java/org/openmrs/performance/http/DoctorHttpService.java"
    click Docker "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/resources/docker-compose.yml"
    click DemoGen "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/.github/workflows/generate-demo-patients.yml"
    click DB "https://github.com/openmrs/openmrs-contrib-performance-test/blob/main/src/test/resources/dump/dump.sql"

    %% Styles
    classDef core fill:#2374f7,stroke:#000,stroke-width:2px,color:#fff
    classDef persona fill:#85c1e9,stroke:#000,stroke-width:2px
    classDef scenario fill:#82e0aa,stroke:#000,stroke-width:2px
    classDef registry fill:#f4d03f,stroke:#000,stroke-width:2px
    classDef http fill:#e59866,stroke:#000,stroke-width:2px
    classDef infra fill:#808b96,stroke:#000,stroke-width:2px
    classDef db fill:#d5d8dc,stroke:#000,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Personas"]:::persona
        L3["Scenarios"]:::scenario
        L4["Registries"]:::registry
        L5["HTTP Services"]:::http
        L6["Infrastructure"]:::infra
        L7[(Database)]:::db
    end
```
