# abdesslam-oop/elecalc architecture

> Architecture diagram of the GitHub repository abdesslam-oop/elecalc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdesslam-oop/elecalc
- Repository: https://github.com/abdesslam-oop/elecalc

## Overview

EleCalc is an electronics calculator available through a menu-driven CLI, a tabbed desktop GUI, and a keyboard-driven TUI. Users select a calculation, enter engineering values (including SI prefixes), receive results, and can review or export calculation history. The six calculation domains are distinct runtime capabilities; calculation history is shared through a logger facade and SQLite-backed storage. The README documents the full interface coverage; source excerpts directly confirm CLI routing, GUI/TUI calculation examples, and the history persistence boundary.

Main entry points: [`main.py`](https://github.com/abdesslam-oop/elecalc/blob/main/main.py) (Terminal menu), [`gui/main_app.py`](https://github.com/abdesslam-oop/elecalc/blob/main/gui/main_app.py) (Desktop tabs), [`modules/logger.py`](https://github.com/abdesslam-oop/elecalc/blob/main/modules/logger.py) (History facade), [`tui/app.py`](https://github.com/abdesslam-oop/elecalc/blob/main/tui/app.py) (Keyboard TUI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["Terminal menu<br/>[main.py]"]
  node_gui["Desktop tabs<br/>[main_app.py]"]
  node_tui["Keyboard TUI<br/>[app.py]"]
end

subgraph group_calculators["Calculation domains"]
  node_ohms["Ohm's law<br/>[Ohm_s_law.py]"]
  node_resistor["Resistor decoder"]
  node_rc["RC analysis<br/>[rc_circuit.py]"]
  node_converter["Unit converter<br/>[unit_converter.py]"]
  node_rlc["RLC analysis<br/>[rlc_circuit.py]"]
  node_frequency["Bode response"]
end

subgraph group_history["History and storage"]
  node_logger["History facade<br/>[logger.py]"]
  node_storage[("SQLite and JSON<br/>[storage.py]")]
end

subgraph group_presentation["Shared presentation"]
  node_display["Terminal presentation<br/>[display.py]"]
end

node_user(("Engineer or learner"))

node_user -->|"selects and enters"| node_cli
node_user -->|"enters values"| node_gui
node_user -->|"selects and enters"| node_tui
node_cli -->|"routes choice"| node_ohms
node_cli -->|"routes choice"| node_resistor
node_cli -->|"routes choice"| node_rc
node_cli -->|"routes choice"| node_converter
node_cli -->|"routes choice"| node_rlc
node_cli -->|"routes choice"| node_frequency
node_gui -->|"computes with"| node_ohms
node_gui -->|"computes with"| node_resistor
node_gui -->|"computes with"| node_rc
node_gui -->|"computes with"| node_converter
node_gui -->|"computes with"| node_rlc
node_gui -->|"computes with"| node_frequency
node_tui -->|"computes with"| node_ohms
node_tui -->|"computes with"| node_resistor
node_tui -->|"computes with"| node_rc
node_tui -->|"computes with"| node_converter
node_tui -->|"computes with"| node_rlc
node_tui -->|"computes with"| node_frequency
node_ohms -->|"records calculation"| node_logger
node_resistor -->|"records calculation"| node_logger
node_rc -->|"records calculation"| node_logger
node_converter -->|"records calculation"| node_logger
node_rlc -->|"records calculation"| node_logger
node_frequency -->|"records calculation"| node_logger
node_cli -->|"views history"| node_logger
node_gui -->|"views history"| node_logger
node_logger -->|"delegates persistence"| node_storage
node_cli -->|"renders terminal UI"| node_display
node_ohms -->|"prompts and formats"| node_display
node_resistor -->|"formats results"| node_display
node_rlc -->|"formats results"| node_display
node_frequency -->|"renders terminal output"| node_display

click node_cli "https://github.com/abdesslam-oop/elecalc/blob/main/main.py"
click node_gui "https://github.com/abdesslam-oop/elecalc/blob/main/gui/main_app.py"
click node_tui "https://github.com/abdesslam-oop/elecalc/blob/main/tui/app.py"
click node_ohms "https://github.com/abdesslam-oop/elecalc/blob/main/modules/Ohm_s_law.py"
click node_resistor "https://github.com/abdesslam-oop/elecalc/blob/main/modules/resistor_decoder.py"
click node_rc "https://github.com/abdesslam-oop/elecalc/blob/main/modules/rc_circuit.py"
click node_converter "https://github.com/abdesslam-oop/elecalc/blob/main/modules/unit_converter.py"
click node_rlc "https://github.com/abdesslam-oop/elecalc/blob/main/modules/rlc_circuit.py"
click node_frequency "https://github.com/abdesslam-oop/elecalc/blob/main/modules/frequency_response.py"
click node_logger "https://github.com/abdesslam-oop/elecalc/blob/main/modules/logger.py"
click node_storage "https://github.com/abdesslam-oop/elecalc/blob/main/modules/storage.py"
click node_display "https://github.com/abdesslam-oop/elecalc/blob/main/modules/display.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_gui,node_tui toneBlue
class node_ohms,node_resistor,node_rc,node_converter,node_rlc,node_frequency toneAmber
class node_logger,node_storage toneMint
class node_display toneRose
class node_user toneIndigo
```

## Components

### User interfaces

- [Terminal menu](https://github.com/abdesslam-oop/elecalc/blob/main/main.py): `main.py`
- [Desktop tabs](https://github.com/abdesslam-oop/elecalc/blob/main/gui/main_app.py): `gui/main_app.py`
- [Keyboard TUI](https://github.com/abdesslam-oop/elecalc/blob/main/tui/app.py): `tui/app.py`

### Calculation domains

- [Ohm's law](https://github.com/abdesslam-oop/elecalc/blob/main/modules/Ohm_s_law.py): `modules/Ohm_s_law.py`
- [Resistor decoder](https://github.com/abdesslam-oop/elecalc/blob/main/modules/resistor_decoder.py): `modules/resistor_decoder.py`
- [RC analysis](https://github.com/abdesslam-oop/elecalc/blob/main/modules/rc_circuit.py): `modules/rc_circuit.py`
- [Unit converter](https://github.com/abdesslam-oop/elecalc/blob/main/modules/unit_converter.py): `modules/unit_converter.py`
- [RLC analysis](https://github.com/abdesslam-oop/elecalc/blob/main/modules/rlc_circuit.py): `modules/rlc_circuit.py`
- [Bode response](https://github.com/abdesslam-oop/elecalc/blob/main/modules/frequency_response.py): `modules/frequency_response.py`

### History and storage

- [History facade](https://github.com/abdesslam-oop/elecalc/blob/main/modules/logger.py): `modules/logger.py`
- [SQLite and JSON](https://github.com/abdesslam-oop/elecalc/blob/main/modules/storage.py): `modules/storage.py`

### Shared presentation

- [Terminal presentation](https://github.com/abdesslam-oop/elecalc/blob/main/modules/display.py): `modules/display.py`

### Other components

- **Engineer or learner**

## Connections

- Engineer or learner → Terminal menu: selects and enters (evidence: `README.md`)
- Engineer or learner → Desktop tabs: enters values (evidence: `README.md`)
- Engineer or learner → Keyboard TUI: selects and enters (evidence: `README.md`)
- Terminal menu → Ohm's law: routes choice (evidence: `main.py`)
- Terminal menu → Resistor decoder: routes choice (evidence: `main.py`)
- Terminal menu → RC analysis: routes choice (evidence: `main.py`)
- Terminal menu → Unit converter: routes choice (evidence: `README.md`)
- Terminal menu → RLC analysis: routes choice (evidence: `main.py`)
- Terminal menu → Bode response: routes choice (evidence: `README.md`)
- Desktop tabs → Ohm's law: computes with (evidence: `README.md`)
- Desktop tabs → Resistor decoder: computes with (evidence: `README.md`)
- Desktop tabs → RC analysis: computes with (evidence: `gui/main_app.py`)
- Desktop tabs → Unit converter: computes with (evidence: `README.md`)
- Desktop tabs → RLC analysis: computes with (evidence: `README.md`)
- Desktop tabs → Bode response: computes with (evidence: `gui/main_app.py`)
- Keyboard TUI → Ohm's law: computes with (evidence: `README.md`)
- Keyboard TUI → Resistor decoder: computes with (evidence: `README.md`)
- Keyboard TUI → RC analysis: computes with (evidence: `tui/app.py`)
- Keyboard TUI → Unit converter: computes with (evidence: `README.md`)
- Keyboard TUI → RLC analysis: computes with (evidence: `README.md`)
- Keyboard TUI → Bode response: computes with (evidence: `tui/app.py`)
- Ohm's law → History facade: records calculation (evidence: `modules/Ohm_s_law.py`)
- Resistor decoder → History facade: records calculation (evidence: `modules/resistor_decoder.py`)
- RC analysis → History facade: records calculation (evidence: `modules/rc_circuit.py`)
- Unit converter → History facade: records calculation (evidence: `modules/unit_converter.py`)
- RLC analysis → History facade: records calculation (evidence: `modules/rlc_circuit.py`)
- Bode response → History facade: records calculation (evidence: `modules/frequency_response.py`)
- Terminal menu → History facade: views history (evidence: `README.md`)
- Desktop tabs → History facade: views history (evidence: `README.md`)
- History facade → SQLite and JSON: delegates persistence (evidence: `modules/logger.py`)
- Terminal menu → Terminal presentation: renders terminal UI (evidence: `main.py`)
- Ohm's law → Terminal presentation: prompts and formats (evidence: `modules/Ohm_s_law.py`)
- Resistor decoder → Terminal presentation: formats results (evidence: `modules/resistor_decoder.py`)
- RLC analysis → Terminal presentation: formats results (evidence: `modules/rlc_circuit.py`)
- Bode response → Terminal presentation: renders terminal output (evidence: `modules/frequency_response.py`)
