# kunalekare/answer_evalution_system_with_ai architecture

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

- Interactive diagram: https://gitdiagram.com/kunalekare/answer_evalution_system_with_ai
- Repository: https://github.com/kunalekare/answer_evalution_system_with_ai

## Overview

#### 1. Purpose and entry points
AssessIQ is a student-answer evaluation platform: it accepts text or uploaded answer sheets, extracts and analyzes content, produces rubric-like scores/feedback, and exposes teacher/student/admin workflows. The backend FastAPI entry point is `api/main.py` (also launched via `run_backend.py`); the React SPA starts at `frontend/src/index.js` and composes routes/UI in `frontend/src/App.jsx`.

#### 2. API and role-oriented application boundary
FastAPI route modules separate public evaluation/upload operations from authentication and institutional workflows. Key boundaries include evaluation/result APIs, upload/extraction task handling, dashboards, user management, community, and grievance features:
- `api/routes/evaluation.py`
- `api/routes/upload.py`
- `api/routes/auth.py`
- `api/routes/results.py`
- `api/routes/upload_extraction_task.py`

The frontend calls this HTTP boundary through `frontend/src/services/api.js`; authentication state is managed client-side in `frontend/src/context/AuthContext.jsx`.

#### 3. Answer-ingestion and extraction pipeline
Evaluation begins with direct text or uploaded PDFs/images. Files are persisted under the local upload hierarchy, then OCR/extraction yields text for downstream evaluation. OCR is an explicit pluggable boundary supporting local engines and Sarvam’s cloud OCR API; layout analysis and question segmentation support multi-question answer sheets.
- `api/services/file_storage_service.py`
- `api/services/ocr_service.py`
- `api/services/layout_analysis_service.py`
- `api/services/question_segmentation_service.py`
- `uploads/student_answers/.gitkeep`

#### 4. Text understanding and comparison
Extracted/student text and model answers pass through cleaning, NLP, semantic similarity, and structural/alignment analysis. The system combines conventional NLP features with Sentence-BERT-based semantic comparison; optional language correction and concept graph analysis enrich evaluation signals.
- `api/services/text_cleaning_service.py`
- `api/services/nlp_service.py`
- `api/services/semantic_service.py`
- `api/services/sentence_alignment_service.py`
- `api/services/concept_graph_service.py`

#### 5. Evaluation, scoring, and integrity
The scoring layer combines semantic, keyword/rubric, Bloom-taxonomy, structural, confidence, and optional diagram signals into marks, grades, explanations, and feedback. Anti-gaming checks are a distinct policy signal before results are finalized. Diagram evaluation is isolated because it operates on visual content rather than only text.
- `api/services/scoring_service.py`
- `api/services/rubric_scoring_service.py`
- `api/services/bloom_taxonomy_service.py`
- `api/services/diagram_service.py`
- `api/services/anti_gaming_service.py`

#### 6. Persistence and operational infrastructure
SQLAlchemy-backed models provide the durable system-of-record for users, evaluations, and related workflow data; README identifies SQLite as the default database. Configuration is centralized and environment-driven. Local filesystem directories retain uploaded inputs, processed artifacts, model answers, and results. Docker and Azure deployment automation support containerized/cloud operation.
- `database/models.py`
- `config/settings.py`
- `uploads/processed/.gitkeep`
- `uploads/results/.gitkeep`
- `Dockerfile`
- `.github/workflows/azure-deploy.yml`

#### 7. User-facing workflows
The React application provides evaluation, results/history, dashboards, manual checking, student management, and role-specific views. It is a separate Node/React runtime from the Python API and is deployable as a static web app.
- `frontend/src/pages/Evaluate.jsx`
- `frontend/src/pages/Results.jsx`
- `frontend/src/pages/ManualChecking.jsx`
- `frontend/src/pages/Dashboard.jsx`
- `frontend/src/pages/StudentDashboard.jsx`
- `frontend/staticwebapp.config.json`

