# gpenessot/baribal architecture

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

- Interactive diagram: https://gitdiagram.com/gpenessot/baribal
- Repository: https://github.com/gpenessot/baribal

## Overview

##### Main Components
- Core Library (src/baribal):
– Core functionality is implemented in a few key modules:
- core.py – likely contains the main functional logic.
- utils.py – holds utility functions shared across the package.
- viz.py – may contain visualization helpers.
- Demonstration Use Cases (demos):
– Provides example scripts (e.g., demo_clean_names.py, demo_glimpse.py, demo_tabyl.py) and sample data.
- Documentation (docs + mkdocs.yml):
– Includes API documentation and user guides detailing installation and usage.
- Testing Suite (tests):
– Contains unit tests for various functions ensuring correctness.
- CI/CD & Project Configuration:
– GitHub workflow files (.github/workflows) indicate automated builds and tests.
– Configuration files (pyproject.toml, Makefile) guide development tooling and packaging.
- External Dependencies:
– External libraries like pandas, polars, numpy, and scipy are key to how Baribal provides its functions.

##### Interactions and Relationships
- The core library (src/baribal) is the heart of the package and directly interacts with external data through function calls.
- The demos act as both usage examples and verification of how the core package functions integrate with real datasets (using sample_data.csv and demo scripts).
- The tests uniformly validate each helper function by invoking the corresponding functions from core, utils, or viz.
- Documentation is generated and maintained (as evident from mkdocs.yml and docs/ folders) and is built possibly via CI workflows.
- CI/CD configuration (in .github/workflows) ties into testing and deployment, activating on code changes to ensure quality.

##### Architectural Patterns
- Modular Design: The package is neatly divided into separate modules (core, utils, viz) within the src folder, promoting separation of concerns.
- Test-Driven Development: The comprehensive tests directory suggests that functionality is verified through unit tests.
- Documentation-Driven Development: With dedicated docs and demos directories, the architecture emphasizes clear user guidance.

##### Incorporate Technologies and Tools
- Python (≥3.8), pandas, polars, numpy, scipy.
- Development tools such as uv for package management, ruff for linting, and pytest for testing.
- CI/CD tools as specified by GitHub workflows.
- mkdocs for generating documentation, as indicated by the mkdocs.yml file.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level Nodes
    A["External Dependencies (pandas,polars,numpy,scipy)"]:::external
    B["Baribal Core Library (src/baribal)"]:::core
    CMain["Demonstration Use Cases (demos)"]:::demo
    TMain["Testing Suite (tests)"]:::test
    DMain["Documentation (docs & mkdocs.yml)"]:::doc
    CIMain["CI/CD & Config (.github/workflows,Makefile,pyproject.toml)"]:::ci

    %% Core Library Modules
    B1["core.py"]:::coreModule
    B2["utils.py"]:::coreModule
    B3["viz.py"]:::coreModule

    %% Link Core Library to its Modules
    B --> B1
    B --> B2
    B --> B3

    %% Demonstration Use Cases Subgraph
    subgraph DemosItems [ ]
      direction TB
      C1["demo_clean_names.py"]:::demoModule
      C2["demo_glimpse.py"]:::demoModule
      C3["demo_tabyl.py"]:::demoModule
      C4["sample_data.csv"]:::demoModule
    end
    CMain --> C1
    CMain --> C2
    CMain --> C3
    CMain --> C4

    %% Testing Suite Subgraph
    subgraph TestsItems [ ]
      direction TB
      T1["test_clean_names.py"]:::testModule
      T2["test_glimpse.py"]:::testModule
      T3["test_memory_diet.py"]:::testModule
      T4["test_missing_summary.py"]:::testModule
      T5["test_rename_all.py"]:::testModule
      T6["test_tabyl.py"]:::testModule
    end
    TMain --> T1
    TMain --> T2
    TMain --> T3
    TMain --> T4
    TMain --> T5
    TMain --> T6

    %% Documentation Subgraph
    subgraph DocsItems [ ]
      direction TB
      D1["docs/"]:::docModule
      D2["mkdocs.yml"]:::docModule
    end
    DMain --> D1
    DMain --> D2

    %% CI/CD & Config Subgraph
    subgraph CIItems [ ]
      direction TB
      CI1[".github/workflows/"]:::ciModule
      CI2["Makefile"]:::ciModule
      CI3["pyproject.toml"]:::ciModule
    end
    CIMain --> CI1
    CIMain --> CI2
    CIMain --> CI3

    %% Inter-Component Relationships
    A --> B
    CMain -->|"uses"| B
    TMain -->|"validates"| B
    DMain -->|"documents"| B
    CIMain -->|"triggers"| TMain
    CIMain -->|"builds"| DMain

    %% Click Events for Core Library Modules
    click B1 "https://github.com/gpenessot/baribal/blob/main/src/baribal/core.py"
    click B2 "https://github.com/gpenessot/baribal/blob/main/src/baribal/utils.py"
    click B3 "https://github.com/gpenessot/baribal/blob/main/src/baribal/viz.py"

    %% Click Events for Demonstration Use Cases
    click CMain "https://github.com/gpenessot/baribal/tree/main/demos/"
    click C1 "https://github.com/gpenessot/baribal/blob/main/demos/demo_clean_names.py"
    click C2 "https://github.com/gpenessot/baribal/blob/main/demos/demo_glimpse.py"
    click C3 "https://github.com/gpenessot/baribal/blob/main/demos/demo_tabyl.py"
    click C4 "https://github.com/gpenessot/baribal/blob/main/demos/data/sample_data.csv"

    %% Click Events for Testing Suite
    click TMain "https://github.com/gpenessot/baribal/tree/main/tests/"
    click T1 "https://github.com/gpenessot/baribal/blob/main/tests/test_clean_names.py"
    click T2 "https://github.com/gpenessot/baribal/blob/main/tests/test_glimpse.py"
    click T3 "https://github.com/gpenessot/baribal/blob/main/tests/test_memory_diet.py"
    click T4 "https://github.com/gpenessot/baribal/blob/main/tests/test_missing_summary.py"
    click T5 "https://github.com/gpenessot/baribal/blob/main/tests/test_rename_all.py"
    click T6 "https://github.com/gpenessot/baribal/blob/main/tests/test_tabyl.py"

    %% Click Events for Documentation
    click DMain "https://github.com/gpenessot/baribal/tree/main/docs/"
    click D2 "https://github.com/gpenessot/baribal/blob/main/mkdocs.yml"

    %% Click Events for CI/CD & Config
    click CIMain "https://github.com/gpenessot/baribal/tree/main/.github/workflows/"
    click CI2 "https://github.com/gpenessot/baribal/tree/main/Makefile"
    click CI3 "https://github.com/gpenessot/baribal/blob/main/pyproject.toml"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef coreModule fill:#B0E0E6,stroke:#000,stroke-width:1px;
    classDef demo fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef demoModule fill:#98FB98,stroke:#000,stroke-width:1px;
    classDef test fill:#FFC0CB,stroke:#000,stroke-width:1px;
    classDef testModule fill:#FFB6C1,stroke:#000,stroke-width:1px;
    classDef doc fill:#DDA0DD,stroke:#000,stroke-width:1px;
    classDef docModule fill:#EE82EE,stroke:#000,stroke-width:1px;
    classDef ci fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef ciModule fill:#FFFACD,stroke:#000,stroke-width:1px;
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
