# harishnns/house-price-predictor architecture

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

- Interactive diagram: https://gitdiagram.com/harishnns/house-price-predictor
- Repository: https://github.com/harishnns/house-price-predictor

## Overview

##### Project Type and Purpose
- This is an end-to-end MLOps pipeline and full-stack application.
- It ingests raw housing data, processes it, engineers features, trains models, tracks experiments via MLflow, exposes a FastAPI inference service, and offers a Streamlit frontend.

##### File Structure
- Top-level directories
- data/raw & data/processed – storage for raw and cleaned data
- src/data, src/features, src/models – batch pipeline code
- src/api – FastAPI microservice for inference
- streamlit_app – React-like UI for user predictions
- models/trained – serialized model artifacts and preprocessors
- deployment/mlflow & deployment/kubernetes – container/cluster orchestration
- Notebooks – exploratory and prototyping
- Requirements and Docker-Compose snippets scattered for reproducible environments

##### README Insights
- Three main workflow stages: data processing → feature engineering → model training & MLflow logging
- Two deployment targets: FastAPI service for programmatic prediction and Streamlit app for interactive UI
- MLflow server spun up via Docker-Compose; Kubernetes manifests also included for more advanced deployments

##### Core Components
a. Data Layer
- Raw Data Store (data/raw/house_data.csv)
- Processed Data Store (data/processed/*.csv)
b. Batch Pipeline
- Data Processing (src/data/run_processing.py)
- Feature Engineering (src/features/engineer.py)
- Model Training & Experimentation (src/models/train_model.py + MLflow Client)
c. Model Registry & Artifact Storage
- MLflow Tracking Server (deployment/mlflow/docker-compose.yaml)
- models/trained/* (.pkl artifacts + config files)
d. Serving Layer
- FastAPI Inference Service (src/api/main.py, inference.py, schemas.py)
- Streamlit User Interface (streamlit_app/app.py)
e. Orchestration & Deployment
- Docker-Compose on local/dev for MLflow, API, and Streamlit
- Kubernetes manifests for production (deployment/kubernetes/)
f. Optional Interactive Layer
- Jupyter Notebooks (notebooks/) for ad-hoc exploration

##### Architectural Patterns & Design Principles
- Modular pipeline stages (separation of concerns)
- Microservices for serving (FastAPI) and UI (Streamlit)
- Containerization for reproducibility (Docker-Compose, Kubernetes)
- Experiment tracking via external service (MLflow)
- Artifact versioning and configurability (YAML configs, environment variables)

##### Technologies & Frameworks to Call Out
- Language: Python 3.11
- Web: FastAPI, Uvicorn, Streamlit
- Data Processing: Pandas, custom scripts
- Feature Engineering: sklearn pipelines (preprocessor.pkl)
- Model Training & Tracking: MLflow, scikit-learn (or similar)
- Containers: Docker, Docker-Compose
- Orchestration: Kubernetes (manifests)
- Optional: JupyterLab for notebooks

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    subgraph "Data Layer"
        direction TB
        RawData(["Raw Data Store<br/>data/raw/house_data.csv"]):::data
        ProcessedData(["Processed Data Store<br/>data/processed/"]):::data
    end

    %% Batch Pipeline
    subgraph "Batch Pipeline"
        direction TB
        DataProcessing["run_processing.py"]:::pipeline
        FeatureEngineering["engineer.py"]:::pipeline
        ModelTraining["train_model.py"]:::pipeline
    end

    %% Model Registry & Artifact Storage
    subgraph "Model Registry & Artifact Storage"
        direction TB
        MLflowServer(["MLflow Tracking Server<br/>docker-compose.yaml"]):::model
        ModelArtifacts(["Serialized Model Artifacts<br/>models/trained/"]):::model
    end

    %% Serving Layer
    subgraph "Serving Layer"
        direction TB
        API_Main["main.py"]:::serving
        API_Inference["inference.py"]:::serving
        API_Schemas["schemas.py"]:::serving
        API_Utils["utils.py"]:::serving
    end

    %% UI Layer
    subgraph "User Interface"
        direction TB
        StreamlitApp["app.py"]:::ui
    end

    %% Deployment
    subgraph "Orchestration & Deployment"
        direction TB
        DockerCompose["Docker-Compose<br/>deployment/mlflow/docker-compose.yaml"]:::deploy
        Kubernetes["Kubernetes Manifests<br/>deployment/kubernetes/"]:::deploy
    end

    %% Notebooks
    subgraph "Exploratory Notebooks"
        direction TB
        NB1["00_data_engineering.ipynb"]:::notebooks
        NB2["01_exploratory_data_analysis.ipynb"]:::notebooks
        NB3["02_feature_engineering.ipynb"]:::notebooks
        NB4["03_experimentation.ipynb"]:::notebooks
    end

    %% Connections
    RawData -->|"ingest"| DataProcessing
    DataProcessing -->|"writes CSV"| ProcessedData
    ProcessedData -->|"input"| FeatureEngineering
    FeatureEngineering -->|"features"| ModelTraining
    ModelTraining -->|"logs experiments"| MLflowServer
    MLflowServer -->|"stores artifacts"| ModelArtifacts
    ModelArtifacts -->|"loads model"| API_Inference
    API_Main -->|"calls"| API_Inference
    API_Inference -->|"uses schemas/utils"| API_Schemas
    API_Inference -->|"uses schemas/utils"| API_Utils
    StreamlitApp -->|"POST /predict"| API_Main
    NB1 --> ProcessedData
    NB2 --> ProcessedData
    NB3 --> ProcessedData
    NB4 --> ProcessedData
    DockerCompose --> MLflowServer
    DockerCompose --> API_Main
    DockerCompose --> StreamlitApp
    Kubernetes --> MLflowServer
    Kubernetes --> API_Main
    Kubernetes --> StreamlitApp

    %% Click Events
    click RawData "https://github.com/harishnns/house-price-predictor/blob/main/data/raw/house_data.csv"
    click ProcessedData "https://github.com/harishnns/house-price-predictor/tree/main/data/processed/"
    click DataProcessing "https://github.com/harishnns/house-price-predictor/blob/main/src/data/run_processing.py"
    click FeatureEngineering "https://github.com/harishnns/house-price-predictor/blob/main/src/features/engineer.py"
    click ModelTraining "https://github.com/harishnns/house-price-predictor/blob/main/src/models/train_model.py"
    click MLflowServer "https://github.com/harishnns/house-price-predictor/blob/main/deployment/mlflow/docker-compose.yaml"
    click ModelArtifacts "https://github.com/harishnns/house-price-predictor/tree/main/models/trained/"
    click API_Main "https://github.com/harishnns/house-price-predictor/blob/main/src/api/main.py"
    click API_Inference "https://github.com/harishnns/house-price-predictor/blob/main/src/api/inference.py"
    click API_Schemas "https://github.com/harishnns/house-price-predictor/blob/main/src/api/schemas.py"
    click API_Utils "https://github.com/harishnns/house-price-predictor/blob/main/src/api/utils.py"
    click StreamlitApp "https://github.com/harishnns/house-price-predictor/blob/main/streamlit_app/app.py"
    click DockerCompose "https://github.com/harishnns/house-price-predictor/blob/main/deployment/mlflow/docker-compose.yaml"
    click Kubernetes "https://github.com/harishnns/house-price-predictor/tree/main/deployment/kubernetes/"
    click NB1 "https://github.com/harishnns/house-price-predictor/blob/main/notebooks/00_data_engineering.ipynb"
    click NB2 "https://github.com/harishnns/house-price-predictor/blob/main/notebooks/01_exploratory_data_analysis.ipynb"
    click NB3 "https://github.com/harishnns/house-price-predictor/blob/main/notebooks/02_feature_engineering.ipynb"
    click NB4 "https://github.com/harishnns/house-price-predictor/blob/main/notebooks/03_experimentation.ipynb"

    %% Styles
    classDef data fill:#A8DADC,stroke:#1D3557,color:#1D3557;
    classDef pipeline fill:#457B9D,stroke:#1D3557,color:#F1FAEE;
    classDef model fill:#E9C46A,stroke:#1D3557,color:#1D3557;
    classDef serving fill:#F4A261,stroke:#1D3557,color:#1D3557;
    classDef ui fill:#9D4EDD,stroke:#1D3557,color:#F1FAEE;
    classDef deploy fill:#E76F51,stroke:#1D3557,color:#F1FAEE;
    classDef notebooks fill:#CED4DA,stroke:#1D3557,color:#1D3557;
```
