# yunruse/noether architecture

> Architecture diagram of the GitHub repository yunruse/noether, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yunruse/noether
- Repository: https://github.com/yunruse/noether

## Overview

##### Main Components

a) Core System:
- `core/` directory components as the fundamental building blocks:
- Measure (handling measurements)
- Unit (base unit definitions)
- Dimension (dimensional analysis)
- Catalogue (unit registry)
- Handler (output formatting)

b) Unit Types Layer:
- Different unit implementations from `core/units/`:
- Linear Units
- Affine Units
- Geometric Units
- Logarithmic Units
- Prefixed Units

c) Catalogue Layer:
- Extensive unit catalogue into categories:
- Scientific (SI, CGS, astronomy, constants)
- Conventional
- Historic
- Humorous

d) Interface Layer:
- CLI Interface
- Python API
- System
- Configuration Handler

##### Relationships and Data Flow

- User input flow through either CLI or Python API
- Unit conversion pathways
- Catalogue lookup operations
- Formatting process

##### Specific Implementation Details

- Input parsing system (_tokenizers.py)
- Unit conversion logic (Multiplication.py)
- Configuration management (config.py)
- Error handling (errors.py)

##### External Integrations (Planned)
- Planned integrations with:
- GNU units
- NumPy
- Matplotlib

##### The configuration system that allows customization

Key Architectural Patterns to Highlight:

##### Facade Pattern (for simple API access)

- Diamond endings: Composition relationships
- Rectangles: Core components
- Rounded rectangles: Interfaces
- Hexagons: External systems

Level of Detail:

##### Conversion Pipeline

Remember to include version information (Python 3.10+ requirement) and note the planned future integrations as part of the system's evolution.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core["Core System"]
        Measure["Measure Handler"]
        Unit["Unit System"]
        Dimension["Dimension Handler"]
        Catalogue["Catalogue System"]
        Display["Display Handler"]
    end

    subgraph Units["Unit Types"]
        Linear["Linear Units"]
        Affine["Affine Units"]
        Geometric["Geometric Units"]
        Logarithmic["Logarithmic Units"]
        Prefixed["Prefixed Units"]
    end

    subgraph Cat["Catalogue Categories"]
        Scientific["Scientific Units"]
        Conventional["Conventional Units"]
        Historic["Historic Units"]
        Humorous["Humorous Units"]
    end

    subgraph Interface["Interface Layer"]
        CLI["CLI Interface"]
        DisplaySystem["Display System"]
        Config["Configuration Handler"]
    end

    subgraph Implementation["Implementation Details"]
        Parser["Input Parser"]
        Conversion["Unit Conversion"]
        ErrorHandler["Error Handler"]
        GNUIntegration["GNU Units Integration"]
    end

    subgraph SciData["Scientific Data"]
        Constants["Constants"]
        SI["SI Units"]
        CGS["CGS Units"]
        Astro["Astronomical Units"]
    end

    %% Core relationships
    Unit --> Dimension
    Unit --> Catalogue
    Measure --> Unit
    Measure --> Display
    
    %% Unit type relationships
    Unit --> Linear
    Unit --> Affine
    Unit --> Geometric
    Unit --> Logarithmic
    Unit --> Prefixed

    %% Catalogue relationships
    Catalogue --> Scientific
    Catalogue --> Conventional
    Catalogue --> Historic
    Catalogue --> Humorous

    %% Interface relationships
    CLI --> Parser
    CLI --> Conversion
    DisplaySystem --> Display
    Config --> Catalogue

    %% Scientific data relationships
    Scientific --> Constants
    Scientific --> SI
    Scientific --> CGS
    Scientific --> Astro

    %% External integrations
    GNUIntegration -.-> Conversion
    ErrorHandler --> Measure

    %% Styling
    classDef core fill:#a8d1f0
    classDef units fill:#90EE90
    classDef cat fill:#FFB366
    classDef interface fill:#DDA0DD
    classDef impl fill:#D3D3D3
    classDef scidata fill:#98FB98

    class Measure,Unit,Dimension,Catalogue,Display core
    class Linear,Affine,Geometric,Logarithmic,Prefixed units
    class Scientific,Conventional,Historic,Humorous cat
    class CLI,DisplaySystem,Config interface
    class Parser,Conversion,ErrorHandler,GNUIntegration impl
    class Constants,SI,CGS,Astro scidata

    %% Click events
    click Measure "https://github.com/yunruse/noether/blob/release/noether/core/Measure.py"
    click Unit "https://github.com/yunruse/noether/blob/release/noether/core/Unit.py"
    click Dimension "https://github.com/yunruse/noether/blob/release/noether/core/Dimension.py"
    click Catalogue "https://github.com/yunruse/noether/blob/release/noether/core/Catalogue.py"
    click Display "https://github.com/yunruse/noether/blob/release/noether/core/_DisplayHandler.py"
    click Linear "https://github.com/yunruse/noether/blob/release/noether/core/units/LinearUnit.py"
    click Affine "https://github.com/yunruse/noether/blob/release/noether/core/units/AffineUnit.py"
    click Geometric "https://github.com/yunruse/noether/blob/release/noether/core/units/GeometricUnit.py"
    click Logarithmic "https://github.com/yunruse/noether/blob/release/noether/core/units/LogarithmicUnit.py"
    click Prefixed "https://github.com/yunruse/noether/blob/release/noether/core/units/PrefixedUnit.py"
    click Scientific "https://github.com/yunruse/noether/tree/release/noether/catalogue/scientific/"
    click Conventional "https://github.com/yunruse/noether/tree/release/noether/catalogue/conventional/"
    click Historic "https://github.com/yunruse/noether/tree/release/noether/catalogue/historic/"
    click Humorous "https://github.com/yunruse/noether/tree/release/noether/catalogue/humorous/"
    click CLI "https://github.com/yunruse/noether/blob/release/noether/__main__.py"
    click DisplaySystem "https://github.com/yunruse/noether/blob/release/noether/display.py"
    click Config "https://github.com/yunruse/noether/blob/release/noether/config.py"
    click Parser "https://github.com/yunruse/noether/blob/release/noether/_tokenizers.py"
    click Conversion "https://github.com/yunruse/noether/blob/release/noether/Multiplication.py"
    click ErrorHandler "https://github.com/yunruse/noether/blob/release/noether/errors.py"
    click GNUIntegration "https://github.com/yunruse/noether/blob/release/noether/gnu.py"
    click Constants "https://github.com/yunruse/noether/blob/release/noether/catalogue/scientific/constants.py"
    click SI "https://github.com/yunruse/noether/blob/release/noether/catalogue/scientific/si.py"
    click CGS "https://github.com/yunruse/noether/blob/release/noether/catalogue/scientific/cgs.py"
    click Astro "https://github.com/yunruse/noether/blob/release/noether/catalogue/scientific/astronomy.py"
```
