# yobibyte/report architecture

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

## Overview

##### Core Library Components (Central Layer)
- AbstractReport Base Class
- Block System
- Template Engine
- Utility Functions

##### Input Layer (Top)
- Python Report Files (.py)
- Configuration (.report files)
- User Data Sources

##### Processing Layer (Middle)
- Report Generation Pipeline:
- Data Loading Phase
- Preparation Phase
- Block Assembly
- HTML Generation

##### Output Layer (Bottom)
- Static HTML Reports
- Associated Assets (images, etc.)

- [Input] → [Processing] → [Output]

##### Component Relationships

Detailed Component Breakdown:

- Report Library    |

- base.py             |
- block.py            |
- template.py         |
- util.py             |
- app.py              |

##### Configuration Flow
- Priority order:
1. Local .report
2. Git repo root .report
3. Home directory .report
4. Default values

##### Report Generation Pipeline
- [Python Report File] → [AbstractReport] → [Block Assembly] → [HTML Generation]

##### Block System
- Supported block types:
- Headers (H1, H2, H3)
- Figures
- Tables
- Paragraphs

Important Elements to Highlight:

##### File Organization
- Separation between source files and generated reports
- Configurable nature of input/output directories

##### Execution Flow
- `load_data()` and `prepare()` methods
- How blocks are sequentially added
- Demonstrate the final HTML generation process

##### Integration Points
- How the library integrates with matplotlib for figures
- Data input flexibility
- Asset management for generated content

- Symbols for different block types
- File extensions (.py, .html, .report)

Level of Detail:

##### Static HTML output

This system design should help developers understand both the high-level architecture and the detailed components while maintaining clarity about the project's purpose of providing a more disciplined alternative to Jupyter notebooks.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#2374ab,color:white
    classDef input fill:#57a773,color:white
    classDef process fill:#ff8c42,color:white
    classDef output fill:#7d4e57,color:white
    classDef config fill:#084c61,color:white

    %% Input Layer
    subgraph Input
        PY[Python Report Files]:::input
        DATA[User Data Sources]:::input
        CONFIG[Configuration Files]:::input
    end

    %% Core Library Components
    subgraph CoreLib[Report Library Core]
        ABS[AbstractReport Base Class]:::core
        BLOCK[Block System]:::core
        TEMP[Template Engine]:::core
        UTIL[Utility Functions]:::core
        APP[Application Core]:::core
    end

    %% Processing Layer
    subgraph Process[Report Generation Pipeline]
        LOAD[Data Loading Phase]:::process
        PREP[Preparation Phase]:::process
        ASSEMBLY[Block Assembly]:::process
        HTMLGEN[HTML Generation]:::process
    end

    %% Output Layer
    subgraph Output
        HTML[Static HTML Reports]:::output
        ASSETS[Associated Assets]:::output
    end

    %% Configuration Flow
    subgraph ConfigFlow[Configuration Resolution]
        LOCAL[Local .report]:::config
        GIT[Git Root .report]:::config
        HOME[Home Dir .report]:::config
        DEFAULT[Default Values]:::config
    end

    %% Block Types
    subgraph Blocks[Block Types]
        H1[Header 1]:::core
        H2[Header 2]:::core
        H3[Header 3]:::core
        FIG[Figures]:::core
        TBL[Tables]:::core
        PAR[Paragraphs]:::core
    end

    %% Relationships
    PY --> LOAD
    DATA --> LOAD
    CONFIG --> CoreLib
    LOAD --> PREP
    PREP --> ASSEMBLY
    ASSEMBLY --> HTMLGEN
    HTMLGEN --> HTML
    HTMLGEN --> ASSETS
    
    LOCAL --> CONFIG
    GIT --> CONFIG
    HOME --> CONFIG
    DEFAULT --> CONFIG

    BLOCK --> H1
    BLOCK --> H2
    BLOCK --> H3
    BLOCK --> FIG
    BLOCK --> TBL
    BLOCK --> PAR

    %% Click Events
    click ABS "https://github.com/yobibyte/report/blob/master/report/base.py"
    click BLOCK "https://github.com/yobibyte/report/blob/master/report/block.py"
    click TEMP "https://github.com/yobibyte/report/blob/master/report/template.py"
    click UTIL "https://github.com/yobibyte/report/blob/master/report/util.py"
    click APP "https://github.com/yobibyte/report/blob/master/report/app.py"
    click CONFIG "https://github.com/yobibyte/report/blob/master/.report"
    click PY "https://github.com/yobibyte/report/blob/master/examples_src/2024_11_30_megareport.py"
    click HTML "https://github.com/yobibyte/report/blob/master/examples_reports/megareport/report.html"
    click CoreLib "https://github.com/yobibyte/report/blob/master/report/__init__.py"

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Input Elements]:::input
        L3[Processing Steps]:::process
        L4[Output Elements]:::output
        L5[Configuration]:::config
    end
```
