# rachit-jain-24/loan-status-approval-prediction-gui-model architecture

> Architecture diagram of the GitHub repository rachit-jain-24/loan-status-approval-prediction-gui-model, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rachit-jain-24/loan-status-approval-prediction-gui-model
- Repository: https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model

## Overview

##### Project Type & Purpose
- This is a single-service, full-stack web application built with Streamlit.
- Purpose: Collect user financial inputs via a browser UI, pass them through a trained machine-learning (Logistic Regression) pipeline, and return an instant “approved” or “denied” prediction.

##### File Structure
- Top level:
- app.py – Entry point for the Streamlit web server and UI.
- Loan Status Prediction_GUI.ipynb – Jupyter notebook for model exploration/training.
- loan_approval_dataset.csv, loan_prediction_dataset.csv – Raw data used during experimentation/training.
- loan_status_predict/ – Python package housing preprocessing and model-loading code (presumably modules like preprocessor.py, model.py).
- No external databases—model artifacts are deployed locally (via Joblib).

##### Main Components & Their Responsibilities
a. Client (Browser)
– Renders Streamlit UI, collects input fields (income, credit score, employment, etc.).
b. Streamlit Server (app.py)
– Hosts UI, routes user inputs to the prediction pipeline, displays results.
c. Prediction Engine (loan_status_predict package)
– Preprocessing module: applies scaling, encoding, feature selection (via Pandas & NumPy).
– Model loader module: loads the serialized Logistic Regression model (Joblib).
– Predictor: runs model.predict() and returns classification.
d. Model Artifact (Joblib file)
– Serialized ML model with tuned hyperparameters.
e. (Optional) Data & Training Pipeline
– Jupyter notebook + CSV files used for retraining or batch updates—but not in the live request path.

##### Relationships & Data Flow
1) User submits form in Browser → HTTP request to Streamlit Server.
2) Streamlit Server invokes Preprocessor with raw inputs.
3) Preprocessor returns a transformed feature vector → fed into Model Loader.
4) Model Loader passes features to the Logistic Regression model → outputs prediction.
5) Streamlit Server returns result to Browser UI.

##### Architectural Patterns & Design Principles
- Separation of Concerns: UI (Streamlit) vs Business Logic (prediction package) vs Data Artifacts.
- Modular Code Organization: `loan_status_predict` isolates preprocessing & model logic for testability and maintainability.
- Stateless Service: Each request is self-contained; no session state or database dependencies in production.

##### Technologies & Frameworks
- Frontend/UI: Streamlit
- Backend/Logic: Python modules (`app.py`, `loan_status_predict`)
- Data Processing: Pandas, NumPy
- Machine Learning: Scikit-Learn Logistic Regression, Joblib
- Experimentation: Jupyter Notebook

[Browser UI], [Streamlit Server], [Preprocessing Module], [Model Loader & Predictor], [Model Artifact], [Raw Data/Notebook (optional)].
- Annotations for key frameworks (Streamlit, Pandas, Scikit-Learn, Joblib).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        BrowserUI["Browser UI"]:::ui
    end

    %% Service Layer
    subgraph "Service Layer"
        direction TB
        StreamlitServer["Streamlit Server (app.py)"]:::service
    end

    %% Logic Layer
    subgraph "Logic Layer"
        direction TB
        subgraph "Prediction Engine Package" 
            direction TB
            Preprocessor["Preprocessing Module"]:::logic
            ModelLoader["Model Loader & Predictor Module"]:::logic
        end
    end

    %% Data/Artifacts Layer
    subgraph "Data & Artifacts"
        direction TB
        ModelArtifact["Model Artifact (model.joblib)"]:::data
    end

    %% Training Path (Optional)
    subgraph "Training Pipeline (Optional)"
        direction TB
        Notebook["Training Notebook (Loan Status Prediction_GUI.ipynb)"]:::training
        CSV1["loan_approval_dataset.csv"]:::training
        CSV2["loan_prediction_dataset.csv"]:::training
    end

    %% Documentation
    README["README.md"]:::doc

    %% Connections
    BrowserUI -->|"HTTP Request"| StreamlitServer
    StreamlitServer -->|"invoke Preprocessor"| Preprocessor
    Preprocessor -->|"transformed features"| ModelLoader
    ModelLoader -->|"prediction result"| StreamlitServer
    StreamlitServer -->|"HTTP Response"| BrowserUI

    Notebook -->|"reads data"| CSV1
    Notebook -->|"reads data"| CSV2
    Notebook -->|"exports trained model"| ModelArtifact

    %% Click Events
    click StreamlitServer "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/blob/main/app.py"
    click Preprocessor "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/blob/main/loan_status_predict/preprocessor.py"
    click ModelLoader "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/blob/main/loan_status_predict/model.py"
    click ModelArtifact "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/blob/main/loan_status_predict/model.joblib"
    click Notebook "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/blob/main/Loan Status Prediction_GUI.ipynb"
    click CSV1 "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/blob/main/loan_approval_dataset.csv"
    click CSV2 "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/blob/main/loan_prediction_dataset.csv"
    click README "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/blob/main/README.md"
    click Prediction_Engine_Package "https://github.com/rachit-jain-24/loan-status-approval-prediction-gui-model/tree/main/loan_status_predict/"

    %% Styles
    classDef ui fill:#E0F7FA,stroke:#006064,color:#006064;
    classDef service fill:#E8F5E9,stroke:#1B5E20,color:#1B5E20;
    classDef logic fill:#FFF8E1,stroke:#F57F17,color:#F57F17;
    classDef data fill:#ECEFF1,stroke:#37474F,color:#37474F;
    classDef training fill:#F3E5F5,stroke:#4A148C,color:#4A148C;
    classDef doc fill:#FFEBEE,stroke:#B71C1C,color:#B71C1C;
```
