# whu-aise/tvdiag architecture

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

## Overview

##### Main Components
- Core Failure Diagnosis Framework: The heart of the project resides in the “core” folder. Here you find the primary diagnosis module (TVDiag.py), data augmentation (aug.py), task-oriented modules (ita.py), and various loss functions (in the “loss” subdirectory). The “model” folder holds the different submodules (Classifier, Encoder, MainModel, Voter, and backbone implementations like FC and sage), which together constitute the machine learning models for failure identification.
- Configuration: The “config” directory (with exp_config.py) defines the experiment and model parameters. These configurations drive how experiments run (e.g., which dataset to use, whether to dynamically weigh losses, etc.).
- Data Management: The “data” folder covers two datasets (gaia & sockshop). Notice the consistent structure (label.csv, raw, and tmp folders) indicating raw data ingestion, processing, and temporary storage for intermediate results.
- Extractor Module: In the “extractor” folder, you have scripts for extracting and processing raw logs, metrics, and traces. This includes specialized modules such as the “drain” folder and event-specific extractors.
- Helper Utilities

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top-Level Components
    A("Configuration"):::config
    B("Extractor Module"):::extractor
    C("Data Management"):::data
    D("Core Failure Diagnosis Framework"):::core
    E("Helper Utilities"):::helper

    %% Connections between top-level components
    A -->|"configures"| B
    B -->|"populates"| C
    C -->|"feeds"| D
    E ---|"supports"| B
    E ---|"supports"| D

    %% Subgraph for Extractor Module Details
    subgraph "Extractor Details"
        direction TB
        B1("Drain Extractor"):::extractor
        B2("Event Extractor"):::extractor
    end
    B --> B1
    B --> B2

    %% Subgraph for Data Management Datasets
    subgraph "Datasets"
        direction TB
        C1("Gaia Dataset"):::data
        C2("Sockshop Dataset"):::data
    end
    C --> C1
    C --> C2

    %% Subgraph for Core Failure Diagnosis Framework Details
    subgraph "Core Components"
        direction TB
        D1("Diagnosis Module (TVDiag.py)"):::core
        D2("Data Augmentation (aug.py)"):::core
        D3("Task Modules (ita.py)"):::core
        D4("Loss Functions (loss)"):::core
        D5("ML Models"):::core
    end
    D --> D1
    D --> D2
    D --> D3
    D --> D4
    D --> D5

    %% Subgraph for ML Models details within Core
    subgraph "ML Models"
        direction TB
        D5a("Classifier"):::models
        D5b("Encoder"):::models
        D5c("MainModel"):::models
        D5d("Voter"):::models
        D5e("Backbone: FC"):::models
        D5f("Backbone: Sage"):::models
    end
    D5 --> D5a
    D5 --> D5b
    D5 --> D5c
    D5 --> D5d
    D5 --> D5e
    D5 --> D5f

    %% Click Events
    click A "https://github.com/whu-aise/tvdiag/blob/main/config/exp_config.py"
    click B "https://github.com/whu-aise/tvdiag/tree/main/extractor/"
    click B1 "https://github.com/whu-aise/tvdiag/tree/main/extractor/drain/"
    click B2 "https://github.com/whu-aise/tvdiag/blob/main/extractor/event_extractor.py"
    click C "https://github.com/whu-aise/tvdiag/tree/main/data/"
    click C1 "https://github.com/whu-aise/tvdiag/tree/main/data/gaia/"
    click C2 "https://github.com/whu-aise/tvdiag/tree/main/data/sockshop/"
    click D "https://github.com/whu-aise/tvdiag/tree/main/core/"
    click D1 "https://github.com/whu-aise/tvdiag/blob/main/core/TVDiag.py"
    click D2 "https://github.com/whu-aise/tvdiag/blob/main/core/aug.py"
    click D3 "https://github.com/whu-aise/tvdiag/blob/main/core/ita.py"
    click D4 "https://github.com/whu-aise/tvdiag/tree/main/core/loss/"
    click D5 "https://github.com/whu-aise/tvdiag/tree/main/core/model/"
    click E "https://github.com/whu-aise/tvdiag/tree/main/helper/"

    %% Styles
    classDef config fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef extractor fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef data fill:#ccddff,stroke:#333,stroke-width:2px;
    classDef core fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef helper fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef models fill:#d0d0f0,stroke:#333,stroke-width:2px;
```
