# saurov565/data-science architecture

> Architecture diagram of the GitHub repository saurov565/data-science, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saurov565/data-science
- Repository: https://github.com/saurov565/data-science

## Overview

1. **Repo shape**
   - This is an **R-based data science workspace**, not an application with a runtime service.
   - The repository is split into two clear zones: a **main project** for supermarket sales analysis and a **Lab** area with standalone learning exercises.

2. **Primary business problem**
   - The main analysis centers on a **Supermarket Sales** dataset.
   - The goal is to understand **customer behavior, spending patterns, and sales drivers**, then prepare data for predictive and exploratory modeling.

3. **Main pipeline boundary**
   - The repository’s core flow is: **raw transactional data → cleaning → exploratory analysis → feature engineering → preprocessing → model-ready dataset**.
   - This boundary is important because the project appears focused on **analysis and preparation**, not deployment or operational APIs.

4. **Mid-project script as the preparation layer**
   - `H-G08 mid-project.r` is likely the **central data preparation / EDA script**.
   - Based on the README, this layer handles:
     - missing values
     - outliers
     - distribution checks
     - relationship exploration
     - feature creation such as `Total_Sales`
     - encoding and normalization

5. **Final project modeling branches**
   - The `Final Project` folder contains three separate analysis scripts:
     - `H-G08 final-Regression.R`
     - `H-G08 final-classification.R`
     - `H-G08 final-clustering.R`
   - These form **three model-specific branches** that likely consume the cleaned/preprocessed dataset and explore different analytical tasks:
     - regression for numeric prediction
     - classification for category prediction
     - clustering for customer segmentation

6. **Shared data foundation across models**
   - All three final scripts likely operate on the **same supermarket sales feature space**, but with different targets or objectives.
   - This means the architecture is not a monolithic pipeline; it is a **shared preprocessing foundation with multiple downstream modeling paths**.

7. **Feature engineering and encoding layer**
   - The README identifies several important transformations that sit between raw data and modeling:
     - `Total_Sales = unit_price × Quantity`
     - categorical encoding for `Branch`, `Gender`, `Customer_type`, `Product_line`, `Payment`
     - normalization and log transforms to reduce skew
   - This is the main **schema-conversion boundary** in the project, turning business-facing transaction data into numeric model inputs.

8. **Exploration and visualization subsystem**
   - The project uses `ggplot2` and `GGally` for EDA.
   - This subsystem likely produces the plots used to inspect distributions, correlations, and relationships before modeling.
   - In an architecture diagram, this should be shown as a **side path off the cleaned data**, feeding insight back into preprocessing choices.

9. **Tooling and execution model**
   - The stack is primarily **R with dplyr, ggplot2, and GGally**.
   - The scripts are likely run interactively or sequentially in an R environment, with no evidence of orchestration, backend services, or external infrastructure.
   - The repo therefore behaves like a **script-based analytics project**.

10. **Lab folder role**
   - The `Lab` directory contains many independent `.R` exercises on basics, matrices, arrays, descriptive statistics, and data handling.
   - These are best treated as **learning/reference modules**, not production dependencies of the final project.
   - In an architecture view, they are separate from the main pipeline and should not be connected into the supermarket-sales flow.

11. **What the architecture diagram should emphasize**
   - Show one main path from the dataset into **cleaning/EDA/feature engineering**, then branch into **regression**, **classification**, and **clustering**.
   - Keep the Lab scripts outside the core flow as **supporting educational material**.
   - There is no evident persistence layer, API boundary, or deployment target; the important architecture is **analytical and script-centric**.

