# wirg/stqdm architecture

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

- Interactive diagram: https://gitdiagram.com/wirg/stqdm
- Repository: https://github.com/wirg/stqdm

## Overview

##### Main Components

a) Core Components:
- STqdm Library Core
- Streamlit Integration Layer
- Configuration Management
- Type System
- Frontend Progress Bar Display
- Backend Progress Bar Display

b) Integration Points:
- Pandas Integration
- Streamlit Container Integration (Main/Sidebar)

**Top Layer (User Interface):**
- Streamlit Frontend Components
- Progress Bar Display Options (Main/Sidebar)

**Middle Layer (Core Library):**
- STqdm Core Implementation
- Configuration Manager
- Type System

**Bottom Layer (Integration):**
- Pandas Integration
- Backend Progress Handling

##### Key Elements to Highlight

a) Component Relationships:
- Configuration flow
- Progress updates
- User interaction

- Blue: Core library components
- Green: Frontend/UI components
- Yellow: Integration points
- Gray: External dependencies

##### Specific Implementation Details

Key architectural features:
- Progress Bar Manager (stqdm/stqdm.py)
- Configuration System (stqdm/configuration_manager.py)
- Type Definitions (stqdm/types.py)
- Demo Applications (demo/app/)
- Example Implementations (examples/)

Create distinct sections for:
a) Runtime Flow:
- How progress updates flow from user code through the library to the Streamlit UI
- Where configuration is applied
- Both frontend and backend progress bar paths

b) Integration Points:
- How the library connects with Streamlit containers
- Pandas integration
- Demonstrate backend/frontend toggle mechanism

##### Important Relationships

- STqdm's inheritance from tqdm
- Connection to Streamlit's container system
- Configuration flow through the application
- Progress update propagation

##### Technical Details

- Python version compatibility
- Streamlit dependency
- Pandas integration capabilities
- Configuration options (frontend/backend toggles)

##### Implementation Notes

Use these symbols:
- Rectangles: Main components
- Rounded rectangles: External services/libraries
- Diamonds: Decision points

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef core fill:#2b6cb0,stroke:#1a4971,color:white
    classDef external fill:#48bb78,stroke:#2f855a,color:white
    classDef demo fill:#ed8936,stroke:#c05621,color:white
    classDef config fill:#718096,stroke:#4a5568,color:white
    classDef test fill:#805ad5,stroke:#553c9a,color:white
    
    %% Application Layer
    subgraph Applications
        DemoApp["Demo Application"]:::demo
        DemoPages["Demo Pages"]:::demo
        Examples["Example Applications"]:::demo
    end

    %% Core Implementation Layer
    subgraph CoreLayer["Core Implementation"]
        STqdm["STqdm Core"]:::core
        ConfigMgr["Configuration Manager"]:::config
        TypeSystem["Type Definitions"]:::config
    end

    %% Integration Layer
    subgraph Integration
        StreamlitInt["Streamlit Integration"]:::external
        TqdmInt["tqdm Integration"]:::external
    end

    %% Testing Layer
    subgraph Testing
        FrontendTests["Frontend Tests"]:::test
        ConfigTests["Configuration Tests"]:::test
    end

    %% Example Implementations
    subgraph Examples["Example Implementations"]
        BasicUsage["Basic Usage Example"]:::demo
        SidebarInt["Sidebar Integration"]:::demo
        PandasInt["Pandas Integration"]:::demo
    end

    %% Infrastructure
    subgraph Infrastructure
        GHActions["GitHub Actions"]:::config
        DemoUtils["Demo Utilities"]:::demo
        DemoLogic["Demo Application Logic"]:::demo
    end

    %% Relationships
    DemoApp --> STqdm
    DemoPages --> STqdm
    Examples --> STqdm
    STqdm --> StreamlitInt
    STqdm --> TqdmInt
    ConfigMgr --> STqdm
    TypeSystem --> STqdm
    STqdm --> FrontendTests
    ConfigMgr --> ConfigTests
    DemoUtils --> DemoLogic
    DemoLogic --> DemoApp

    %% Click events
    click STqdm "https://github.com/wirg/stqdm/blob/main/stqdm/stqdm.py"
    click ConfigMgr "https://github.com/wirg/stqdm/blob/main/stqdm/configuration_manager.py"
    click TypeSystem "https://github.com/wirg/stqdm/blob/main/stqdm/types.py"
    click DemoApp "https://github.com/wirg/stqdm/tree/main/demo/app/"
    click Examples "https://github.com/wirg/stqdm/tree/main/examples/"
    click FrontendTests "https://github.com/wirg/stqdm/blob/main/tests/test_streamlit_frontend.py"
    click ConfigTests "https://github.com/wirg/stqdm/blob/main/tests/test_configuration_manager.py"
    click DemoPages "https://github.com/wirg/stqdm/blob/main/demo/app/pages/1_🎬_STqdm_in_main.py"
    click BasicUsage "https://github.com/wirg/stqdm/blob/main/examples/stqdm_in_main.py"
    click SidebarInt "https://github.com/wirg/stqdm/blob/main/examples/stqdm_in_sidebar.py"
    click PandasInt "https://github.com/wirg/stqdm/blob/main/examples/stqdm_pandas.py"
    click GHActions "https://github.com/wirg/stqdm/tree/main/.github/workflows/"
    click DemoUtils "https://github.com/wirg/stqdm/blob/main/demo/src/utils.py"
    click DemoLogic "https://github.com/wirg/stqdm/blob/main/demo/src/demo_apps.py"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["External Dependencies"]:::external
        L3["Demo & Examples"]:::demo
        L4["Configuration & Types"]:::config
        L5["Testing Components"]:::test
    end
```
