# fareed7479/oral-cancer architecture

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

- Interactive diagram: https://gitdiagram.com/fareed7479/oral-cancer
- Repository: https://github.com/fareed7479/oral-cancer

## Overview

OncoDetectAI is an oral-cancer screening web application. A user uploads a clinical image; the frontend requests a prediction, then displays the classification, confidence, and image visualizations. Users can continue to a lifestyle assessment and recommendations flow. The backend excerpt shows image handling, model inference, and Grad-CAM generation; the lifestyle endpoint is shown only as commented-out code, so its connection to Gemini is unverified. The README is empty.

Main entry points: [`frontend/src/App.jsx`](https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/App.jsx) (Route dispatch), [`frontend/src/components/HomePage.jsx`](https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/components/HomePage.jsx) (Image upload), [`backend/main.py`](https://github.com/fareed7479/oral-cancer/blob/main/backend/main.py) (FastAPI endpoints), [`frontend/src/components/ResultPage.jsx`](https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/components/ResultPage.jsx) (Diagnostic report)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Screening interface"]
  node_home["Image upload<br/>[HomePage.jsx]"]
  node_result["Diagnostic report<br/>[ResultPage.jsx]"]
  node_router["Route dispatch<br/>[App.jsx]"]
end

subgraph group_backend["Screening backend"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_prediction["Image prediction<br/>[main.py]"]
  node_gradcam["Grad-CAM overlays<br/>[main.py]"]
end

subgraph group_lifestyle["Lifestyle guidance"]
  node_assessment["Lifestyle assessment"]
  node_lifestyle_result["Recommendations view"]
end

subgraph group_ai["AI integration"]
  node_gemini_service["Recommendation generation<br/>[gemini_service.py]"]
end

node_user(("User"))
node_gemini{{"Google Gemini"}}

node_user -->|"uploads image"| node_home
node_home -->|"requests prediction"| node_api
node_api -->|"dispatches inference"| node_prediction
node_prediction -->|"generates overlays"| node_gradcam
node_home -->|"navigates with result"| node_result
node_result -->|"opens assessment"| node_assessment
node_assessment -->|"requests plan"| node_api
node_api -.->|"may invoke"| node_gemini_service
node_gemini_service -->|"generates content"| node_gemini
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_result
node_router -->|"routes to"| node_assessment
node_router -->|"routes to"| node_lifestyle_result

click node_home "https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/components/HomePage.jsx"
click node_result "https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/components/ResultPage.jsx"
click node_assessment "https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/pages/LifestyleAssessment.jsx"
click node_lifestyle_result "https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/pages/LifestyleResult.jsx"
click node_router "https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/fareed7479/oral-cancer/blob/main/backend/main.py"
click node_prediction "https://github.com/fareed7479/oral-cancer/blob/main/backend/main.py"
click node_gradcam "https://github.com/fareed7479/oral-cancer/blob/main/backend/main.py"
click node_gemini_service "https://github.com/fareed7479/oral-cancer/blob/main/backend/services/gemini_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_home,node_result,node_router,node_user toneBlue
class node_api,node_prediction,node_gradcam toneAmber
class node_assessment,node_lifestyle_result toneMint
class node_gemini_service toneRose
class node_gemini toneIndigo
```

## Components

### Screening interface

- [Image upload](https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/components/HomePage.jsx): `frontend/src/components/HomePage.jsx`
- [Diagnostic report](https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/components/ResultPage.jsx): `frontend/src/components/ResultPage.jsx`
- [Route dispatch](https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Screening backend

- [FastAPI endpoints](https://github.com/fareed7479/oral-cancer/blob/main/backend/main.py): `backend/main.py`
- [Image prediction](https://github.com/fareed7479/oral-cancer/blob/main/backend/main.py): `backend/main.py`
- [Grad-CAM overlays](https://github.com/fareed7479/oral-cancer/blob/main/backend/main.py): `backend/main.py`

### Lifestyle guidance

- [Lifestyle assessment](https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/pages/LifestyleAssessment.jsx): `frontend/src/pages/LifestyleAssessment.jsx`
- [Recommendations view](https://github.com/fareed7479/oral-cancer/blob/main/frontend/src/pages/LifestyleResult.jsx): `frontend/src/pages/LifestyleResult.jsx`

### AI integration

- [Recommendation generation](https://github.com/fareed7479/oral-cancer/blob/main/backend/services/gemini_service.py): `backend/services/gemini_service.py`

### Other components

- **User**
- **Google Gemini**

## Connections

- User → Image upload: uploads image (evidence: `frontend/src/components/HomePage.jsx`)
- Image upload → FastAPI endpoints: requests prediction (evidence: `frontend/src/components/HomePage.jsx`)
- FastAPI endpoints → Image prediction: dispatches inference (evidence: `backend/main.py`)
- Image prediction → Grad-CAM overlays: generates overlays (evidence: `backend/main.py`)
- Image upload → Diagnostic report: navigates with result (evidence: `frontend/src/components/HomePage.jsx`)
- Diagnostic report → Lifestyle assessment: opens assessment (evidence: `frontend/src/components/ResultPage.jsx`)
- Lifestyle assessment → FastAPI endpoints: requests plan (evidence: `frontend/src/pages/LifestyleAssessment.jsx`)
- FastAPI endpoints → Recommendation generation: may invoke (evidence: `backend/main.py`)
- Recommendation generation → Google Gemini: generates content (evidence: `backend/services/gemini_service.py`)
- Route dispatch → Image upload: routes to (evidence: `frontend/src/App.jsx`)
- Route dispatch → Diagnostic report: routes to (evidence: `frontend/src/App.jsx`)
- Route dispatch → Lifestyle assessment: routes to (evidence: `frontend/src/App.jsx`)
- Route dispatch → Recommendations view: routes to (evidence: `frontend/src/App.jsx`)