Main entry points: [`H-G08 mid-project.r`](https://github.com/saurov565/data-science/blob/HEAD/H-G08%20mid-project.r) (Mid project), [`Lab/Descriptive Statistics in R.R`](https://github.com/saurov565/data-science/blob/HEAD/Lab/Descriptive%20Statistics%20in%20R.R) (Stats), [`Lab/Matrix.R`](https://github.com/saurov565/data-science/blob/main/Lab/Matrix.R) (Matrices), [`Final Project/H-G08 final-Regression.R`](https://github.com/saurov565/data-science/blob/HEAD/Final%20Project/H-G08%20final-Regression.R) (Regression)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_main["Main Project"]
  node_supermarket_data[("Sales data<br/>dataset")]
  node_mid_project["Mid project<br/>analysis script"]
  node_cleaning["Clean data<br/>prep stage"]
  node_eda["Explore data<br/>eda stage"]
  node_feature_engineering["Features<br/>feature stage"]
  node_model_ready[("Model set<br/>prepared dataset")]
  node_total_sales(("Total Sales<br/>feature"))
  node_encoding["Encode vars<br/>transform"]
  node_normalization["Normalize<br/>transform"]
end

subgraph group_final["Final Project"]
  node_regression["Regression<br/>model script"]
  node_classification["Classification<br/>model script"]
  node_clustering["Clustering<br/>model script"]
end

subgraph group_lab["Lab"]
  node_lab_basics["Syntax<br/>lab script"]
  node_lab_stats["Stats<br/>lab script"]
  node_lab_arrays["Matrices<br/>lab script<br/>[Matrix.R]"]
  node_lab_viz["Viz & data<br/>lab script"]
end

subgraph group_tools["Tools"]
  node_r_env(("R env<br/>runtime"))
  node_tidyverse["dplyr"]
  node_ggplot2["ggplot2"]
  node_ggally["GGally"]
end

node_supermarket_data -->|"input"| node_mid_project
node_mid_project -->|"clean"| node_cleaning
node_mid_project -->|"inspect"| node_eda
node_eda -.->|"guide"| node_feature_engineering
node_cleaning -->|"prepare"| node_feature_engineering
node_feature_engineering -->|"derive"| node_total_sales
node_feature_engineering -->|"encode"| node_encoding
node_feature_engineering -->|"scale"| node_normalization
node_total_sales -->|"assemble"| node_model_ready
node_encoding -->|"assemble"| node_model_ready
node_normalization -->|"assemble"| node_model_ready
node_model_ready -->|"branch"| node_regression
node_model_ready -->|"branch"| node_classification
node_model_ready -->|"branch"| node_clustering
node_r_env -.->|"runs"| node_mid_project
node_r_env -.->|"runs"| node_regression
node_r_env -.->|"runs"| node_classification
node_r_env -.->|"runs"| node_clustering
node_tidyverse -.->|"supports"| node_mid_project
node_ggplot2 -.->|"supports"| node_eda
node_ggally -.->|"supports"| node_eda
node_lab_basics -.->|"learns"| node_lab_stats
node_lab_stats -.->|"learns"| node_lab_arrays
node_lab_arrays -.->|"learns"| node_lab_viz

click node_mid_project "https://github.com/saurov565/data-science/blob/main/H-G08 mid-project.r"
click node_regression "https://github.com/saurov565/data-science/blob/main/Final Project/H-G08 final-Regression.R"
click node_classification "https://github.com/saurov565/data-science/blob/main/Final Project/H-G08 final-classification.R"
click node_clustering "https://github.com/saurov565/data-science/blob/main/Final Project/H-G08 final-clustering.R"
click node_lab_basics "https://github.com/saurov565/data-science/blob/main/Lab/22-48823-3 Basic syntax, R Data Structures.R"
click node_lab_stats "https://github.com/saurov565/data-science/blob/main/Lab/Descriptive Statistics in R.R"
click node_lab_arrays "https://github.com/saurov565/data-science/blob/main/Lab/Matrix.R"
click node_lab_viz "https://github.com/saurov565/data-science/blob/main/Lab/Advanced Data Handling and Visualization.R"

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_supermarket_data,node_mid_project,node_cleaning,node_eda,node_feature_engineering,node_model_ready,node_total_sales,node_encoding,node_normalization toneBlue
class node_regression,node_classification,node_clustering toneAmber
class node_lab_basics,node_lab_stats,node_lab_arrays,node_lab_viz toneMint
class node_r_env,node_tidyverse,node_ggplot2,node_ggally toneRose
```

## Components

### Main Project

Supermarket sales analysis pipeline

- **Sales data**: dataset · Raw supermarket sales transactions used as the analysis foundation
- [Mid project](https://github.com/saurov565/data-science/blob/HEAD/H-G08%20mid-project.r): analysis script · Central preparation script for cleaning, EDA, and feature work · `H-G08 mid-project.r`
- **Clean data**: prep stage · Missing values, outliers, and basic data quality handling
- **Explore data**: eda stage · Distribution checks, relationships, and visualization-driven inspection
- **Features**: feature stage · Derived variables and encoding for modeling
- **Model set**: prepared dataset · Normalized, encoded dataset ready for downstream analysis
- **Total Sales**: feature · Derived as unit price times quantity
- **Encode vars**: transform · Categorical encoding for branch, gender, customer type, product line, and payment
- **Normalize**: transform · Scaling and log transforms to reduce skew

### Final Project

Modeling branches built on the shared prepared dataset

- [Regression](https://github.com/saurov565/data-science/blob/HEAD/Final%20Project/H-G08%20final-Regression.R): model script · Numeric prediction branch · `Final Project/H-G08 final-Regression.R`
- [Classification](https://github.com/saurov565/data-science/blob/HEAD/Final%20Project/H-G08%20final-classification.R): model script · Category prediction branch · `Final Project/H-G08 final-classification.R`
- [Clustering](https://github.com/saurov565/data-science/blob/HEAD/Final%20Project/H-G08%20final-clustering.R): model script · Customer segmentation branch · `Final Project/H-G08 final-clustering.R`

### Lab

Standalone learning and practice scripts

- [Syntax](https://github.com/saurov565/data-science/blob/HEAD/Lab/22-48823-3%20Basic%20syntax%2C%20R%20Data%20Structures.R): lab script · Introductory R syntax and data structure exercises · `Lab/22-48823-3 Basic syntax, R Data Structures.R`
- [Stats](https://github.com/saurov565/data-science/blob/HEAD/Lab/Descriptive%20Statistics%20in%20R.R): lab script · Descriptive statistics practice · `Lab/Descriptive Statistics in R.R`
- [Matrices](https://github.com/saurov565/data-science/blob/main/Lab/Matrix.R): lab script · Matrix and array exercises · `Lab/Matrix.R`
- [Viz & data](https://github.com/saurov565/data-science/blob/HEAD/Lab/Advanced%20Data%20Handling%20and%20Visualization.R): lab script · Advanced data handling and visualization practice · `Lab/Advanced Data Handling and Visualization.R`

### Tools

R packages and analysis stack

- **R env**: runtime · Script-based R analysis workflow
- **dplyr**: library · Data wrangling used across the analysis scripts
- **ggplot2**: library · Primary visualization library for EDA
- **GGally**: library · Correlation and pairwise relationship exploration

## Connections

- Sales data → Mid project: input · Raw transactions feed the central preparation script
- Mid project → Clean data: clean · Handle missing values and outliers
- Mid project → Explore data: inspect · Run distribution and relationship analysis
- Explore data → Features: guide · Exploration informs feature design
- Clean data → Features: prepare · Cleaned data becomes the basis for derived fields
- Features → Total Sales: derive · Create total sales from unit price and quantity
- Features → Encode vars: encode · Convert categorical fields for modeling
- Features → Normalize: scale · Apply normalization and log transforms
- Total Sales → Model set: assemble · Derived feature joins the model dataset
- Encode vars → Model set: assemble · Encoded fields are included in the model set
- Normalize → Model set: assemble · Scaled features complete the model-ready dataset
- Model set → Regression: branch · Prepared dataset supports numeric prediction analysis
- Model set → Classification: branch · Prepared dataset supports category prediction analysis
- Model set → Clustering: branch · Prepared dataset supports segmentation analysis
- R env → Mid project: runs · Scripts execute in an R analysis environment
- R env → Regression: runs · Modeling scripts are executed in R
- R env → Classification: runs · Modeling scripts are executed in R
- R env → Clustering: runs · Modeling scripts are executed in R
- dplyr → Mid project: supports · Wrangling support for cleaning and feature work
- ggplot2 → Explore data: supports · Visualization support for exploratory analysis
- GGally → Explore data: supports · Pairwise relationship and correlation exploration
- Syntax → Stats: learns · Exercises progress from syntax to statistics
- Stats → Matrices: learns · Concepts extend into structural data practice
- Matrices → Viz & data: learns · Later exercises cover data handling and visualization
