# otman-dev/atar-cli architecture

> Architecture diagram of the GitHub repository otman-dev/atar-cli, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/otman-dev/atar-cli
- Repository: https://github.com/otman-dev/atar-cli

## Overview

##### Project type and purpose
- This is a Python-based command-line interface (CLI) tool named “atar-cli.”
- From the file tree and module names, its primary purpose is to orchestrate machine-learning operations: data ingestion (possibly from RoboFlow), feature extraction, model training, validation, and detection routines.
- Users invoke a single entry point (`atar/cli.py`) which dispatches subcommands into the Utilities library.

##### File structure
Top-level directories and files:
- atar/cli.py – the CLI entry point (console script)
- src/Utilities/… – core logic modules (features, data ingestion, training, validation, detection, logging)
- OUTPUT/Train/… – model artifacts and argument snapshots (`args.yaml`), organized by training runs
- tests/ – unit tests for CLI and feature extraction
- build/, dist/, atar.egg-info/ – build and distribution artifacts for packaging
- setup.py / pyproject.toml – defines packaging, dependencies, and console-script entry point

##### Key insights from README
- We infer from module names and structure that this is purely a command-line orchestration tool for ML workflows.

##### Main components and interactions
a. CLI Layer (atar/cli.py)
- Parses user arguments (e.g., subcommands: train, validate, detect, etc.)
- Invokes the corresponding Utilities module with the parsed configuration (args.yaml).
b. Utilities Library (src/Utilities)
1. Data Ingestion: roboFlowDataSet.py – fetches or loads datasets
2. Preprocessing & Feature Extraction: features.py, sDetect.py, vDetect.py
3. Training Engines: modelTrain.py, rTrain.py
4. Validation/Testing: modelValid.py
5. Auxiliary: log.py (logging), flexMenu.py (interactive menus)
c. File System / Artifacts
- INPUT: Raw data directories or external data services (e.g., RoboFlow API)
- CONFIG: args.yaml saved under OUTPUT after each run
- OUTPUT: Model checkpoints, metrics, logs in OUTPUT/Train/...
d. External Dependencies
- RoboFlow (external dataset service)
- Machine-learning frameworks (e.g., PyTorch, TensorFlow) – inferred from modelTrain.py
- Logging frameworks (built into log.py)

##### Architectural patterns and design principles
- Modular CLI design: single entry point with subcommand dispatch
- Layered structure: CLI → Core Utilities → External services & file system
- Separation of concerns: each Utility module focuses on one responsibility
- Configuration-as-code: CLI writes args.yaml per run to ensure reproducibility

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Entities
    User["User"]:::external
    subgraph Control
        CLI["atar/cli.py\n(console script)"]:::control
    end
    subgraph "Utilities Library"
        subgraph "Data Ingestion"
            Ingest["roboFlowDataSet.py"]:::io
        end
        subgraph "Preprocessing & Feature Extraction"
            Features["features.py"]:::compute
            SDetect["sDetect.py"]:::compute
            VDetect["vDetect.py"]:::compute
        end
        subgraph "Training Engines"
            MTrain["modelTrain.py"]:::compute
            RTrain["rTrain.py"]:::compute
        end
        VValid["modelValid.py"]:::compute
        Log["log.py"]:::io
        Flex["flexMenu.py"]:::io
    end
    External["RoboFlow API"]:::external
    FileSys["Local File System\n(INPUT & OUTPUT)"]:::io
    Packaging["setup.py\npyproject.toml"]:::io

    %% Data Flows
    User -->|"invoke CLI"| CLI
    CLI -->|"load config"| FileSys
    CLI -->|"dispatch ingest"| Ingest
    Ingest <-->|"dataset"| External
    CLI -->|"dispatch preprocess"| Features
    CLI -->|"dispatch segmentation"| SDetect
    CLI -->|"dispatch validation detect"| VDetect
    Features -->|"features"| MTrain
    SDetect -->|"segments"| MTrain
    VDetect -->|"detections"| MTrain
    MTrain -->|"model checkpoint"| FileSys
    CLI -->|"start recurrent training"| RTrain
    RTrain -->|"model checkpoint"| FileSys
    MTrain -->|"proceed to validation"| VValid
    VValid -->|"metrics"| FileSys
    %% Logging and snapshots
    CLI -->|"args.yaml snapshot"| FileSys
    CLI -->|"log start"| Log
    Ingest -->|"log status"| Log
    Features -->|"log status"| Log
    MTrain -->|"log status"| Log
    RTrain -->|"log status"| Log
    VValid -->|"log status"| Log

    %% Packaging
    CLI -->|"entry point defined in"| Packaging

    %% Click Events
    click CLI "https://github.com/otman-dev/atar-cli/blob/master/atar/cli.py"
    click Ingest "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/roboFlowDataSet.py"
    click Features "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/features.py"
    click SDetect "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/sDetect.py"
    click VDetect "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/vDetect.py"
    click MTrain "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/modelTrain.py"
    click RTrain "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/rTrain.py"
    click VValid "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/modelValid.py"
    click Log "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/log.py"
    click Flex "https://github.com/otman-dev/atar-cli/blob/master/src/Utilities/flexMenu.py"
    click FileSys "https://github.com/otman-dev/atar-cli/blob/master/OUTPUT/Train/[train-run]/args.yaml"
    click Packaging "https://github.com/otman-dev/atar-cli/blob/master/setup.py"

    %% Styles
    classDef control fill:#FFA500,stroke:#333,stroke-width:2px
    classDef compute fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef io fill:#90EE90,stroke:#333,stroke-width:2px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:2px
```
