# mantis2404/gradeops architecture

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

- Interactive diagram: https://gitdiagram.com/mantis2404/gradeops
- Repository: https://github.com/mantis2404/gradeops

## Overview

GradeOps turns instructor-uploaded exam PDFs and rubrics into AI-proposed grades, then routes each student through mandatory TA review before producing a gradebook and class statistics. The primary path spans the browser upload and review experience, FastAPI pipeline endpoints, a checkpointed LangGraph agent workflow, and persistence. The README documents additional course, rubric, user, reporting, and role-based capabilities; their UI modules are represented, though unsampled implementation details and some connections are not asserted.

Main entry points: [`pipeline/graph.py`](https://github.com/mantis2404/gradeops/blob/main/pipeline/graph.py) (Workflow orchestration), [`pipeline/server/routes/pipeline.py`](https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/pipeline.py) (Pipeline endpoints), [`pipeline/agents/finalize.py`](https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/finalize.py) (Gradebook finalization), [`js/pages/ta-review.js`](https://github.com/mantis2404/gradeops/blob/main/js/pages/ta-review.js) (TA review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Browser application"]
  node_upload["Exam upload<br/>[upload.js]"]
  node_review_ui["TA review<br/>[ta-review.js]"]
  node_reports["Reports<br/>[reports.js]"]
  node_management["Course and rubric management<br/>[courses.js]"]
  node_user_admin["User management<br/>[users.js]"]
  node_router["Role-based navigation<br/>[router.js]"]
  node_client_api["Pipeline API client<br/>[pipeline.js]"]
  node_review_api["Review API client<br/>[reviews.js]"]
  node_auth_client["Authentication client<br/>[auth.js]"]
end

subgraph group_api["API and access"]
  node_pipeline_routes["Pipeline endpoints<br/>[pipeline.py]"]
  node_review_routes["Review endpoints<br/>[review.py]"]
  node_auth_routes["Authentication endpoints<br/>[auth.py]"]
  node_metadata_routes["Metadata endpoints<br/>[metadata.py]"]
  node_websocket["Live updates<br/>[ws.py]"]
end

subgraph group_grading["Grading workflow"]
  node_graph["Workflow orchestration<br/>[graph.py]"]
  node_ingestion["PDF ingestion and segmentation<br/>[ingestion.py]"]
  node_ocr["Handwriting transcription<br/>[ocr.py]"]
  node_grading_agent["Rubric grading<br/>[grading.py]"]
  node_human_review["Human review gate<br/>[review.py]"]
  node_finalize["Gradebook finalization<br/>[finalize.py]"]
  node_pdf_tools["PDF splitting<br/>[pdf_splitter.py]"]
  node_similarity["Answer similarity<br/>[similarity.py]"]
end

subgraph group_data["Persistence and models"]
  node_schemas["Rubric and grade schemas<br/>[outputs.py]"]
  node_state["Exam workflow state<br/>[state.py]"]
  node_db[("MongoDB client<br/>[db.py]")]
  node_storage[("Exam file storage<br/>[storage.py]")]
  node_settings["Runtime settings<br/>[config.py]"]
end

node_instructors(("Instructors"))
node_tas(("Teaching assistants"))
node_llm{{"Vision and reasoning models"}}
node_gradebook["CSV and JSON gradebook"]

node_instructors -->|"uploads exams"| node_upload
node_tas -->|"reviews grades"| node_review_ui
node_instructors -->|"manages courses"| node_management
node_instructors -->|"views analytics"| node_reports
node_upload -->|"starts grading"| node_client_api
node_review_ui -->|"polls status"| node_client_api
node_review_ui -->|"submits decisions"| node_review_api
node_router -->|"routes to"| node_review_ui
node_router -->|"checks session"| node_auth_client
node_client_api -->|"calls pipeline"| node_pipeline_routes
node_review_api -->|"calls review"| node_review_routes
node_auth_client -->|"calls auth"| node_auth_routes
node_pipeline_routes -->|"starts and resumes"| node_graph
node_pipeline_routes -->|"reads exam state"| node_db
node_review_routes -->|"resumes review"| node_graph
node_metadata_routes -->|"reads workflow state"| node_graph
node_graph -->|"runs first"| node_ingestion
node_graph -->|"runs next"| node_ocr
node_graph -->|"runs next"| node_grading_agent
node_graph -->|"pauses for review"| node_human_review
node_graph -->|"finalizes after review"| node_finalize
node_graph -->|"creates checkpointer"| node_db
node_ingestion -->|"splits PDF"| node_pdf_tools
node_ingestion -->|"stores exam files"| node_storage
node_ocr -->|"reads page images"| node_storage
node_grading_agent -->|"checks similarity"| node_similarity
node_grading_agent -->|"evaluates answers"| node_llm
node_ocr -->|"transcribes writing"| node_llm
node_finalize -->|"persists results"| node_db
node_finalize -->|"broadcasts updates"| node_websocket
node_pipeline_routes -->|"stores upload"| node_storage
node_graph -->|"uses shared state"| node_state
node_state -->|"types grade data"| node_schemas
node_finalize -->|"produces gradebook"| node_gradebook
node_pipeline_routes -->|"exports CSV and JSON"| node_gradebook
node_settings -->|"configures persistence"| node_graph

click node_upload "https://github.com/mantis2404/gradeops/blob/main/js/pages/upload.js"
click node_review_ui "https://github.com/mantis2404/gradeops/blob/main/js/pages/ta-review.js"
click node_reports "https://github.com/mantis2404/gradeops/blob/main/js/pages/reports.js"
click node_management "https://github.com/mantis2404/gradeops/blob/main/js/pages/courses.js"
click node_user_admin "https://github.com/mantis2404/gradeops/blob/main/js/pages/users.js"
click node_router "https://github.com/mantis2404/gradeops/blob/main/js/router.js"
click node_client_api "https://github.com/mantis2404/gradeops/blob/main/js/api/pipeline.js"
click node_review_api "https://github.com/mantis2404/gradeops/blob/main/js/api/reviews.js"
click node_auth_client "https://github.com/mantis2404/gradeops/blob/main/js/api/auth.js"
click node_pipeline_routes "https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/pipeline.py"
click node_review_routes "https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/review.py"
click node_auth_routes "https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/auth.py"
click node_metadata_routes "https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/metadata.py"
click node_graph "https://github.com/mantis2404/gradeops/blob/main/pipeline/graph.py"
click node_ingestion "https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/ingestion.py"
click node_ocr "https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/ocr.py"
click node_grading_agent "https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/grading.py"
click node_human_review "https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/review.py"
click node_finalize "https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/finalize.py"
click node_schemas "https://github.com/mantis2404/gradeops/blob/main/pipeline/schemas/outputs.py"
click node_state "https://github.com/mantis2404/gradeops/blob/main/pipeline/state.py"
click node_db "https://github.com/mantis2404/gradeops/blob/main/pipeline/server/db.py"
click node_storage "https://github.com/mantis2404/gradeops/blob/main/pipeline/tools/storage.py"
click node_pdf_tools "https://github.com/mantis2404/gradeops/blob/main/pipeline/tools/pdf_splitter.py"
click node_similarity "https://github.com/mantis2404/gradeops/blob/main/pipeline/tools/similarity.py"
click node_settings "https://github.com/mantis2404/gradeops/blob/main/pipeline/config.py"
click node_websocket "https://github.com/mantis2404/gradeops/blob/main/pipeline/server/ws.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_upload,node_review_ui,node_reports,node_management,node_user_admin,node_router,node_client_api,node_review_api,node_auth_client toneBlue
class node_pipeline_routes,node_review_routes,node_auth_routes,node_metadata_routes,node_websocket toneAmber
class node_graph,node_ingestion,node_ocr,node_grading_agent,node_human_review,node_finalize,node_pdf_tools,node_similarity toneMint
class node_schemas,node_state,node_db,node_storage,node_settings toneRose
class node_instructors,node_tas,node_llm,node_gradebook toneIndigo
```

## Components

### Browser application

- [Exam upload](https://github.com/mantis2404/gradeops/blob/main/js/pages/upload.js): `js/pages/upload.js`
- [TA review](https://github.com/mantis2404/gradeops/blob/main/js/pages/ta-review.js): `js/pages/ta-review.js`
- [Reports](https://github.com/mantis2404/gradeops/blob/main/js/pages/reports.js): `js/pages/reports.js`
- [Course and rubric management](https://github.com/mantis2404/gradeops/blob/main/js/pages/courses.js): `js/pages/courses.js`
- [User management](https://github.com/mantis2404/gradeops/blob/main/js/pages/users.js): `js/pages/users.js`
- [Role-based navigation](https://github.com/mantis2404/gradeops/blob/main/js/router.js): `js/router.js`
- [Pipeline API client](https://github.com/mantis2404/gradeops/blob/main/js/api/pipeline.js): `js/api/pipeline.js`
- [Review API client](https://github.com/mantis2404/gradeops/blob/main/js/api/reviews.js): `js/api/reviews.js`
- [Authentication client](https://github.com/mantis2404/gradeops/blob/main/js/api/auth.js): `js/api/auth.js`

### API and access

- [Pipeline endpoints](https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/pipeline.py): `pipeline/server/routes/pipeline.py`
- [Review endpoints](https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/review.py): `pipeline/server/routes/review.py`
- [Authentication endpoints](https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/auth.py): `pipeline/server/routes/auth.py`
- [Metadata endpoints](https://github.com/mantis2404/gradeops/blob/main/pipeline/server/routes/metadata.py): `pipeline/server/routes/metadata.py`
- [Live updates](https://github.com/mantis2404/gradeops/blob/main/pipeline/server/ws.py): `pipeline/server/ws.py`

### Grading workflow

- [Workflow orchestration](https://github.com/mantis2404/gradeops/blob/main/pipeline/graph.py): `pipeline/graph.py`
- [PDF ingestion and segmentation](https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/ingestion.py): `pipeline/agents/ingestion.py`
- [Handwriting transcription](https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/ocr.py): `pipeline/agents/ocr.py`
- [Rubric grading](https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/grading.py): `pipeline/agents/grading.py`
- [Human review gate](https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/review.py): `pipeline/agents/review.py`
- [Gradebook finalization](https://github.com/mantis2404/gradeops/blob/main/pipeline/agents/finalize.py): `pipeline/agents/finalize.py`
- [PDF splitting](https://github.com/mantis2404/gradeops/blob/main/pipeline/tools/pdf_splitter.py): `pipeline/tools/pdf_splitter.py`
- [Answer similarity](https://github.com/mantis2404/gradeops/blob/main/pipeline/tools/similarity.py): `pipeline/tools/similarity.py`

### Persistence and models

- [Rubric and grade schemas](https://github.com/mantis2404/gradeops/blob/main/pipeline/schemas/outputs.py): `pipeline/schemas/outputs.py`
- [Exam workflow state](https://github.com/mantis2404/gradeops/blob/main/pipeline/state.py): `pipeline/state.py`
- [MongoDB client](https://github.com/mantis2404/gradeops/blob/main/pipeline/server/db.py): `pipeline/server/db.py`
- [Exam file storage](https://github.com/mantis2404/gradeops/blob/main/pipeline/tools/storage.py): `pipeline/tools/storage.py`
- [Runtime settings](https://github.com/mantis2404/gradeops/blob/main/pipeline/config.py): `pipeline/config.py`

### Other components

- **Instructors**
- **Teaching assistants**
- **Vision and reasoning models**
- **CSV and JSON gradebook**

## Connections

- Instructors → Exam upload: uploads exams (evidence: `README.md`)
- Teaching assistants → TA review: reviews grades (evidence: `README.md`)
- Instructors → Course and rubric management: manages courses (evidence: `README.md`)
- Instructors → Reports: views analytics (evidence: `README.md`)
- Exam upload → Pipeline API client: starts grading (evidence: `js/pages/upload.js`)
- TA review → Pipeline API client: polls status (evidence: `js/pages/ta-review.js`)
- TA review → Review API client: submits decisions (evidence: `js/pages/ta-review.js`)
- Role-based navigation → TA review: routes to (evidence: `js/router.js`)
- Role-based navigation → Authentication client: checks session (evidence: `js/router.js`)
- Pipeline API client → Pipeline endpoints: calls pipeline (evidence: `js/api/pipeline.js`)
- Review API client → Review endpoints: calls review
- Authentication client → Authentication endpoints: calls auth (evidence: `js/api/auth.js`)
- Pipeline endpoints → Workflow orchestration: starts and resumes (evidence: `pipeline/server/routes/pipeline.py`)
- Pipeline endpoints → MongoDB client: reads exam state (evidence: `pipeline/server/routes/pipeline.py`)
- Review endpoints → Workflow orchestration: resumes review (evidence: `pipeline/server/routes/review.py`)
- Metadata endpoints → Workflow orchestration: reads workflow state (evidence: `pipeline/server/routes/metadata.py`)
- Workflow orchestration → PDF ingestion and segmentation: runs first (evidence: `pipeline/graph.py`)
- Workflow orchestration → Handwriting transcription: runs next (evidence: `pipeline/graph.py`)
- Workflow orchestration → Rubric grading: runs next (evidence: `pipeline/graph.py`)
- Workflow orchestration → Human review gate: pauses for review (evidence: `pipeline/graph.py`)
- Workflow orchestration → Gradebook finalization: finalizes after review (evidence: `pipeline/graph.py`)
- Workflow orchestration → MongoDB client: creates checkpointer (evidence: `pipeline/graph.py`)
- PDF ingestion and segmentation → PDF splitting: splits PDF (evidence: `pipeline/agents/ingestion.py`)
- PDF ingestion and segmentation → Exam file storage: stores exam files (evidence: `pipeline/agents/ingestion.py`)
- Handwriting transcription → Exam file storage: reads page images (evidence: `pipeline/agents/ocr.py`)
- Rubric grading → Answer similarity: checks similarity (evidence: `pipeline/agents/grading.py`)
- Rubric grading → Vision and reasoning models: evaluates answers (evidence: `README.md`)
- Handwriting transcription → Vision and reasoning models: transcribes writing (evidence: `README.md`)
- Gradebook finalization → MongoDB client: persists results (evidence: `pipeline/agents/finalize.py`)
- Gradebook finalization → Live updates: broadcasts updates (evidence: `pipeline/agents/finalize.py`)
- Pipeline endpoints → Exam file storage: stores upload (evidence: `pipeline/server/routes/pipeline.py`)
- Workflow orchestration → Exam workflow state: uses shared state (evidence: `pipeline/graph.py`)
- Exam workflow state → Rubric and grade schemas: types grade data (evidence: `pipeline/state.py`)
- Gradebook finalization → CSV and JSON gradebook: produces gradebook (evidence: `README.md`)
- Pipeline endpoints → CSV and JSON gradebook: exports CSV and JSON (evidence: `pipeline/server/routes/pipeline.py`)
- Runtime settings → Workflow orchestration: configures persistence (evidence: `pipeline/graph.py`)
