# psanyalaich/oral-cancer-histopathology-ml architecture

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

- Interactive diagram: https://gitdiagram.com/psanyalaich/oral-cancer-histopathology-ml
- Repository: https://github.com/psanyalaich/oral-cancer-histopathology-ml

## Overview

This is a research pipeline for classifying normal versus OSCC histopathology images using handcrafted features and classical ML. Its main workflow generates experiment configurations, prepares reproducible folds, loads and processes images into feature datasets, then trains and evaluates models across folds and records results for analysis. The graph also includes quality control, explainability, visual evaluation, learning curves, and statistical comparisons. Several connections are based on the README or source-index references; unsampled implementation details are not asserted beyond those documented links.

Main entry points: [`train_model.py`](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/train_model.py) (Experiment orchestration), [`src/experiment_runner.py`](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/experiment_runner.py) (Cross-validation runner), [`src/dataset.py`](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/dataset.py) (Image dataset), [`experiments.py`](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/experiments.py) (Experiment generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_design["Experiment design"]
  node_experiment_config["Experiment settings"]
  node_preprocessing_config["Preprocessing settings"]
  node_experiment_generation["Experiment generation<br/>[experiments.py]"]
  node_fold_generation["CV split generation<br/>[generate_splits.py]"]
end

subgraph group_data["Image data"]
  node_image_dataset["Image dataset<br/>[dataset.py]"]
  node_preprocessing["Image preprocessing<br/>[preprocessing.py]"]
  node_quality_control["Image quality checks<br/>[data_quality.py]"]
  node_feature_extraction["Handcrafted features<br/>[features.py]"]
  node_feature_cache[("Feature cache<br/>[cache_utils.py]")]
end

subgraph group_training["Model training"]
  node_training_orchestrator["Experiment orchestration<br/>[train_model.py]"]
  node_fold_runner["Cross-validation runner"]
  node_model_building["Model selection<br/>[model_utils.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_metrics["Fold metrics<br/>[metrics_utils.py]"]
  node_visualization["Evaluation plots"]
  node_explainability["Model explainability<br/>[explainability.py]"]
  node_result_persistence[("Experiment results<br/>[results_utils.py]")]
end

subgraph group_analysis["Result analysis"]
  node_learning_curves["Learning curves"]
  node_statistical_analysis["Statistical comparisons<br/>[stats_analysis.py]"]
  node_statistical_tests["Statistical utilities"]
end

node_researcher(("Researcher"))

node_researcher -->|"defines experiments"| node_experiment_generation
node_experiment_config -->|"configures"| node_experiment_generation
node_preprocessing_config -->|"sets normalization options"| node_experiment_config
node_experiment_generation -->|"supplies settings"| node_fold_generation
node_fold_generation -->|"defines CV folds"| node_image_dataset
node_experiment_generation -->|"supplies configurations"| node_training_orchestrator
node_training_orchestrator -->|"selects split files"| node_fold_generation
node_training_orchestrator -->|"loads cached dataset"| node_feature_cache
node_feature_cache -->|"caches dataset build"| node_image_dataset
node_image_dataset -->|"loads and processes images"| node_preprocessing
node_image_dataset -->|"checks image quality"| node_quality_control
node_image_dataset -->|"extracts descriptors"| node_feature_extraction
node_training_orchestrator -->|"runs folds"| node_fold_runner
node_fold_runner -->|"builds and tunes model"| node_model_building
node_fold_runner -->|"computes metrics"| node_metrics
node_fold_runner -->|"plots fold results"| node_visualization
node_fold_runner -->|"measures importance"| node_explainability
node_training_orchestrator -->|"saves experiment outputs"| node_result_persistence
node_training_orchestrator -->|"plots learning curves"| node_learning_curves
node_result_persistence -->|"provides experiment results"| node_statistical_analysis
node_statistical_analysis -->|"verifies matching splits"| node_statistical_tests

click node_experiment_config "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/configs/experiment_config.py"
click node_preprocessing_config "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/configs/preprocessing_config.py"
click node_experiment_generation "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/experiments.py"
click node_fold_generation "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/generate_splits.py"
click node_image_dataset "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/dataset.py"
click node_preprocessing "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/preprocessing.py"
click node_quality_control "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/data_quality.py"
click node_feature_extraction "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/features.py"
click node_feature_cache "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/cache_utils.py"
click node_training_orchestrator "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/train_model.py"
click node_fold_runner "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/experiment_runner.py"
click node_model_building "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/model_utils.py"
click node_metrics "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/metrics_utils.py"
click node_visualization "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/visualize_results.py"
click node_explainability "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/explainability.py"
click node_result_persistence "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/results_utils.py"
click node_learning_curves "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/learning_curve_analysis.py"
click node_statistical_analysis "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/stats_analysis.py"
click node_statistical_tests "https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/statistics_utils.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_experiment_config,node_preprocessing_config,node_experiment_generation,node_fold_generation toneBlue
class node_image_dataset,node_preprocessing,node_quality_control,node_feature_extraction,node_feature_cache toneAmber
class node_training_orchestrator,node_fold_runner,node_model_building toneMint
class node_metrics,node_visualization,node_explainability,node_result_persistence toneRose
class node_learning_curves,node_statistical_analysis,node_statistical_tests,node_researcher toneIndigo
```

## Components

### Experiment design

- [Experiment settings](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/configs/experiment_config.py): `configs/experiment_config.py`
- [Preprocessing settings](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/configs/preprocessing_config.py): `configs/preprocessing_config.py`
- [Experiment generation](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/experiments.py): `experiments.py`
- [CV split generation](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/generate_splits.py): `generate_splits.py`

### Image data

- [Image dataset](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/dataset.py): `src/dataset.py`
- [Image preprocessing](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/preprocessing.py): `src/preprocessing.py`
- [Image quality checks](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/data_quality.py): `src/data_quality.py`
- [Handcrafted features](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/features.py): `src/features.py`
- [Feature cache](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/cache_utils.py): `src/cache_utils.py`

### Model training

- [Experiment orchestration](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/train_model.py): `train_model.py`
- [Cross-validation runner](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/experiment_runner.py): `src/experiment_runner.py`
- [Model selection](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/model_utils.py): `src/model_utils.py`

### Evaluation

- [Fold metrics](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/metrics_utils.py): `src/metrics_utils.py`
- [Evaluation plots](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/visualize_results.py): `src/visualize_results.py`
- [Model explainability](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/explainability.py): `src/explainability.py`
- [Experiment results](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/results_utils.py): `src/results_utils.py`

### Result analysis

- [Learning curves](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/learning_curve_analysis.py): `src/learning_curve_analysis.py`
- [Statistical comparisons](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/stats_analysis.py): `stats_analysis.py`
- [Statistical utilities](https://github.com/psanyalaich/oral-cancer-histopathology-ml/blob/main/src/statistics_utils.py): `src/statistics_utils.py`

### Other components

- **Researcher**

## Connections

- Researcher → Experiment generation: defines experiments (evidence: `README.md`)
- Experiment settings → Experiment generation: configures (evidence: `experiments.py`)
- Preprocessing settings → Experiment settings: sets normalization options (evidence: `configs/experiment_config.py`)
- Experiment generation → CV split generation: supplies settings (evidence: `README.md`)
- CV split generation → Image dataset: defines CV folds (evidence: `README.md`)
- Experiment generation → Experiment orchestration: supplies configurations (evidence: `train_model.py`)
- Experiment orchestration → CV split generation: selects split files (evidence: `README.md`)
- Experiment orchestration → Feature cache: loads cached dataset (evidence: `train_model.py`)
- Feature cache → Image dataset: caches dataset build (evidence: `src/cache_utils.py`)
- Image dataset → Image preprocessing: loads and processes images (evidence: `src/dataset.py`)
- Image dataset → Image quality checks: checks image quality (evidence: `src/dataset.py`)
- Image dataset → Handcrafted features: extracts descriptors (evidence: `src/dataset.py`)
- Experiment orchestration → Cross-validation runner: runs folds (evidence: `train_model.py`)
- Cross-validation runner → Model selection: builds and tunes model (evidence: `src/experiment_runner.py`)
- Cross-validation runner → Fold metrics: computes metrics (evidence: `src/experiment_runner.py`)
- Cross-validation runner → Evaluation plots: plots fold results (evidence: `src/experiment_runner.py`)
- Cross-validation runner → Model explainability: measures importance (evidence: `src/experiment_runner.py`)
- Experiment orchestration → Experiment results: saves experiment outputs (evidence: `train_model.py`)
- Experiment orchestration → Learning curves: plots learning curves (evidence: `train_model.py`)
- Experiment results → Statistical comparisons: provides experiment results (evidence: `README.md`)
- Statistical comparisons → Statistical utilities: verifies matching splits (evidence: `stats_analysis.py`)
