# aamir09/ftzard architecture

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

- Interactive diagram: https://gitdiagram.com/aamir09/ftzard
- Repository: https://github.com/aamir09/ftzard

## Overview

##### Main Components
- Environment & Deployment:
- The Dockerfile shows that the project is containerized.
- Pixi is used for environment activation and dependency isolation.
- Configuration:
- The “ftzard/config” folder contains YAML configuration files (including Dagster job configurations and Hydra configurations).
- Pipeline/Orchestration:
- The “ftzard/pipeline” directory holds the core pipeline logic. Within it, you have notebooks for each step (e.g., data cleaning, preprocessing, inference, hyperparameter tuning, sampling, retraining) and a central “pipeline.py” file.
- Dagster configuration files (in ftzard/config/dagster) define each step’s execution details.
- Experiment Tracking:
- MLflow is integrated, which logs runs for each experiment step. The MLflow database (mlflow.db) in the notebooks folder and the MLflow UI tasks in pixi are examples of this.
- Data Versioning:
- Although DVC-related files have been cleaned out for a new setup, the README explains that DVC is used to track data artifacts and link them with Git commits.
- Utility Modules:
- The “ftzard/utils” folder includes helper functions (e.g., common utilities, custom Dagster I/O managers, and MLflow integration routines).

##### Architectural Patterns and Design Principles
- Make it clear that configuration files (managed by Hydra and stored in ftzard/config) feed both Dagster orchestration and overall system parameters.
- That each pipeline step is responsible for executing complex tasks (like data cleaning or model training) and that results (artifacts, metadata) are logged and passed downstream.
- Bidirectional interaction between pipeline processing and external services like MLflow for logging and monitoring, and Git/DVC for version control.

## Diagram (Mermaid)

