# meetmatt/organization-structure-optimizer architecture

> Architecture diagram of the GitHub repository meetmatt/organization-structure-optimizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/meetmatt/organization-structure-optimizer
- Repository: https://github.com/meetmatt/organization-structure-optimizer

## Overview

##### Project type and purpose
- This is a command-line Java SE application (Maven project) called “Organization Structure Optimizer.”
- It ingests a CSV of employees, applies business rules (salary bounds, reporting‐line length), and prints a console report.
- There is no UI beyond the console; it’s a small, single-process tool, packaged via Docker and built in CI.

##### File structure
- Top level:
- pom.xml (Maven build, dependencies, plugins)
- Dockerfile + .docker/* scripts (container build/test entrypoints)
- .github/workflows/ci.yml & site.yml (CI and site generation)
- src/main/java/lu/golikov/oso (code)
- src/test/java/... (unit tests)
- Layered packages under src/main/java/lu/golikov/oso:
- Application (orchestration layer: DataObject, Factory, Service)
- Domain (business logic: Model, Service interfaces, DataMapper abstractions)
- Infrastructure (concrete DataMapper & Repository implementations)
- Util (helper classes DSN, FileUtil)
- Main.java (entrypoint)
- Tests mirror the structure, validating factories, services, mappers, utils.

##### README for additional insights
- Describes CSV format and business rules: managers’ salary must be 20–50% above direct reports; reporting lines <=4 layers.
- Emphasizes simplicity, readability, Java SE + JUnit, console I/O.

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Resources
    subgraph "External Resources"
        direction TB
        CSVFile["CSV File"]:::external
        Console["Console"]:::external
    end

    %% Utilities
    subgraph "Utilities"
        direction TB
        FileUtil["FileUtil"]:::util
        DSNUtil["DSN"]:::util
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        direction TB
        CSVDataMapper["CSVDataMapper"]:::infrastructure
        InMemRepo["InMemoryEmployeeRepository"]:::infrastructure
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        EmployeeModel["Employee"]:::domain
        EmployeeListModel["EmployeeList"]:::domain
        EmployeeRepoIface["EmployeeRepository"]:::domain
        DataMapperIface["DataMapper"]:::domain
        DataSourceURI["DataSourceURI"]:::domain
        AnalyzerIface["Analyzer"]:::domain
        SalaryAnalyzer["SalaryBalanceAnalyzer"]:::domain
        ReportingAnalyzer["ReportingLineLengthAnalyzer"]:::domain
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        DataMapperFactory["DataMapperFactory"]:::application
        RepoFactory["EmployeeRepositoryFactory"]:::application
        OrgAnalyzer["OrganizationAnalyzer"]:::application
        ResultListDO["ResultList"]:::application
    end

    %% Main Entry
    Main["Main"]:::application

    %% Relationships
    Main -->|"initialize factories"| DataMapperFactory
    Main -->|"initialize factories"| RepoFactory
    DataMapperFactory -->|"uses DSN & FileUtil"| DSNUtil
    DataMapperFactory -->|"uses DSN & FileUtil"| FileUtil
    DataMapperFactory -->|"creates DataMapper"| CSVDataMapper
    RepoFactory -->|"creates Repository"| InMemRepo

    CSVDataMapper -->|"reads CSV"| CSVFile
    CSVDataMapper -->|"maps to EmployeeList"| EmployeeListModel
    EmployeeListModel -->|"provided to"| InMemRepo

    Main -->|"load and map data"| CSVDataMapper
    Main -->|"load repository"| InMemRepo

    Main -->|"invoke analysis"| OrgAnalyzer
    OrgAnalyzer -->|"uses Analyzer interface"| AnalyzerIface
    AnalyzerIface --> SalaryAnalyzer
    AnalyzerIface --> ReportingAnalyzer
    SalaryAnalyzer -->|"applies salary rules"| ResultListDO
    ReportingAnalyzer -->|"applies reporting rules"| ResultListDO

    ResultListDO -->|"returns results"| Main
    Main -->|"print report"| Console

    %% Click Events
    click Main "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Main.java"
    click DataMapperFactory "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Application/Factory/DataMapperFactory.java"
    click RepoFactory "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Application/Factory/EmployeeRepositoryFactory.java"
    click OrgAnalyzer "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Application/Service/OrganizationAnalyzer.java"
    click ResultListDO "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Application/DataObject/ResultList.java"
    click CSVDataMapper "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Infrastructure/DataMapper/CSVDataMapper.java"
    click InMemRepo "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Infrastructure/Repository/InMemoryEmployeeRepository.java"
    click EmployeeModel "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Domain/Model/Employee.java"
    click EmployeeListModel "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Domain/Model/EmployeeList.java"
    click EmployeeRepoIface "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Domain/Model/EmployeeRepository.java"
    click DataMapperIface "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Domain/DataMapper/DataMapper.java"
    click DataSourceURI "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Domain/DataMapper/DataSourceURI.java"
    click AnalyzerIface "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Domain/Service/Analyzer.java"
    click ReportingAnalyzer "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Domain/Service/ReportingLineLengthAnalyzer.java"
    click SalaryAnalyzer "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Domain/Service/SalaryBalanceAnalyzer.java"
    click FileUtil "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Util/FileUtil.java"
    click DSNUtil "https://github.com/meetmatt/organization-structure-optimizer/blob/master/src/main/java/lu/golikov/oso/Util/DSN.java"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-dasharray: 5 5
    classDef util fill:#ccc,stroke:#333
    classDef infrastructure fill:#f93,stroke:#333
    classDef domain fill:#9f6,stroke:#333
    classDef application fill:#39f,stroke:#333, color:#fff
```
