# ravija-pasalkar/loaneligibilityprediction architecture

> Architecture diagram of the GitHub repository ravija-pasalkar/loaneligibilityprediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ravija-pasalkar/loaneligibilityprediction
- Repository: https://github.com/ravija-pasalkar/loaneligibilityprediction

## Overview

##### Project type and purpose
- This is a simple full-stack, ML-powered web application built with Flask.
- Purpose: let end users enter loan-related features in a browser and get an eligibility prediction from a trained ML model.

##### File structure
- Top-level files:
- LoanEligibilityPrediction.ipynb – Jupyter notebook used to explore data, train/evaluate model, then serialize it.
- LoanPrediction.csv – raw dataset used for training.
- app.py – Flask application that loads the exported model and exposes a web UI + predict endpoint.
- static/ – contains client-side assets (script.js, style.css).
- templates/application.html – Jinja2 template for the input form and result display.

##### Insights from README
- Minimal: points to the Colab notebook link for training and exploration.
- No extra deployment or architecture notes, so we infer a single-service monolith.

##### Components
a. Main components
- Client Browser (User Interface)
- Flask Web Service (app.py)
- ML Model (serialized artifact from the notebook)
- Data Store (CSV during training; model binary for inference)
- Training Environment (Jupyter Notebook / Google Colab)
b. Relationships and interactions
1. User opens form in browser → HTTP GET to Flask → serves HTML/CSS/JS.
2. User fills form → HTTP POST (or AJAX) to Flask’s /predict endpoint.
3. Flask loads the ML model artifact, applies preprocessing, runs prediction.
4. Flask sends result back → browser renders outcome.
5. (Offline) Notebook reads CSV, trains model, serializes it as a .pkl or equivalent.
c. Architectural patterns and design principles
- Monolithic MVC-style: Flask “Controller” in app.py, Jinja2 “View” in templates, model code in a separate module or inline.
- Single process service—no microservices or separate database.
- Clear separation of training (Notebook) vs. inference (Flask).
d. Key technologies
- Python, Flask, Jinja2
- scikit-learn / pandas / numpy (model training & inference)
- HTML5 / CSS3 / JavaScript (client)
- Google Colab (training environment)

##### Detailed breakdown to capture all architectural elements
- Offline training pipeline:
- “LoanPrediction.csv” → Notebook → preprocess/train/evaluate → export “model.pkl”
- Inference pipeline:
- Browser requests “/” → Flask → serves application.html + script.js + style.css
- Browser submits form → POST /predict → Flask loads model.pkl → runs prediction → returns rendered HTML
- External dependencies:
- scikit-learn/pandas in Notebook and app.py
- Flask & Jinja2 in app.py
- Static assets in static/

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Training Layer
    subgraph "Training Layer"
        CSV["LoanPrediction.csv<br/>(CSV Data Store)"]:::datastore
        Notebook["LoanEligibilityPrediction.ipynb<br/>(Jupyter Notebook)"]:::training
        Model["model.pkl<br/>(Serialized ML Model)"]:::model
        CSV -->|"reads data"| Notebook
        Notebook -->|"exports model"| Model
    end

    %% Inference Layer
    subgraph "Inference Layer"
        Browser["Client Browser<br/>(HTML5/CSS3/JavaScript)"]:::browser
        Flask["Flask Service<br/>(app.py | Flask & Jinja2)"]:::flask
        Template["application.html<br/>(Jinja2 Template)"]:::flask
        Script["script.js"]:::browser
        Style["style.css"]:::browser
        Browser -->|"GET /"| Flask
        Flask -->|"serves HTML/CSS/JS"| Browser
        Browser -->|"POST /predict"| Flask
        Flask -->|"loads model.pkl"| Model
        Flask -->|"uses template"| Template
        Flask -->|"serves script"| Script
        Flask -->|"serves style"| Style
    end

    %% Click Events
    click CSV "https://github.com/ravija-pasalkar/loaneligibilityprediction/blob/main/LoanPrediction.csv"
    click Notebook "https://github.com/ravija-pasalkar/loaneligibilityprediction/blob/main/LoanEligibilityPrediction.ipynb"
    click Flask "https://github.com/ravija-pasalkar/loaneligibilityprediction/blob/main/app.py"
    click Template "https://github.com/ravija-pasalkar/loaneligibilityprediction/blob/main/templates/application.html"
    click Script "https://github.com/ravija-pasalkar/loaneligibilityprediction/blob/main/static/script.js"
    click Style "https://github.com/ravija-pasalkar/loaneligibilityprediction/blob/main/static/style.css"

    %% Styles
    classDef browser fill:#b2fab4,stroke:#2d7a2d,stroke-width:1px
    classDef flask fill:#9ec5fe,stroke:#1f4e79,stroke-width:1px
    classDef model fill:#ffd98e,stroke:#b37400,stroke-width:1px
    classDef training fill:#d4baff,stroke:#4b0082,stroke-width:1px
    classDef datastore fill:#d3d3d3,stroke:#696969,stroke-width:1px
```
