# pras097/brain_tumour architecture

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

- Interactive diagram: https://gitdiagram.com/pras097/brain_tumour
- Repository: https://github.com/pras097/brain_tumour

## Overview

This is a Flask-based brain-tumour image screening demo. Staff log in, upload an MRI image, and receive a classifier result with a tumour profile and care guidance. The runtime path shown is image preprocessing and feature extraction, followed by scaling and model prediction, then result rendering. The sampled source also shows label-encoder loading and profile lookup. There is no README, and the source excerpt is partial, so the graph includes only relationships visible in the excerpt; notebook and CSV artifacts are not treated as runtime components.

Main entry points: [`app.py`](https://github.com/pras097/brain_tumour/blob/main/app.py) (Scan upload and routing), [`Scaler.pkl`](https://github.com/pras097/brain_tumour/blob/main/Scaler.pkl) (Feature scaler), [`Best_BrainTumor_Model.pkl`](https://github.com/pras097/brain_tumour/blob/main/Best_BrainTumor_Model.pkl) (Tumour classifier), [`static/uploads`](https://github.com/pras097/brain_tumour/tree/main/static/uploads) (Uploaded scans)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Staff access"]
  node_auth["Staff authentication<br/>[app.py]"]
end

subgraph group_screening["Image screening"]
  node_scan_route["Scan upload and routing<br/>[app.py]"]
  node_uploads[("Uploaded scans")]
  node_preprocess["Image preprocessing<br/>[app.py]"]
  node_features["Feature extraction<br/>[app.py]"]
  node_scaler["Feature scaler<br/>[Scaler.pkl]"]
  node_classifier["Tumour classifier"]
  node_label_encoder["Label encoder<br/>[LabelEncoder.pkl]"]
end

subgraph group_guidance["Results and guidance"]
  node_profiles["Tumour profiles<br/>[app.py]"]
  node_care_guidance["Care guidance<br/>[app.py]"]
end

subgraph group_interface["Web interface"]
  node_login_page["Login page<br/>[login.html]"]
  node_results_page["Scan results page<br/>[index.html]"]
end

node_staff(("Staff user"))

node_staff -->|"submits credentials"| node_auth
node_auth -->|"renders"| node_login_page
node_staff -->|"uploads scan"| node_scan_route
node_scan_route -->|"saves image"| node_uploads
node_scan_route -->|"analyzes image"| node_preprocess
node_preprocess -->|"supplies grayscale image"| node_features
node_features -->|"transforms features"| node_scaler
node_scaler -->|"supplies scaled features"| node_classifier
node_classifier -->|"decodes prediction"| node_label_encoder
node_scan_route -->|"looks up prediction"| node_profiles
node_profiles -->|"provides care details"| node_care_guidance
node_scan_route -->|"renders result"| node_results_page

click node_auth "https://github.com/pras097/brain_tumour/blob/main/app.py"
click node_login_page "https://github.com/pras097/brain_tumour/blob/main/templates/login.html"
click node_scan_route "https://github.com/pras097/brain_tumour/blob/main/app.py"
click node_uploads "https://github.com/pras097/brain_tumour/tree/main/static/uploads"
click node_preprocess "https://github.com/pras097/brain_tumour/blob/main/app.py"
click node_features "https://github.com/pras097/brain_tumour/blob/main/app.py"
click node_scaler "https://github.com/pras097/brain_tumour/blob/main/Scaler.pkl"
click node_classifier "https://github.com/pras097/brain_tumour/blob/main/Best_BrainTumor_Model.pkl"
click node_label_encoder "https://github.com/pras097/brain_tumour/blob/main/LabelEncoder.pkl"
click node_profiles "https://github.com/pras097/brain_tumour/blob/main/app.py"
click node_care_guidance "https://github.com/pras097/brain_tumour/blob/main/app.py"
click node_results_page "https://github.com/pras097/brain_tumour/blob/main/templates/index.html"

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_auth,node_staff toneBlue
class node_scan_route,node_uploads,node_preprocess,node_features,node_scaler,node_classifier,node_label_encoder toneAmber
class node_profiles,node_care_guidance toneMint
class node_login_page,node_results_page toneRose
```

## Components

### Staff access

- [Staff authentication](https://github.com/pras097/brain_tumour/blob/main/app.py): `app.py`

### Image screening

- [Scan upload and routing](https://github.com/pras097/brain_tumour/blob/main/app.py): `app.py`
- [Uploaded scans](https://github.com/pras097/brain_tumour/tree/main/static/uploads): `static/uploads`
- [Image preprocessing](https://github.com/pras097/brain_tumour/blob/main/app.py): `app.py`
- [Feature extraction](https://github.com/pras097/brain_tumour/blob/main/app.py): `app.py`
- [Feature scaler](https://github.com/pras097/brain_tumour/blob/main/Scaler.pkl): `Scaler.pkl`
- [Tumour classifier](https://github.com/pras097/brain_tumour/blob/main/Best_BrainTumor_Model.pkl): `Best_BrainTumor_Model.pkl`
- [Label encoder](https://github.com/pras097/brain_tumour/blob/main/LabelEncoder.pkl): `LabelEncoder.pkl`

### Results and guidance

- [Tumour profiles](https://github.com/pras097/brain_tumour/blob/main/app.py): `app.py`
- [Care guidance](https://github.com/pras097/brain_tumour/blob/main/app.py): `app.py`

### Web interface

- [Login page](https://github.com/pras097/brain_tumour/blob/main/templates/login.html): `templates/login.html`
- [Scan results page](https://github.com/pras097/brain_tumour/blob/main/templates/index.html): `templates/index.html`

### Other components

- **Staff user**

## Connections

- Staff user → Staff authentication: submits credentials (evidence: `app.py`)
- Staff authentication → Login page: renders (evidence: `app.py`)
- Staff user → Scan upload and routing: uploads scan (evidence: `app.py`)
- Scan upload and routing → Uploaded scans: saves image (evidence: `app.py`)
- Scan upload and routing → Image preprocessing: analyzes image (evidence: `app.py`)
- Image preprocessing → Feature extraction: supplies grayscale image (evidence: `app.py`)
- Feature extraction → Feature scaler: transforms features (evidence: `app.py`)
- Feature scaler → Tumour classifier: supplies scaled features
- Tumour classifier → Label encoder: decodes prediction
- Scan upload and routing → Tumour profiles: looks up prediction (evidence: `app.py`)
- Tumour profiles → Care guidance: provides care details (evidence: `app.py`)
- Scan upload and routing → Scan results page: renders result (evidence: `app.py`)
