# yashwanthgodala/javalabformatter architecture

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

- Interactive diagram: https://gitdiagram.com/yashwanthgodala/javalabformatter
- Repository: https://github.com/yashwanthgodala/javalabformatter

## Overview

Java Lab Formatter is a browser-based PDF-to-text conversion tool. Users select or drop a lab PDF, submit it for extraction and Gemini-assisted structuring, then preview or download the formatted TXT. The backend also detects program filenames, handles multiple programs, and distinguishes output from error sections. The README documents image-based PDF support and the overall processing stages; the source excerpts show the Gemini calls and formatting logic, but omit parts of the upload handler.

Main entry points: [`Backend/app.py`](https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py) (Upload handler), [`script.js`](https://github.com/yashwanthgodala/javalabformatter/blob/main/script.js) (Upload and preview), [`index.html`](https://github.com/yashwanthgodala/javalabformatter/blob/main/index.html) (Web page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_page["Web page<br/>[index.html]"]
  node_client["Upload and preview<br/>[script.js]"]
  node_preview["Preview and download<br/>[script.js]"]
end

subgraph group_processing["Document processing"]
  node_upload["Upload handler<br/>[app.py]"]
  node_extract["PDF extraction<br/>[app.py]"]
  node_structure["Question structuring<br/>[app.py]"]
end

subgraph group_ai["AI analysis"]
  node_gemini["Gemini analysis<br/>[app.py]"]
  node_gemini_service{{"Google Gemini"}}
end

subgraph group_output["Formatted output"]
  node_format["TXT formatting<br/>[app.py]"]
end

node_user(("PDF user"))

node_user -->|"opens"| node_page
node_page -->|"hosts"| node_client
node_client -->|"uploads PDF"| node_upload
node_upload -->|"extracts text"| node_extract
node_upload -->|"requests analysis"| node_gemini
node_gemini -->|"uploads and analyzes"| node_gemini_service
node_gemini -->|"returns JSON"| node_structure
node_upload -->|"formats questions"| node_format
node_format -->|"returns formatted text"| node_client
node_client -->|"previews or downloads"| node_preview

click node_page "https://github.com/yashwanthgodala/javalabformatter/blob/main/index.html"
click node_client "https://github.com/yashwanthgodala/javalabformatter/blob/main/script.js"
click node_upload "https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py"
click node_extract "https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py"
click node_gemini "https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py"
click node_structure "https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py"
click node_format "https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py"
click node_preview "https://github.com/yashwanthgodala/javalabformatter/blob/main/script.js"

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_page,node_client,node_preview,node_user toneBlue
class node_upload,node_extract,node_structure toneAmber
class node_gemini,node_gemini_service toneMint
class node_format toneRose
```

## Components

### Web interface

- [Web page](https://github.com/yashwanthgodala/javalabformatter/blob/main/index.html): `index.html`
- [Upload and preview](https://github.com/yashwanthgodala/javalabformatter/blob/main/script.js): `script.js`
- [Preview and download](https://github.com/yashwanthgodala/javalabformatter/blob/main/script.js): `script.js`

### Document processing

- [Upload handler](https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py): `Backend/app.py`
- [PDF extraction](https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py): `Backend/app.py`
- [Question structuring](https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py): `Backend/app.py`

### AI analysis

- [Gemini analysis](https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py): `Backend/app.py`
- **Google Gemini**

### Formatted output

- [TXT formatting](https://github.com/yashwanthgodala/javalabformatter/blob/main/Backend/app.py): `Backend/app.py`

### Other components

- **PDF user**

## Connections

- PDF user → Web page: opens (evidence: `README.md`)
- Web page → Upload and preview: hosts (evidence: `README.md`)
- Upload and preview → Upload handler: uploads PDF (evidence: `script.js`)
- Upload handler → PDF extraction: extracts text (evidence: `README.md`)
- Upload handler → Gemini analysis: requests analysis (evidence: `README.md`)
- Gemini analysis → Google Gemini: uploads and analyzes (evidence: `Backend/app.py`)
- Gemini analysis → Question structuring: returns JSON (evidence: `README.md`)
- Upload handler → TXT formatting: formats questions (evidence: `Backend/app.py`)
- TXT formatting → Upload and preview: returns formatted text (evidence: `script.js`)
- Upload and preview → Preview and download: previews or downloads (evidence: `script.js`)
