# iamgopinathbehera/student-performance-indicator architecture

> Architecture diagram of the GitHub repository iamgopinathbehera/student-performance-indicator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iamgopinathbehera/student-performance-indicator
- Repository: https://github.com/iamgopinathbehera/student-performance-indicator

## Overview

##### Project Type and Purpose
- This is a full-stack ML application.
- Offline batch pipeline: ingest raw data, transform, train CatBoost/Scikit-Learn models, store artifacts (*.pkl).
- Online serving: Flask API + simple HTML templates for real-time predictions.
- Deployed via Docker on AWS Elastic Beanstalk (with optional Azure ML integrations).

##### File Structure
Top-level directories / files:
- .ebextensions + Dockerfile → AWS EB container config
- application.py + templates/ → Flask web service
- src/components/ → data_ingestion.py, data_transformation.py, model_trainer.py
- src/pipeline/ → train_pipeline.py (orchestrates components), predict_pipeline.py (loads artifacts for inference)
- artifacts/ → serialized model.pkl & preprocessor.pkl, CSV datasets
- notebook/ → EDA & training notebooks (for experimentation)
- requirements.txt, setup.py → dependency management

##### README Insights
- Confirms four major stages: data ingestion, EDA, model training, deployment.
- Tech stack: Python, pandas, scikit-learn, Jupyter, Flask, Docker, AWS, Azure.

##### Main Components & Their Interactions
a. Offline Pipeline (Batch)
1) Raw Data Source (artifacts/data.csv, notebook/data/stud.csv)
2) DataIngestion (src/components/data_ingestion.py)
3) DataTransformation (src/components/data_transformation.py)
4) ModelTrainer (src/components/model_trainer.py)
5) Artifacts Store (artifacts/model.pkl, preprocessor.pkl, train.csv, test.csv)

b. Online Serving (Real-time)
1) Flask REST API (application.py)
2) PredictPipeline (src/pipeline/predict_pipeline.py) loads model + preprocessor
3) HTML UI (templates/index.html, home.html) calls API
4) Returns prediction to user

c. Deployment Infrastructure
1) Docker Container (Dockerfile)
2) AWS Elastic Beanstalk (.ebextensions/python.config)
3) (Optional) Azure ML or Azure services for retraining or hosting

##### Architectural Patterns & Design Principles
- Layered / Modular Design: separate components for ingestion, transformation, training, serving.
- Single Responsibility: each Python module handles one step.
- Artifact Management: versioned model + preprocessor in artifacts/
- Reproducibility: notebooks for EDA, pipelines for automation.
- Deployment as immutable container on cloud PaaS.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Engineering Layer
    subgraph "Data Engineering" 
        direction TB
        RawData1(("artifacts/data.csv")):::data
        RawData2(("notebook/data/stud.csv")):::data
        Ingestion["DataIngestion Component"]:::data
        Transformation["DataTransformation Component"]:::data
    end

    %% Model Training Layer
    subgraph "Model Training" 
        direction TB
        Trainer["ModelTrainer Component"]:::train
        TrainOrch["Offline Pipeline Orchestrator\n(train_pipeline.py)"]:::train
    end

    %% Artifacts Store
    Artifacts(("Artifacts Store\n(model.pkl, preprocessor.pkl,\ntrain.csv, test.csv)")):::store

    %% Experimentation Layer
    subgraph "Experimentation (EDA)" 
        direction TB
        Notebook1(("1. EDA STUDENT PERFORMANCE.ipynb")):::exp
        Notebook2(("2. MODEL TRAINING.ipynb")):::exp
    end

    %% Serving Layer
    subgraph "Serving & API" 
        direction TB
        PredictOrch["Online Predict Pipeline\n(predict_pipeline.py)"]:::serve
        API["Flask REST API\n(application.py)"]:::serve
        UI["HTML UI Templates\n(index.html, home.html)"]:::serve
    end

    %% Infrastructure Layer
    subgraph "Infrastructure" 
        direction TB
        Docker["Docker Container\n(Dockerfile)"]:::infra
        EBConfig["AWS EB Config\n(.ebextensions/python.config)"]:::infra
        AWS(("AWS Elastic Beanstalk")):::cloud
        Azure(("Azure ML (Optional)")):::cloud
    end

    %% Data flow arrows
    RawData1 -->|reads CSV| Ingestion
    RawData2 -->|reads CSV| Ingestion
    Ingestion -->|raw -> cleaned| Transformation
    Transformation -->|features| Trainer
    Trainer -->|model artifacts| Artifacts
    TrainOrch -->|orchestrates| Ingestion
    TrainOrch --> Transformation
    TrainOrch --> Trainer
    Notebook1 -->|explores| Notebook2
    Notebook2 -->|trains| Trainer

    Artifacts -->|loads pickle| PredictOrch
    PredictOrch -->|API call| API
    UI -->|HTTP REST| API
    API -->|returns prediction| UI

    %% Deployment arrows
    Docker -.->|build image| API
    Docker -.-> UI
    Docker -.-> PredictOrch
    Docker -.-> TrainOrch
    EBConfig -.->|configures| AWS
    Docker -.-> AWS
    AWS -.->|optional retrain| Azure

    %% Click events
    click RawData1 "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/artifacts/data.csv"
    click RawData2 "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/notebook/data/stud.csv"
    click Ingestion "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/src/components/data_ingestion.py"
    click Transformation "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/src/components/data_transformation.py"
    click Trainer "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/src/components/model_trainer.py"
    click TrainOrch "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/src/pipeline/train_pipeline.py"
    click PredictOrch "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/src/pipeline/predict_pipeline.py"
    click API "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/application.py"
    click UI "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/templates/index.html"
    click UI "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/templates/home.html"
    click Artifacts "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/artifacts/model.pkl"
    click Artifacts "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/artifacts/preprocessor.pkl"
    click Artifacts "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/artifacts/train.csv"
    click Artifacts "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/artifacts/test.csv"
    click Docker "https://github.com/iamgopinathbehera/student-performance-indicator/tree/main/Dockerfile"
    click EBConfig "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/.ebextensions/python.config"
    click Notebook1 "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/notebook/1 . EDA STUDENT PERFORMANCE .ipynb"
    click Notebook2 "https://github.com/iamgopinathbehera/student-performance-indicator/blob/main/notebook/2. MODEL TRAINING.ipynb"

    %% Styles
    classDef data fill:#E3F2FD,stroke:#2196F3,color:#0D47A1;
    classDef train fill:#E8F5E9,stroke:#4CAF50,color:#1B5E20;
    classDef serve fill:#FFF3E0,stroke:#FF9800,color:#E65100;
    classDef infra fill:#ECEFF1,stroke:#90A4AE,color:#37474F;
    classDef store fill:#F3E5F5,stroke:#9C27B0,color:#4A148C;
    classDef exp fill:#FCE4EC,stroke:#E91E63,color:#880E4F;
    classDef cloud fill:#E0F7FA,stroke:#00BCD4,color:#006064;
```
