# mohammad-raselr/kidney-disease-classification-deep-learning-project architecture

> Architecture diagram of the GitHub repository mohammad-raselr/kidney-disease-classification-deep-learning-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohammad-raselr/kidney-disease-classification-deep-learning-project
- Repository: https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project

## Overview

1. This repository is a config-driven deep learning system for kidney-disease image classification. The core application code lives under `src/cnnClassifier`, while `research/` holds one-off notebooks used to prototype and validate each stage.

2. The project is structured as a multi-stage ML pipeline rather than a single training script. The main pipeline stages are split into `data_ingestion`, `prepare_base_model`, `model_training`, and `model_evolution_mlflow`, with matching wrappers in `src/cnnClassifier/pipeline/`.

3. The central data flow is: raw dataset acquisition and organization → train/validation splitting and preprocessing → transfer-learning base model setup → model training/fine-tuning → evaluation and experiment logging. The trained artifact is persisted as `model/trained_model.h5`.

4. Configuration is separated from code. `config/config.yaml` and `params.yaml` define runtime and model parameters, while `src/cnnClassifier/entity/config_entity.py` and `src/cnnClassifier/config/configuration.py` translate those files into typed objects used by the pipeline.

5. `src/cnnClassifier/components/` contains the actual business logic for each stage. This is the main boundary where data engineering, model construction, and training behavior are implemented. `src/cnnClassifier/utils/common.py` likely provides shared helpers such as file handling, downloads, and config utilities.

6. The project uses DVC to orchestrate and version the pipeline. `dvc.yaml`, `dvc.lock`, and `.dvc/` indicate that pipeline execution and artifact lineage are intended to be reproducible, with `dvc repro` and `dvc dag` as the operational entry points.

7. MLflow is used for experiment tracking, and the README shows DagsHub as the remote MLflow backend. This means model runs, metrics, and tags are not only local but can be synchronized to an external tracking service.

8. There are two likely runtime surfaces: `main.py` for training/orchestration and `app.py` plus `templates/index.html` for inference via a small web UI. That UI boundary is separate from the training pipeline and probably consumes the saved model artifact rather than retraining.

9. Deployment is container-based. The root `Dockerfile` packages the application, and `.github/workflows/main.yaml` automates CI/CD to AWS ECR and EC2. The README describes a GitHub Actions flow that builds the image, pushes it to ECR, and runs it on an EC2 host.

10. The repository includes packaging outputs and install metadata (`setup.py`, `dist/`, `build/`, `src/cnnClassifier.egg-info/`), which indicates the codebase is meant to be installable as a Python package and reused across scripts, pipelines, and deployment targets.

11. `logs/running_logs.log` suggests the pipeline emits local operational logs, which is important for debugging stage transitions and failures in long-running training jobs.

12. Overall, the architecture is a classic ML lifecycle split into three planes: experimentation in notebooks, reproducible pipeline execution in `src/cnnClassifier` + DVC, and production delivery through a web app container deployed via GitHub Actions to AWS.

