# 24520871/nt132-mlops architecture

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

- Interactive diagram: https://gitdiagram.com/24520871/nt132-mlops
- Repository: https://github.com/24520871/nt132-mlops

## Overview

This repository is an end-to-end MLOps platform, with four ML use cases and shared data, training, registry, serving, and monitoring components. The principal flow is ingest and validate data, train and evaluate a candidate, apply promotion gates, serve the production model, then monitor behavior and optionally trigger retraining. The README describes broader AWS and CI/CD deployment capabilities, but the supplied tree does not show their implementation; the graph focuses on runtime code and marks only documented orchestration links as unverified.

Main entry points: [`src/mlops/serving/app.py`](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/app.py) (API Service), [`src/mlops/data/ingest.py`](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/data/ingest.py) (Data Ingestion), [`src/mlops/registry/promote.py`](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/registry/promote.py) (Model Registry), [`src/mlops/training/runner.py`](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/runner.py) (Training Runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data_training["Data and Training"]
  node_config["Configuration<br/>[config.py]"]
  node_ingest["Data Ingestion<br/>[ingest.py]"]
  node_validation["Data Validation<br/>[validation.py]"]
  node_training_runner["Training Runner<br/>[runner.py]"]
  node_evaluation["Model Evaluation<br/>[evaluate.py]"]
  node_quality_gate["Quality Gate<br/>[quality_gate.py]"]
  node_staging_check["Staging Checks<br/>[staging_check.py]"]
end

subgraph group_model_lifecycle["Model Lifecycle"]
  node_registry[("Model Registry<br/>[promote.py]")]
  node_rollback["Rollback<br/>[rollback.py]"]
end

subgraph group_serving["Prediction Serving"]
  node_serving_app["API Service<br/>[app.py]"]
  node_router["Production Model Router<br/>[router.py]"]
  node_schemas["API Schemas<br/>[schemas.py]"]
  node_metrics["Serving Metrics<br/>[metrics.py]"]
  node_prediction_log[("Prediction Log<br/>[prediction_log.py]")]
end

subgraph group_monitoring["Monitoring and Orchestration"]
  node_airflow_ingest["Ingest Workflow<br/>[ingest_dag.py]"]
  node_airflow_training["Training Workflow<br/>[training_dag.py]"]
  node_perf_monitor["Performance Monitor<br/>[perf_monitor.py]"]
  node_drift["Drift Monitor<br/>[drift.py]"]
  node_retrain["Retrain Trigger<br/>[trigger_retrain.py]"]
  node_airflow_monitoring["Monitoring Workflow<br/>[monitoring_dag.py]"]
end

subgraph group_use_cases["ML Use Cases"]
  node_churn["Churn Use Case"]
  node_fraud["Fraud Use Case"]
  node_forecast["Forecast Use Case"]
  node_recsys["Recommendation Use Case"]
end

node_user(("API Client"))
node_dataset[("Dataset")]
node_external_monitoring(("Monitoring Services"))

node_dataset -->|"reads data"| node_ingest
node_config -->|"resolves paths"| node_ingest
node_ingest -->|"provides data"| node_training_runner
node_training_runner -->|"evaluates models"| node_evaluation
node_training_runner -->|"registers candidate"| node_registry
node_registry -->|"checks candidate"| node_quality_gate
node_registry -->|"checks staging"| node_staging_check
node_registry -->|"reads metrics"| node_evaluation
node_rollback -.->|"updates alias"| node_registry
node_user -->|"requests prediction"| node_serving_app
node_serving_app -->|"loads model"| node_router
node_serving_app -.->|"uses schemas"| node_schemas
node_serving_app -->|"records metrics"| node_metrics
node_serving_app -->|"records predictions"| node_prediction_log
node_router -->|"reads production alias"| node_registry
node_serving_app -->|"loads adapter"| node_churn
node_serving_app -->|"loads adapter"| node_fraud
node_serving_app -->|"loads adapter"| node_forecast
node_serving_app -->|"loads adapter"| node_recsys
node_churn -->|"loads data"| node_ingest
node_churn -->|"validates data"| node_validation
node_forecast -->|"loads data"| node_ingest
node_forecast -->|"validates data"| node_validation
node_fraud -.->|"loads data"| node_ingest
node_fraud -.->|"validates data"| node_validation
node_recsys -->|"loads data"| node_ingest
node_recsys -->|"validates data"| node_validation
node_airflow_ingest -.->|"orchestrates ingestion"| node_ingest
node_airflow_training -.->|"orchestrates training"| node_training_runner
node_external_monitoring -.->|"provides telemetry"| node_perf_monitor
node_prediction_log -.->|"supplies observations"| node_drift
node_perf_monitor -.->|"supports analysis"| node_drift
node_drift -.->|"signals retraining"| node_retrain
node_airflow_monitoring -.->|"orchestrates checks"| node_retrain
node_retrain -.->|"triggers pipeline"| node_airflow_training

click node_config "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/config.py"
click node_ingest "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/data/ingest.py"
click node_validation "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/data/validation.py"
click node_training_runner "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/runner.py"
click node_evaluation "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/evaluate.py"
click node_quality_gate "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/quality_gate.py"
click node_staging_check "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/staging_check.py"
click node_airflow_ingest "https://github.com/24520871/nt132-mlops/blob/main/airflow/dags/ingest_dag.py"
click node_airflow_training "https://github.com/24520871/nt132-mlops/blob/main/airflow/dags/training_dag.py"
click node_registry "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/registry/promote.py"
click node_rollback "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/registry/rollback.py"
click node_serving_app "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/app.py"
click node_router "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/router.py"
click node_schemas "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/schemas.py"
click node_metrics "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/metrics.py"
click node_prediction_log "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/prediction_log.py"
click node_perf_monitor "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/monitoring/perf_monitor.py"
click node_drift "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/monitoring/drift.py"
click node_retrain "https://github.com/24520871/nt132-mlops/blob/main/src/mlops/monitoring/trigger_retrain.py"
click node_airflow_monitoring "https://github.com/24520871/nt132-mlops/blob/main/airflow/dags/monitoring_dag.py"
click node_churn "https://github.com/24520871/nt132-mlops/tree/main/usecases/churn"
click node_fraud "https://github.com/24520871/nt132-mlops/tree/main/usecases/fraud"
click node_forecast "https://github.com/24520871/nt132-mlops/tree/main/usecases/forecast"
click node_recsys "https://github.com/24520871/nt132-mlops/tree/main/usecases/recsys"

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_config,node_ingest,node_validation,node_training_runner,node_evaluation,node_quality_gate,node_staging_check,node_user toneBlue
class node_registry,node_rollback,node_dataset toneAmber
class node_serving_app,node_router,node_schemas,node_metrics,node_prediction_log toneMint
class node_airflow_ingest,node_airflow_training,node_perf_monitor,node_drift,node_retrain,node_airflow_monitoring toneRose
class node_churn,node_fraud,node_forecast,node_recsys,node_external_monitoring toneIndigo
```

## Components

### Data and Training

- [Configuration](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/config.py): `src/mlops/config.py`
- [Data Ingestion](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/data/ingest.py): `src/mlops/data/ingest.py`
- [Data Validation](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/data/validation.py): `src/mlops/data/validation.py`
- [Training Runner](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/runner.py): `src/mlops/training/runner.py`
- [Model Evaluation](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/evaluate.py): `src/mlops/training/evaluate.py`
- [Quality Gate](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/quality_gate.py): `src/mlops/training/quality_gate.py`
- [Staging Checks](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/training/staging_check.py): `src/mlops/training/staging_check.py`

### Model Lifecycle

- [Model Registry](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/registry/promote.py): `src/mlops/registry/promote.py`
- [Rollback](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/registry/rollback.py): `src/mlops/registry/rollback.py`

### Prediction Serving

- [API Service](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/app.py): `src/mlops/serving/app.py`
- [Production Model Router](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/router.py): `src/mlops/serving/router.py`
- [API Schemas](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/schemas.py): `src/mlops/serving/schemas.py`
- [Serving Metrics](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/metrics.py): `src/mlops/serving/metrics.py`
- [Prediction Log](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/serving/prediction_log.py): `src/mlops/serving/prediction_log.py`

### Monitoring and Orchestration

- [Ingest Workflow](https://github.com/24520871/nt132-mlops/blob/main/airflow/dags/ingest_dag.py): `airflow/dags/ingest_dag.py`
- [Training Workflow](https://github.com/24520871/nt132-mlops/blob/main/airflow/dags/training_dag.py): `airflow/dags/training_dag.py`
- [Performance Monitor](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/monitoring/perf_monitor.py): `src/mlops/monitoring/perf_monitor.py`
- [Drift Monitor](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/monitoring/drift.py): `src/mlops/monitoring/drift.py`
- [Retrain Trigger](https://github.com/24520871/nt132-mlops/blob/main/src/mlops/monitoring/trigger_retrain.py): `src/mlops/monitoring/trigger_retrain.py`
- [Monitoring Workflow](https://github.com/24520871/nt132-mlops/blob/main/airflow/dags/monitoring_dag.py): `airflow/dags/monitoring_dag.py`

### ML Use Cases

- [Churn Use Case](https://github.com/24520871/nt132-mlops/tree/main/usecases/churn): `usecases/churn`
- [Fraud Use Case](https://github.com/24520871/nt132-mlops/tree/main/usecases/fraud): `usecases/fraud`
- [Forecast Use Case](https://github.com/24520871/nt132-mlops/tree/main/usecases/forecast): `usecases/forecast`
- [Recommendation Use Case](https://github.com/24520871/nt132-mlops/tree/main/usecases/recsys): `usecases/recsys`

### Other components

- **API Client**
- **Dataset**
- **Monitoring Services**

## Connections

- Dataset → Data Ingestion: reads data (evidence: `src/mlops/data/ingest.py`)
- Configuration → Data Ingestion: resolves paths (evidence: `src/mlops/data/ingest.py`)
- Data Ingestion → Training Runner: provides data (evidence: `src/mlops/training/runner.py`)
- Training Runner → Model Evaluation: evaluates models (evidence: `src/mlops/training/runner.py`)
- Training Runner → Model Registry: registers candidate (evidence: `src/mlops/training/runner.py`)
- Model Registry → Quality Gate: checks candidate (evidence: `src/mlops/registry/promote.py`)
- Model Registry → Staging Checks: checks staging (evidence: `src/mlops/registry/promote.py`)
- Model Registry → Model Evaluation: reads metrics (evidence: `src/mlops/registry/promote.py`)
- Rollback → Model Registry: updates alias
- API Client → API Service: requests prediction (evidence: `src/mlops/serving/app.py`)
- API Service → Production Model Router: loads model (evidence: `src/mlops/serving/app.py`)
- API Service → API Schemas: uses schemas
- API Service → Serving Metrics: records metrics (evidence: `src/mlops/serving/app.py`)
- API Service → Prediction Log: records predictions (evidence: `src/mlops/serving/app.py`)
- Production Model Router → Model Registry: reads production alias (evidence: `src/mlops/serving/router.py`)
- API Service → Churn Use Case: loads adapter (evidence: `src/mlops/serving/app.py`)
- API Service → Fraud Use Case: loads adapter (evidence: `src/mlops/serving/app.py`)
- API Service → Forecast Use Case: loads adapter (evidence: `src/mlops/serving/app.py`)
- API Service → Recommendation Use Case: loads adapter (evidence: `src/mlops/serving/app.py`)
- Churn Use Case → Data Ingestion: loads data (evidence: `usecases/churn/data.py`)
- Churn Use Case → Data Validation: validates data (evidence: `usecases/churn/data.py`)
- Forecast Use Case → Data Ingestion: loads data (evidence: `usecases/forecast/data.py`)
- Forecast Use Case → Data Validation: validates data (evidence: `usecases/forecast/data.py`)
- Fraud Use Case → Data Ingestion: loads data (evidence: `usecases/fraud/data.py`)
- Fraud Use Case → Data Validation: validates data (evidence: `usecases/fraud/data.py`)
- Recommendation Use Case → Data Ingestion: loads data (evidence: `usecases/recsys/data.py`)
- Recommendation Use Case → Data Validation: validates data (evidence: `usecases/recsys/data.py`)
- Ingest Workflow → Data Ingestion: orchestrates ingestion
- Training Workflow → Training Runner: orchestrates training
- Monitoring Services → Performance Monitor: provides telemetry
- Prediction Log → Drift Monitor: supplies observations
- Performance Monitor → Drift Monitor: supports analysis (evidence: `src/mlops/monitoring/drift.py`)
- Drift Monitor → Retrain Trigger: signals retraining
- Monitoring Workflow → Retrain Trigger: orchestrates checks
- Retrain Trigger → Training Workflow: triggers pipeline
