# darkstarstrix/auto_api architecture

> Architecture diagram of the GitHub repository darkstarstrix/auto_api, 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/darkstarstrix/auto_api
- Repository: https://github.com/darkstarstrix/auto_api

## Overview

##### Main Components

a) Core AutoML Engine Layer:
- It to `Base_model.py` and `Model_Library.py` for model definitions
- `Model_Types.py` for type definitions and model categorization
- Link to `Optimization_Suite.py` for hyperparameter tuning

b) Model Layer:
- Decision Tree
- KMeans
- LightGBM
- Linear Models
- Naive Bayes
- Connection to model persistence (.pt files)

c) API/Interface Layer:
- Endpoints directory components:
- Main API (Main.py)
- Authentication (Auth.py)
- Dashboard (Dashboard.py)
- Monitoring (API_Monitoring.py)
- CLI Interface (CLI.py)

d) Training Infrastructure:
- Training Files component
- To Training Plots output
- Lightning Logs storage
- Link to Neptune.py for experiment tracking

##### Specific Implementation Details

**[Component Layout Example]**

**┌─────────────────────────────────────────────┐**
- API Layer                      │
- ┌─────────┐  ┌─────────┐  ┌────────────┐  │
- Main   │  │  Auth   │  │ Dashboard  │  │
- ┘  └─────────┘  └────────────┘  │
- ┬─────────────────────────┘

**┌───────────────────▼─────────────────────────┐**
- AutoML Core Engine               │
- ┌─────────────┐      ┌──────────────────┐  │
- Base Model   │◄────►│Model Library     │  │
- ┘      └──────────────────┘  │
- ▲                     ▲            │

- ┌─────────────┐      ┌──────────────────┐  │
- Optimization │◄────►│Training Pipeline  │  │
- ┘      └──────────────────┘  │
- ┬─────────────────────────┘

**┌───────────────────▼─────────────────────────┐**
- Model Layer                       │
- ┌─────────┐ ┌─────────┐ ┌─────────────┐   │
- Decision │ │ Linear  │ │  LightGBM   │   │
- Tree   │ │ Models  │ │             │   │
- ┘ └─────────┘ └─────────────┘   │
- ┘

##### Additional Elements

- A monitoring/logging section showing connection to Neptune.py
- Visualization pipeline connecting to Training_plots
- Configuration management flow
- External interfaces (CLI, API) entry points

##### Documentation References

- Link to Writerside documentation components
- Reference to configuration templates
- Connection to example notebooks

Remember to:
- Both synchronous and asynchronous interactions
- Scalability points and potential bottlenecks
- Version control and deployment aspects

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and Classes
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef model fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#e67e22,stroke:#d35400,color:white
    classDef training fill:#9b59b6,stroke:#8e44ad,color:white
    classDef docs fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef config fill:#34495e,stroke:#2c3e50,color:white

    %% API Layer
    subgraph API
        MainAPI["Main API"]:::api
        Auth["Authentication"]:::api
        Dashboard["Dashboard"]:::api
        APIMonitor["API Monitoring"]:::api
        CLI["CLI Interface"]:::api
        AppEntry["App Entry"]:::api
    end

    %% Core Engine Layer
    subgraph CoreEngine
        AutoML["Lightning Auto"]:::core
        BaseModel["Base Model"]:::core
        ModelLib["Model Library"]:::core
        ModelTypes["Model Types"]:::core
        OptSuite["Optimization Suite"]:::core
    end

    %% Model Layer
    subgraph Models
        DTree["Decision Tree"]:::model
        KMeans["KMeans"]:::model
        LGBM["LightGBM"]:::model
        Linear["Linear Models"]:::model
        NaiveBayes["Naive Bayes"]:::model
    end

    %% Training Infrastructure
    subgraph Training
        TrainFiles["Training Files"]:::training
        TrainPlots["Training Plots"]:::training
        LightningLogs["Lightning Logs"]:::training
        Neptune["Neptune Tracking"]:::training
    end

    %% Documentation
    subgraph Docs
        APIDocs["API Documentation"]:::docs
        HowItWorks["How It Works"]:::docs
        ModelPerf["Model Performance"]:::docs
    end

    %% Configuration
    Config["Setup Configuration"]:::config

    %% Relationships
    API --> CoreEngine
    CoreEngine --> Models
    CoreEngine --> Training
    Training --> Models
    CoreEngine --> Config
    API --> Docs

    %% Click Events
    click AutoML "https://github.com/DarkStarStrix/Auto_Api/blob/master/lightning_auto.py"
    click BaseModel "https://github.com/DarkStarStrix/Auto_Api/blob/master/Base_model.py"
    click ModelLib "https://github.com/DarkStarStrix/Auto_Api/blob/master/Model_Library.py"
    click ModelTypes "https://github.com/DarkStarStrix/Auto_Api/blob/master/Model_Types.py"
    click OptSuite "https://github.com/DarkStarStrix/Auto_Api/blob/master/Optimization_Suite.py"
    click DTree "https://github.com/DarkStarStrix/Auto_Api/blob/master/Models/decision_tree_model.pt"
    click KMeans "https://github.com/DarkStarStrix/Auto_Api/blob/master/Models/kmeans_model.pt"
    click LGBM "https://github.com/DarkStarStrix/Auto_Api/blob/master/Models/lightgbm_model.pt"
    click Linear "https://github.com/DarkStarStrix/Auto_Api/blob/master/Models/linear_model.pt"
    click NaiveBayes "https://github.com/DarkStarStrix/Auto_Api/blob/master/Models/naive_bayes_model.pt"
    click MainAPI "https://github.com/DarkStarStrix/Auto_Api/blob/master/Endpoints/Main.py"
    click Auth "https://github.com/DarkStarStrix/Auto_Api/blob/master/Endpoints/Auth.py"
    click Dashboard "https://github.com/DarkStarStrix/Auto_Api/blob/master/Endpoints/Dashboard.py"
    click APIMonitor "https://github.com/DarkStarStrix/Auto_Api/blob/master/Endpoints/API_Monitoring.py"
    click CLI "https://github.com/DarkStarStrix/Auto_Api/blob/master/Endpoints/CLI.py"
    click AppEntry "https://github.com/DarkStarStrix/Auto_Api/blob/master/Endpoints/app.py"
    click TrainFiles "https://github.com/DarkStarStrix/Auto_Api/tree/master/Train_Files/"
    click TrainPlots "https://github.com/DarkStarStrix/Auto_Api/tree/master/Training_plots/"
    click LightningLogs "https://github.com/DarkStarStrix/Auto_Api/tree/master/lightning_logs/"
    click Neptune "https://github.com/DarkStarStrix/Auto_Api/blob/master/Neptune.py"
    click APIDocs "https://github.com/DarkStarStrix/Auto_Api/blob/master/Writerside/topics/automl-api-docs.md"
    click HowItWorks "https://github.com/DarkStarStrix/Auto_Api/blob/master/Writerside/topics/How_It_works.md"
    click ModelPerf "https://github.com/DarkStarStrix/Auto_Api/blob/master/Writerside/topics/Model_Performance.md"
    click Config "https://github.com/DarkStarStrix/Auto_Api/blob/master/Configs/setup.py"
```
