# yess1ne/breast_cancer_themed_ml_project architecture

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

- Interactive diagram: https://gitdiagram.com/yess1ne/breast_cancer_themed_ml_project
- Repository: https://github.com/yess1ne/breast_cancer_themed_ml_project

## Overview

This is a Flask breast-cancer risk application with two prediction modes: numeric-feature assessment and image-based assessment. The visible app routes accept inputs and render forms or results; image uploads are saved and results are retrieved through a redirect. Separate training scripts produce the models and feature artifacts. The README documents setup, not the user workflow, and omitted app sections limit confirmation of model invocation and some result handling.

Main entry points: [`app.py`](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/app.py) (Flask routes), [`MLP_model_training.py`](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/MLP_model_training.py) (Numeric model training), [`image_based_RFC_model_training.py`](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/image_based_RFC_model_training.py) (Image model training), [`templates/index.html`](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/index.html) (Home page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Flask routes<br/>[app.py]"]
  node_home["Home page<br/>[index.html]"]
  node_numeric_form["Numeric form<br/>[MB_form.html]"]
  node_numeric_result["Numeric result<br/>[MB_result.html]"]
  node_image_result["Image result<br/>[result.html]"]
  node_uploads["Image uploads"]
end

subgraph group_training["Model training"]
  node_mlp_training["Numeric model training"]
  node_image_training["Image model training"]
end

subgraph group_artifacts["Model artifacts"]
  node_numeric_data["Numeric dataset"]
  node_numeric_model["MLP model<br/>[mlp_mean10.pkl]"]
  node_numeric_scaler["Numeric scaler<br/>[scaler_mean10.pkl]"]
  node_feature_order["Feature order"]
  node_image_features["Image features<br/>[features.csv]"]
  node_image_model["Random forest model<br/>[risk_model.pkl]"]
  node_image_scaler["Image scaler<br/>[scaler.pkl]"]
  node_image_results["Evaluation results<br/>[risk_results.csv]"]
end

node_user(("User"))
node_gemini["Gemini API"]

node_user -->|"submits requests"| node_app
node_app -->|"renders"| node_home
node_app -->|"renders"| node_numeric_form
node_app -->|"renders"| node_numeric_result
node_app -->|"saves uploads"| node_uploads
node_app -->|"renders"| node_image_result
node_app -.->|"requests explanations"| node_gemini
node_mlp_training -->|"reads"| node_numeric_data
node_mlp_training -->|"writes"| node_numeric_model
node_mlp_training -->|"writes"| node_numeric_scaler
node_mlp_training -->|"writes"| node_feature_order
node_image_training -->|"writes"| node_image_features
node_image_training -->|"writes"| node_image_model
node_image_training -->|"writes"| node_image_scaler
node_image_training -->|"writes"| node_image_results

click node_app "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/app.py"
click node_home "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/index.html"
click node_numeric_form "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/MB_form.html"
click node_numeric_result "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/MB_result.html"
click node_image_result "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/result.html"
click node_uploads "https://github.com/yess1ne/breast_cancer_themed_ml_project/tree/main/static/uploads"
click node_mlp_training "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/MLP_model_training.py"
click node_image_training "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/image_based_RFC_model_training.py"
click node_numeric_data "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/wdbc_mean10_encoded.csv"
click node_numeric_model "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/models/mlp_mean10.pkl"
click node_numeric_scaler "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/models/scaler_mean10.pkl"
click node_feature_order "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/models/mean10_feature_order.json"
click node_image_features "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/features.csv"
click node_image_model "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/risk_model.pkl"
click node_image_scaler "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/scaler.pkl"
click node_image_results "https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/risk_results.csv"

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_app,node_home,node_numeric_form,node_numeric_result,node_image_result,node_uploads,node_user toneBlue
class node_mlp_training,node_image_training toneAmber
class node_numeric_data,node_numeric_model,node_numeric_scaler,node_feature_order,node_image_features,node_image_model,node_image_scaler,node_image_results,node_gemini toneMint
```

## Components

### Web application

- [Flask routes](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/app.py): `app.py`
- [Home page](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/index.html): `templates/index.html`
- [Numeric form](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/MB_form.html): `templates/MB_form.html`
- [Numeric result](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/MB_result.html): `templates/MB_result.html`
- [Image result](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/templates/result.html): `templates/result.html`
- [Image uploads](https://github.com/yess1ne/breast_cancer_themed_ml_project/tree/main/static/uploads): `static/uploads`

### Model training

- [Numeric model training](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/MLP_model_training.py): `MLP_model_training.py`
- [Image model training](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/image_based_RFC_model_training.py): `image_based_RFC_model_training.py`

### Model artifacts

- [Numeric dataset](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/wdbc_mean10_encoded.csv): `wdbc_mean10_encoded.csv`
- [MLP model](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/models/mlp_mean10.pkl): `models/mlp_mean10.pkl`
- [Numeric scaler](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/models/scaler_mean10.pkl): `models/scaler_mean10.pkl`
- [Feature order](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/models/mean10_feature_order.json): `models/mean10_feature_order.json`
- [Image features](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/features.csv): `features.csv`
- [Random forest model](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/risk_model.pkl): `risk_model.pkl`
- [Image scaler](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/scaler.pkl): `scaler.pkl`
- [Evaluation results](https://github.com/yess1ne/breast_cancer_themed_ml_project/blob/main/risk_results.csv): `risk_results.csv`

### Other components

- **User**
- **Gemini API**

## Connections

- User → Flask routes: submits requests (evidence: `app.py`)
- Flask routes → Home page: renders (evidence: `app.py`)
- Flask routes → Numeric form: renders (evidence: `app.py`)
- Flask routes → Numeric result: renders (evidence: `app.py`)
- Flask routes → Image uploads: saves uploads (evidence: `app.py`)
- Flask routes → Image result: renders (evidence: `app.py`)
- Flask routes → Gemini API: requests explanations (evidence: `app.py`)
- Numeric model training → Numeric dataset: reads (evidence: `MLP_model_training.py`)
- Numeric model training → MLP model: writes (evidence: `MLP_model_training.py`)
- Numeric model training → Numeric scaler: writes (evidence: `MLP_model_training.py`)
- Numeric model training → Feature order: writes (evidence: `MLP_model_training.py`)
- Image model training → Image features: writes (evidence: `image_based_RFC_model_training.py`)
- Image model training → Random forest model: writes (evidence: `image_based_RFC_model_training.py`)
- Image model training → Image scaler: writes (evidence: `image_based_RFC_model_training.py`)
- Image model training → Evaluation results: writes (evidence: `image_based_RFC_model_training.py`)
