# satyaifd/mlops-governance-reference architecture

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

- Interactive diagram: https://gitdiagram.com/satyaifd/mlops-governance-reference
- Repository: https://github.com/satyaifd/mlops-governance-reference

## Overview

This monorepo is a reference MLOps platform spanning batch fraud classification, fair-lending loan underwriting, and stateful AML stream detection. The main user-facing workflow is a loan application entering the prediction API, receiving a risk recommendation and governance routing, with inference telemetry recorded for monitoring. Separate branches cover model-data preparation and training, fraud-model lifecycle capabilities, AML event processing and DLQ replay, and shared compliance controls. The README documents capabilities beyond the excerpts; edges for unsampled or indirect wiring are omitted rather than inferred.

Main entry points: [`project-2-loan-default/src/inference/main.py`](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/inference/main.py) (Loan Prediction API), [`project-3-aml-streaming/src/streaming/pipeline.py`](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/streaming/pipeline.py) (Stream Pipeline), [`project-3-aml-streaming/scripts/replay_dlq.py`](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/scripts/replay_dlq.py) (DLQ Replay), [`project-2-loan-default/src/ingestion/ingestion.py`](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/ingestion/ingestion.py) (Loan Data Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_fraud["Batch Fraud"]
  node_fraud_data["Fraud Ingestion<br/>[ingestion.py]"]
  node_fraud_train["Fraud Training<br/>[train.py]"]
  node_fraud_infer["Fraud Inference<br/>[main.py]"]
  node_fraud_audit["Segment Auditing<br/>[audit.py]"]
  node_fraud_drift["PSI Drift Checks<br/>[drift_check.py]"]
  node_fraud_obs["Fraud Observability<br/>[observability.py]"]
end

subgraph group_loan["Loan Underwriting"]
  node_loan_api["Loan Prediction API<br/>[main.py]"]
  node_loan_ingest["Loan Data Ingestion<br/>[ingestion.py]"]
  node_loan_extract["Loan Data Extractor<br/>[extract.py]"]
  node_loan_schema["Loan Schema Contract<br/>[schemas.py]"]
  node_loan_train["Fair-Lending Training<br/>[train.py]"]
  node_loan_eval["Model Evaluation<br/>[evaluate.py]"]
  node_loan_drift["Drift Monitoring<br/>[drift_monitor.py]"]
  node_loan_traffic["Traffic Generation"]
  node_loan_obs[("Inference Telemetry<br/>[observability.py]")]
  node_loan_validation["Drift Validation<br/>[drift_check.py]"]
  node_loan_dag["Underwriting Workflow"]
end

subgraph group_aml["AML Streaming"]
  node_aml_generator["Transaction Generator<br/>[generator.py]"]
  node_aml_ingest["Event Validation<br/>[stream_ingestor.py]"]
  node_aml_features["Velocity Features<br/>[velocity.py]"]
  node_aml_model["Anomaly Detector"]
  node_aml_pipeline["Stream Pipeline<br/>[pipeline.py]"]
  node_aml_dlq["DLQ Replay<br/>[replay_dlq.py]"]
end

subgraph group_governance["Governance Controls"]
  node_hitl["HITL Decision Router"]
  node_breaker["Inference Circuit Breaker"]
  node_purge["GDPR Erasure<br/>[gdpr_purge.py]"]
end

node_loan_user(("Applicant"))

node_loan_user -->|"submits application"| node_loan_api
node_loan_api -->|"routes decision"| node_hitl
node_loan_api -->|"guards inference"| node_breaker
node_loan_api -->|"logs transaction"| node_loan_obs
node_loan_ingest -->|"fetches data"| node_loan_extract
node_loan_ingest -->|"validates against"| node_loan_schema
node_loan_dag -.->|"coordinates"| node_loan_ingest
node_loan_api -->|"emits telemetry"| node_loan_drift
node_loan_traffic -->|"creates telemetry"| node_loan_obs
node_loan_validation -->|"reports drift"| node_loan_obs
node_aml_pipeline -->|"reads events"| node_aml_generator
node_aml_pipeline -->|"validates events"| node_aml_ingest
node_aml_pipeline -->|"computes features"| node_aml_features
node_aml_pipeline -->|"scores events"| node_aml_model
node_aml_dlq -->|"replays events"| node_aml_ingest
node_aml_dlq -->|"replays events"| node_aml_features
node_aml_dlq -->|"replays events"| node_aml_model
node_aml_dlq -->|"reads source stream"| node_aml_generator
node_fraud_infer -.->|"audits decisions"| node_fraud_audit

click node_fraud_data "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/ingestion/ingestion.py"
click node_fraud_train "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/training/train.py"
click node_fraud_infer "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/inference/main.py"
click node_fraud_audit "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/governance/audit.py"
click node_fraud_drift "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/validation/drift_check.py"
click node_fraud_obs "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/monitoring/observability.py"
click node_loan_api "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/inference/main.py"
click node_loan_ingest "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/ingestion/ingestion.py"
click node_loan_extract "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/ingestion/extract.py"
click node_loan_schema "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/ingestion/schemas.py"
click node_loan_train "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/training/train.py"
click node_loan_eval "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/evaluation/evaluate.py"
click node_loan_drift "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/monitoring/drift_monitor.py"
click node_loan_traffic "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/monitoring/generate_traffic.py"
click node_loan_obs "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/monitoring/observability.py"
click node_loan_validation "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/validation/drift_check.py"
click node_loan_dag "https://github.com/satyaifd/mlops-governance-reference/blob/main/airflow/dags/loan_underwriting_dag.py"
click node_aml_generator "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/streaming/generator.py"
click node_aml_ingest "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/ingestion/stream_ingestor.py"
click node_aml_features "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/features/velocity.py"
click node_aml_model "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/models/anomaly_detector.py"
click node_aml_pipeline "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/streaming/pipeline.py"
click node_aml_dlq "https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/scripts/replay_dlq.py"
click node_hitl "https://github.com/satyaifd/mlops-governance-reference/blob/main/compliance/eu_ai_act_hitl_router.py"
click node_breaker "https://github.com/satyaifd/mlops-governance-reference/blob/main/compliance/dora_circuit_breaker.py"
click node_purge "https://github.com/satyaifd/mlops-governance-reference/blob/main/compliance/gdpr_purge.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_fraud_data,node_fraud_train,node_fraud_infer,node_fraud_audit,node_fraud_drift,node_fraud_obs toneBlue
class node_loan_api,node_loan_ingest,node_loan_extract,node_loan_schema,node_loan_train,node_loan_eval,node_loan_drift,node_loan_traffic,node_loan_obs,node_loan_validation,node_loan_dag toneAmber
class node_aml_generator,node_aml_ingest,node_aml_features,node_aml_model,node_aml_pipeline,node_aml_dlq toneMint
class node_hitl,node_breaker,node_purge toneRose
class node_loan_user toneIndigo
```

## Components

### Batch Fraud

- [Fraud Ingestion](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/ingestion/ingestion.py): `project-1-credit-card-fraud/src/ingestion/ingestion.py`
- [Fraud Training](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/training/train.py): `project-1-credit-card-fraud/src/training/train.py`
- [Fraud Inference](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/inference/main.py): `project-1-credit-card-fraud/src/inference/main.py`
- [Segment Auditing](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/governance/audit.py): `project-1-credit-card-fraud/src/governance/audit.py`
- [PSI Drift Checks](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/validation/drift_check.py): `project-1-credit-card-fraud/src/validation/drift_check.py`
- [Fraud Observability](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-1-credit-card-fraud/src/monitoring/observability.py): `project-1-credit-card-fraud/src/monitoring/observability.py`

### Loan Underwriting

- [Loan Prediction API](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/inference/main.py): `project-2-loan-default/src/inference/main.py`
- [Loan Data Ingestion](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/ingestion/ingestion.py): `project-2-loan-default/src/ingestion/ingestion.py`
- [Loan Data Extractor](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/ingestion/extract.py): `project-2-loan-default/src/ingestion/extract.py`
- [Loan Schema Contract](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/ingestion/schemas.py): `project-2-loan-default/src/ingestion/schemas.py`
- [Fair-Lending Training](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/training/train.py): `project-2-loan-default/src/training/train.py`
- [Model Evaluation](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/evaluation/evaluate.py): `project-2-loan-default/src/evaluation/evaluate.py`
- [Drift Monitoring](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/monitoring/drift_monitor.py): `project-2-loan-default/src/monitoring/drift_monitor.py`
- [Traffic Generation](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/monitoring/generate_traffic.py): `project-2-loan-default/src/monitoring/generate_traffic.py`
- [Inference Telemetry](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/monitoring/observability.py): `project-2-loan-default/src/monitoring/observability.py`
- [Drift Validation](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-2-loan-default/src/validation/drift_check.py): `project-2-loan-default/src/validation/drift_check.py`
- [Underwriting Workflow](https://github.com/satyaifd/mlops-governance-reference/blob/main/airflow/dags/loan_underwriting_dag.py): `airflow/dags/loan_underwriting_dag.py`

### AML Streaming

- [Transaction Generator](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/streaming/generator.py): `project-3-aml-streaming/src/streaming/generator.py`
- [Event Validation](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/ingestion/stream_ingestor.py): `project-3-aml-streaming/src/ingestion/stream_ingestor.py`
- [Velocity Features](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/features/velocity.py): `project-3-aml-streaming/src/features/velocity.py`
- [Anomaly Detector](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/models/anomaly_detector.py): `project-3-aml-streaming/src/models/anomaly_detector.py`
- [Stream Pipeline](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/src/streaming/pipeline.py): `project-3-aml-streaming/src/streaming/pipeline.py`
- [DLQ Replay](https://github.com/satyaifd/mlops-governance-reference/blob/main/project-3-aml-streaming/scripts/replay_dlq.py): `project-3-aml-streaming/scripts/replay_dlq.py`

### Governance Controls

- [HITL Decision Router](https://github.com/satyaifd/mlops-governance-reference/blob/main/compliance/eu_ai_act_hitl_router.py): `compliance/eu_ai_act_hitl_router.py`
- [Inference Circuit Breaker](https://github.com/satyaifd/mlops-governance-reference/blob/main/compliance/dora_circuit_breaker.py): `compliance/dora_circuit_breaker.py`
- [GDPR Erasure](https://github.com/satyaifd/mlops-governance-reference/blob/main/compliance/gdpr_purge.py): `compliance/gdpr_purge.py`

### Other components

- **Applicant**

## Connections

- Applicant → Loan Prediction API: submits application (evidence: `README.md`)
- Loan Prediction API → HITL Decision Router: routes decision (evidence: `project-2-loan-default/src/inference/main.py`)
- Loan Prediction API → Inference Circuit Breaker: guards inference (evidence: `project-2-loan-default/src/inference/main.py`)
- Loan Prediction API → Inference Telemetry: logs transaction (evidence: `project-2-loan-default/src/inference/main.py`)
- Loan Data Ingestion → Loan Data Extractor: fetches data (evidence: `project-2-loan-default/src/ingestion/ingestion.py`)
- Loan Data Ingestion → Loan Schema Contract: validates against (evidence: `project-2-loan-default/src/ingestion/ingestion.py`)
- Underwriting Workflow → Loan Data Ingestion: coordinates
- Loan Prediction API → Drift Monitoring: emits telemetry (evidence: `project-2-loan-default/src/monitoring/drift_monitor.py`)
- Traffic Generation → Inference Telemetry: creates telemetry (evidence: `project-2-loan-default/src/monitoring/generate_traffic.py`)
- Drift Validation → Inference Telemetry: reports drift (evidence: `project-2-loan-default/src/validation/drift_check.py`)
- Stream Pipeline → Transaction Generator: reads events (evidence: `project-3-aml-streaming/src/streaming/pipeline.py`)
- Stream Pipeline → Event Validation: validates events (evidence: `project-3-aml-streaming/src/streaming/pipeline.py`)
- Stream Pipeline → Velocity Features: computes features (evidence: `project-3-aml-streaming/src/streaming/pipeline.py`)
- Stream Pipeline → Anomaly Detector: scores events (evidence: `project-3-aml-streaming/src/streaming/pipeline.py`)
- DLQ Replay → Event Validation: replays events (evidence: `project-3-aml-streaming/scripts/replay_dlq.py`)
- DLQ Replay → Velocity Features: replays events (evidence: `project-3-aml-streaming/scripts/replay_dlq.py`)
- DLQ Replay → Anomaly Detector: replays events (evidence: `project-3-aml-streaming/scripts/replay_dlq.py`)
- DLQ Replay → Transaction Generator: reads source stream (evidence: `project-3-aml-streaming/scripts/replay_dlq.py`)
- Fraud Inference → Segment Auditing: audits decisions
