# shyamkailash/-cancer-detection-in-histopathology-images architecture

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

- Interactive diagram: https://gitdiagram.com/shyamkailash/-cancer-detection-in-histopathology-images
- Repository: https://github.com/shyamkailash/-cancer-detection-in-histopathology-images

## Overview

This is a histopathology cancer-detection platform centered on a federated-training workflow: prepare and partition image data, train simulated site clients, aggregate model updates, and validate a global model. It also provides model inference and an agentic MLOps lifecycle for client selection, privacy and drift assessment, retraining decisions, evaluation, and registry management. The README documents REST API and Grad-CAM capabilities. Some API, training, and orchestration internals were not sampled, so uncertain connections are omitted.

Main entry points: [`agents/orchestrator.py`](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/orchestrator.py) (Lifecycle orchestrator), [`ml/federated/server.py`](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/server.py) (Federated server), [`ml/data/manifest.py`](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/data/manifest.py) (Sample manifest), [`ml/federated/client.py`](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/client.py) (Federated client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_sources["Dataset sources"]
  node_manifest["Sample manifest<br/>[manifest.py]"]
  node_validation["Data validation"]
  node_splits["Leakage-safe splits<br/>[split.py]"]
  node_preprocess["Image transforms<br/>[transforms.py]"]
  node_loaders["Dataset loaders<br/>[dataloaders.py]"]
end

subgraph group_learning["Model training"]
  node_partition["Site partitioning<br/>[partition.py]"]
  node_trainer["Training workflows"]
  node_client["Federated client<br/>[client.py]"]
  node_privacy["Private updates<br/>[privacy.py]"]
  node_aggregation["Federated aggregation<br/>[aggregation.py]"]
  node_server["Federated server<br/>[server.py]"]
  node_model["ResNet-18<br/>[resnet.py]"]
  node_metrics["Model evaluation<br/>[metrics.py]"]
end

subgraph group_serving["Inference and API"]
  node_inference["Inference pipeline<br/>[pipeline.py]"]
  node_manager["Model manager<br/>[model_manager.py]"]
  node_explain["Grad-CAM<br/>[gradcam.py]"]
  node_api["REST API<br/>[views.py]"]
end

subgraph group_ops["Agentic MLOps"]
  node_orchestrator["Lifecycle orchestrator<br/>[orchestrator.py]"]
  node_selection["Client selection"]
  node_distributed["Site coordination<br/>[distributed.py]"]
  node_drift["Drift monitoring<br/>[drift_monitor.py]"]
  node_retraining["Retraining decisions<br/>[retraining.py]"]
  node_evalagent["Candidate evaluation<br/>[evaluation.py]"]
  node_registry["Model lifecycle registry"]
  node_contracts["Agent contracts<br/>[contracts.py]"]
  node_audit[("Run and event storage<br/>[storage.py]")]
end

node_operator(("Researcher or operator"))

node_operator -->|"starts training"| node_trainer
node_sources -->|"creates records"| node_manifest
node_manifest -->|"assigns splits"| node_splits
node_manifest -->|"checks samples"| node_validation
node_manifest -->|"provides samples"| node_loaders
node_preprocess -->|"transforms images"| node_loaders
node_trainer -->|"partitions sites"| node_partition
node_trainer -->|"runs federation"| node_server
node_partition -.->|"assigns site data"| node_client
node_client -->|"trains locally"| node_model
node_client -->|"protects gradients"| node_privacy
node_server -->|"dispatches rounds"| node_client
node_server -->|"aggregates updates"| node_aggregation
node_server -->|"evaluates global model"| node_metrics
node_server -->|"manages global model"| node_model
node_inference -->|"loads model"| node_manager
node_inference -->|"generates explanations"| node_explain
node_manager -->|"constructs architecture"| node_model
node_operator -.->|"requests predictions"| node_api
node_orchestrator -->|"selects clients"| node_selection
node_selection -->|"checks site health"| node_distributed
node_orchestrator -->|"assesses drift"| node_drift
node_orchestrator -->|"plans retraining"| node_retraining
node_orchestrator -->|"evaluates candidate"| node_evalagent
node_orchestrator -->|"registers model"| node_registry
node_orchestrator -->|"persists events"| node_audit
node_selection -->|"returns decisions"| node_contracts
node_drift -->|"returns assessment"| node_contracts
node_evalagent -->|"uses model manager"| node_manager
node_registry -->|"uses model manager"| node_manager

click node_sources "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/tree/main/ml/sources"
click node_manifest "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/data/manifest.py"
click node_validation "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/tree/main/ml/validation"
click node_splits "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/data/split.py"
click node_preprocess "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/preprocessing/transforms.py"
click node_loaders "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/datasets/dataloaders.py"
click node_partition "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/partition.py"
click node_trainer "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/tree/main/ml/training"
click node_client "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/client.py"
click node_privacy "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/privacy.py"
click node_aggregation "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/aggregation.py"
click node_server "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/server.py"
click node_model "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/models/resnet.py"
click node_metrics "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/evaluation/metrics.py"
click node_inference "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/inference/pipeline.py"
click node_manager "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/inference/model_manager.py"
click node_explain "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/inference/gradcam.py"
click node_api "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/backend/apps/predictions/views.py"
click node_orchestrator "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/orchestrator.py"
click node_selection "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/client_selection.py"
click node_distributed "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/distributed.py"
click node_drift "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/drift_monitor.py"
click node_retraining "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/retraining.py"
click node_evalagent "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/evaluation.py"
click node_registry "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/registry_lifecycle.py"
click node_contracts "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/contracts.py"
click node_audit "https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/storage.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_sources,node_manifest,node_validation,node_splits,node_preprocess,node_loaders toneBlue
class node_partition,node_trainer,node_client,node_privacy,node_aggregation,node_server,node_model,node_metrics toneAmber
class node_inference,node_manager,node_explain,node_api toneMint
class node_orchestrator,node_selection,node_distributed,node_drift,node_retraining,node_evalagent,node_registry,node_contracts,node_audit toneRose
class node_operator toneIndigo
```

## Components

### Data preparation

- [Dataset sources](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/tree/main/ml/sources): `ml/sources`
- [Sample manifest](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/data/manifest.py): `ml/data/manifest.py`
- [Data validation](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/tree/main/ml/validation): `ml/validation`
- [Leakage-safe splits](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/data/split.py): `ml/data/split.py`
- [Image transforms](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/preprocessing/transforms.py): `ml/preprocessing/transforms.py`
- [Dataset loaders](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/datasets/dataloaders.py): `ml/datasets/dataloaders.py`

### Model training

- [Site partitioning](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/partition.py): `ml/federated/partition.py`
- [Training workflows](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/tree/main/ml/training): `ml/training`
- [Federated client](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/client.py): `ml/federated/client.py`
- [Private updates](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/privacy.py): `ml/federated/privacy.py`
- [Federated aggregation](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/aggregation.py): `ml/federated/aggregation.py`
- [Federated server](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/federated/server.py): `ml/federated/server.py`
- [ResNet-18](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/models/resnet.py): `ml/models/resnet.py`
- [Model evaluation](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/evaluation/metrics.py): `ml/evaluation/metrics.py`

### Inference and API

- [Inference pipeline](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/inference/pipeline.py): `ml/inference/pipeline.py`
- [Model manager](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/inference/model_manager.py): `ml/inference/model_manager.py`
- [Grad-CAM](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/ml/inference/gradcam.py): `ml/inference/gradcam.py`
- [REST API](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/backend/apps/predictions/views.py): `backend/apps/predictions/views.py`

### Agentic MLOps

- [Lifecycle orchestrator](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/orchestrator.py): `agents/orchestrator.py`
- [Client selection](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/client_selection.py): `agents/client_selection.py`
- [Site coordination](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/distributed.py): `mlops/distributed.py`
- [Drift monitoring](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/drift_monitor.py): `mlops/drift_monitor.py`
- [Retraining decisions](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/retraining.py): `agents/retraining.py`
- [Candidate evaluation](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/agents/evaluation.py): `agents/evaluation.py`
- [Model lifecycle registry](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/registry_lifecycle.py): `mlops/registry_lifecycle.py`
- [Agent contracts](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/contracts.py): `mlops/contracts.py`
- [Run and event storage](https://github.com/shyamkailash/-cancer-detection-in-histopathology-images/blob/main/mlops/storage.py): `mlops/storage.py`

### Other components

- **Researcher or operator**

## Connections

- Researcher or operator → Training workflows: starts training (evidence: `README.md`)
- Dataset sources → Sample manifest: creates records (evidence: `ml/sources/pcam.py`)
- Sample manifest → Leakage-safe splits: assigns splits (evidence: `ml/data/split.py`)
- Sample manifest → Data validation: checks samples (evidence: `ml/validation/duplicates.py`)
- Sample manifest → Dataset loaders: provides samples (evidence: `ml/datasets/dataloaders.py`)
- Image transforms → Dataset loaders: transforms images (evidence: `ml/datasets/dataloaders.py`)
- Training workflows → Site partitioning: partitions sites (evidence: `ml/training/federated_trainer.py`)
- Training workflows → Federated server: runs federation (evidence: `ml/training/federated_trainer.py`)
- Site partitioning → Federated client: assigns site data
- Federated client → ResNet-18: trains locally (evidence: `ml/federated/client.py`)
- Federated client → Private updates: protects gradients (evidence: `ml/federated/client.py`)
- Federated server → Federated client: dispatches rounds (evidence: `ml/federated/server.py`)
- Federated server → Federated aggregation: aggregates updates (evidence: `ml/federated/server.py`)
- Federated server → Model evaluation: evaluates global model (evidence: `ml/federated/server.py`)
- Federated server → ResNet-18: manages global model (evidence: `ml/federated/server.py`)
- Inference pipeline → Model manager: loads model (evidence: `ml/inference/pipeline.py`)
- Inference pipeline → Grad-CAM: generates explanations (evidence: `ml/inference/pipeline.py`)
- Model manager → ResNet-18: constructs architecture (evidence: `ml/inference/model_manager.py`)
- Researcher or operator → REST API: requests predictions
- Lifecycle orchestrator → Client selection: selects clients (evidence: `agents/orchestrator.py`)
- Client selection → Site coordination: checks site health (evidence: `agents/client_selection.py`)
- Lifecycle orchestrator → Drift monitoring: assesses drift (evidence: `agents/orchestrator.py`)
- Lifecycle orchestrator → Retraining decisions: plans retraining (evidence: `agents/orchestrator.py`)
- Lifecycle orchestrator → Candidate evaluation: evaluates candidate (evidence: `agents/orchestrator.py`)
- Lifecycle orchestrator → Model lifecycle registry: registers model (evidence: `agents/orchestrator.py`)
- Lifecycle orchestrator → Run and event storage: persists events (evidence: `agents/orchestrator.py`)
- Client selection → Agent contracts: returns decisions (evidence: `agents/client_selection.py`)
- Drift monitoring → Agent contracts: returns assessment (evidence: `agents/drift.py`)
- Candidate evaluation → Model manager: uses model manager (evidence: `agents/evaluation.py`)
- Model lifecycle registry → Model manager: uses model manager (evidence: `mlops/registry_lifecycle.py`)
