# mohamedabdelnabi1/hr_system architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedabdelnabi1/hr_system
- Repository: https://github.com/mohamedabdelnabi1/hr_system

## Overview

This is a small PyQt desktop HR application for viewing, filtering, adding, and deleting departments and employees, with visible employee-table export to CSV. Its runtime flow starts in the controller, which builds the window, loads model data, and handles UI actions; the models perform SQLite access. The tree includes separate add-dialog forms. The README is empty, so capabilities are limited to those shown in the sampled source; no additional integrations are inferred.

Main entry points: [`controller/main.py`](https://github.com/mohamedabdelnabi1/hr_system/blob/master/controller/main.py) (Window controller), [`model/department.py`](https://github.com/mohamedabdelnabi1/hr_system/blob/master/model/department.py) (Department records), [`model/employee.py`](https://github.com/mohamedabdelnabi1/hr_system/blob/master/model/employee.py) (Employee records), [`view/main_window.py`](https://github.com/mohamedabdelnabi1/hr_system/blob/master/view/main_window.py) (HR main form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_controller["Window controller<br/>[main.py]"]
  node_main_ui["HR main form<br/>[main_window.py]"]
  node_dept_dialog["Add department form<br/>[add_dept.ui]"]
  node_emp_dialog["Add employee form<br/>[add_emp.ui]"]
end

subgraph group_domain["HR records"]
  node_departments["Department records<br/>[department.py]"]
  node_employees["Employee records<br/>[employee.py]"]
end

subgraph group_storage["Persistence and export"]
  node_sqlite[("HR SQLite database")]
  node_csv["CSV export file"]
end

node_user(("HR user"))

node_user -->|"uses"| node_controller
node_controller -->|"sets up"| node_main_ui
node_main_ui -->|"dispatches actions"| node_controller
node_controller -->|"loads records"| node_departments
node_controller -->|"loads records"| node_employees
node_controller -->|"loads form"| node_dept_dialog
node_controller -->|"loads form"| node_emp_dialog
node_controller -->|"saves or deletes"| node_departments
node_controller -->|"saves or deletes"| node_employees
node_departments -->|"reads and writes"| node_sqlite
node_employees -->|"reads and writes"| node_sqlite
node_controller -->|"writes visible rows"| node_csv

click node_controller "https://github.com/mohamedabdelnabi1/hr_system/blob/master/controller/main.py"
click node_main_ui "https://github.com/mohamedabdelnabi1/hr_system/blob/master/view/main_window.py"
click node_dept_dialog "https://github.com/mohamedabdelnabi1/hr_system/blob/master/view/add_dept.ui"
click node_emp_dialog "https://github.com/mohamedabdelnabi1/hr_system/blob/master/view/add_emp.ui"
click node_departments "https://github.com/mohamedabdelnabi1/hr_system/blob/master/model/department.py"
click node_employees "https://github.com/mohamedabdelnabi1/hr_system/blob/master/model/employee.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_controller,node_main_ui,node_dept_dialog,node_emp_dialog,node_user toneBlue
class node_departments,node_employees toneAmber
class node_sqlite,node_csv toneMint
```

## Components

### Desktop interface

- [Window controller](https://github.com/mohamedabdelnabi1/hr_system/blob/master/controller/main.py): `controller/main.py`
- [HR main form](https://github.com/mohamedabdelnabi1/hr_system/blob/master/view/main_window.py): `view/main_window.py`
- [Add department form](https://github.com/mohamedabdelnabi1/hr_system/blob/master/view/add_dept.ui): `view/add_dept.ui`
- [Add employee form](https://github.com/mohamedabdelnabi1/hr_system/blob/master/view/add_emp.ui): `view/add_emp.ui`

### HR records

- [Department records](https://github.com/mohamedabdelnabi1/hr_system/blob/master/model/department.py): `model/department.py`
- [Employee records](https://github.com/mohamedabdelnabi1/hr_system/blob/master/model/employee.py): `model/employee.py`

### Persistence and export

- **HR SQLite database**
- **CSV export file**

### Other components

- **HR user**

## Connections

- HR user → Window controller: uses (evidence: `controller/main.py`)
- Window controller → HR main form: sets up (evidence: `controller/main.py`)
- HR main form → Window controller: dispatches actions (evidence: `controller/main.py`)
- Window controller → Department records: loads records (evidence: `controller/main.py`)
- Window controller → Employee records: loads records (evidence: `controller/main.py`)
- Window controller → Add department form: loads form (evidence: `controller/main.py`)
- Window controller → Add employee form: loads form (evidence: `controller/main.py`)
- Window controller → Department records: saves or deletes (evidence: `controller/main.py`)
- Window controller → Employee records: saves or deletes (evidence: `controller/main.py`)
- Department records → HR SQLite database: reads and writes (evidence: `model/department.py`)
- Employee records → HR SQLite database: reads and writes (evidence: `model/employee.py`)
- Window controller → CSV export file: writes visible rows (evidence: `controller/main.py`)
