# ish-code1/cse-mlops architecture

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

- Interactive diagram: https://gitdiagram.com/ish-code1/cse-mlops
- Repository: https://github.com/ish-code1/cse-mlops

## Overview

This repository trains and serves an Iris classifier. The training workflow loads and splits the Iris dataset, fits and evaluates a random forest, applies an accuracy gate, saves a local joblib artifact, and logs metrics and a model to MLflow. At runtime, FastAPI loads the MLflow-format model during startup; the prediction endpoint validates four positive measurements, invokes the model, and returns a class label. The README is empty, so the map reflects the sampled source; unsampled files may contain additional details.

Main entry points: [`train.py`](https://github.com/ish-code1/cse-mlops/blob/main/train.py) (Training workflow), [`main.py`](https://github.com/ish-code1/cse-mlops/blob/main/main.py) (FastAPI app), [`model/MLmodel`](https://github.com/ish-code1/cse-mlops/blob/main/model/MLmodel) (MLflow model), [`models/Iris_random_forest_model.joblib`](https://github.com/ish-code1/cse-mlops/blob/main/models/Iris_random_forest_model.joblib) (Joblib model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_trainer["Training workflow<br/>[train.py]"]
  node_iris_data["Iris dataset<br/>[train.py]"]
  node_random_forest["Random forest<br/>[train.py]"]
  node_evaluation["Evaluation gate<br/>[train.py]"]
end

subgraph group_management["Model artifacts"]
  node_joblib_artifact["Joblib model"]
  node_mlflow_tracking["MLflow tracking<br/>[train.py]"]
  node_mlflow_model["MLflow model"]
end

subgraph group_serving["Prediction API"]
  node_api["FastAPI app<br/>[main.py]"]
  node_model_loader["Model loader<br/>[main.py]"]
  node_input_validation["Input validation<br/>[main.py]"]
  node_prediction["Prediction endpoint<br/>[main.py]"]
  node_health_routes["Health routes<br/>[main.py]"]
end

node_mlflow_service(("MLflow service"))

node_trainer -->|"loads and splits"| node_iris_data
node_trainer -->|"fits classifier"| node_random_forest
node_trainer -->|"evaluates and gates"| node_evaluation
node_trainer -->|"saves model"| node_joblib_artifact
node_trainer -->|"logs run and model"| node_mlflow_tracking
node_mlflow_tracking -->|"tracks and registers"| node_mlflow_service
node_api -->|"loads at startup"| node_model_loader
node_model_loader -->|"loads model"| node_mlflow_model
node_model_loader -->|"sets tracking URI"| node_mlflow_service
node_api -->|"validates request"| node_input_validation
node_api -->|"routes prediction"| node_prediction
node_prediction -->|"invokes predict"| node_mlflow_model
node_api -->|"serves health"| node_health_routes

click node_trainer "https://github.com/ish-code1/cse-mlops/blob/main/train.py"
click node_iris_data "https://github.com/ish-code1/cse-mlops/blob/main/train.py"
click node_random_forest "https://github.com/ish-code1/cse-mlops/blob/main/train.py"
click node_evaluation "https://github.com/ish-code1/cse-mlops/blob/main/train.py"
click node_joblib_artifact "https://github.com/ish-code1/cse-mlops/blob/main/models/Iris_random_forest_model.joblib"
click node_mlflow_tracking "https://github.com/ish-code1/cse-mlops/blob/main/train.py"
click node_mlflow_model "https://github.com/ish-code1/cse-mlops/blob/main/model/MLmodel"
click node_api "https://github.com/ish-code1/cse-mlops/blob/main/main.py"
click node_model_loader "https://github.com/ish-code1/cse-mlops/blob/main/main.py"
click node_input_validation "https://github.com/ish-code1/cse-mlops/blob/main/main.py"
click node_prediction "https://github.com/ish-code1/cse-mlops/blob/main/main.py"
click node_health_routes "https://github.com/ish-code1/cse-mlops/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_trainer,node_iris_data,node_random_forest,node_evaluation toneBlue
class node_joblib_artifact,node_mlflow_tracking,node_mlflow_model toneAmber
class node_api,node_model_loader,node_input_validation,node_prediction,node_health_routes toneMint
class node_mlflow_service toneIndigo
```

## Components

### Model training

- [Training workflow](https://github.com/ish-code1/cse-mlops/blob/main/train.py): `train.py`
- [Iris dataset](https://github.com/ish-code1/cse-mlops/blob/main/train.py): `train.py`
- [Random forest](https://github.com/ish-code1/cse-mlops/blob/main/train.py): `train.py`
- [Evaluation gate](https://github.com/ish-code1/cse-mlops/blob/main/train.py): `train.py`

### Model artifacts

- [Joblib model](https://github.com/ish-code1/cse-mlops/blob/main/models/Iris_random_forest_model.joblib): `models/Iris_random_forest_model.joblib`
- [MLflow tracking](https://github.com/ish-code1/cse-mlops/blob/main/train.py): `train.py`
- [MLflow model](https://github.com/ish-code1/cse-mlops/blob/main/model/MLmodel): `model/MLmodel`

### Prediction API

- [FastAPI app](https://github.com/ish-code1/cse-mlops/blob/main/main.py): `main.py`
- [Model loader](https://github.com/ish-code1/cse-mlops/blob/main/main.py): `main.py`
- [Input validation](https://github.com/ish-code1/cse-mlops/blob/main/main.py): `main.py`
- [Prediction endpoint](https://github.com/ish-code1/cse-mlops/blob/main/main.py): `main.py`
- [Health routes](https://github.com/ish-code1/cse-mlops/blob/main/main.py): `main.py`

### Other components

- **MLflow service**

## Connections

- Training workflow → Iris dataset: loads and splits (evidence: `train.py`)
- Training workflow → Random forest: fits classifier (evidence: `train.py`)
- Training workflow → Evaluation gate: evaluates and gates (evidence: `train.py`)
- Training workflow → Joblib model: saves model (evidence: `train.py`)
- Training workflow → MLflow tracking: logs run and model (evidence: `train.py`)
- MLflow tracking → MLflow service: tracks and registers (evidence: `train.py`)
- FastAPI app → Model loader: loads at startup (evidence: `main.py`)
- Model loader → MLflow model: loads model (evidence: `main.py`)
- Model loader → MLflow service: sets tracking URI (evidence: `main.py`)
- FastAPI app → Input validation: validates request (evidence: `main.py`)
- FastAPI app → Prediction endpoint: routes prediction (evidence: `main.py`)
- Prediction endpoint → MLflow model: invokes predict (evidence: `main.py`)
- FastAPI app → Health routes: serves health (evidence: `main.py`)
