# pylajaganmohan/document-comparator architecture

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

- Interactive diagram: https://gitdiagram.com/pylajaganmohan/document-comparator
- Repository: https://github.com/pylajaganmohan/document-comparator

## Overview

Document Comparator is a Streamlit application for comparing uploaded spreadsheets and PDFs. Users configure matching and normalization rules, run a comparison, review categorized results, and download a QA workbook. The README documents both comparison modes and optional OCR; sampled code confirms comparison helpers, saved-setup JSON I/O, report generation, and Streamlit UI logic, but excerpts omit much of the dispatch and file-reading code, so uncertain internal links are not shown.

Main entry points: [`app.py`](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py) (Streamlit Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Application UI"]
  node_app_ui["Streamlit Interface<br/>[app.py]"]
  node_file_input["File Uploads<br/>[app.py]"]
  node_rule_config["Comparison Settings<br/>[app.py]"]
end

subgraph group_tabular["Spreadsheet Comparison"]
  node_tabular_match["Record Matching<br/>[app.py]"]
  node_key_groups["Match Key Groups<br/>[app.py]"]
  node_value_compare["Value Comparison<br/>[app.py]"]
  node_tabular_results["Comparison Results<br/>[app.py]"]
  node_excel_reader["Excel And CSV Reading<br/>[app.py]"]
end

subgraph group_pdf["PDF Comparison"]
  node_pdf_compare["PDF Comparison<br/>[app.py]"]
  node_pdf_text["PDF Text And Metadata<br/>[app.py]"]
  node_ocr["Optional OCR<br/>[app.py]"]
end

subgraph group_persistence["Setup And Reports"]
  node_setup_io["Saved Setups<br/>[app.py]"]
  node_setup_files[("Setup JSON Files<br/>[app.py]")]
  node_qa_report["QA Excel Report<br/>[app.py]"]
end

node_user(("User"))
node_tesseract["Tesseract OCR"]

node_user -->|"uses"| node_app_ui
node_user -->|"uploads files"| node_file_input
node_app_ui -->|"configures"| node_rule_config
node_app_ui -->|"manages setups"| node_setup_io
node_setup_io -->|"reads / writes"| node_setup_files
node_app_ui -->|"loads tabular files"| node_excel_reader
node_excel_reader -->|"provides data"| node_tabular_match
node_app_ui -->|"runs comparison"| node_tabular_match
node_tabular_match -->|"groups records"| node_key_groups
node_tabular_match -->|"compares values"| node_value_compare
node_tabular_match -->|"produces sections"| node_tabular_results
node_app_ui -->|"runs comparison"| node_pdf_compare
node_pdf_compare -->|"compares content"| node_pdf_text
node_pdf_compare -.->|"may invoke"| node_ocr
node_ocr -.->|"uses"| node_tesseract
node_app_ui -->|"generates download"| node_qa_report
node_tabular_results -->|"supplies results"| node_qa_report
node_user -->|"downloads"| node_qa_report

click node_app_ui "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_file_input "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_rule_config "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_setup_io "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_setup_files "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_tabular_match "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_key_groups "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_value_compare "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_tabular_results "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_pdf_compare "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_pdf_text "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_ocr "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_qa_report "https://github.com/pylajaganmohan/document-comparator/blob/main/app.py"
click node_excel_reader "https://github.com/pylajaganmohan/document-comparator/blob/main/app.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_app_ui,node_file_input,node_rule_config,node_user toneBlue
class node_tabular_match,node_key_groups,node_value_compare,node_tabular_results,node_excel_reader toneAmber
class node_pdf_compare,node_pdf_text,node_ocr toneMint
class node_setup_io,node_setup_files,node_qa_report toneRose
class node_tesseract toneIndigo
```

## Components

### Application UI

- [Streamlit Interface](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [File Uploads](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [Comparison Settings](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`

### Spreadsheet Comparison

- [Record Matching](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [Match Key Groups](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [Value Comparison](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [Comparison Results](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [Excel And CSV Reading](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`

### PDF Comparison

- [PDF Comparison](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [PDF Text And Metadata](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [Optional OCR](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`

### Setup And Reports

- [Saved Setups](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [Setup JSON Files](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`
- [QA Excel Report](https://github.com/pylajaganmohan/document-comparator/blob/main/app.py): `app.py`

### Other components

- **User**
- **Tesseract OCR**

## Connections

- User → Streamlit Interface: uses
- User → File Uploads: uploads files
- Streamlit Interface → Comparison Settings: configures
- Streamlit Interface → Saved Setups: manages setups
- Saved Setups → Setup JSON Files: reads / writes
- Streamlit Interface → Excel And CSV Reading: loads tabular files
- Excel And CSV Reading → Record Matching: provides data
- Streamlit Interface → Record Matching: runs comparison
- Record Matching → Match Key Groups: groups records
- Record Matching → Value Comparison: compares values
- Record Matching → Comparison Results: produces sections
- Streamlit Interface → PDF Comparison: runs comparison
- PDF Comparison → PDF Text And Metadata: compares content
- PDF Comparison → Optional OCR: may invoke
- Optional OCR → Tesseract OCR: uses
- Streamlit Interface → QA Excel Report: generates download
- Comparison Results → QA Excel Report: supplies results
- User → QA Excel Report: downloads
