# pitarchalexandre/pdf-summariser architecture

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

- Interactive diagram: https://gitdiagram.com/pitarchalexandre/pdf-summariser
- Repository: https://github.com/pitarchalexandre/pdf-summariser

## Overview

PDF Summariser is a Tkinter desktop app whose main workflow selects a PDF, extracts text (using OCR for scanned documents), generates a user-configured multilingual summary, and lets the user export it or ask questions about it. The main window orchestrates these stages and also manages model settings, themes, and chatbot interaction. The README documents provider choices and export formats; sampled sources show the primary calls. OCR tooling is visible in the PDF module, while details of some UI actions and export behavior are not fully excerpted.

Main entry points: [`PDF-Summariser/main.py`](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/main.py) (Main window), [`PDF-Summariser/ia_client.py`](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/ia_client.py) (Summary generation), [`PDF-Summariser/ollama_manager.py`](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/ollama_manager.py) (Ollama manager), [`PDF-Summariser/pdf.py`](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/pdf.py) (PDF text extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop interface"]
  node_main_ui["Main window<br/>[main.py]"]
  node_theme["Theme control<br/>[main.py]"]
end

subgraph group_documents["Document workflow"]
  node_pdf_select["PDF selection<br/>[pdf.py]"]
  node_pdf_text["PDF text extraction<br/>[pdf.py]"]
  node_ocr["OCR conversion<br/>[pdf.py]"]
end

subgraph group_ai["AI services"]
  node_summary["Summary generation<br/>[ia_client.py]"]
  node_chatbot["Chatbot context and answers<br/>[chat_bot.py]"]
  node_ollama_manager["Ollama manager<br/>[ollama_manager.py]"]
end

subgraph group_settings["Settings and export"]
  node_model_config["Model configuration<br/>[config_ia.py]"]
  node_config_file[("Model settings JSON<br/>[config.json]")]
  node_export["Summary export<br/>[registered_file.py]"]
end

node_user(("User"))
node_ocr_tools["OCR and PDF tools"]
node_ai_provider["AI provider API"]
node_ollama_service["Local Ollama"]

node_user -->|"uses"| node_main_ui
node_main_ui -->|"toggles"| node_theme
node_main_ui -->|"selects PDF"| node_pdf_select
node_main_ui -->|"extracts text"| node_pdf_text
node_pdf_text -->|"falls back"| node_ocr
node_ocr -->|"uses"| node_ocr_tools
node_main_ui -->|"loads settings"| node_model_config
node_model_config -->|"reads and writes"| node_config_file
node_main_ui -->|"generates summary"| node_summary
node_summary -->|"sends completion"| node_ai_provider
node_main_ui -->|"handles questions"| node_chatbot
node_chatbot -->|"reuses generation"| node_summary
node_main_ui -->|"saves summary"| node_export
node_main_ui -->|"starts service"| node_ollama_manager
node_main_ui -->|"pulls selected model"| node_ollama_manager
node_ollama_manager -->|"starts or pulls"| node_ollama_service
node_ai_provider -.->|"optional local API"| node_ollama_service

click node_main_ui "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/main.py"
click node_theme "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/main.py"
click node_pdf_select "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/pdf.py"
click node_pdf_text "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/pdf.py"
click node_ocr "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/pdf.py"
click node_summary "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/ia_client.py"
click node_chatbot "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/chat_bot.py"
click node_model_config "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/config_ia.py"
click node_config_file "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/config.json"
click node_export "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/registered_file.py"
click node_ollama_manager "https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/ollama_manager.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_main_ui,node_theme,node_user toneBlue
class node_pdf_select,node_pdf_text,node_ocr toneAmber
class node_summary,node_chatbot,node_ollama_manager,node_ai_provider toneMint
class node_model_config,node_config_file,node_export toneRose
class node_ocr_tools,node_ollama_service toneIndigo
```

## Components

### Desktop interface

- [Main window](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/main.py): `PDF-Summariser/main.py`
- [Theme control](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/main.py): `PDF-Summariser/main.py`

### Document workflow

- [PDF selection](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/pdf.py): `PDF-Summariser/pdf.py`
- [PDF text extraction](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/pdf.py): `PDF-Summariser/pdf.py`
- [OCR conversion](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/pdf.py): `PDF-Summariser/pdf.py`

### AI services

- [Summary generation](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/ia_client.py): `PDF-Summariser/ia_client.py`
- [Chatbot context and answers](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/chat_bot.py): `PDF-Summariser/chat_bot.py`
- [Ollama manager](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/ollama_manager.py): `PDF-Summariser/ollama_manager.py`

### Settings and export

- [Model configuration](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/config_ia.py): `PDF-Summariser/config_ia.py`
- [Model settings JSON](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/config.json): `PDF-Summariser/config.json`
- [Summary export](https://github.com/pitarchalexandre/pdf-summariser/blob/main/PDF-Summariser/registered_file.py): `PDF-Summariser/registered_file.py`

### Other components

- **User**
- **OCR and PDF tools**
- **AI provider API**
- **Local Ollama**

## Connections

- User → Main window: uses (evidence: `README.md`)
- Main window → Theme control: toggles (evidence: `PDF-Summariser/main.py`)
- Main window → PDF selection: selects PDF (evidence: `PDF-Summariser/main.py`)
- Main window → PDF text extraction: extracts text (evidence: `PDF-Summariser/main.py`)
- PDF text extraction → OCR conversion: falls back (evidence: `PDF-Summariser/pdf.py`)
- OCR conversion → OCR and PDF tools: uses (evidence: `PDF-Summariser/pdf.py`)
- Main window → Model configuration: loads settings (evidence: `PDF-Summariser/main.py`)
- Model configuration → Model settings JSON: reads and writes (evidence: `PDF-Summariser/config_ia.py`)
- Main window → Summary generation: generates summary (evidence: `PDF-Summariser/main.py`)
- Summary generation → AI provider API: sends completion (evidence: `PDF-Summariser/ia_client.py`)
- Main window → Chatbot context and answers: handles questions (evidence: `PDF-Summariser/main.py`)
- Chatbot context and answers → Summary generation: reuses generation (evidence: `PDF-Summariser/chat_bot.py`)
- Main window → Summary export: saves summary (evidence: `PDF-Summariser/main.py`)
- Main window → Ollama manager: starts service (evidence: `PDF-Summariser/main.py`)
- Main window → Ollama manager: pulls selected model (evidence: `PDF-Summariser/main.py`)
- Ollama manager → Local Ollama: starts or pulls (evidence: `PDF-Summariser/ollama_manager.py`)
- AI provider API → Local Ollama: optional local API (evidence: `README.md`)
