# alfareza26/gerd_classification architecture

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

- Interactive diagram: https://gitdiagram.com/alfareza26/gerd_classification
- Repository: https://github.com/alfareza26/gerd_classification

## Overview

GERDGuard is a clinical decision-support web app for analyzing upper-GI endoscopy images. Its principal workflow is image upload, image-type screening, GERD classification, Grad-CAM visualization, report generation, and clinical report display. The backend excerpts show the API coordinating screening, explanation, and reporting; the README documents the frontend dashboard and browser-local history. Some frontend wiring and unsampled gate internals are not shown, so those connections are omitted or marked unverified.

Main entry points: [`backend/main.py`](https://github.com/alfareza26/gerd_classification/blob/main/backend/main.py) (Prediction API & classifier), [`frontend/components/AnalysisReportDashboard.tsx`](https://github.com/alfareza26/gerd_classification/blob/main/frontend/components/AnalysisReportDashboard.tsx) (Report dashboard), [`frontend/lib/store.ts`](https://github.com/alfareza26/gerd_classification/blob/main/frontend/lib/store.ts) (Local history & profile), [`frontend/app/analisis/page.tsx`](https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/analisis/page.tsx) (Analysis workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_analysis_ui["Analysis workflow<br/>[page.tsx]"]
  node_api_client["Prediction API client<br/>[api.ts]"]
  node_history[("Local history &amp; profile<br/>[store.ts]")]
  node_history_page["History view<br/>[page.tsx]"]
  node_profile_page["Profile view<br/>[page.tsx]"]
  node_auth_pages["Login &amp; registration<br/>[page.tsx]"]
end

subgraph group_backend["Inference backend"]
  node_backend_api["Prediction API &amp; classifier<br/>[main.py]"]
  node_image_gate["Image screening<br/>[guard.py]"]
  node_gradcam["Grad-CAM explainer<br/>[gradcam.py]"]
  node_report_generator["Patient report generator"]
end

subgraph group_clinical["Clinical results"]
  node_report_dashboard["Report dashboard"]
  node_result_dialog["Report dialog<br/>[ResultDialog.tsx]"]
end

node_clinician(("Clinician"))

node_clinician -->|"uploads image"| node_analysis_ui
node_analysis_ui -.->|"requests prediction"| node_api_client
node_api_client -->|"posts image"| node_backend_api
node_backend_api -->|"screens image"| node_image_gate
node_backend_api -->|"generates heatmap"| node_gradcam
node_backend_api -->|"builds report"| node_report_generator
node_backend_api -.->|"returns report data"| node_report_dashboard
node_report_dashboard -->|"renders in"| node_result_dialog
node_report_dashboard -.->|"reads saved record"| node_history
node_clinician -->|"reviews history"| node_history_page
node_history_page -.->|"uses local history"| node_history
node_clinician -->|"manages profile"| node_profile_page
node_profile_page -.->|"stores preferences"| node_history
node_clinician -.->|"accesses account"| node_auth_pages

click node_analysis_ui "https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/analisis/page.tsx"
click node_api_client "https://github.com/alfareza26/gerd_classification/blob/main/frontend/lib/api.ts"
click node_history "https://github.com/alfareza26/gerd_classification/blob/main/frontend/lib/store.ts"
click node_history_page "https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/riwayat/page.tsx"
click node_profile_page "https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/profil/page.tsx"
click node_auth_pages "https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/login/page.tsx"
click node_report_dashboard "https://github.com/alfareza26/gerd_classification/blob/main/frontend/components/AnalysisReportDashboard.tsx"
click node_result_dialog "https://github.com/alfareza26/gerd_classification/blob/main/frontend/components/ResultDialog.tsx"
click node_backend_api "https://github.com/alfareza26/gerd_classification/blob/main/backend/main.py"
click node_image_gate "https://github.com/alfareza26/gerd_classification/blob/main/backend/guard.py"
click node_gradcam "https://github.com/alfareza26/gerd_classification/blob/main/backend/gradcam.py"
click node_report_generator "https://github.com/alfareza26/gerd_classification/blob/main/backend/report_generator.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_analysis_ui,node_api_client,node_history,node_history_page,node_profile_page,node_auth_pages toneBlue
class node_backend_api,node_image_gate,node_gradcam,node_report_generator toneAmber
class node_report_dashboard,node_result_dialog toneMint
class node_clinician toneIndigo
```

## Components

### Web application

- [Analysis workflow](https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/analisis/page.tsx): `frontend/app/analisis/page.tsx`
- [Prediction API client](https://github.com/alfareza26/gerd_classification/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`
- [Local history & profile](https://github.com/alfareza26/gerd_classification/blob/main/frontend/lib/store.ts): `frontend/lib/store.ts`
- [History view](https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/riwayat/page.tsx): `frontend/app/riwayat/page.tsx`
- [Profile view](https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/profil/page.tsx): `frontend/app/profil/page.tsx`
- [Login & registration](https://github.com/alfareza26/gerd_classification/blob/main/frontend/app/login/page.tsx): `frontend/app/login/page.tsx`

### Inference backend

- [Prediction API & classifier](https://github.com/alfareza26/gerd_classification/blob/main/backend/main.py): `backend/main.py`
- [Image screening](https://github.com/alfareza26/gerd_classification/blob/main/backend/guard.py): `backend/guard.py`
- [Grad-CAM explainer](https://github.com/alfareza26/gerd_classification/blob/main/backend/gradcam.py): `backend/gradcam.py`
- [Patient report generator](https://github.com/alfareza26/gerd_classification/blob/main/backend/report_generator.py): `backend/report_generator.py`

### Clinical results

- [Report dashboard](https://github.com/alfareza26/gerd_classification/blob/main/frontend/components/AnalysisReportDashboard.tsx): `frontend/components/AnalysisReportDashboard.tsx`
- [Report dialog](https://github.com/alfareza26/gerd_classification/blob/main/frontend/components/ResultDialog.tsx): `frontend/components/ResultDialog.tsx`

### Other components

- **Clinician**

## Connections

- Clinician → Analysis workflow: uploads image (evidence: `README.md`)
- Analysis workflow → Prediction API client: requests prediction
- Prediction API client → Prediction API & classifier: posts image (evidence: `frontend/lib/api.ts`)
- Prediction API & classifier → Image screening: screens image (evidence: `backend/main.py`)
- Prediction API & classifier → Grad-CAM explainer: generates heatmap (evidence: `backend/main.py`)
- Prediction API & classifier → Patient report generator: builds report (evidence: `backend/main.py`)
- Prediction API & classifier → Report dashboard: returns report data
- Report dashboard → Report dialog: renders in (evidence: `frontend/components/ResultDialog.tsx`)
- Report dashboard → Local history & profile: reads saved record
- Clinician → History view: reviews history (evidence: `README.md`)
- History view → Local history & profile: uses local history
- Clinician → Profile view: manages profile (evidence: `README.md`)
- Profile view → Local history & profile: stores preferences
- Clinician → Login & registration: accesses account
