# shreyask95/s4ds-project architecture

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

- Interactive diagram: https://gitdiagram.com/shreyask95/s4ds-project
- Repository: https://github.com/shreyask95/s4ds-project

## Overview

This is a web application for turning handwritten exam PDFs into transcripts and AI-generated grades. The main workflow is: a user uploads a PDF in Home, the Flask API converts pages to images, Gemini transcribes them, and the transcript is saved and returned. The user then opens Evaluation, which asks the API to grade that transcript against the question paper and displays feedback. Login is a separate capability. The backend’s conversion, extraction, and grading functions are all implemented in app.py; unsampled backend scripts are not mapped.

Main entry points: [`backend/scripts/app.py`](https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py) (Upload handler), [`client/src/components/Home/Home.jsx`](https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Home/Home.jsx) (Upload page), [`client/src/components/Login/Login.jsx`](https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Login/Login.jsx) (Login page), [`client/src/components/Evaluation/Evaluation.jsx`](https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Evaluation/Evaluation.jsx) (Evaluation page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_home["Upload page<br/>[Home.jsx]"]
  node_login["Login page<br/>[Login.jsx]"]
  node_evaluation_ui["Evaluation page<br/>[Evaluation.jsx]"]
  node_routes["Client routes<br/>[App.js]"]
end

subgraph group_api["Flask API"]
  node_flask["Flask API<br/>[app.py]"]
  node_login_handler["Login handler<br/>[app.py]"]
  node_upload_handler["Upload handler<br/>[app.py]"]
end

subgraph group_processing["Document processing"]
  node_pdf_convert["PDF conversion<br/>[app.py]"]
  node_page_images[("Page images")]
  node_transcription["Gemini transcription<br/>[app.py]"]
  node_raw_pdfs[("Uploaded PDFs")]
  node_transcripts[("Transcript files")]
end

subgraph group_grading["Grading"]
  node_grading_handler["Evaluation handler<br/>[app.py]"]
  node_grading_logic["Answer grading<br/>[app.py]"]
  node_question_paper["Question paper<br/>[etrx_qp &#40;1&#41;.txt]"]
end

node_user(("User"))
node_gemini["Google Gemini"]

node_user -->|"enters credentials"| node_login
node_login -->|"posts login"| node_login_handler
node_login_handler -->|"returns status"| node_login
node_login -->|"navigates home"| node_routes
node_user -->|"uploads PDF"| node_home
node_home -->|"posts file"| node_upload_handler
node_upload_handler -->|"saves PDF"| node_raw_pdfs
node_upload_handler -->|"converts PDF"| node_pdf_convert
node_pdf_convert -->|"writes pages"| node_page_images
node_upload_handler -->|"extracts pages"| node_transcription
node_transcription -->|"reads images"| node_page_images
node_transcription -->|"requests transcription"| node_gemini
node_transcription -->|"writes transcript"| node_transcripts
node_upload_handler -->|"returns transcript"| node_home
node_home -->|"opens evaluation"| node_routes
node_routes -->|"routes evaluation"| node_evaluation_ui
node_evaluation_ui -->|"posts transcript path"| node_grading_handler
node_grading_handler -->|"reads transcript"| node_transcripts
node_grading_handler -->|"reads questions"| node_question_paper
node_grading_handler -->|"grades answers"| node_grading_logic
node_grading_logic -->|"requests grading"| node_gemini
node_grading_handler -->|"returns feedback"| node_evaluation_ui
node_evaluation_ui -->|"displays results"| node_user

click node_home "https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Home/Home.jsx"
click node_login "https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Login/Login.jsx"
click node_evaluation_ui "https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Evaluation/Evaluation.jsx"
click node_routes "https://github.com/shreyask95/s4ds-project/blob/main/client/src/App.js"
click node_flask "https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py"
click node_login_handler "https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py"
click node_upload_handler "https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py"
click node_pdf_convert "https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py"
click node_page_images "https://github.com/shreyask95/s4ds-project/tree/main/backend/data/processed"
click node_transcription "https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py"
click node_raw_pdfs "https://github.com/shreyask95/s4ds-project/tree/main/backend/data/raw"
click node_transcripts "https://github.com/shreyask95/s4ds-project/tree/main/backend/data/results"
click node_grading_handler "https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py"
click node_grading_logic "https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py"
click node_question_paper "https://github.com/shreyask95/s4ds-project/blob/main/backend/data/etrx_qp%20(1).txt"

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_home,node_login,node_evaluation_ui,node_routes,node_user toneBlue
class node_flask,node_login_handler,node_upload_handler toneAmber
class node_pdf_convert,node_page_images,node_transcription,node_raw_pdfs,node_transcripts toneMint
class node_grading_handler,node_grading_logic,node_question_paper toneRose
class node_gemini toneIndigo
```

## Components

### Web client

- [Upload page](https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Home/Home.jsx): `client/src/components/Home/Home.jsx`
- [Login page](https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Login/Login.jsx): `client/src/components/Login/Login.jsx`
- [Evaluation page](https://github.com/shreyask95/s4ds-project/blob/main/client/src/components/Evaluation/Evaluation.jsx): `client/src/components/Evaluation/Evaluation.jsx`
- [Client routes](https://github.com/shreyask95/s4ds-project/blob/main/client/src/App.js): `client/src/App.js`

### Flask API

- [Flask API](https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py): `backend/scripts/app.py`
- [Login handler](https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py): `backend/scripts/app.py`
- [Upload handler](https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py): `backend/scripts/app.py`

### Document processing

- [PDF conversion](https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py): `backend/scripts/app.py`
- [Page images](https://github.com/shreyask95/s4ds-project/tree/main/backend/data/processed): `backend/data/processed`
- [Gemini transcription](https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py): `backend/scripts/app.py`
- [Uploaded PDFs](https://github.com/shreyask95/s4ds-project/tree/main/backend/data/raw): `backend/data/raw`
- [Transcript files](https://github.com/shreyask95/s4ds-project/tree/main/backend/data/results): `backend/data/results`

### Grading

- [Evaluation handler](https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py): `backend/scripts/app.py`
- [Answer grading](https://github.com/shreyask95/s4ds-project/blob/main/backend/scripts/app.py): `backend/scripts/app.py`
- [Question paper](https://github.com/shreyask95/s4ds-project/blob/main/backend/data/etrx_qp%20(1).txt): `backend/data/etrx_qp (1).txt`

### Other components

- **User**
- **Google Gemini**

## Connections

- User → Login page: enters credentials (evidence: `client/src/components/Login/Login.jsx`)
- Login page → Login handler: posts login (evidence: `client/src/components/Login/Login.jsx`)
- Login handler → Login page: returns status (evidence: `backend/scripts/app.py`)
- Login page → Client routes: navigates home (evidence: `client/src/components/Login/Login.jsx`)
- User → Upload page: uploads PDF (evidence: `client/src/components/Home/Home.jsx`)
- Upload page → Upload handler: posts file (evidence: `client/src/components/Home/Home.jsx`)
- Upload handler → Uploaded PDFs: saves PDF (evidence: `backend/scripts/app.py`)
- Upload handler → PDF conversion: converts PDF (evidence: `backend/scripts/app.py`)
- PDF conversion → Page images: writes pages (evidence: `backend/scripts/app.py`)
- Upload handler → Gemini transcription: extracts pages (evidence: `backend/scripts/app.py`)
- Gemini transcription → Page images: reads images (evidence: `backend/scripts/app.py`)
- Gemini transcription → Google Gemini: requests transcription (evidence: `backend/scripts/app.py`)
- Gemini transcription → Transcript files: writes transcript (evidence: `backend/scripts/app.py`)
- Upload handler → Upload page: returns transcript (evidence: `backend/scripts/app.py`)
- Upload page → Client routes: opens evaluation (evidence: `client/src/components/Home/Home.jsx`)
- Client routes → Evaluation page: routes evaluation (evidence: `client/src/App.js`)
- Evaluation page → Evaluation handler: posts transcript path (evidence: `client/src/components/Evaluation/Evaluation.jsx`)
- Evaluation handler → Transcript files: reads transcript (evidence: `backend/scripts/app.py`)
- Evaluation handler → Question paper: reads questions (evidence: `backend/scripts/app.py`)
- Evaluation handler → Answer grading: grades answers (evidence: `backend/scripts/app.py`)
- Answer grading → Google Gemini: requests grading (evidence: `backend/scripts/app.py`)
- Evaluation handler → Evaluation page: returns feedback (evidence: `backend/scripts/app.py`)
- Evaluation page → User: displays results (evidence: `client/src/components/Evaluation/Evaluation.jsx`)
