# jotis86/fridai architecture

> Architecture diagram of the GitHub repository jotis86/fridai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jotis86/fridai
- Repository: https://github.com/jotis86/fridai

## Overview

##### Project Type & Purpose
- FridAI is a full-stack, interactive web app that integrates data upload, exploration, model training, evaluation, and prediction into a single modular workflow.
- The README emphasizes key aspects like data preprocessing, various ML algorithms (classification and regression), and model export, all handled within a visual, user-friendly interface.

##### Analyzing the File Structure
- Top-level files like .gitignore, LICENSE, and README establish the project’s open-source nature and compliance with MIT licensing.
- The config directory (with settings.py) indicates centralized configuration management for application settings.
- The src directory contains the main application script (main.py), which likely bootstraps the Streamlit web app.
- The models directory (with __init__.py) suggests that the machine learning models (perhaps wrappers for algorithms and pipelines) are organized here.
- The utils directory (with __init__.py) is used for helper functions or utilities supporting various features.
- The tests directory contains tests (test_main.py) that ensure proper functionality of the core components.
- The images directory holds visual assets used in the UI (banners, screenshots).

##### Main Components
a. User Interface / Frontend:
- Represented by the Streamlit web interface launched from src/main.py.
- Includes modules for Data Upload, Exploratory Data Analysis, Model Training, Evaluation, and Prediction.
b. Backend/Processing Engine:
- Data processing with Pandas and NumPy.
- Visualization functionality using Matplotlib and Seaborn.
- Machine learning implementations driven by Scikit-learn.
- Model persistence via Pickle.
c. Configuration Management:
- Centralized settings in config/settings.py that drive app behavior, environment variables, and possibly database or API endpoints if needed.
d. Domain Modules:
- The models directory contains ML algorithms, preprocessing pipelines, and functions for training and evaluation.
- The utils directory includes shared helper functions to support various application features.
e. Testing Framework:
- The tests directory ensures reliability through automated tests.

##### Relationships and Interactions
- The user interacts with the UI portion (Streamlit) which in turn calls the backend logic (in src/main.py).
- This main script integrates components from the models and utils directories.
- Configuration settings (from config/settings.py) are loaded to adjust parameters or environment-specific variables.
- Data flows from file uploads through processing modules into visualization components, then into model training/evaluation routines.
- Serialization (using Pickle) is used to persist the trained models and relevant metadata.

##### Architectural Patterns & Design Principles
- Modular architecture: separating the UI (src/main.py), core ML functionalities (models), utility functions (utils), and configuration (config).
- A layered design that isolates presentation (Streamlit), business logic (data processing, model training, evaluation), and configuration.
- Clean separation ensuring that testing (tests directory) is a standalone verification of functionality.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Subgraph: User Interaction
    User["User"]:::external

    %% Subgraph: Frontend Layer
    subgraph "Frontend Layer"
        UI["Streamlit UI"]:::frontend
    end

    %% Subgraph: Configuration
    subgraph "Configuration"
        Config["Configuration (settings)"]:::config
    end

    %% Subgraph: Backend Processing
    subgraph "Backend Processing"
        DU["Data Upload"]:::backend
        DP["Data Preprocessing"]:::backend
        DV["Data Visualization"]:::backend
        MT["Model Training/Evaluation"]:::backend
        PR["Prediction"]:::backend
    end

    %% Subgraph: Domain Modules
    subgraph "Domain Modules"
        Models["ML Models & Pipelines"]:::backend
        Utils["Utility Functions"]:::backend
    end

    %% Subgraph: Testing
    subgraph "Testing"
        Test["Testing Framework"]:::test
    end

    %% Subgraph: External Dependencies
    subgraph "External Dependencies"
        Pandas["Pandas"]:::external
        Numpy["NumPy"]:::external
        Matplotlib["Matplotlib"]:::external
        Seaborn["Seaborn"]:::external
        SKLearn["Scikit-learn"]:::external
        Pickle["Pickle"]:::external
    end

    %% Relationships
    User -->|"interacts"| UI
    UI -->|"loads"| Config
    UI -->|"triggers"| DU
    DU -->|"passes"| DP
    DP -->|"enables"| DV
    DV -->|"supports"| MT
    MT -->|"generates"| PR

    UI -->|"integrates"| Models
    UI -->|"calls"| Utils

    Models -->|"utilizes"| SKLearn
    Models -->|"persists"| Pickle

    DP -->|"processes"| Pandas
    DP -->|"processes"| Numpy

    DV -->|"renders"| Matplotlib
    DV -->|"renders"| Seaborn

    Test -->|"validates"| UI
    Test -->|"validates"| Models
    Test -->|"validates"| Utils

    %% Click Events
    click UI "https://github.com/jotis86/fridai/blob/main/src/main.py"
    click Config "https://github.com/jotis86/fridai/blob/main/config/settings.py"
    click Models "https://github.com/jotis86/fridai/blob/main/models/__init__.py"
    click Utils "https://github.com/jotis86/fridai/blob/main/utils/__init__.py"
    click Test "https://github.com/jotis86/fridai/blob/main/tests/test_main.py"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#1f77b4,stroke-width:2px;
    classDef backend fill:#ffcccc,stroke:#d62728,stroke-width:2px;
    classDef config fill:#e6ffcc,stroke:#2ca02c,stroke-width:2px;
    classDef external fill:#fce5cd,stroke:#ff7f0e,stroke-width:2px;
    classDef test fill:#f5f5f5,stroke:#7f7f7f,stroke-width:2px;
```
