# it-is-me-mario/mario architecture

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

- Interactive diagram: https://gitdiagram.com/it-is-me-mario/mario
- Repository: https://github.com/it-is-me-mario/mario

## Overview

##### Project Type and Purpose
- MARIO is a Python package for input–output analysis. It’s designed to parse different structured databases (e.g., EXIOBASE, EORA, EUROSTAT, FIGARO) from various file formats and then perform a series of analytical operations such as aggregation, transformation (e.g., SUT to IOT), scenario/shock analysis, and visualization.
- The package is intended to offer a simple and intuitive API for regional input–output analysis, inspired by Pymrio. Its purpose is to aid users in modeling, data transformation, and visualization of economic input–output models.

##### Analyzing the File Structure
- Key Directories/Files:
- "mario/" directory: Holds the main package modules.
· "mario/core": Contains the core functions and classes (e.g., CoreIO, CoreModel functions) that drive the input–output processing.
· "mario/log_exc": Includes exception classes and logging utilities for error handling.
· "mario/settings": Manages configurations (with both code and YAML settings) which control runtime behavior.
· "mario/tools": Provides various utility functions such as database building, aggregation, file parsing, plotting, and conversion routines.
- "tests/": Contains unit tests and mock data for validating package components.
- "doc/": Documentation sources including Sphinx configurations, built HTML outputs, and notebooks showing usage examples.
- Configuration and packaging files (e.g., setup.py, requirements.txt, Pipfile) indicate that the project supports both pip and conda environments.
- Architectural Patterns:
- A modular design is evident with a clear separation of concerns (core processing, auxiliary tools, settings, and logging).
- Testing and documentation appear as separate “support” layers for ensuring reliability and ease-of-use.

- Main Components:
a. User Interface / External Scripts:
– Users interact with the package by importing “mario” and calling functions (e.g., load_test, plotting routines, table parsing).
b. Core Processing Module (mario/core):
– Contains all the primary data management routines that parse and process the input–output/supply–use tables.
– Represents the central “engine” handling the transformation and analysis logic.
c. Tools and Utilities (mario/tools):
– Provides functions for aggregating data, handling excel files, creating visual plots, performing database transformations, file parsing, etc.
– Acts as a helper layer that augments the core functionality.
d. Configuration and Settings (mario/settings):
– Manages runtime parameters, default settings, and YAML configurations.
e. Exception and Logging (mario/log_exc):
– Handles error catching, logging, and exception reporting for robust operations.
f. Testing and Documentation:

- Relationship and Data Flow:
- That “Core Processing” is central and interacts with “Tools” for extended functionalities (such as file parsing, plotting, and aggregation).
- That “Settings” and “Exception Handling” are support modules that provide configuration data and error management across the entire system.
- “Documentation” as an adjunct component that details usage, API details, and examples (derived from the “doc/” folder).

##### Architectural Patterns & Design Principles
- Integration points (for instance, where parsed data flows from file readers in the tools module to core analysis functions).
- Notes on the transformation and export capabilities (e.g., data flows into plotting routines and external file exports).

## Diagram (Mermaid)

```mermaid
graph TD
    UI["User Interface/External Scripts"]:::user

    subgraph "MARIO Package"
        CORE["Core Module"]:::core
        TOOLS["Tools & Utilities"]:::tools
        CONFIG["Configuration and Settings"]:::settings
        LOG["Logging & Exception Handling"]:::logging
    end

    TESTS["Tests"]:::support
    DOC["Documentation"]:::support

    UI -->|"calls"| CORE
    CORE -->|"uses"| TOOLS
    CORE -->|"getsConfig"| CONFIG
    CORE -->|"reports"| LOG

    TESTS -.-> CORE
    TESTS -.-> TOOLS
    TESTS -.-> CONFIG
    TESTS -.-> LOG

    CORE -.-> DOC
    TOOLS -.-> DOC

    click CORE "https://github.com/it-is-me-mario/mario/tree/main/mario/core/"
    click TOOLS "https://github.com/it-is-me-mario/mario/tree/main/mario/tools/"
    click CONFIG "https://github.com/it-is-me-mario/mario/tree/main/mario/settings/"
    click LOG "https://github.com/it-is-me-mario/mario/tree/main/mario/log_exc/"
    click TESTS "https://github.com/it-is-me-mario/mario/tree/main/tests/"
    click DOC "https://github.com/it-is-me-mario/mario/tree/main/doc/"

    classDef user fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef core fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef tools fill:#f9844a,stroke:#333,stroke-width:2px;
    classDef settings fill:#577590,stroke:#333,stroke-width:2px,color:#fff;
    classDef logging fill:#f94144,stroke:#333,stroke-width:2px;
    classDef support fill:#e0e0e0,stroke:#666,stroke-dasharray: 5,5;
    classDef external fill:#a0c4ff,stroke:#333,stroke-width:2px;
```