Main entry points: [`api/main.py`](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/main.py) (API entry), [`frontend/src/App.jsx`](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/App.jsx) (SPA entry and routes), [`api/services/scoring_service.py`](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/scoring_service.py) (Scoring and feedback), [`api/routes/evaluation.py`](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/routes/evaluation.py) (Evaluation and results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React SPA"]
  node_spa_entry["SPA entry and routes<br/>React app<br/>[App.jsx]"]
  node_auth_state["Client auth state<br/>React context<br/>[AuthContext.jsx]"]
  node_api_client["API client<br/>HTTP client<br/>[api.js]"]
  node_teacher_workflows["Teacher workflows<br/>UI pages<br/>[Evaluate.jsx]"]
  node_student_dashboard["Student dashboard<br/>UI page"]
end

subgraph group_api["FastAPI API"]
  node_api_entry["API entry<br/>FastAPI app<br/>[main.py]"]
  node_evaluation_routes["Evaluation and results<br/>route modules<br/>[evaluation.py]"]
  node_workflow_routes["Auth and upload workflows<br/>route modules<br/>[upload.py]"]
end

subgraph group_pipeline["Evaluation Pipeline"]
  node_ingestion["Ingestion and OCR<br/>extraction services<br/>[ocr_service.py]"]
  node_document_structure["Layout and segmentation<br/>document analysis"]
  node_text_analysis["Text understanding<br/>NLP and semantic analysis"]
  node_scoring{{"Scoring and feedback<br/>evaluation engine<br/>[scoring_service.py]"}}
  node_integrity["Anti-gaming policy<br/>integrity checks"]
  node_diagram_evaluation["Diagram evaluation<br/>visual analysis<br/>[diagram_service.py]"]
end

subgraph group_storage["Data &amp; Storage"]
  node_database[("System of record<br/>SQLAlchemy models<br/>[models.py]")]
  node_upload_storage["Upload artifacts<br/>local filesystem<br/>[.gitkeep]"]
  node_configuration["Environment settings<br/>configuration<br/>[settings.py]"]
end

subgraph group_operations["Deployment"]
  node_container_build["Container build<br/>Docker"]
  node_azure_deploy["Azure deployment<br/>GitHub Actions workflow<br/>[azure-deploy.yml]"]
  node_static_host_config["Static web app config<br/>hosting config"]
end

node_spa_entry -->|"uses"| node_auth_state
node_spa_entry -->|"renders"| node_teacher_workflows
node_spa_entry -->|"renders"| node_student_dashboard
node_teacher_workflows -->|"calls"| node_api_client
node_student_dashboard -->|"calls"| node_api_client
node_api_client -->|"HTTP"| node_api_entry
node_api_entry -->|"mounts"| node_evaluation_routes
node_api_entry -->|"mounts"| node_workflow_routes
node_workflow_routes -->|"uploads and tasks"| node_ingestion
node_evaluation_routes -->|"submits text"| node_text_analysis
node_ingestion -->|"reads and writes"| node_upload_storage
node_ingestion -->|"extracted content"| node_document_structure
node_document_structure -->|"question text"| node_text_analysis
node_text_analysis -->|"comparison signals"| node_scoring
node_diagram_evaluation -->|"visual signals"| node_scoring
node_integrity -->|"policy signal"| node_scoring
node_scoring -->|"stores evaluations"| node_database
node_evaluation_routes -->|"reads results"| node_database
node_configuration -.->|"configures"| node_api_entry
node_container_build -.->|"packages"| node_api_entry
node_azure_deploy -->|"builds and deploys"| node_container_build
node_static_host_config -.->|"hosts"| node_spa_entry

click node_spa_entry "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/App.jsx"
click node_auth_state "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/context/AuthContext.jsx"
click node_api_client "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/services/api.js"
click node_teacher_workflows "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/pages/Evaluate.jsx"
click node_student_dashboard "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/pages/StudentDashboard.jsx"
click node_api_entry "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/main.py"
click node_evaluation_routes "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/routes/evaluation.py"
click node_workflow_routes "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/routes/upload.py"
click node_ingestion "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/ocr_service.py"
click node_document_structure "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/layout_analysis_service.py"
click node_text_analysis "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/semantic_service.py"
click node_scoring "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/scoring_service.py"
click node_integrity "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/anti_gaming_service.py"
click node_diagram_evaluation "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/diagram_service.py"
click node_database "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/database/models.py"
click node_upload_storage "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/uploads/student_answers/.gitkeep"
click node_configuration "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/config/settings.py"
click node_container_build "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/Dockerfile"
click node_azure_deploy "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/.github/workflows/azure-deploy.yml"
click node_static_host_config "https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/staticwebapp.config.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_spa_entry,node_auth_state,node_api_client,node_teacher_workflows,node_student_dashboard toneBlue
class node_api_entry,node_evaluation_routes,node_workflow_routes toneAmber
class node_ingestion,node_document_structure,node_text_analysis,node_scoring,node_integrity,node_diagram_evaluation toneMint
class node_database,node_upload_storage,node_configuration toneRose
class node_container_build,node_azure_deploy,node_static_host_config toneIndigo
```

## Components

### React SPA

Separate browser runtime for role-based workflows.

- [SPA entry and routes](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/App.jsx): React app · `frontend/src/App.jsx`
- [Client auth state](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/context/AuthContext.jsx): React context · `frontend/src/context/AuthContext.jsx`
- [API client](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/services/api.js): HTTP client · `frontend/src/services/api.js`
- [Teacher workflows](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/pages/Evaluate.jsx): UI pages · Evaluation, results, dashboard, and manual checking. · `frontend/src/pages/Evaluate.jsx`
- [Student dashboard](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/src/pages/StudentDashboard.jsx): UI page · `frontend/src/pages/StudentDashboard.jsx`

### FastAPI API

HTTP boundary and institutional workflows.

- [API entry](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/main.py): FastAPI app · `api/main.py`
- [Evaluation and results](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/routes/evaluation.py): route modules · Evaluation submission and result retrieval APIs. · `api/routes/evaluation.py`
- [Auth and upload workflows](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/routes/upload.py): route modules · Authentication, uploads, extraction tasks, and institutional workflows. · `api/routes/upload.py`

### Evaluation Pipeline

Extraction, analysis, scoring, and integrity stages.

- [Ingestion and OCR](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/ocr_service.py): extraction services · Persists uploads and extracts text through pluggable OCR. · `api/services/ocr_service.py`
- [Layout and segmentation](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/layout_analysis_service.py): document analysis · Finds layout and separates multi-question answer sheets. · `api/services/layout_analysis_service.py`
- [Text understanding](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/semantic_service.py): NLP and semantic analysis · Cleaning, NLP, Sentence-BERT similarity, alignment, and concepts. · `api/services/semantic_service.py`
- [Scoring and feedback](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/scoring_service.py): evaluation engine · Combines rubric, semantic, Bloom, structural, and confidence signals. · `api/services/scoring_service.py`
- [Anti-gaming policy](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/anti_gaming_service.py): integrity checks · `api/services/anti_gaming_service.py`
- [Diagram evaluation](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/api/services/diagram_service.py): visual analysis · Separately evaluates visual answer content. · `api/services/diagram_service.py`

### Data & Storage

Durable records and local artifacts.

- [System of record](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/database/models.py): SQLAlchemy models · SQLite is the default durable store for users and evaluations. · `database/models.py`
- [Upload artifacts](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/uploads/student_answers/.gitkeep): local filesystem · Stores student inputs, processed artifacts, and results. · `uploads/student_answers/.gitkeep`
- [Environment settings](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/config/settings.py): configuration · `config/settings.py`

### Deployment

Container and Azure delivery automation.

- [Container build](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/Dockerfile): Docker · `Dockerfile`
- [Azure deployment](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/.github/workflows/azure-deploy.yml): GitHub Actions workflow · `.github/workflows/azure-deploy.yml`
- [Static web app config](https://github.com/kunalekare/answer_evalution_system_with_ai/blob/main/frontend/staticwebapp.config.json): hosting config · `frontend/staticwebapp.config.json`

## Connections

- SPA entry and routes → Client auth state: uses
- SPA entry and routes → Teacher workflows: renders
- SPA entry and routes → Student dashboard: renders
- Teacher workflows → API client: calls
- Student dashboard → API client: calls
- API client → API entry: HTTP
- API entry → Evaluation and results: mounts
- API entry → Auth and upload workflows: mounts
- Auth and upload workflows → Ingestion and OCR: uploads and tasks
- Evaluation and results → Text understanding: submits text
- Ingestion and OCR → Upload artifacts: reads and writes
- Ingestion and OCR → Layout and segmentation: extracted content
- Layout and segmentation → Text understanding: question text
- Text understanding → Scoring and feedback: comparison signals
- Diagram evaluation → Scoring and feedback: visual signals
- Anti-gaming policy → Scoring and feedback: policy signal
- Scoring and feedback → System of record: stores evaluations
- Evaluation and results → System of record: reads results
- Environment settings → API entry: configures
- Container build → API entry: packages
- Azure deployment → Container build: builds and deploys
- Static web app config → SPA entry and routes: hosts
