# lohithvattam1628/house-price-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/lohithvattam1628/house-price-prediction
- Repository: https://github.com/lohithvattam1628/house-price-prediction

## Overview

This is a small FastAPI service for California housing price prediction. At startup, it fetches the housing dataset, splits the features and target, scales training features, and fits a linear regression model. A JSON request is validated as house features, scaled with the fitted scaler, and passed to the model; the API returns the predicted price. The README also advertises evaluation and interactive documentation, though their implementation is not shown in the sampled source. The graph reflects the shown runtime; the notebook and model artifact are not connected because their use is not evidenced.

Main entry points: [`main.py`](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py) (Prediction endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_service["FastAPI service<br/>[main.py]"]
  node_input["House input validation<br/>[main.py]"]
  node_docs["Interactive API docs<br/>[main.py]"]
end

subgraph group_training["Model training"]
  node_housing_data["Housing dataset<br/>[main.py]"]
  node_preprocessing["Feature split and scaling<br/>[main.py]"]
  node_regression["Linear regression training<br/>[main.py]"]
  node_fitted_model["Fitted model<br/>[main.py]"]
end

subgraph group_prediction["Prediction"]
  node_prediction_endpoint["Prediction endpoint<br/>[main.py]"]
  node_scaled_input["Scaled features<br/>[main.py]"]
  node_price_result["Price response<br/>[main.py]"]
end

node_caller(("API caller"))

node_caller -->|"sends request"| node_service
node_service -->|"validates input"| node_input
node_service -->|"routes prediction"| node_prediction_endpoint
node_service -.->|"provides docs"| node_docs
node_housing_data -->|"supplies features"| node_preprocessing
node_preprocessing -->|"scales training data"| node_regression
node_regression -->|"fits model"| node_fitted_model
node_input -->|"provides validated data"| node_prediction_endpoint
node_prediction_endpoint -->|"scales features"| node_scaled_input
node_prediction_endpoint -->|"predicts with"| node_fitted_model
node_prediction_endpoint -->|"returns prediction"| node_price_result

click node_service "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_input "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_docs "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_housing_data "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_preprocessing "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_regression "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_fitted_model "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_prediction_endpoint "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_scaled_input "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"
click node_price_result "https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py"

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_service,node_input,node_docs toneBlue
class node_housing_data,node_preprocessing,node_regression,node_fitted_model toneAmber
class node_prediction_endpoint,node_scaled_input,node_price_result,node_caller toneMint
```

## Components

### API

- [FastAPI service](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`
- [House input validation](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`
- [Interactive API docs](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`

### Model training

- [Housing dataset](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`
- [Feature split and scaling](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`
- [Linear regression training](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`
- [Fitted model](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`

### Prediction

- [Prediction endpoint](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`
- [Scaled features](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`
- [Price response](https://github.com/lohithvattam1628/house-price-prediction/blob/main/main.py): `main.py`

### Other components

- **API caller**

## Connections

- API caller → FastAPI service: sends request (evidence: `main.py`)
- FastAPI service → House input validation: validates input (evidence: `main.py`)
- FastAPI service → Prediction endpoint: routes prediction (evidence: `main.py`)
- FastAPI service → Interactive API docs: provides docs (evidence: `README.md`)
- Housing dataset → Feature split and scaling: supplies features (evidence: `main.py`)
- Feature split and scaling → Linear regression training: scales training data (evidence: `main.py`)
- Linear regression training → Fitted model: fits model (evidence: `main.py`)
- House input validation → Prediction endpoint: provides validated data (evidence: `main.py`)
- Prediction endpoint → Scaled features: scales features (evidence: `main.py`)
- Prediction endpoint → Fitted model: predicts with (evidence: `main.py`)
- Prediction endpoint → Price response: returns prediction (evidence: `main.py`)
