# prxnesh/brain-tumor-classifier-prototype2 architecture

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

- Interactive diagram: https://gitdiagram.com/prxnesh/brain-tumor-classifier-prototype2
- Repository: https://github.com/prxnesh/brain-tumor-classifier-prototype2

## Overview

NeuroVision AI is a full-stack brain-imaging decision-support prototype. The main workflow is a user selecting an MRI, CT, or paired scans in the React client; the FastAPI API routes inference to modality-specific classifier services and returns predictions, Grad-CAM overlays, and structured reports for visualization or PDF export. The client also offers scan-context chat through an optional local Ollama service. The README documents CT and fusion as wired but dependent on trained weights. Relationships for API calls are based on documented capabilities; unsampled implementation details are not inferred.

Main entry points: [`frontend/src/App.tsx`](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/App.tsx) (Analysis workspace), [`backend/app/main.py`](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/main.py) (HTTP API and routing), [`frontend/src/ChatPanel.tsx`](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/ChatPanel.tsx) (Scan chat), [`backend/app/services/classifier_service.py`](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/services/classifier_service.py) (Modality inference and Grad-CAM)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Analysis client"]
  node_app["Analysis workspace<br/>[App.tsx]"]
  node_overlay["Tumor overlay"]
  node_processing["Processing state"]
  node_stats["Model statistics<br/>[NerdStatsTab.tsx]"]
  node_chat["Scan chat<br/>[ChatPanel.tsx]"]
  node_pdf["PDF report export<br/>[reportPdf.ts]"]
end

subgraph group_api["Inference API"]
  node_api_main["HTTP API and routing<br/>[main.py]"]
  node_schemas["API response schemas<br/>[schemas.py]"]
  node_config["Runtime settings<br/>[config.py]"]
end

subgraph group_inference["Model and reporting"]
  node_classifier["Modality inference and Grad-CAM"]
end

subgraph group_assistant["Optional assistant"]
  node_ollama_service["Report and chat client<br/>[ollama_service.py]"]
end

node_user(("Clinician / user"))
node_ollama["Ollama service"]

node_user -->|"uploads scans"| node_app
node_app -->|"requests inference"| node_api_main
node_api_main -->|"runs prediction"| node_classifier
node_api_main -->|"returns typed responses"| node_schemas
node_api_main -->|"reads settings"| node_config
node_api_main -->|"enhances reports"| node_ollama_service
node_ollama_service -->|"calls model API"| node_ollama
node_app -->|"renders"| node_overlay
node_app -->|"renders"| node_processing
node_app -->|"renders"| node_stats
node_app -->|"renders"| node_chat
node_app -->|"exports report"| node_pdf
node_chat -->|"sends chat"| node_api_main
node_classifier -->|"returns predictions"| node_api_main

click node_app "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/App.tsx"
click node_overlay "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/BoundingBoxOverlay.tsx"
click node_processing "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/ProcessingOverlay.tsx"
click node_stats "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/NerdStatsTab.tsx"
click node_chat "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/ChatPanel.tsx"
click node_pdf "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/reportPdf.ts"
click node_api_main "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/main.py"
click node_schemas "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/schemas.py"
click node_config "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/config.py"
click node_classifier "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/services/classifier_service.py"
click node_ollama_service "https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/services/ollama_service.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_app,node_overlay,node_processing,node_stats,node_chat,node_pdf,node_user toneBlue
class node_api_main,node_schemas,node_config toneAmber
class node_classifier toneMint
class node_ollama_service toneRose
class node_ollama toneIndigo
```

## Components

### Analysis client

- [Analysis workspace](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Tumor overlay](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/BoundingBoxOverlay.tsx): `frontend/src/BoundingBoxOverlay.tsx`
- [Processing state](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/ProcessingOverlay.tsx): `frontend/src/ProcessingOverlay.tsx`
- [Model statistics](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/NerdStatsTab.tsx): `frontend/src/NerdStatsTab.tsx`
- [Scan chat](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/ChatPanel.tsx): `frontend/src/ChatPanel.tsx`
- [PDF report export](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/frontend/src/reportPdf.ts): `frontend/src/reportPdf.ts`

### Inference API

- [HTTP API and routing](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/main.py): `backend/app/main.py`
- [API response schemas](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/schemas.py): `backend/app/schemas.py`
- [Runtime settings](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/config.py): `backend/app/config.py`

### Model and reporting

- [Modality inference and Grad-CAM](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/services/classifier_service.py): `backend/app/services/classifier_service.py`

### Optional assistant

- [Report and chat client](https://github.com/prxnesh/brain-tumor-classifier-prototype2/blob/main/backend/app/services/ollama_service.py): `backend/app/services/ollama_service.py`

### Other components

- **Clinician / user**
- **Ollama service**

## Connections

- Clinician / user → Analysis workspace: uploads scans (evidence: `README.md`)
- Analysis workspace → HTTP API and routing: requests inference (evidence: `README.md`)
- HTTP API and routing → Modality inference and Grad-CAM: runs prediction (evidence: `backend/app/main.py`)
- HTTP API and routing → API response schemas: returns typed responses (evidence: `backend/app/main.py`)
- HTTP API and routing → Runtime settings: reads settings (evidence: `backend/app/main.py`)
- HTTP API and routing → Report and chat client: enhances reports (evidence: `backend/app/main.py`)
- Report and chat client → Ollama service: calls model API (evidence: `backend/app/services/ollama_service.py`)
- Analysis workspace → Tumor overlay: renders (evidence: `frontend/src/App.tsx`)
- Analysis workspace → Processing state: renders (evidence: `frontend/src/App.tsx`)
- Analysis workspace → Model statistics: renders (evidence: `frontend/src/App.tsx`)
- Analysis workspace → Scan chat: renders (evidence: `frontend/src/App.tsx`)
- Analysis workspace → PDF report export: exports report (evidence: `frontend/src/App.tsx`)
- Scan chat → HTTP API and routing: sends chat (evidence: `frontend/src/ChatPanel.tsx`)
- Modality inference and Grad-CAM → HTTP API and routing: returns predictions (evidence: `backend/app/main.py`)
