# vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging architecture

> Architecture diagram of the GitHub repository vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging
- Repository: https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging

## Overview

##### Project type and purpose
- This is a configuration-driven Python data-analysis pipeline that ingests TIFF image crops, extracts morphological features, cleans and aggregates them, trains a stacking ensemble classifier (XGBoost, LightGBM, CatBoost + LogisticRegression meta-learner), and outputs model artifacts, reports, and plots.

##### File structure
- Top-level:
- config.json (runtime parameters)
- main.py (pipeline orchestrator)
- requirements.txt
- analysis_results/ (generated models, reports, plots)
- scripts/ (modular step implementations)
- scripts/ maps 1:1 to pipeline stages (feature_extraction, clean_and_prepare, train_and_save_pipeline, feature_insights, etc.).
- main.py imports and calls these scripts in sequence based on config.json.

##### README for additional insights
- Confirms a 7-step automated workflow.
- Describes each step.
- Notes input directories, output directories, CSVs, model bundles, report formats.

1) Configuration Loader (reads config.json)
2) Feature Extraction Module (scripts/feature_extraction.py)
3) Data Cleaning & Preparation Module (scripts/clean_and_prepare.py)
4) Model Training & Saving Module (scripts/train_and_save_pipeline.py)
5) Feature Importance & Insights Module (scripts/feature_insights.py)
6) Output Storage (analysis_results/ with subfolders reports/, models/, plots/)
7) Input Storage (raw TIFF folders or CSVs)
b. Relationships & data flow
c. Architectural patterns / design principles
- Modular, single-responsibility scripts for each stage
- Orchestration layer (main.py) for sequential execution based on config
- Separation of code (scripts/) vs. data (analysis_results/) vs. config (config.json)
d. Key technologies & frameworks
- Python 3.x, joblib
- XGBoost, LightGBM, CatBoost, scikit-learn (stacking ensemble)
- TIFF image processing libraries (e.g. scikit-image / PIL)
- pandas, numpy for data manipulation

## Diagram (Mermaid)

```mermaid
graph TB
    %% Configuration
    Config["config.json"]:::config

    %% Orchestration
    Orchestrator["Orchestration Layer (main.py)"]:::processing

    %% Pipeline Stages
    FE["Feature Extraction Module"]:::processing
    DC["Data Cleaning & Preparation Module"]:::processing
    MT["Model Training & Saving Module"]:::processing
    FI["Feature Importance & Insights Module"]:::processing

    %% Storage
    subgraph "Input Storage" 
        Input["Raw TIFF / CSV"]:::storage
    end

    subgraph "Output Storage" 
        AR["analysis_results/"]:::storage
        subgraph " " 
            Models["models/"]:::storage
            Reports["reports/"]:::storage
            Plots["plots/"]:::storage
        end
    end

    %% Data Flow
    Config -->|loads config| Orchestrator
    Orchestrator -->|reads raw TIFF| FE
    FE -->|"features.csv"| DC
    DC -->|"cleaned.csv"| MT
    MT -->|"trained models"| FI
    FI -->|"insights reports"| AR
    FE --> AR
    DC --> AR
    MT --> AR
    FI --> AR
    Input --> FE

    %% Click Events
    click Config "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/blob/main/config.json"
    click Orchestrator "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/blob/main/main.py"
    click FE "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/blob/main/scripts/feature_extraction.py"
    click DC "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/blob/main/scripts/clean_and_prepare.py"
    click MT "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/blob/main/scripts/train_and_save_pipeline.py"
    click FI "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/blob/main/scripts/feature_insights.py"
    click AR "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/tree/main/analysis_results/"
    click Models "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/tree/main/analysis_results/models/"
    click Reports "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/tree/main/analysis_results/reports/"
    click Plots "https://github.com/vanthienphan2004/morphological-feature-analysis-of-retinal-pigment-epithelial-cells-from-c57bl-6j-mice-during-aging/tree/main/analysis_results/plots/"

    %% Styles
    classDef processing fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef storage fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef config fill:#FFA500,stroke:#000,stroke-width:1px;
```
