# madihakounain/explainable-ai-automl-platform architecture

> Architecture diagram of the GitHub repository madihakounain/explainable-ai-automl-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/madihakounain/explainable-ai-automl-platform
- Repository: https://github.com/madihakounain/explainable-ai-automl-platform

## Overview

This Flask application takes users from CSV upload and dataset exploration through task selection, preprocessing, model benchmarking, and best-model selection, then serves predictions with confidence and explanation results. The upload and training endpoints retain dataset and model artifacts in a session-keyed in-memory store, which the prediction endpoint reads. The dashboard presents exploration, model comparisons, and global and per-prediction explanations. The graph follows the sampled route and ML implementations; dashboard rendering and some frontend request details are based on the README and partial JavaScript excerpt.

Main entry points: [`routes/train_routes.py`](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/train_routes.py) (Training endpoint), [`routes/predict_routes.py`](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/predict_routes.py) (Prediction endpoint), [`static/js/app.js`](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/static/js/app.js) (Web dashboard), [`routes/upload_routes.py`](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/upload_routes.py) (Upload and analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_dashboard["Web dashboard<br/>[app.js]"]
  node_page["Dashboard template<br/>[index.html]"]
  node_app["Flask app<br/>[app.py]"]
  node_upload["Upload and analysis<br/>[upload_routes.py]"]
  node_train["Training endpoint<br/>[train_routes.py]"]
  node_predict["Prediction endpoint<br/>[predict_routes.py]"]
  node_store[("Session data store<br/>[config.py]")]
end

subgraph group_data["Dataset preparation"]
  node_task["Task detection<br/>[preprocessing.py]"]
  node_prep["Feature preprocessing<br/>[preprocessing.py]"]
  node_target["Target encoding<br/>[preprocessing.py]"]
  node_rowencode["Input row encoding<br/>[preprocessing.py]"]
end

subgraph group_model["Modeling"]
  node_automl["Model benchmarking<br/>[automl.py]"]
  node_importance["Global importance<br/>[automl.py]"]
  node_inference["Model prediction<br/>[predict_routes.py]"]
end

subgraph group_xai["Explainability"]
  node_local["LIME-style explanation<br/>[explainability.py]"]
  node_shap["SHAP-style impact<br/>[explainability.py]"]
  node_narrative["Narrative summaries<br/>[explainability.py]"]
  node_plotting["Chart rendering<br/>[plotting.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_dashboard
node_app -->|"registers"| node_upload
node_app -->|"registers"| node_train
node_app -->|"registers"| node_predict
node_dashboard -->|"renders"| node_page
node_dashboard -->|"uploads CSV"| node_upload
node_upload -->|"stores dataset"| node_store
node_upload -->|"renders charts"| node_plotting
node_upload -->|"returns analysis"| node_dashboard
node_dashboard -->|"requests training"| node_train
node_train -->|"reads and updates"| node_store
node_train -->|"detects task"| node_task
node_train -->|"prepares features"| node_prep
node_train -->|"encodes target"| node_target
node_train -->|"trains candidates"| node_automl
node_automl -->|"selects best model"| node_importance
node_train -->|"computes importance"| node_importance
node_importance -->|"renders chart"| node_plotting
node_train -->|"summarizes training"| node_narrative
node_train -->|"returns results"| node_dashboard
node_dashboard -->|"submits input"| node_predict
node_predict -->|"reads artifacts"| node_store
node_predict -->|"encodes row"| node_rowencode
node_predict -->|"runs model"| node_inference
node_predict -->|"explains locally"| node_local
node_predict -->|"estimates impacts"| node_shap
node_predict -->|"builds narrative"| node_narrative
node_local -->|"renders chart"| node_plotting
node_shap -->|"renders chart"| node_plotting
node_predict -->|"returns prediction"| node_dashboard

click node_dashboard "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/static/js/app.js"
click node_page "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/templates/index.html"
click node_app "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/app.py"
click node_upload "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/upload_routes.py"
click node_train "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/train_routes.py"
click node_predict "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/predict_routes.py"
click node_store "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/config.py"
click node_task "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/preprocessing.py"
click node_prep "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/preprocessing.py"
click node_target "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/preprocessing.py"
click node_rowencode "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/preprocessing.py"
click node_automl "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/automl.py"
click node_importance "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/automl.py"
click node_inference "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/predict_routes.py"
click node_local "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/explainability.py"
click node_shap "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/explainability.py"
click node_narrative "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/explainability.py"
click node_plotting "https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/utils/plotting.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_dashboard,node_page,node_app,node_upload,node_train,node_predict,node_store,node_user toneBlue
class node_task,node_prep,node_target,node_rowencode toneAmber
class node_automl,node_importance,node_inference toneMint
class node_local,node_shap,node_narrative,node_plotting toneRose
```

## Components

### Web application

- [Web dashboard](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/static/js/app.js): `static/js/app.js`
- [Dashboard template](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/templates/index.html): `templates/index.html`
- [Flask app](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/app.py): `app.py`
- [Upload and analysis](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/upload_routes.py): `routes/upload_routes.py`
- [Training endpoint](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/train_routes.py): `routes/train_routes.py`
- [Prediction endpoint](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/predict_routes.py): `routes/predict_routes.py`
- [Session data store](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/config.py): `config.py`

### Dataset preparation

- [Task detection](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/preprocessing.py): `ml/preprocessing.py`
- [Feature preprocessing](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/preprocessing.py): `ml/preprocessing.py`
- [Target encoding](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/preprocessing.py): `ml/preprocessing.py`
- [Input row encoding](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/preprocessing.py): `ml/preprocessing.py`

### Modeling

- [Model benchmarking](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/automl.py): `ml/automl.py`
- [Global importance](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/automl.py): `ml/automl.py`
- [Model prediction](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/routes/predict_routes.py): `routes/predict_routes.py`

### Explainability

- [LIME-style explanation](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/explainability.py): `ml/explainability.py`
- [SHAP-style impact](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/explainability.py): `ml/explainability.py`
- [Narrative summaries](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/ml/explainability.py): `ml/explainability.py`
- [Chart rendering](https://github.com/madihakounain/explainable-ai-automl-platform/blob/main/utils/plotting.py): `utils/plotting.py`

### Other components

- **User**

## Connections

- User → Web dashboard: uses
- Flask app → Upload and analysis: registers
- Flask app → Training endpoint: registers
- Flask app → Prediction endpoint: registers
- Web dashboard → Dashboard template: renders
- Web dashboard → Upload and analysis: uploads CSV
- Upload and analysis → Session data store: stores dataset
- Upload and analysis → Chart rendering: renders charts
- Upload and analysis → Web dashboard: returns analysis
- Web dashboard → Training endpoint: requests training
- Training endpoint → Session data store: reads and updates
- Training endpoint → Task detection: detects task
- Training endpoint → Feature preprocessing: prepares features
- Training endpoint → Target encoding: encodes target
- Training endpoint → Model benchmarking: trains candidates
- Model benchmarking → Global importance: selects best model
- Training endpoint → Global importance: computes importance
- Global importance → Chart rendering: renders chart
- Training endpoint → Narrative summaries: summarizes training
- Training endpoint → Web dashboard: returns results
- Web dashboard → Prediction endpoint: submits input
- Prediction endpoint → Session data store: reads artifacts
- Prediction endpoint → Input row encoding: encodes row
- Prediction endpoint → Model prediction: runs model
- Prediction endpoint → LIME-style explanation: explains locally
- Prediction endpoint → SHAP-style impact: estimates impacts
- Prediction endpoint → Narrative summaries: builds narrative
- LIME-style explanation → Chart rendering: renders chart
- SHAP-style impact → Chart rendering: renders chart
- Prediction endpoint → Web dashboard: returns prediction
