# anas-694/pdf-read-tool architecture

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

- Interactive diagram: https://gitdiagram.com/anas-694/pdf-read-tool
- Repository: https://github.com/anas-694/pdf-read-tool

## Overview

This repository provides a PDF financial-report analyzer with both a Streamlit interface and a command-line runner. The main workflow accepts a PDF, extracts page text, asks Gemini to analyze it, consolidates results in the interactive app, and produces a formatted Word report. The report-design module supplies reusable document elements. The README is empty; the graph reflects the shown source and does not infer additional capabilities from unsampled sections.

Main entry points: [`app.py`](https://github.com/anas-694/pdf-read-tool/blob/main/app.py) (Interactive Analyzer), [`main.py`](https://github.com/anas-694/pdf-read-tool/blob/main/main.py) (Command-Line Runner), [`summary_design.py`](https://github.com/anas-694/pdf-read-tool/blob/main/summary_design.py) (Document Design Helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Entry"]
  node_streamlit_app["Interactive Analyzer<br/>[app.py]"]
  node_cli_runner["Command-Line Runner<br/>[main.py]"]
end

subgraph group_analysis["PDF Analysis"]
  node_pdf_input["PDF Input<br/>[app.py]"]
  node_page_text["Page Text Extraction<br/>[app.py]"]
  node_page_analysis["Page Analysis<br/>[app.py]"]
  node_summary_generation["Executive Summary<br/>[app.py]"]
  node_cli_analysis["CLI Page Analysis<br/>[main.py]"]
end

subgraph group_reporting["Report Output"]
  node_doc_builder["Word Report Builder<br/>[app.py]"]
  node_markdown_format["Markdown Formatting<br/>[app.py]"]
  node_design_helpers["Document Design Helpers<br/>[summary_design.py]"]
  node_word_output["Word Document"]
  node_cli_doc_builder["CLI Word Builder<br/>[main.py]"]
end

node_user(("PDF User"))
node_gemini{{"Gemini API"}}

node_user -->|"uploads PDF"| node_streamlit_app
node_streamlit_app -->|"reads upload"| node_pdf_input
node_pdf_input -->|"opens PDF"| node_page_text
node_page_text -->|"provides page text"| node_page_analysis
node_page_analysis -->|"requests analysis"| node_gemini
node_streamlit_app -->|"requests final summary"| node_summary_generation
node_summary_generation -->|"requests summary"| node_gemini
node_streamlit_app -->|"builds report"| node_doc_builder
node_doc_builder -->|"formats summary"| node_markdown_format
node_markdown_format -->|"renders tables and headings"| node_design_helpers
node_doc_builder -->|"adds report elements"| node_design_helpers
node_doc_builder -->|"saves document"| node_word_output
node_user -->|"provides PDF path"| node_cli_runner
node_cli_runner -->|"extracts page text"| node_page_text
node_cli_runner -->|"analyzes each page"| node_cli_analysis
node_cli_analysis -->|"requests analysis"| node_gemini
node_cli_runner -->|"builds report"| node_cli_doc_builder
node_cli_doc_builder -->|"saves document"| node_word_output

click node_streamlit_app "https://github.com/anas-694/pdf-read-tool/blob/main/app.py"
click node_cli_runner "https://github.com/anas-694/pdf-read-tool/blob/main/main.py"
click node_pdf_input "https://github.com/anas-694/pdf-read-tool/blob/main/app.py"
click node_page_text "https://github.com/anas-694/pdf-read-tool/blob/main/app.py"
click node_page_analysis "https://github.com/anas-694/pdf-read-tool/blob/main/app.py"
click node_summary_generation "https://github.com/anas-694/pdf-read-tool/blob/main/app.py"
click node_cli_analysis "https://github.com/anas-694/pdf-read-tool/blob/main/main.py"
click node_doc_builder "https://github.com/anas-694/pdf-read-tool/blob/main/app.py"
click node_markdown_format "https://github.com/anas-694/pdf-read-tool/blob/main/app.py"
click node_design_helpers "https://github.com/anas-694/pdf-read-tool/blob/main/summary_design.py"
click node_cli_doc_builder "https://github.com/anas-694/pdf-read-tool/blob/main/main.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_streamlit_app,node_cli_runner,node_user toneBlue
class node_pdf_input,node_page_text,node_page_analysis,node_summary_generation,node_cli_analysis toneAmber
class node_doc_builder,node_markdown_format,node_design_helpers,node_word_output,node_cli_doc_builder,node_gemini toneMint
```

## Components

### User Entry

- [Interactive Analyzer](https://github.com/anas-694/pdf-read-tool/blob/main/app.py): `app.py`
- [Command-Line Runner](https://github.com/anas-694/pdf-read-tool/blob/main/main.py): `main.py`

### PDF Analysis

- [PDF Input](https://github.com/anas-694/pdf-read-tool/blob/main/app.py): `app.py`
- [Page Text Extraction](https://github.com/anas-694/pdf-read-tool/blob/main/app.py): `app.py`
- [Page Analysis](https://github.com/anas-694/pdf-read-tool/blob/main/app.py): `app.py`
- [Executive Summary](https://github.com/anas-694/pdf-read-tool/blob/main/app.py): `app.py`
- [CLI Page Analysis](https://github.com/anas-694/pdf-read-tool/blob/main/main.py): `main.py`

### Report Output

- [Word Report Builder](https://github.com/anas-694/pdf-read-tool/blob/main/app.py): `app.py`
- [Markdown Formatting](https://github.com/anas-694/pdf-read-tool/blob/main/app.py): `app.py`
- [Document Design Helpers](https://github.com/anas-694/pdf-read-tool/blob/main/summary_design.py): `summary_design.py`
- **Word Document**
- [CLI Word Builder](https://github.com/anas-694/pdf-read-tool/blob/main/main.py): `main.py`

### Other components

- **PDF User**
- **Gemini API**

## Connections

- PDF User → Interactive Analyzer: uploads PDF (evidence: `app.py`)
- Interactive Analyzer → PDF Input: reads upload (evidence: `app.py`)
- PDF Input → Page Text Extraction: opens PDF (evidence: `app.py`)
- Page Text Extraction → Page Analysis: provides page text (evidence: `app.py`)
- Page Analysis → Gemini API: requests analysis (evidence: `app.py`)
- Interactive Analyzer → Executive Summary: requests final summary (evidence: `app.py`)
- Executive Summary → Gemini API: requests summary (evidence: `app.py`)
- Interactive Analyzer → Word Report Builder: builds report (evidence: `app.py`)
- Word Report Builder → Markdown Formatting: formats summary (evidence: `app.py`)
- Markdown Formatting → Document Design Helpers: renders tables and headings (evidence: `app.py`)
- Word Report Builder → Document Design Helpers: adds report elements (evidence: `app.py`)
- Word Report Builder → Word Document: saves document (evidence: `app.py`)
- PDF User → Command-Line Runner: provides PDF path (evidence: `main.py`)
- Command-Line Runner → Page Text Extraction: extracts page text (evidence: `main.py`)
- Command-Line Runner → CLI Page Analysis: analyzes each page (evidence: `main.py`)
- CLI Page Analysis → Gemini API: requests analysis (evidence: `main.py`)
- Command-Line Runner → CLI Word Builder: builds report (evidence: `main.py`)
- CLI Word Builder → Word Document: saves document (evidence: `main.py`)
