# gopi-krish3/django_ml_project architecture

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

- Interactive diagram: https://gitdiagram.com/gopi-krish3/django_ml_project
- Repository: https://github.com/gopi-krish3/django_ml_project

## Overview

This Django application presents a Titanic survival-probability predictor. A user reaches the home page, submits passenger attributes to the prediction endpoint, and receives a rendered probability result. On import, the view code loads and preprocesses the Titanic CSV, splits and scales features, and trains a random-forest classifier; prediction scales submitted features and requests a survival probability. The README also describes model accuracy, but evaluation is not part of the user-facing result flow. Source evidence is limited to the excerpts and README; template internals were not inspected.

Main entry points: [`project/project/urls.py`](https://github.com/gopi-krish3/django_ml_project/blob/main/project/project/urls.py) (URL Routing), [`project/base/views.py`](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py) (Prediction Handler), [`project/titanic.csv`](https://github.com/gopi-krish3/django_ml_project/blob/main/project/titanic.csv) (Titanic Dataset), [`project/templates/predict.html`](https://github.com/gopi-krish3/django_ml_project/blob/main/project/templates/predict.html) (Prediction Form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Interface"]
  node_routing["URL Routing<br/>[urls.py]"]
  node_home["Home View<br/>[views.py]"]
  node_prediction_handler["Prediction Handler<br/>[views.py]"]
  node_input_template["Prediction Form<br/>[predict.html]"]
  node_result_template["Result Page<br/>[result.html]"]
end

subgraph group_ml["Prediction Model"]
  node_preprocessing["Data Preprocessing<br/>[views.py]"]
  node_feature_split["Feature Split<br/>[views.py]"]
  node_scaler["Feature Scaler<br/>[views.py]"]
  node_forest["Random Forest<br/>[views.py]"]
  node_evaluation["Model Evaluation<br/>[views.py]"]
  node_probability["Probability Prediction<br/>[views.py]"]
end

subgraph group_data["Passenger Data"]
  node_csv["Titanic Dataset<br/>[titanic.csv]"]
end

node_user(("User"))

node_user -->|"requests pages"| node_routing
node_routing -->|"routes home"| node_home
node_routing -->|"routes prediction"| node_prediction_handler
node_home -->|"renders"| node_input_template
node_prediction_handler -->|"renders result"| node_result_template
node_prediction_handler -->|"requests probability"| node_probability
node_csv -->|"supplies records"| node_preprocessing
node_preprocessing -->|"produces features"| node_feature_split
node_feature_split -->|"fits and transforms"| node_scaler
node_scaler -->|"scales training data"| node_forest
node_forest -->|"predicts test set"| node_evaluation
node_scaler -->|"scales input"| node_probability
node_forest -->|"predicts probability"| node_probability

click node_routing "https://github.com/gopi-krish3/django_ml_project/blob/main/project/project/urls.py"
click node_home "https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py"
click node_prediction_handler "https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py"
click node_input_template "https://github.com/gopi-krish3/django_ml_project/blob/main/project/templates/predict.html"
click node_result_template "https://github.com/gopi-krish3/django_ml_project/blob/main/project/templates/result.html"
click node_preprocessing "https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py"
click node_feature_split "https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py"
click node_scaler "https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py"
click node_forest "https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py"
click node_evaluation "https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py"
click node_probability "https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py"
click node_csv "https://github.com/gopi-krish3/django_ml_project/blob/main/project/titanic.csv"

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_routing,node_home,node_prediction_handler,node_input_template,node_result_template,node_user toneBlue
class node_preprocessing,node_feature_split,node_scaler,node_forest,node_evaluation,node_probability toneAmber
class node_csv toneMint
```

## Components

### Web Interface

- [URL Routing](https://github.com/gopi-krish3/django_ml_project/blob/main/project/project/urls.py): `project/project/urls.py`
- [Home View](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py): `project/base/views.py`
- [Prediction Handler](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py): `project/base/views.py`
- [Prediction Form](https://github.com/gopi-krish3/django_ml_project/blob/main/project/templates/predict.html): `project/templates/predict.html`
- [Result Page](https://github.com/gopi-krish3/django_ml_project/blob/main/project/templates/result.html): `project/templates/result.html`

### Prediction Model

- [Data Preprocessing](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py): `project/base/views.py`
- [Feature Split](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py): `project/base/views.py`
- [Feature Scaler](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py): `project/base/views.py`
- [Random Forest](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py): `project/base/views.py`
- [Model Evaluation](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py): `project/base/views.py`
- [Probability Prediction](https://github.com/gopi-krish3/django_ml_project/blob/main/project/base/views.py): `project/base/views.py`

### Passenger Data

- [Titanic Dataset](https://github.com/gopi-krish3/django_ml_project/blob/main/project/titanic.csv): `project/titanic.csv`

### Other components

- **User**

## Connections

- User → URL Routing: requests pages (evidence: `project/project/urls.py`)
- URL Routing → Home View: routes home (evidence: `project/project/urls.py`)
- URL Routing → Prediction Handler: routes prediction (evidence: `project/project/urls.py`)
- Home View → Prediction Form: renders (evidence: `project/base/views.py`)
- Prediction Handler → Result Page: renders result (evidence: `project/base/views.py`)
- Prediction Handler → Probability Prediction: requests probability (evidence: `project/base/views.py`)
- Titanic Dataset → Data Preprocessing: supplies records (evidence: `project/base/views.py`)
- Data Preprocessing → Feature Split: produces features (evidence: `project/base/views.py`)
- Feature Split → Feature Scaler: fits and transforms (evidence: `project/base/views.py`)
- Feature Scaler → Random Forest: scales training data (evidence: `project/base/views.py`)
- Random Forest → Model Evaluation: predicts test set (evidence: `project/base/views.py`)
- Feature Scaler → Probability Prediction: scales input (evidence: `project/base/views.py`)
- Random Forest → Probability Prediction: predicts probability (evidence: `project/base/views.py`)