Main entry points: [`src/cnnClassifier/entity/config_entity.py`](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/entity/config_entity.py) (Config entity), [`src/cnnClassifier/components/model_training.py`](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/model_training.py) (Model training), [`src/cnnClassifier/components/model_evolution_mlflow.py`](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/model_evolution_mlflow.py) (MLflow logging), [`research`](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/tree/main/research) (Research notebooks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experimentation["Experimentation"]
  node_research["Research notebooks"]
end

subgraph group_pipeline["ML Pipeline"]
  node_dvc_yaml["DVC pipeline<br/>orchestration<br/>[dvc.yaml]"]
  node_main_py["Main entry<br/>orchestrator<br/>[main.py]"]
  node_stage_ingestion["Ingest stage<br/>pipeline stage"]
  node_stage_base["Base model stage<br/>pipeline stage"]
  node_stage_training["Training stage<br/>pipeline stage"]
  node_stage_mlflow["MLflow stage<br/>pipeline stage"]
  node_comp_ingestion["Data ingestion<br/>[data_ingestion.py]"]
  node_comp_base["Base model"]
  node_comp_training["Model training<br/>[model_training.py]"]
  node_comp_mlflow["MLflow logging"]
  node_trained_model[("Trained model<br/>artifact<br/>[trained_model.h5]")]
end

subgraph group_config["Config"]
  node_config_yaml["Config YAML<br/>runtime config<br/>[config.yaml]"]
  node_params_yaml["Params YAML<br/>model params<br/>[params.yaml]"]
  node_config_entity["Config entity<br/>typed schema<br/>[config_entity.py]"]
  node_configuration_py["Configuration<br/>loader<br/>[configuration.py]"]
  node_common_py["Common utils<br/>shared helpers<br/>[common.py]"]
end

subgraph group_delivery["Delivery"]
  node_prediction_py["Prediction<br/>inference<br/>[prediction.py]"]
  node_app_py["Web app<br/>server<br/>[app.py]"]
  node_index_html["UI template<br/>view<br/>[index.html]"]
  node_dockerfile["Dockerfile<br/>container build"]
  node_workflow["GitHub Actions<br/>ci/cd<br/>[main.yaml]"]
end

node_research -.->|"prototype"| node_comp_ingestion
node_research -.->|"prototype"| node_comp_base
node_research -.->|"prototype"| node_comp_training
node_research -.->|"prototype"| node_comp_mlflow
node_dvc_yaml -->|"orchestrates"| node_stage_ingestion
node_dvc_yaml -->|"orchestrates"| node_stage_base
node_dvc_yaml -->|"orchestrates"| node_stage_training
node_dvc_yaml -->|"orchestrates"| node_stage_mlflow
node_main_py -->|"runs"| node_stage_ingestion
node_main_py -->|"runs"| node_stage_base
node_main_py -->|"runs"| node_stage_training
node_main_py -->|"runs"| node_stage_mlflow
node_config_yaml -->|"loads"| node_configuration_py
node_params_yaml -->|"loads"| node_configuration_py
node_configuration_py -->|"types"| node_config_entity
node_common_py -.->|"supports"| node_comp_ingestion
node_common_py -.->|"supports"| node_comp_base
node_common_py -.->|"supports"| node_comp_training
node_common_py -.->|"supports"| node_comp_mlflow
node_config_entity -->|"feeds"| node_comp_ingestion
node_config_entity -->|"feeds"| node_comp_base
node_config_entity -->|"feeds"| node_comp_training
node_config_entity -->|"feeds"| node_comp_mlflow
node_stage_ingestion -->|"invokes"| node_comp_ingestion
node_stage_base -->|"invokes"| node_comp_base
node_stage_training -->|"invokes"| node_comp_training
node_stage_mlflow -->|"invokes"| node_comp_mlflow
node_comp_training -->|"persists"| node_trained_model
node_comp_mlflow -->|"evaluates"| node_trained_model
node_prediction_py -->|"loads"| node_trained_model
node_app_py -->|"serves"| node_prediction_py
node_app_py -->|"renders"| node_index_html
node_workflow -->|"builds"| node_dockerfile
node_workflow -->|"deploys"| node_app_py

click node_research "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/tree/main/research"
click node_dvc_yaml "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/dvc.yaml"
click node_main_py "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/main.py"
click node_stage_ingestion "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/stage_01_data_ingestion.py"
click node_stage_base "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/stage_02_prepare_base_model.py"
click node_stage_training "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/stage_03_model_training.py"
click node_stage_mlflow "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/stage_04_model_evolution_mlflow.py"
click node_comp_ingestion "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/data_ingestion.py"
click node_comp_base "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/prepare_base_model.py"
click node_comp_training "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/model_training.py"
click node_comp_mlflow "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/model_evolution_mlflow.py"
click node_config_yaml "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/config/config.yaml"
click node_params_yaml "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/params.yaml"
click node_config_entity "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/entity/config_entity.py"
click node_configuration_py "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/config/configuration.py"
click node_common_py "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/utils/common.py"
click node_trained_model "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/model/trained_model.h5"
click node_prediction_py "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/prediction.py"
click node_app_py "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/app.py"
click node_index_html "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/templates/index.html"
click node_dockerfile "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/tree/main/Dockerfile"
click node_workflow "https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/.github/workflows/main.yaml"

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_research toneBlue
class node_dvc_yaml,node_main_py,node_stage_ingestion,node_stage_base,node_stage_training,node_stage_mlflow,node_comp_ingestion,node_comp_base,node_comp_training,node_comp_mlflow,node_trained_model toneAmber
class node_config_yaml,node_params_yaml,node_config_entity,node_configuration_py,node_common_py toneMint
class node_prediction_py,node_app_py,node_index_html,node_dockerfile,node_workflow toneRose
```

## Components

### Experimentation

One-off notebooks used to prototype and validate pipeline stages

- [Research notebooks](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/tree/main/research): notebooks · Stage prototypes and validation experiments · `research`

### ML Pipeline

Reproducible training and evaluation flow implemented in source code

- [DVC pipeline](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/dvc.yaml): orchestration · Reproducible multi-stage pipeline definition · `dvc.yaml`
- [Main entry](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/main.py): orchestrator · Training orchestration entry point · `main.py`
- [Ingest stage](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/stage_01_data_ingestion.py): pipeline stage · Wrapper for data ingestion · `src/cnnClassifier/pipeline/stage_01_data_ingestion.py`
- [Base model stage](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/stage_02_prepare_base_model.py): pipeline stage · Wrapper for transfer-learning setup · `src/cnnClassifier/pipeline/stage_02_prepare_base_model.py`
- [Training stage](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/stage_03_model_training.py): pipeline stage · Wrapper for model training · `src/cnnClassifier/pipeline/stage_03_model_training.py`
- [MLflow stage](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/stage_04_model_evolution_mlflow.py): pipeline stage · Wrapper for experiment logging and evaluation · `src/cnnClassifier/pipeline/stage_04_model_evolution_mlflow.py`
- [Data ingestion](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/data_ingestion.py): Acquires and organizes raw dataset · `src/cnnClassifier/components/data_ingestion.py`
- [Base model](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/prepare_base_model.py): Builds the transfer-learning backbone · `src/cnnClassifier/components/prepare_base_model.py`
- [Model training](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/model_training.py): Fits and fine-tunes the classifier · `src/cnnClassifier/components/model_training.py`
- [MLflow logging](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/components/model_evolution_mlflow.py): Evaluates runs and records metrics/artifacts · `src/cnnClassifier/components/model_evolution_mlflow.py`
- [Trained model](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/model/trained_model.h5): artifact · Persisted Keras model artifact · `model/trained_model.h5`

### Config

Typed configuration and shared utilities that drive the pipeline

- [Config YAML](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/config/config.yaml): runtime config · Runtime and pipeline configuration · `config/config.yaml`
- [Params YAML](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/params.yaml): model params · Model and training hyperparameters · `params.yaml`
- [Config entity](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/entity/config_entity.py): typed schema · Typed configuration objects · `src/cnnClassifier/entity/config_entity.py`
- [Configuration](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/config/configuration.py): loader · Translates YAML into usable config objects · `src/cnnClassifier/config/configuration.py`
- [Common utils](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/utils/common.py): shared helpers · Shared file, download, and config utilities · `src/cnnClassifier/utils/common.py`

### Delivery

Web inference and containerized deployment surface

- [Prediction](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/src/cnnClassifier/pipeline/prediction.py): inference · Loads saved model for serving-time inference · `src/cnnClassifier/pipeline/prediction.py`
- [Web app](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/app.py): server · Inference UI and request handling · `app.py`
- [UI template](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/templates/index.html): view · Frontend template for the inference page · `templates/index.html`
- [Dockerfile](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/tree/main/Dockerfile): container build · Packages the application for container deployment · `Dockerfile`
- [GitHub Actions](https://github.com/mohammad-raselr/kidney-disease-classification-deep-learning-project/blob/main/.github/workflows/main.yaml): ci/cd · Builds, pushes, and deploys the container · `.github/workflows/main.yaml`

## Connections

- Research notebooks → Data ingestion: prototype · Notebook experiments validate the ingestion stage
- Research notebooks → Base model: prototype · Notebook experiments validate the base-model stage
- Research notebooks → Model training: prototype · Notebook experiments validate the training stage
- Research notebooks → MLflow logging: prototype · Notebook experiments validate the logging stage
- DVC pipeline → Ingest stage: orchestrates · DVC tracks the ingestion stage
- DVC pipeline → Base model stage: orchestrates · DVC tracks the base-model stage
- DVC pipeline → Training stage: orchestrates · DVC tracks the training stage
- DVC pipeline → MLflow stage: orchestrates · DVC tracks the MLflow stage
- Main entry → Ingest stage: runs · Main entry executes ingestion first
- Main entry → Base model stage: runs · Main entry executes base-model setup
- Main entry → Training stage: runs · Main entry executes training next
- Main entry → MLflow stage: runs · Main entry executes experiment logging last
- Config YAML → Configuration: loads · Runtime config is parsed into configuration objects
- Params YAML → Configuration: loads · Model parameters are parsed into configuration objects
- Configuration → Config entity: types · Configuration layer produces typed entities
- Common utils → Data ingestion: supports · Shared helpers support file and data handling
- Common utils → Base model: supports · Shared helpers support model setup
- Common utils → Model training: supports · Shared helpers support training workflows
- Common utils → MLflow logging: supports · Shared helpers support logging and artifact handling
- Config entity → Data ingestion: feeds · Typed config drives ingestion
- Config entity → Base model: feeds · Typed config drives base-model preparation
- Config entity → Model training: feeds · Typed config drives training
- Config entity → MLflow logging: feeds · Typed config drives evaluation and tracking
- Ingest stage → Data ingestion: invokes · Stage wrapper delegates to ingestion component
- Base model stage → Base model: invokes · Stage wrapper delegates to base-model component
- Training stage → Model training: invokes · Stage wrapper delegates to training component
- MLflow stage → MLflow logging: invokes · Stage wrapper delegates to MLflow component
- Model training → Trained model: persists · Training writes the final model artifact
- MLflow logging → Trained model: evaluates · Logged evaluation uses the trained artifact
- Prediction → Trained model: loads · Inference code consumes the saved model
- Web app → Prediction: serves · Web app routes requests to prediction logic
- Web app → UI template: renders · Web app uses the UI template
- GitHub Actions → Dockerfile: builds · CI/CD builds the container image
- GitHub Actions → Web app: deploys · Workflow deploys the app container
