# aryangiri03/adobe-hackathon-round1a architecture

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

- Interactive diagram: https://gitdiagram.com/aryangiri03/adobe-hackathon-round1a
- Repository: https://github.com/aryangiri03/adobe-hackathon-round1a

## Overview

This repository is a single-script PDF-to-JSON outline processor. Its user workflow is to place PDFs in the configured input directory, run the script, and receive one JSON outline per document in the output directory. The script detects scanned versus text-based PDFs, extracts text using the corresponding route, infers headings from text attributes and layout, then formats and writes results. The excerpts show these stages within process_pdfs.py; OCR internals and the final write details are only partially shown, so those links are documented or marked unverified where appropriate.

Main entry points: [`process_pdfs.py`](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py) (Batch runner), [`input`](https://github.com/aryangiri03/adobe-hackathon-round1a/tree/main/input) (PDF inputs), [`ouput`](https://github.com/aryangiri03/adobe-hackathon-round1a/tree/main/ouput) (JSON outputs), [`sample_dataset/schema/output_schema.json`](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/sample_dataset/schema/output_schema.json) (Output schema)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["PDF processing"]
  node_pdf_input["PDF inputs"]
  node_batch_runner["Batch runner<br/>[process_pdfs.py]"]
  node_outline_builder["Outline formatter<br/>[process_pdfs.py]"]
  node_json_output["JSON outputs"]
end

subgraph group_analysis["Document analysis"]
  node_pdf_classifier["Scan detector<br/>[process_pdfs.py]"]
  node_text_extractor["Text extraction<br/>[process_pdfs.py]"]
  node_ocr_extractor["OCR extraction<br/>[process_pdfs.py]"]
  node_attribute_analysis["Font analysis<br/>[process_pdfs.py]"]
  node_heading_detection["Heading detection<br/>[process_pdfs.py]"]
end

node_user(("PDF operator"))
node_pymupdf["PyMuPDF"]
node_tesseract["Tesseract OCR"]
node_output_schema["Output schema<br/>[output_schema.json]"]

node_user -->|"provides PDFs"| node_pdf_input
node_pdf_input -.->|"reads PDFs"| node_batch_runner
node_batch_runner -->|"classifies each"| node_pdf_classifier
node_pdf_classifier -->|"inspects PDF"| node_pymupdf
node_batch_runner -->|"uses text route"| node_text_extractor
node_batch_runner -->|"uses scanned route"| node_ocr_extractor
node_text_extractor -->|"extracts text"| node_pymupdf
node_ocr_extractor -.->|"recognizes text"| node_tesseract
node_text_extractor -.->|"returns text attributes"| node_attribute_analysis
node_ocr_extractor -.->|"returns text attributes"| node_attribute_analysis
node_batch_runner -->|"analyzes attributes"| node_attribute_analysis
node_batch_runner -->|"extracts headings"| node_heading_detection
node_attribute_analysis -.->|"provides majority attributes"| node_heading_detection
node_batch_runner -->|"formats result"| node_outline_builder
node_heading_detection -->|"supplies headings"| node_outline_builder
node_outline_builder -.->|"writes JSON"| node_json_output
node_json_output -.->|"returns outlines"| node_user
node_outline_builder -.->|"conforms to schema"| node_output_schema

click node_pdf_input "https://github.com/aryangiri03/adobe-hackathon-round1a/tree/main/input"
click node_batch_runner "https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py"
click node_pdf_classifier "https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py"
click node_text_extractor "https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py"
click node_ocr_extractor "https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py"
click node_attribute_analysis "https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py"
click node_heading_detection "https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py"
click node_outline_builder "https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py"
click node_json_output "https://github.com/aryangiri03/adobe-hackathon-round1a/tree/main/ouput"
click node_output_schema "https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/sample_dataset/schema/output_schema.json"

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_pdf_input,node_batch_runner,node_outline_builder,node_json_output toneBlue
class node_pdf_classifier,node_text_extractor,node_ocr_extractor,node_attribute_analysis,node_heading_detection toneAmber
class node_user,node_pymupdf,node_tesseract toneIndigo
class node_output_schema toneTeal
```

## Components

### PDF processing

- [PDF inputs](https://github.com/aryangiri03/adobe-hackathon-round1a/tree/main/input): `input`
- [Batch runner](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py): `process_pdfs.py`
- [Outline formatter](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py): `process_pdfs.py`
- [JSON outputs](https://github.com/aryangiri03/adobe-hackathon-round1a/tree/main/ouput): `ouput`

### Document analysis

- [Scan detector](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py): `process_pdfs.py`
- [Text extraction](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py): `process_pdfs.py`
- [OCR extraction](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py): `process_pdfs.py`
- [Font analysis](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py): `process_pdfs.py`
- [Heading detection](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/process_pdfs.py): `process_pdfs.py`

### Other components

- **PDF operator**
- **PyMuPDF**
- **Tesseract OCR**
- [Output schema](https://github.com/aryangiri03/adobe-hackathon-round1a/blob/main/sample_dataset/schema/output_schema.json): `sample_dataset/schema/output_schema.json`

## Connections

- PDF operator → PDF inputs: provides PDFs (evidence: `README.md`)
- PDF inputs → Batch runner: reads PDFs (evidence: `README.md`)
- Batch runner → Scan detector: classifies each (evidence: `process_pdfs.py`)
- Scan detector → PyMuPDF: inspects PDF (evidence: `process_pdfs.py`)
- Batch runner → Text extraction: uses text route (evidence: `process_pdfs.py`)
- Batch runner → OCR extraction: uses scanned route (evidence: `process_pdfs.py`)
- Text extraction → PyMuPDF: extracts text (evidence: `process_pdfs.py`)
- OCR extraction → Tesseract OCR: recognizes text (evidence: `README.md`)
- Text extraction → Font analysis: returns text attributes (evidence: `process_pdfs.py`)
- OCR extraction → Font analysis: returns text attributes (evidence: `process_pdfs.py`)
- Batch runner → Font analysis: analyzes attributes (evidence: `process_pdfs.py`)
- Batch runner → Heading detection: extracts headings (evidence: `process_pdfs.py`)
- Font analysis → Heading detection: provides majority attributes (evidence: `process_pdfs.py`)
- Batch runner → Outline formatter: formats result (evidence: `process_pdfs.py`)
- Heading detection → Outline formatter: supplies headings (evidence: `process_pdfs.py`)
- Outline formatter → JSON outputs: writes JSON (evidence: `README.md`)
- JSON outputs → PDF operator: returns outlines (evidence: `README.md`)
- Outline formatter → Output schema: conforms to schema (evidence: `README.md`)
