# mattoofahad/net-salary-calculator architecture

> Architecture diagram of the GitHub repository mattoofahad/net-salary-calculator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mattoofahad/net-salary-calculator
- Repository: https://github.com/mattoofahad/net-salary-calculator

## Overview

##### Project Type & Purpose
- This is a Python-based salary calculator that computes the additional amount required over a desired net salary in order to cover taxes, travel costs, and work schedule factors.
- Although the current implementation is CLI-based (and includes a Streamlit scaffolding via the “app.py” file), there is also a roadmap (see TODO) for adding a REST API server and a web interface (via Streamlit) along with deployment support (e.g., via Hugging Face Spaces).
- Knowing this is primarily a command-line tool but with potential for multi-interface expansion is key.

##### Main Components
- User Interface:
- Command-Line Interface (CLI): Handled through “salary_calculator.py” where users provide arguments.
- Web Interface: “app.py” indicates usage of Streamlit for a future or experimental GUI.
- Business Logic & Calculation:
- “functions.py” likely contains the core algorithms to compute the necessary additional salary.
- “salary_calculator.py” acts as the main entry point that orchestrates input arguments, calls the functions, and displays outcomes.
- “constants.py” holds configuration or constant values used in calculations.
- Logging & Observability:
- “logs.py” manages application logging, error reporting, or debugging information.
- Configuration & Dependencies:
- “requirements.txt” lists all Python packages needed.
- The .github/workflows directory (with “hf-space.yml”) shows CI/CD and potential deployment automation (likely for Hugging Face Spaces).

##### Relationships & Interactions
- The user interacts with the CLI (or Streamlit UI) which launches the corresponding entry point (“salary_calculator.py” for CLI, “app.py” for Streamlit).
- From the entry point, input values are passed to the calculation logic in “functions.py.”
- “constants.py” provides any necessary fixed values used in these computations.
- “logs.py” is integrated with these components to capture logs and diagnostic messages.
- That the output (calculation results) is displayed on the command line or via Streamlit.

##### Architectural Patterns & Design Principles
- Despite the small scale, the project has a modular design separating the UI, business logic, and configuration.
- This modularity anticipates future extension (REST API or Streamlit-based deployment) and shows a separation-of-concerns principle.
- Flow from user input to processing logic and then output, ensuring each module/component is labeled and its dependencies are highlighted.

##### Technology and Tools
- Python 3.11 is the runtime.
- Streamlit for the future UI (“app.py”).
- GitHub Actions workflows for auto-deployment (especially to hugging face per “hf-space.yml”).
- The project is configured to run in a Conda environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Node
    user("User"):::userStyle

    %% User Interfaces Subgraph
    subgraph "User Interfaces"
        cli("CLI - salary_calculator.py"):::uiStyle
        web("Streamlit Interface - app.py"):::uiStyle
    end

    %% Business Logic Subgraph
    subgraph "Business Logic"
        calc("Calculation Logic - functions.py"):::logicStyle
        const("Constants - constants.py"):::logicStyle
        logs("Logging - logs.py"):::supportStyle
    end

    %% Support & Deployment Subgraph
    subgraph "Support & Deployment"
        deploy("Deployment & CI/CD - .github/workflows/hf-space.yml"):::supportStyle
        dependency("Dependency Management - requirements.txt"):::supportStyle
    end

    %% Future Enhancements Subgraph
    subgraph "Future Enhancements"
        future("Planned: RESTAPI&WebUIExpansion"):::futureStyle
    end

    %% Connections
    user -->|"selects"| cli
    user -->|"selects"| web

    cli -->|"calls"| calc
    cli -->|"uses"| const

    web -->|"calls"| calc
    web -->|"uses"| const

    calc -->|"logs"| logs
    calc -->|"outputs_to"| cli
    calc -->|"outputs_to"| web

    %% Deployment supports UI directly
    deploy -->|"auto_deploys"| cli
    deploy -->|"auto_deploys"| web
    dependency -->|"supports"| deploy

    %% Future enhancements connect to Business Logic as expansion
    future -->|"extends"| calc

    %% Click Events
    click cli "https://github.com/mattoofahad/net-salary-calculator/blob/main/salary_calculator.py"
    click web "https://github.com/mattoofahad/net-salary-calculator/blob/main/app.py"
    click calc "https://github.com/mattoofahad/net-salary-calculator/blob/main/functions.py"
    click const "https://github.com/mattoofahad/net-salary-calculator/blob/main/constants.py"
    click logs "https://github.com/mattoofahad/net-salary-calculator/blob/main/logs.py"
    click deploy "https://github.com/mattoofahad/net-salary-calculator/blob/main/.github/workflows/hf-space.yml"
    click dependency "https://github.com/mattoofahad/net-salary-calculator/blob/main/requirements.txt"

    %% Styles
    classDef userStyle fill:#ffebcd,stroke:#000,stroke-width:2px;
    classDef uiStyle fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef logicStyle fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef supportStyle fill:#d3d3d3,stroke:#000,stroke-width:2px;
    classDef futureStyle fill:#fffacd,stroke:#000,stroke-width:2px,stroke-dasharray: 5 5;
```