```mermaid
flowchart TD 
    %% Containerized Environment (Docker + Pixi)
    subgraph "Containerized Environment (Docker + Pixi)"
        A1("Dockerfile"):::container
        A2("pyproject.toml"):::container
        A3("pixi.lock"):::container
    end

    %% Configuration Manager
    subgraph "Configuration Manager"
        B1("ftzard/config"):::config
        B2("config.yaml"):::config
        B3("Dagster YAML"):::config
    end

    %% Pipeline & Orchestration (Dagster Ops & Jobs)
    subgraph "Pipeline & Orchestration (Dagster Ops & Jobs)"
        C1("ftzard/pipeline/pipeline.py"):::pipeline
        subgraph "Notebook Steps"
            C2("Step1: Data Cleaning"):::pipeline
            C3("Step2: Data Preprocessing"):::pipeline
            C4("Step3: Inference"):::pipeline
            C5("Step4: Hyperparameter Tuning"):::pipeline
            C6("Step5: Sampling"):::pipeline
            C7("Step6: Retraining"):::pipeline
        end
    end

    %% Experiment Tracking (MLflow)
    subgraph "Experiment Tracking (MLflow)"
        D1("MLflow Integration Database"):::tracking
        D2("MLflow Integration Logic"):::tracking
    end

    %% Data Versioning (DVC & Git)
    subgraph "Data Versioning (DVC & Git)"
        E1("DVC Tracking"):::versioning
        E2("Git Integration"):::versioning
    end

    %% Utility Modules
    subgraph "Utility Modules"
        F1("ftzard/utils"):::utility
        F2("common.py"):::utility
        F3("dagster_io_managers.py"):::utility
    end

    %% UIs & External Integration
    subgraph "UIs & External Integration"
        G1("MLflow UI"):::external
        G2("Dagster UI"):::external
    end

    %% Connections from Container to other system components
    A1 -->|"initializes"| B1
    A1 -->|"hosts"| C1

    %% Configuration influences pipeline orchestration
    B1 -->|"provides configuration"| C1

    %% Pipeline Flow
    C1 -->|"triggers"| C2
    C2 -->|"then"| C3
    C3 -->|"then"| C4
    C4 -->|"then"| C5
    C5 -->|"then"| C6
    C6 -->|"then"| C7

    %% Pipeline steps logging to Experiment Tracking and Data Versioning
    C2 -->|"logs to"| D1
    C3 -->|"logs to"| D1
    C4 -->|"logs to"| D1
    C5 -->|"logs to"| D1
    C6 -->|"logs to"| D1
    C7 -->|"logs to"| D1

    C2 -->|"artifacts to"| E1
    C3 -->|"artifacts to"| E1
    C4 -->|"artifacts to"| E1
    C5 -->|"artifacts to"| E1
    C6 -->|"artifacts to"| E1
    C7 -->|"artifacts to"| E1

    %% Utility modules support pipeline and experiment tracking
    F1 -->|"provides helpers to"| C1
    F1 -->|"integrates with"| D2
    F2 --> F1
    F3 --> F1

    %% External UIs connections
    D1 -->|"view experiments at"| G1
    C1 -->|"monitor jobs at"| G2

    %% Data Versioning integration with Git
    E1 --> E2

    %% Click Events
    click A1 "https://github.com/aamir09/ftzard/tree/main/Dockerfile"
    click A2 "https://github.com/aamir09/ftzard/blob/main/pyproject.toml"
    click A3 "https://github.com/aamir09/ftzard/blob/main/pixi.lock"

    click B1 "https://github.com/aamir09/ftzard/tree/main/ftzard/config"
    click B2 "https://github.com/aamir09/ftzard/blob/main/ftzard/config/config.yaml"
    click B3 "https://github.com/aamir09/ftzard/tree/main/ftzard/config/dagster"

    click C1 "https://github.com/aamir09/ftzard/blob/main/ftzard/pipeline/pipeline.py"
    click C2 "https://github.com/aamir09/ftzard/blob/main/ftzard/pipeline/notebooks/Step1_Data_Cleaning.ipynb"
    click C3 "https://github.com/aamir09/ftzard/blob/main/ftzard/pipeline/notebooks/Step2_Data_Preprocessing.ipynb"
    click C4 "https://github.com/aamir09/ftzard/blob/main/ftzard/pipeline/notebooks/Step3_Inference.ipynb"
    click C5 "https://github.com/aamir09/ftzard/blob/main/ftzard/pipeline/notebooks/Step4_Hyperparameter_Tuning.ipynb"
    click C6 "https://github.com/aamir09/ftzard/blob/main/ftzard/pipeline/notebooks/Step5_Sampling.ipynb"
    click C7 "https://github.com/aamir09/ftzard/blob/main/ftzard/pipeline/notebooks/Step6_Retraining.ipynb"

    click D1 "https://github.com/aamir09/ftzard/blob/main/ftzard/pipeline/notebooks/mlflow.db"
    click D2 "https://github.com/aamir09/ftzard/blob/main/ftzard/utils/mlflow.py"

    click F1 "https://github.com/aamir09/ftzard/tree/main/ftzard/utils"
    click F2 "https://github.com/aamir09/ftzard/blob/main/ftzard/utils/common.py"
    click F3 "https://github.com/aamir09/ftzard/blob/main/ftzard/utils/dagster_io_managers.py"

    %% Styles
    classDef container fill:#FFCCCC,stroke:#990000,stroke-width:2px;
    classDef config fill:#FFFFCC,stroke:#999900,stroke-width:2px;
    classDef pipeline fill:#CCFFCC,stroke:#009900,stroke-width:2px;
    classDef tracking fill:#CCE5FF,stroke:#003366,stroke-width:2px;
    classDef versioning fill:#FFEECC,stroke:#CC6600,stroke-width:2px;
    classDef utility fill:#E6CCFF,stroke:#663399,stroke-width:2px;
    classDef external fill:#E0F7FA,stroke:#006064,stroke-width:2px;
```
