# tharana-dev/contact-engine architecture

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

- Interactive diagram: https://gitdiagram.com/tharana-dev/contact-engine
- Repository: https://github.com/tharana-dev/contact-engine

## Overview

Contact Engine is a PySide6 desktop contact manager. The main workflow is to validate an added or edited contact, route it through the window controller and table model, and persist it in SQLite; the table also supports debounced search and multi-select deletion. The controller can export the model’s contacts to CSV, JSON, or vCard. The graph reflects README-documented capabilities and sampled source; edges are limited to relationships visible in those sources or explicitly documented.

Main entry points: [`main_window.py`](https://github.com/tharana-dev/contact-engine/blob/main/main_window.py) (Window controller), [`table_model.py`](https://github.com/tharana-dev/contact-engine/blob/main/table_model.py) (Table model), [`main.py`](https://github.com/tharana-dev/contact-engine/blob/main/main.py) (App startup), [`database.py`](https://github.com/tharana-dev/contact-engine/blob/main/database.py) (SQLite database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_entry["App startup<br/>[main.py]"]
  node_window["Window controller<br/>[main_window.py]"]
end

subgraph group_interface["Contact UI"]
  node_input["Add form<br/>[input_panel.py]"]
  node_list["Contact list<br/>[list_panel.py]"]
  node_dialog["Edit dialog<br/>[contact_dialog.py]"]
end

subgraph group_domain["Contact rules"]
  node_validation["Input validation<br/>[validation.py]"]
  node_contact["Contact record<br/>[contact.py]"]
end

subgraph group_data["Contact data"]
  node_model["Table model<br/>[table_model.py]"]
  node_database[("SQLite database<br/>[database.py]")]
  node_exporter["Export writers<br/>[exporter.py]"]
end

node_user(("User"))

node_user -->|"launches"| node_entry
node_entry -->|"opens"| node_database
node_entry -->|"creates"| node_window
node_entry -->|"closes on exit"| node_database
node_user -->|"enters contact"| node_input
node_input -->|"checks formats"| node_validation
node_dialog -->|"checks formats"| node_validation
node_input -->|"emits contact"| node_window
node_user -->|"uses actions"| node_window
node_window -->|"adds or deletes"| node_model
node_window -->|"opens edit"| node_dialog
node_dialog -->|"returns edits"| node_window
node_window -->|"updates contact"| node_model
node_list -->|"searches"| node_model
node_list -->|"emits delete or edit"| node_window
node_list -->|"displays via"| node_model
node_model -->|"reads and writes"| node_database
node_database -->|"creates records"| node_contact
node_window -->|"exports contacts"| node_exporter
node_exporter -->|"reads fields"| node_contact

click node_entry "https://github.com/tharana-dev/contact-engine/blob/main/main.py"
click node_window "https://github.com/tharana-dev/contact-engine/blob/main/main_window.py"
click node_input "https://github.com/tharana-dev/contact-engine/blob/main/input_panel.py"
click node_list "https://github.com/tharana-dev/contact-engine/blob/main/list_panel.py"
click node_dialog "https://github.com/tharana-dev/contact-engine/blob/main/contact_dialog.py"
click node_validation "https://github.com/tharana-dev/contact-engine/blob/main/validation.py"
click node_contact "https://github.com/tharana-dev/contact-engine/blob/main/contact.py"
click node_model "https://github.com/tharana-dev/contact-engine/blob/main/table_model.py"
click node_database "https://github.com/tharana-dev/contact-engine/blob/main/database.py"
click node_exporter "https://github.com/tharana-dev/contact-engine/blob/main/exporter.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_entry,node_window,node_user toneBlue
class node_input,node_list,node_dialog toneAmber
class node_validation,node_contact toneMint
class node_model,node_database,node_exporter toneRose
```

## Components

### Application

- [App startup](https://github.com/tharana-dev/contact-engine/blob/main/main.py): `main.py`
- [Window controller](https://github.com/tharana-dev/contact-engine/blob/main/main_window.py): `main_window.py`

### Contact UI

- [Add form](https://github.com/tharana-dev/contact-engine/blob/main/input_panel.py): `input_panel.py`
- [Contact list](https://github.com/tharana-dev/contact-engine/blob/main/list_panel.py): `list_panel.py`
- [Edit dialog](https://github.com/tharana-dev/contact-engine/blob/main/contact_dialog.py): `contact_dialog.py`

### Contact rules

- [Input validation](https://github.com/tharana-dev/contact-engine/blob/main/validation.py): `validation.py`
- [Contact record](https://github.com/tharana-dev/contact-engine/blob/main/contact.py): `contact.py`

### Contact data

- [Table model](https://github.com/tharana-dev/contact-engine/blob/main/table_model.py): `table_model.py`
- [SQLite database](https://github.com/tharana-dev/contact-engine/blob/main/database.py): `database.py`
- [Export writers](https://github.com/tharana-dev/contact-engine/blob/main/exporter.py): `exporter.py`

### Other components

- **User**

## Connections

- User → App startup: launches (evidence: `readme.md`)
- App startup → SQLite database: opens (evidence: `main.py`)
- App startup → Window controller: creates (evidence: `main.py`)
- App startup → SQLite database: closes on exit (evidence: `main.py`)
- User → Add form: enters contact (evidence: `readme.md`)
- Add form → Input validation: checks formats (evidence: `input_panel.py`)
- Edit dialog → Input validation: checks formats (evidence: `contact_dialog.py`)
- Add form → Window controller: emits contact (evidence: `main_window.py`)
- User → Window controller: uses actions (evidence: `readme.md`)
- Window controller → Table model: adds or deletes (evidence: `main_window.py`)
- Window controller → Edit dialog: opens edit (evidence: `main_window.py`)
- Edit dialog → Window controller: returns edits (evidence: `main_window.py`)
- Window controller → Table model: updates contact (evidence: `main_window.py`)
- Contact list → Table model: searches (evidence: `list_panel.py`)
- Contact list → Window controller: emits delete or edit (evidence: `main_window.py`)
- Contact list → Table model: displays via (evidence: `readme.md`)
- Table model → SQLite database: reads and writes (evidence: `table_model.py`)
- SQLite database → Contact record: creates records (evidence: `database.py`)
- Window controller → Export writers: exports contacts (evidence: `main_window.py`)
- Export writers → Contact record: reads fields (evidence: `exporter.py`)
