# sanket124w/stock-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/sanket124w/stock-prediction
- Repository: https://github.com/sanket124w/stock-prediction

## Overview

This is a small Flask stock-price prediction app. A user enters a closing price in the web form; the Flask route validates it, asks a startup-trained linear regression model for a next-close estimate, and renders the result with the latest available close. The model trains from the bundled CSV using each close as input and the following row’s close as target. The graph reflects the sampled app source; notebook contents and the document are not inspected, so their workflows are not inferred.

Main entry points: [`app.py`](https://github.com/sanket124w/stock-prediction/blob/main/app.py) (Flask route), [`templates/index.html`](https://github.com/sanket124w/stock-prediction/blob/main/templates/index.html) (Price form), [`long_stock_price_dataset.csv`](https://github.com/sanket124w/stock-prediction/blob/main/long_stock_price_dataset.csv) (Stock dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_form["Price form<br/>[index.html]"]
  node_styles["Page styles<br/>[style.css]"]
end

subgraph group_runtime["Prediction runtime"]
  node_app["Flask route<br/>[app.py]"]
  node_model["Linear model<br/>[app.py]"]
end

subgraph group_data["Training data"]
  node_dataset["Stock dataset"]
end

node_user(("User"))
node_regression["Scikit-learn"]

node_user -->|"enters price"| node_form
node_form -->|"submits form"| node_app
node_app -->|"reads at startup"| node_dataset
node_app -->|"fits model"| node_regression
node_app -->|"stores trained model"| node_model
node_app -->|"requests prediction"| node_model
node_model -->|"predicts with"| node_regression
node_app -->|"renders result"| node_form

click node_form "https://github.com/sanket124w/stock-prediction/blob/main/templates/index.html"
click node_styles "https://github.com/sanket124w/stock-prediction/blob/main/static/style.css"
click node_app "https://github.com/sanket124w/stock-prediction/blob/main/app.py"
click node_model "https://github.com/sanket124w/stock-prediction/blob/main/app.py"
click node_dataset "https://github.com/sanket124w/stock-prediction/blob/main/long_stock_price_dataset.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_form,node_styles,node_user toneBlue
class node_app,node_model toneAmber
class node_dataset toneMint
class node_regression toneIndigo
```

## Components

### Web interface

- [Price form](https://github.com/sanket124w/stock-prediction/blob/main/templates/index.html): `templates/index.html`
- [Page styles](https://github.com/sanket124w/stock-prediction/blob/main/static/style.css): `static/style.css`

### Prediction runtime

- [Flask route](https://github.com/sanket124w/stock-prediction/blob/main/app.py): `app.py`
- [Linear model](https://github.com/sanket124w/stock-prediction/blob/main/app.py): `app.py`

### Training data

- [Stock dataset](https://github.com/sanket124w/stock-prediction/blob/main/long_stock_price_dataset.csv): `long_stock_price_dataset.csv`

### Other components

- **User**
- **Scikit-learn**

## Connections

- User → Price form: enters price
- Price form → Flask route: submits form
- Flask route → Stock dataset: reads at startup
- Flask route → Scikit-learn: fits model
- Flask route → Linear model: stores trained model
- Flask route → Linear model: requests prediction
- Linear model → Scikit-learn: predicts with
- Flask route → Price form: renders result
