# lavjaiswal034/student_performence_prediction architecture

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

- Interactive diagram: https://gitdiagram.com/lavjaiswal034/student_performence_prediction
- Repository: https://github.com/lavjaiswal034/student_performence_prediction

## Overview

This is a student-performance prediction app: students submit academic and engagement data through the web frontend, the Flask API predicts a category, adds risk reasons and a tailored study path, then records the result for history. A separate model-development workflow generates training data and compares Random Forest with XGBoost; the saved model and encoders are loaded by the API. The repository also includes EDA, model-comparison charts, and SHAP summaries. Runtime wiring is shown in the excerpts; the training and reporting relationships rely on their own excerpts and README workflow.

Main entry points: [`backend/app.py`](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/backend/app.py) (Prediction API), [`dataset/student_data.csv`](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/dataset/student_data.csv) (Student Dataset), [`frontend/script.js`](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/frontend/script.js) (Input & Results UI), [`ml/student_model.pkl`](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/student_model.pkl) (Model & Encoders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Student App"]
  node_frontend["Input &amp; Results UI<br/>[script.js]"]
  node_api["Prediction API<br/>[app.py]"]
end

subgraph group_model["Model Development"]
  node_dataset["Student Dataset<br/>[student_data.csv]"]
  node_synth["Synthetic Data Generator"]
  node_trainer["Model Training &amp; Comparison<br/>[train_model.py]"]
  node_artifacts["Model &amp; Encoders<br/>[student_model.pkl]"]
  node_prediction["Performance Prediction<br/>[app.py]"]
end

subgraph group_advice["Explanation &amp; Guidance"]
  node_reasons["Risk Reason Generation<br/>[explainability.py]"]
  node_path["Personalized Study Path<br/>[learning_path.py]"]
end

subgraph group_history["History &amp; Analysis"]
  node_db[("Prediction History Store<br/>[database.py]")]
  node_eda["Exploratory Analysis<br/>[generate_eda.py]"]
  node_simplecharts["Model &amp; Factor Charts"]
  node_shap["SHAP Summary"]
end

node_student(("Student"))

node_student -->|"enters data"| node_frontend
node_frontend -->|"posts input"| node_api
node_api -->|"loads model"| node_artifacts
node_api -->|"predicts"| node_prediction
node_api -->|"generates reasons"| node_reasons
node_api -->|"builds study path"| node_path
node_api -->|"saves result"| node_db
node_api -->|"gets history"| node_db
node_api -->|"returns result"| node_frontend
node_synth -->|"writes data"| node_dataset
node_trainer -->|"reads data"| node_dataset
node_trainer -->|"saves model"| node_artifacts
node_eda -->|"analyzes data"| node_dataset
node_simplecharts -->|"charts categories"| node_dataset
node_shap -->|"explains features"| node_dataset
node_shap -->|"loads model"| node_artifacts

click node_frontend "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/frontend/script.js"
click node_api "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/backend/app.py"
click node_dataset "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/dataset/student_data.csv"
click node_synth "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/generate_synthetic_dataset.py"
click node_trainer "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/train_model.py"
click node_artifacts "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/student_model.pkl"
click node_prediction "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/backend/app.py"
click node_reasons "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/src/explainability.py"
click node_path "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/src/learning_path.py"
click node_db "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/src/database.py"
click node_eda "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/generate_eda.py"
click node_simplecharts "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/generate_simple_graphs.py"
click node_shap "https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/generate_shap_summary.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_frontend,node_api toneBlue
class node_dataset,node_synth,node_trainer,node_artifacts,node_prediction toneAmber
class node_reasons,node_path toneMint
class node_db,node_eda,node_simplecharts,node_shap toneRose
class node_student toneIndigo
```

## Components

### Student App

- [Input & Results UI](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/frontend/script.js): `frontend/script.js`
- [Prediction API](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/backend/app.py): `backend/app.py`

### Model Development

- [Student Dataset](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/dataset/student_data.csv): `dataset/student_data.csv`
- [Synthetic Data Generator](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/generate_synthetic_dataset.py): `ml/generate_synthetic_dataset.py`
- [Model Training & Comparison](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/train_model.py): `ml/train_model.py`
- [Model & Encoders](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/student_model.pkl): `ml/student_model.pkl`
- [Performance Prediction](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/backend/app.py): `backend/app.py`

### Explanation & Guidance

- [Risk Reason Generation](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/src/explainability.py): `src/explainability.py`
- [Personalized Study Path](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/src/learning_path.py): `src/learning_path.py`

### History & Analysis

- [Prediction History Store](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/src/database.py): `src/database.py`
- [Exploratory Analysis](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/generate_eda.py): `ml/generate_eda.py`
- [Model & Factor Charts](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/generate_simple_graphs.py): `ml/generate_simple_graphs.py`
- [SHAP Summary](https://github.com/lavjaiswal034/student_performence_prediction/blob/main/ml/generate_shap_summary.py): `ml/generate_shap_summary.py`

### Other components

- **Student**

## Connections

- Student → Input & Results UI: enters data (evidence: `frontend/script.js`)
- Input & Results UI → Prediction API: posts input (evidence: `frontend/script.js`)
- Prediction API → Model & Encoders: loads model (evidence: `backend/app.py`)
- Prediction API → Performance Prediction: predicts (evidence: `backend/app.py`)
- Prediction API → Risk Reason Generation: generates reasons (evidence: `backend/app.py`)
- Prediction API → Personalized Study Path: builds study path (evidence: `backend/app.py`)
- Prediction API → Prediction History Store: saves result (evidence: `backend/app.py`)
- Prediction API → Prediction History Store: gets history (evidence: `backend/app.py`)
- Prediction API → Input & Results UI: returns result (evidence: `frontend/script.js`)
- Synthetic Data Generator → Student Dataset: writes data (evidence: `ml/generate_synthetic_dataset.py`)
- Model Training & Comparison → Student Dataset: reads data (evidence: `ml/train_model.py`)
- Model Training & Comparison → Model & Encoders: saves model (evidence: `ml/train_model.py`)
- Exploratory Analysis → Student Dataset: analyzes data (evidence: `ml/generate_eda.py`)
- Model & Factor Charts → Student Dataset: charts categories (evidence: `ml/generate_simple_graphs.py`)
- SHAP Summary → Student Dataset: explains features (evidence: `ml/generate_shap_summary.py`)
- SHAP Summary → Model & Encoders: loads model (evidence: `ml/generate_shap_summary.py`)
