# codewithkaran-21/ds-proj-2 architecture

> Architecture diagram of the GitHub repository codewithkaran-21/ds-proj-2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codewithkaran-21/ds-proj-2
- Repository: https://github.com/codewithkaran-21/ds-proj-2

## Overview

##### Project type and purpose
- This is a machine-learning classification project with a small “full-stack” component: you build and train an income‐prediction model and then deploy it behind a Flask web UI.
- The core functionality lives in the Python packages under src/ (data ingestion, transformation, model training, prediction pipeline). The app.py + templates/ form a minimal web frontend for users to submit inputs and view predictions.

##### File structure
- top-level:
– app.py: Flask application entrypoint (controllers + routes)
– notebook/: exploratory work & raw data (income_cleandata.csv)
– src/components/: core ML tasks (data_ingestion, data_transformation, model_trainer)
– src/pipeline/: orchestrators (training_pipeline, prediction_pipeline)
– src/utils.py, src/logger.py, src/exception.py: cross-cutting utilities
– templates/: Jinja2 HTML for the UI (home.html, results.html)
– requirements.txt, setup.py: build & dependencies
- No external services (no database), model artifacts stored on local disk (likely via pickle within model_trainer).

##### README for additional insights
- Steps: data preprocessing → EDA → model training & evaluation → deployment via Flask
- No mention of external APIs, so model lives locally and Flask serves both UI and prediction API.

##### Detail but avoid unnecessary sub-subcomponents
- Src/components and src/pipeline module as its own element
- Don’t overthink; the goal is to show how each functional piece interacts end-to-end

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Development Environment"
    REQ["requirements.txt"]:::env
    SETUP["setup.py"]:::env
  end

  subgraph "ML Build Pipeline"
    direction TB
    ds["Income CSV"]:::storage
    dp["Training Pipeline"]:::ml
    di["Data Ingestion"]:::ml
    dt["Data Transformation"]:::ml
    mt["Model Trainer"]:::ml
    ms["Model Artifact"]:::storage
    ds --> di --> dt --> mt --> ms
    dp --> di
    dp --> dt
    dp --> mt
  end

  subgraph "Real-time Inference"
    direction TB
    wa["Flask Controller"]:::web
    pp["Prediction Pipeline"]:::ml
    tmpl_home["home.html"]:::web
    tmpl_res["results.html"]:::web
    wa --> pp --> ms --> wa
    wa --> tmpl_home
    wa --> tmpl_res
  end

  subgraph "Utilities"
    direction TB
    log["logger.py"]:::util
    exc["exception.py"]:::util
    utilh["utils.py"]:::util
  end

  log -.-> dp
  log -.-> wa
  exc -.-> dp
  exc -.-> wa
  utilh -.-> dp
  utilh -.-> wa

  classDef ml fill:#AED6F1,stroke:#1F618D,color:#1B4F72
  classDef web fill:#ABEBC6,stroke:#196F3D,color:#145A32
  classDef storage fill:#FAD7A0,stroke:#D68910,color:#7D6608
  classDef util fill:#D5DBDB,stroke:#85929E,color:#424949
  classDef env fill:#F2D7D5,stroke:#CD6155,color:#78281F

  click ds "https://github.com/codewithkaran-21/ds-proj-2/blob/main/notebook/data/income_cleandata.csv"
  click di "https://github.com/codewithkaran-21/ds-proj-2/blob/main/src/components/data_ingestion.py"
  click dt "https://github.com/codewithkaran-21/ds-proj-2/blob/main/src/components/data_transformation.py"
  click mt "https://github.com/codewithkaran-21/ds-proj-2/blob/main/src/components/model_trainer.py"
  click dp "https://github.com/codewithkaran-21/ds-proj-2/blob/main/src/pipeline/training_pipeline.py"
  click pp "https://github.com/codewithkaran-21/ds-proj-2/blob/main/src/pipeline/prediction_pipeline.py"
  click wa "https://github.com/codewithkaran-21/ds-proj-2/blob/main/app.py"
  click tmpl_home "https://github.com/codewithkaran-21/ds-proj-2/blob/main/templates/home.html"
  click tmpl_res "https://github.com/codewithkaran-21/ds-proj-2/blob/main/templates/results.html"
  click log "https://github.com/codewithkaran-21/ds-proj-2/blob/main/src/logger.py"
  click exc "https://github.com/codewithkaran-21/ds-proj-2/blob/main/src/exception.py"
  click utilh "https://github.com/codewithkaran-21/ds-proj-2/blob/main/src/utils.py"
  click REQ "https://github.com/codewithkaran-21/ds-proj-2/blob/main/requirements.txt"
  click SETUP "https://github.com/codewithkaran-21/ds-proj-2/blob/main/setup.py"
```
