# mohamedsathikz/salary_prediction_mlops architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedsathikz/salary_prediction_mlops
- Repository: https://github.com/mohamedsathikz/salary_prediction_mlops

## Overview

This repository trains a salary regression model and serves predictions through a FastAPI endpoint. The main workflow reads the salary dataset, fits and evaluates a linear regression model, saves it for the API to load, then turns submitted experience into a predicted salary. Training also records parameters, metrics, and a model artifact with MLflow. The graph follows the sampled training and API code; it does not infer additional behavior from the tracked MLflow files.

Main entry points: [`train.py`](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/train.py) (Fit and evaluate), [`app.py`](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/app.py) (FastAPI routes), [`models/salary_model.joblib`](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/models/salary_model.joblib) (Saved model), [`Salary_dataset.csv`](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/Salary_dataset.csv) (Salary dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_dataset["Salary dataset<br/>[Salary_dataset.csv]"]
  node_prep["Prepare data<br/>[train.py]"]
  node_fit_eval["Fit and evaluate<br/>[train.py]"]
  node_model_file["Saved model"]
end

subgraph group_serving["Prediction API"]
  node_api["FastAPI routes<br/>[app.py]"]
  node_prediction["Prediction<br/>[app.py]"]
  node_response["Salary result"]
end

subgraph group_tracking["Experiment tracking"]
  node_tracking_meta[("MLflow metadata<br/>[mlflow.db]")]
  node_tracking_artifacts["MLflow artifacts"]
end

node_analyst(("Model operator"))
node_api_user(("API client"))

node_analyst -->|"runs training"| node_prep
node_prep -->|"reads"| node_dataset
node_prep -->|"provides data"| node_fit_eval
node_fit_eval -->|"saves model"| node_model_file
node_fit_eval -->|"logs metrics"| node_tracking_meta
node_fit_eval -->|"logs artifact"| node_tracking_artifacts
node_api_user -->|"submits request"| node_api
node_api -->|"loads model"| node_model_file
node_api -->|"dispatches"| node_prediction
node_prediction -->|"returns salary"| node_response

click node_dataset "https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/Salary_dataset.csv"
click node_prep "https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/train.py"
click node_fit_eval "https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/train.py"
click node_model_file "https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/models/salary_model.joblib"
click node_api "https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/app.py"
click node_prediction "https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/app.py"
click node_tracking_meta "https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/mlflow.db"
click node_tracking_artifacts "https://github.com/mohamedsathikz/salary_prediction_mlops/tree/main/mlruns"

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_dataset,node_prep,node_fit_eval,node_model_file,node_api_user toneBlue
class node_api,node_prediction,node_response toneAmber
class node_tracking_meta,node_tracking_artifacts toneMint
class node_analyst toneIndigo
```

## Components

### Model training

- [Salary dataset](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/Salary_dataset.csv): `Salary_dataset.csv`
- [Prepare data](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/train.py): `train.py`
- [Fit and evaluate](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/train.py): `train.py`
- [Saved model](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/models/salary_model.joblib): `models/salary_model.joblib`

### Prediction API

- [FastAPI routes](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/app.py): `app.py`
- [Prediction](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/app.py): `app.py`
- **Salary result**

### Experiment tracking

- [MLflow metadata](https://github.com/mohamedsathikz/salary_prediction_mlops/blob/main/mlflow.db): `mlflow.db`
- [MLflow artifacts](https://github.com/mohamedsathikz/salary_prediction_mlops/tree/main/mlruns): `mlruns`

### Other components

- **Model operator**
- **API client**

## Connections

- Model operator → Prepare data: runs training (evidence: `train.py`)
- Prepare data → Salary dataset: reads (evidence: `train.py`)
- Prepare data → Fit and evaluate: provides data (evidence: `train.py`)
- Fit and evaluate → Saved model: saves model (evidence: `train.py`)
- Fit and evaluate → MLflow metadata: logs metrics (evidence: `train.py`)
- Fit and evaluate → MLflow artifacts: logs artifact (evidence: `train.py`)
- API client → FastAPI routes: submits request (evidence: `app.py`)
- FastAPI routes → Saved model: loads model (evidence: `app.py`)
- FastAPI routes → Prediction: dispatches (evidence: `app.py`)
- Prediction → Salary result: returns salary (evidence: `app.py`)
