# shivakarthikvuppala/melanomadetection architecture

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

- Interactive diagram: https://gitdiagram.com/shivakarthikvuppala/melanomadetection
- Repository: https://github.com/shivakarthikvuppala/melanomadetection

## Overview

Melanoma Detection is a research-oriented, agentic system for dermoscopic-image analysis with supplied clinical context, evidence retrieval, and explainable reporting. The main workflow runs from image/context submission through orchestration, parallel vision analysis and evidence gathering, then report generation; users can access it through the web UI or API. The README documents these product stages and capabilities. Source-index references support several internal calls, but unsampled UI/API and specialist implementations limit some implementation-level links; those links are omitted or marked unverified.

Main entry points: [`src/agents/orchestrator.py`](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/orchestrator.py) (Case orchestrator), [`src/agents/vision.py`](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/vision.py) (Vision agent), [`rag_pipeline/agent.py`](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/rag_pipeline/agent.py) (Hybrid retrieval), [`api/server.py`](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/api/server.py) (Analysis API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_webapp["Web app routes<br/>[App.jsx]"]
  node_upload["Image upload<br/>[Upload.jsx]"]
  node_results["Results view<br/>[Results.jsx]"]
end

subgraph group_service["API and identity"]
  node_api["Analysis API<br/>[server.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_db[("Application database<br/>[db.py]")]
end

subgraph group_workflow["Case workflow"]
  node_orchestrator["Case orchestrator<br/>[orchestrator.py]"]
  node_state["Case state<br/>[state.py]"]
  node_clinical["Clinical context"]
end

subgraph group_vision["Image analysis"]
  node_vision["Vision agent<br/>[vision.py]"]
  node_classification["SwinV2 classifier<br/>[inference.py]"]
  node_segmentation["SegFormer segmentation"]
  node_features["ABCD features<br/>[extractor.py]"]
  node_scale["Scale calibration<br/>[scale_detection.py]"]
  node_gradcam["Grad-CAM<br/>[gradcam.py]"]
end

subgraph group_evidence["Evidence and reporting"]
  node_evidence_agent["Evidence agent<br/>[evidence.py]"]
  node_rag["Hybrid retrieval<br/>[agent.py]"]
  node_query["Query generation<br/>[query_engine.py]"]
  node_report_agent["Report agent<br/>[report.py]"]
  node_report_generator["Report rendering"]
  node_report_output["Validated report<br/>[report.py]"]
end

node_user(("User"))
node_qdrant[("Qdrant")]
node_llm(("LLM service"))

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_upload
node_webapp -->|"routes to"| node_results
node_upload -.->|"submits image"| node_api
node_user -->|"submits image"| node_api
node_api -->|"routes auth"| node_auth
node_auth -->|"reads/writes"| node_db
node_api -->|"invokes"| node_orchestrator
node_orchestrator -->|"updates"| node_state
node_orchestrator -->|"dispatches"| node_vision
node_orchestrator -->|"dispatches"| node_evidence_agent
node_orchestrator -->|"dispatches"| node_report_agent
node_orchestrator -->|"consults"| node_clinical
node_vision -.->|"classifies"| node_classification
node_vision -.->|"segments"| node_segmentation
node_vision -.->|"extracts features"| node_features
node_vision -.->|"calibrates scale"| node_scale
node_vision -.->|"creates explanation"| node_gradcam
node_evidence_agent -.->|"retrieves evidence"| node_rag
node_rag -->|"generates queries"| node_query
node_rag -.->|"searches"| node_qdrant
node_rag -.->|"uses for HyDE"| node_llm
node_report_agent -.->|"renders report"| node_report_generator
node_report_agent -->|"validates"| node_report_output
node_report_output -.->|"displays"| node_results

click node_webapp "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/frontend-ui/src/App.jsx"
click node_upload "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/frontend-ui/src/pages/Upload.jsx"
click node_results "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/frontend-ui/src/pages/Results.jsx"
click node_api "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/api/server.py"
click node_auth "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/api/auth.py"
click node_db "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/api/db.py"
click node_orchestrator "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/orchestrator.py"
click node_state "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/state.py"
click node_clinical "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/clinical_context.py"
click node_vision "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/vision.py"
click node_classification "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/classification/inference.py"
click node_segmentation "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/segmentation/segformer_wrapper.py"
click node_features "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/features/extractor.py"
click node_scale "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/engine/scale_detection.py"
click node_gradcam "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/explainability/gradcam.py"
click node_evidence_agent "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/evidence.py"
click node_rag "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/rag_pipeline/agent.py"
click node_query "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/rag_pipeline/query_engine.py"
click node_report_agent "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/report.py"
click node_report_generator "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/report_generator.py"
click node_report_output "https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/report.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_webapp,node_upload,node_results,node_user toneBlue
class node_api,node_auth,node_db,node_qdrant toneAmber
class node_orchestrator,node_state,node_clinical toneMint
class node_vision,node_classification,node_segmentation,node_features,node_scale,node_gradcam toneRose
class node_evidence_agent,node_rag,node_query,node_report_agent,node_report_generator,node_report_output,node_llm toneIndigo
```

## Components

### User experience

- [Web app routes](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/frontend-ui/src/App.jsx): `frontend-ui/src/App.jsx`
- [Image upload](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/frontend-ui/src/pages/Upload.jsx): `frontend-ui/src/pages/Upload.jsx`
- [Results view](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/frontend-ui/src/pages/Results.jsx): `frontend-ui/src/pages/Results.jsx`

### API and identity

- [Analysis API](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/api/server.py): `api/server.py`
- [Authentication](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/api/auth.py): `api/auth.py`
- [Application database](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/api/db.py): `api/db.py`

### Case workflow

- [Case orchestrator](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/orchestrator.py): `src/agents/orchestrator.py`
- [Case state](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/state.py): `src/agents/state.py`
- [Clinical context](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/clinical_context.py): `src/agents/clinical_context.py`

### Image analysis

- [Vision agent](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/vision.py): `src/agents/vision.py`
- [SwinV2 classifier](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/classification/inference.py): `src/classification/inference.py`
- [SegFormer segmentation](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/segmentation/segformer_wrapper.py): `src/segmentation/segformer_wrapper.py`
- [ABCD features](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/features/extractor.py): `src/features/extractor.py`
- [Scale calibration](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/engine/scale_detection.py): `src/engine/scale_detection.py`
- [Grad-CAM](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/explainability/gradcam.py): `src/explainability/gradcam.py`

### Evidence and reporting

- [Evidence agent](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/evidence.py): `src/agents/evidence.py`
- [Hybrid retrieval](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/rag_pipeline/agent.py): `rag_pipeline/agent.py`
- [Query generation](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/rag_pipeline/query_engine.py): `rag_pipeline/query_engine.py`
- [Report agent](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/report.py): `src/agents/report.py`
- [Report rendering](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/report_generator.py): `src/agents/report_generator.py`
- [Validated report](https://github.com/shivakarthikvuppala/melanomadetection/blob/main/src/agents/report.py): `src/agents/report.py`

### Other components

- **User**
- **Qdrant**
- **LLM service**

## Connections

- User → Web app routes: uses (evidence: `README.md`)
- Web app routes → Image upload: routes to (evidence: `frontend-ui/src/App.jsx`)
- Web app routes → Results view: routes to (evidence: `frontend-ui/src/App.jsx`)
- Image upload → Analysis API: submits image
- User → Analysis API: submits image (evidence: `README.md`)
- Analysis API → Authentication: routes auth (evidence: `api/server.py`)
- Authentication → Application database: reads/writes (evidence: `api/auth.py`)
- Analysis API → Case orchestrator: invokes (evidence: `api/server.py`)
- Case orchestrator → Case state: updates (evidence: `src/agents/orchestrator.py`)
- Case orchestrator → Vision agent: dispatches (evidence: `src/agents/orchestrator.py`)
- Case orchestrator → Evidence agent: dispatches (evidence: `src/agents/orchestrator.py`)
- Case orchestrator → Report agent: dispatches (evidence: `src/agents/orchestrator.py`)
- Case orchestrator → Clinical context: consults (evidence: `src/agents/orchestrator.py`)
- Vision agent → SwinV2 classifier: classifies
- Vision agent → SegFormer segmentation: segments
- Vision agent → ABCD features: extracts features
- Vision agent → Scale calibration: calibrates scale
- Vision agent → Grad-CAM: creates explanation
- Evidence agent → Hybrid retrieval: retrieves evidence
- Hybrid retrieval → Query generation: generates queries (evidence: `rag_pipeline/agent.py`)
- Hybrid retrieval → Qdrant: searches
- Hybrid retrieval → LLM service: uses for HyDE
- Report agent → Report rendering: renders report
- Report agent → Validated report: validates (evidence: `README.md`)
- Validated report → Results view: displays
