# project-monai/research-contributions architecture

> Architecture diagram of the GitHub repository project-monai/research-contributions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/project-monai/research-contributions
- Repository: https://github.com/project-monai/research-contributions

## Overview

##### Project Type and Purpose
- This repository is not a single application running end-to-end, but rather a collection of independent, research-focused contributions. Its primary purpose is to showcase a variety of MONAI-based research implementations and facilitate quick integration and reproducibility via boilerplate scripts.
- The README stresses that these “contributions” are peer-reviewed and they each use MONAI components heavily. In addition, there is a focus on fast prototyping for research ideas rather than production-level code.

##### File Structure to Uncover Architectural Organization
- At the top level, you see directories such as “DAE”, “DiNTS”, “SkullRec”, “SwinMM”, “SwinUNETR”, “UNETR”, “auto3dseg”, “coplenet-pneumonia-lesion-segmentation”, “lamp-automated-model-parallelism”, and “prostate-mri-lesion-seg”. Each of these directories encapsulates a distinct research contribution or experiment.
- Within each research module these common sub-components appear:
- A README/documentation file describing the method and usage.
- Main training/inference scripts (e.g., main.py, trainer.py).
- Model definitions (e.g., variations of “swin_unetr.py”, “mlp_new.py”).
- Data utilities and configuration files that handle datasets and training parameters.
- Optimizers and schedulers indicating that most contributions follow a standard training pipeline.
- Supporting scripts and sometimes shell scripts for launching experiments.
- Additionally, configuration files and GitHub workflows (.github folder) support CI/CD, testing and packaging across these contributions. There are also dependency and pre-commit configurations indicating quality control and environment standardization.

a. Main Components:
- Individual Contribution Modules: Each research module (DAE, DiNTS, SkullRec, etc.) should be represented as a separate component or “subsystem” within the overall platform.
- Core MONAI Library: Although not directly contained in this repository, since every contribution leverages MONAI, it’s beneficial to include MONAI as an external dependency that all modules interact with.
- Supporting CI/CD and Configuration Systems: Include components representing the GitHub workflows, configuration files (like pyproject.toml, setup.cfg, pre-commit YAMLs), and testing frameworks.
- Data and Experiment Execution: Represent data preprocessing, training pipelines, and inference routines as part of each research contribution.

b. Relationships and Interactions:
- Each module internally shows communication between its configuration, training/inference scripts, data utilities, and optimizers.
- The CI/CD pipelines (GitHub workflows) interact with the repository as a whole, triggering builds, code analysis, and packaging.

c. Architectural Patterns and Design Principles:
- A modular, plug-and-play design where each contribution is largely self-contained.
- That the code organization promotes reusability: similar file structure conventions (for instance, splitting model, optimizer, data utilities) indicate adherence to best practices for research reproducibility.
- That the repository acts as a “collection-of-modules” where each maintains its own training pipelines and experimental design centered around MONAI components.

d. Key Technologies and Frameworks:
- MONAI: The common underlying framework, essential for medical imaging tasks.
- Python: For scripting and module orchestration.
- GitHub Actions and CI/CD Tools: As evident by the GitHub workflows.
- Containerization or environment management may be implicit via dependency files and scripts ensuring reproducibility.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level Platform
    MRP("MONAI Research Contributions Platform"):::platform

    %% Research Modules Subgraph
    subgraph "Research Modules"
        DAE("DAE Module"):::module
        DiNTS("DiNTS Module"):::module
        SkullRec("SkullRec Module"):::module
        SwinMM("SwinMM Module"):::module
        SwinUNETR("SwinUNETR Module"):::module
        UNETR("UNETR Module"):::module
        Auto3dseg("auto3dseg Module"):::module
        Coplenet("coplenet-pneumonia-lesion-seg Module"):::module
        LAMP("lamp-automated-model-parallelism Module"):::module
        Prostate("prostate-mri-lesion-seg Module"):::module
    end

    %% Internal Pipeline Subgraph (Generic Training Pipeline for each module)
    subgraph "Example Module Pipeline"
        CONF("Configuration"):::internal
        DATA("Data Handling"):::internal
        MODEL("Model Definition"):::internal
        TRAIN("Training/Inference"):::internal
        EVAL("Output Evaluation"):::internal
    end

    %% External Dependencies
    MONAI("MONAI Library"):::external
    CI("CI/CD & Testing Framework"):::external
    CONFIG("Configuration & Dependency Management"):::external

    %% Connections from Platform to Research Modules
    MRP --> DAE
    MRP --> DiNTS
    MRP --> SkullRec
    MRP --> SwinMM
    MRP --> SwinUNETR
    MRP --> UNETR
    MRP --> Auto3dseg
    MRP --> Coplenet
    MRP --> LAMP
    MRP --> Prostate

    %% Each Research Module uses the MONAI library (external dependency)
    DAE -->|"uses"| MONAI
    DiNTS -->|"uses"| MONAI
    SkullRec -->|"uses"| MONAI
    SwinMM -->|"uses"| MONAI
    SwinUNETR -->|"uses"| MONAI
    UNETR -->|"uses"| MONAI
    Auto3dseg -->|"uses"| MONAI
    Coplenet -->|"uses"| MONAI
    LAMP -->|"uses"| MONAI
    Prostate -->|"uses"| MONAI

    %% Illustrative Example: Internal pipeline flow for a typical module (applies to all)
    DAE -->|"pipeline"| CONF
    CONF -->|"step"| DATA
    DATA -->|"step"| MODEL
    MODEL -->|"step"| TRAIN
    TRAIN -->|"step"| EVAL

    %% CI/CD and Configuration management support the overall platform
    MRP ---|"triggers"| CI
    MRP ---|"manages"| CONFIG

    %% Styles
    classDef platform fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef module fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef internal fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef external fill:#fff3cd,stroke:#856404,stroke-width:2px;

    %% Click Events
    click MRP "https://github.com/project-monai/research-contributions/tree/main/Repository Root"
    click DAE "https://github.com/project-monai/research-contributions/tree/main/DAE/"
    click DiNTS "https://github.com/project-monai/research-contributions/tree/main/DiNTS/"
    click SkullRec "https://github.com/project-monai/research-contributions/tree/main/SkullRec/"
    click SwinMM "https://github.com/project-monai/research-contributions/tree/main/SwinMM/"
    click SwinUNETR "https://github.com/project-monai/research-contributions/tree/main/SwinUNETR/"
    click UNETR "https://github.com/project-monai/research-contributions/tree/main/UNETR/"
    click Auto3dseg "https://github.com/project-monai/research-contributions/tree/main/auto3dseg/"
    click Coplenet "https://github.com/project-monai/research-contributions/tree/main/coplenet-pneumonia-lesion-segmentation/"
    click LAMP "https://github.com/project-monai/research-contributions/tree/main/lamp-automated-model-parallelism/"
    click Prostate "https://github.com/project-monai/research-contributions/tree/main/prostate-mri-lesion-seg/"
    click CI "https://github.com/project-monai/research-contributions/tree/main/.github/"
    click CONFIG "https://github.com/project-monai/research-contributions/blob/main/pyproject.toml"
```
