# sqb-codes/ku-cse-mlops architecture

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

- Interactive diagram: https://gitdiagram.com/sqb-codes/ku-cse-mlops
- Repository: https://github.com/sqb-codes/ku-cse-mlops

## Overview

This repository is a coursework collection whose substantial product is an Iris-classification MLOps project. Its workflow trains and evaluates a classifier, rejects models below an accuracy threshold, logs and registers accepted models, then serves predictions through a FastAPI application that loads the champion model. Training and serving both use MLflow; training also saves a local artifact. The graph reflects the sampled source and README. The API app instance is commented out, so deployment and process startup are not shown.

Main entry points: [`mlops-first-pipeline/train.py`](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py) (Training run), [`mlops-first-pipeline/main.py`](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/main.py) (FastAPI application), [`mlops-first-pipeline/models/iris_random_forest_model.joblib`](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/models/iris_random_forest_model.joblib) (Local model artifact)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model development"]
  node_iris["Iris dataset"]
  node_train["Training run<br/>[train.py]"]
  node_evaluation["Metrics and gate<br/>[train.py]"]
  node_localmodel["Local model artifact"]
end

subgraph group_registry["Model registry"]
  node_mlflow[("MLflow tracking and registry")]
  node_registration["Registered classifier<br/>[train.py]"]
  node_champion["Champion alias<br/>[train.py]"]
end

subgraph group_serving["Prediction service"]
  node_api["FastAPI application<br/>[main.py]"]
  node_model_loader["Model and version loading<br/>[main.py]"]
  node_prediction["Prediction endpoint<br/>[main.py]"]
  node_health["Health endpoints<br/>[main.py]"]
end

node_engineer(("Project user"))
node_client(("API client"))

node_train -->|"loads"| node_iris
node_train -->|"fits and evaluates"| node_evaluation
node_train -->|"saves artifact"| node_localmodel
node_train -->|"logs run and model"| node_mlflow
node_train -->|"registers model"| node_registration
node_train -->|"sets alias"| node_champion
node_api -->|"starts lifespan"| node_model_loader
node_model_loader -->|"loads champion and version"| node_mlflow
node_client -->|"submits features"| node_prediction
node_prediction -->|"routes through"| node_api
node_api -->|"uses loaded model"| node_model_loader
node_client -->|"checks status"| node_health

click node_train "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py"
click node_evaluation "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py"
click node_localmodel "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/models/iris_random_forest_model.joblib"
click node_registration "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py"
click node_champion "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py"
click node_api "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/main.py"
click node_model_loader "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/main.py"
click node_prediction "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/main.py"
click node_health "https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/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_iris,node_train,node_evaluation,node_localmodel,node_engineer,node_client toneBlue
class node_mlflow,node_registration,node_champion toneAmber
class node_api,node_model_loader,node_prediction,node_health toneMint
```

## Components

### Model development

- **Iris dataset**
- [Training run](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py): `mlops-first-pipeline/train.py`
- [Metrics and gate](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py): `mlops-first-pipeline/train.py`
- [Local model artifact](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/models/iris_random_forest_model.joblib): `mlops-first-pipeline/models/iris_random_forest_model.joblib`

### Model registry

- **MLflow tracking and registry**
- [Registered classifier](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py): `mlops-first-pipeline/train.py`
- [Champion alias](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/train.py): `mlops-first-pipeline/train.py`

### Prediction service

- [FastAPI application](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/main.py): `mlops-first-pipeline/main.py`
- [Model and version loading](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/main.py): `mlops-first-pipeline/main.py`
- [Prediction endpoint](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/main.py): `mlops-first-pipeline/main.py`
- [Health endpoints](https://github.com/sqb-codes/ku-cse-mlops/blob/main/mlops-first-pipeline/main.py): `mlops-first-pipeline/main.py`

### Other components

- **Project user**
- **API client**

## Connections

- Training run → Iris dataset: loads (evidence: `mlops-first-pipeline/train.py`)
- Training run → Metrics and gate: fits and evaluates (evidence: `mlops-first-pipeline/train.py`)
- Training run → Local model artifact: saves artifact (evidence: `mlops-first-pipeline/train.py`)
- Training run → MLflow tracking and registry: logs run and model (evidence: `mlops-first-pipeline/train.py`)
- Training run → Registered classifier: registers model (evidence: `mlops-first-pipeline/train.py`)
- Training run → Champion alias: sets alias (evidence: `mlops-first-pipeline/train.py`)
- FastAPI application → Model and version loading: starts lifespan (evidence: `mlops-first-pipeline/main.py`)
- Model and version loading → MLflow tracking and registry: loads champion and version (evidence: `mlops-first-pipeline/main.py`)
- API client → Prediction endpoint: submits features (evidence: `mlops-first-pipeline/main.py`)
- Prediction endpoint → FastAPI application: routes through (evidence: `mlops-first-pipeline/main.py`)
- FastAPI application → Model and version loading: uses loaded model (evidence: `mlops-first-pipeline/main.py`)
- API client → Health endpoints: checks status (evidence: `mlops-first-pipeline/main.py`)
