# kidkrishkode/fundusguardai architecture

> Architecture diagram of the GitHub repository kidkrishkode/fundusguardai, 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/kidkrishkode/fundusguardai
- Repository: https://github.com/kidkrishkode/fundusguardai

## Overview

FundusGuard AI is presented as a clinician-facing glaucoma screening and advisory platform. Its documented workflow is clinician onboarding, fundus-image submission, AI risk prediction and visual explanation, report generation, longitudinal tracking, and export. The sampled implementation chiefly establishes a Node/Express web application, server-rendered pages, security helpers, and Google Sheets-backed memory; no sampled source demonstrates the clinical image-analysis workflow, so those capability links are documented but unverified.

Main entry points: [`index.js`](https://github.com/kidkrishkode/fundusguardai/blob/main/index.js) (Express server), [`config/memory.ts`](https://github.com/kidkrishkode/fundusguardai/blob/main/config/memory.ts) (Google Sheets memory), [`views`](https://github.com/kidkrishkode/fundusguardai/tree/main/views) (Advisor report), [`public/App.js`](https://github.com/kidkrishkode/fundusguardai/blob/main/public/App.js) (Browser interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_server["Express server<br/>[index.js]"]
  node_webpages["Server-rendered pages"]
  node_templates["Shared templates"]
  node_browser["Browser interface<br/>[App.js]"]
end

subgraph group_clinical["Clinical workflow"]
  node_onboarding["User onboarding"]
  node_fundus["Fundus submission"]
  node_prediction["Glaucoma prediction"]
  node_explainability["XAI visualization"]
  node_advisory["Advisor report"]
  node_tracking[("Patient tracking")]
  node_export["Report export"]
end

subgraph group_platform["Platform services"]
  node_security["Security helpers<br/>[security.ts]"]
  node_hex["Web helpers<br/>[hex.ts]"]
  node_environment["Runtime settings<br/>[env-variables.ts]"]
end

subgraph group_storage["Persistence"]
  node_memory[("Google Sheets memory<br/>[memory.ts]")]
end

node_clinician(("Clinician"))
node_sheets[("Google Sheets")]
node_mlengine["Python ML engine"]

node_clinician -->|"uses"| node_server
node_server -->|"renders"| node_webpages
node_server -->|"renders"| node_templates
node_clinician -.->|"logs in"| node_onboarding
node_onboarding -.->|"uploads scans"| node_fundus
node_fundus -.->|"submits images"| node_prediction
node_prediction -.->|"uses models"| node_mlengine
node_prediction -.->|"produces evidence"| node_explainability
node_explainability -.->|"informs report"| node_advisory
node_advisory -.->|"supports monitoring"| node_tracking
node_advisory -.->|"exports summary"| node_export
node_browser -->|"requests content"| node_server
node_browser -->|"fetches legal content"| node_server
node_server -->|"decodes queries"| node_security
node_server -->|"renders templates"| node_hex
node_server -->|"loads settings"| node_environment
node_server -->|"uses shared state"| node_memory
node_memory -->|"decodes credentials"| node_security
node_memory -->|"uses helpers"| node_hex
node_memory -->|"reads and writes"| node_sheets

click node_server "https://github.com/kidkrishkode/fundusguardai/blob/main/index.js"
click node_webpages "https://github.com/kidkrishkode/fundusguardai/tree/main/views"
click node_templates "https://github.com/kidkrishkode/fundusguardai/tree/main/components"
click node_browser "https://github.com/kidkrishkode/fundusguardai/blob/main/public/App.js"
click node_onboarding "https://github.com/kidkrishkode/fundusguardai/tree/main/views"
click node_fundus "https://github.com/kidkrishkode/fundusguardai/tree/main/views"
click node_advisory "https://github.com/kidkrishkode/fundusguardai/tree/main/views"
click node_tracking "https://github.com/kidkrishkode/fundusguardai/tree/main/views"
click node_export "https://github.com/kidkrishkode/fundusguardai/tree/main/views"
click node_security "https://github.com/kidkrishkode/fundusguardai/blob/main/config/security.ts"
click node_hex "https://github.com/kidkrishkode/fundusguardai/blob/main/config/hex.ts"
click node_environment "https://github.com/kidkrishkode/fundusguardai/blob/main/config/env-variables.ts"
click node_memory "https://github.com/kidkrishkode/fundusguardai/blob/main/config/memory.ts"

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_server,node_webpages,node_templates,node_browser toneBlue
class node_onboarding,node_fundus,node_prediction,node_explainability,node_advisory,node_tracking,node_export,node_sheets toneAmber
class node_security,node_hex,node_environment toneMint
class node_memory toneRose
class node_clinician,node_mlengine toneIndigo
```

## Components

### Web application

- [Express server](https://github.com/kidkrishkode/fundusguardai/blob/main/index.js): `index.js`
- [Server-rendered pages](https://github.com/kidkrishkode/fundusguardai/tree/main/views): `views`
- [Shared templates](https://github.com/kidkrishkode/fundusguardai/tree/main/components): `components`
- [Browser interface](https://github.com/kidkrishkode/fundusguardai/blob/main/public/App.js): `public/App.js`

### Clinical workflow

- [User onboarding](https://github.com/kidkrishkode/fundusguardai/tree/main/views): `views`
- [Fundus submission](https://github.com/kidkrishkode/fundusguardai/tree/main/views): `views`
- **Glaucoma prediction**
- **XAI visualization**
- [Advisor report](https://github.com/kidkrishkode/fundusguardai/tree/main/views): `views`
- [Patient tracking](https://github.com/kidkrishkode/fundusguardai/tree/main/views): `views`
- [Report export](https://github.com/kidkrishkode/fundusguardai/tree/main/views): `views`

### Platform services

- [Security helpers](https://github.com/kidkrishkode/fundusguardai/blob/main/config/security.ts): `config/security.ts`
- [Web helpers](https://github.com/kidkrishkode/fundusguardai/blob/main/config/hex.ts): `config/hex.ts`
- [Runtime settings](https://github.com/kidkrishkode/fundusguardai/blob/main/config/env-variables.ts): `config/env-variables.ts`

### Persistence

- [Google Sheets memory](https://github.com/kidkrishkode/fundusguardai/blob/main/config/memory.ts): `config/memory.ts`

### Other components

- **Clinician**
- **Google Sheets**
- **Python ML engine**

## Connections

- Clinician → Express server: uses (evidence: `README.md`)
- Express server → Server-rendered pages: renders (evidence: `index.js`)
- Express server → Shared templates: renders (evidence: `index.js`)
- Clinician → User onboarding: logs in (evidence: `README.md`)
- User onboarding → Fundus submission: uploads scans (evidence: `README.md`)
- Fundus submission → Glaucoma prediction: submits images (evidence: `README.md`)
- Glaucoma prediction → Python ML engine: uses models (evidence: `README.md`)
- Glaucoma prediction → XAI visualization: produces evidence (evidence: `README.md`)
- XAI visualization → Advisor report: informs report (evidence: `README.md`)
- Advisor report → Patient tracking: supports monitoring (evidence: `README.md`)
- Advisor report → Report export: exports summary (evidence: `README.md`)
- Browser interface → Express server: requests content (evidence: `public/App.js`)
- Browser interface → Express server: fetches legal content (evidence: `public/App.js`)
- Express server → Security helpers: decodes queries (evidence: `index.js`)
- Express server → Web helpers: renders templates (evidence: `index.js`)
- Express server → Runtime settings: loads settings (evidence: `index.js`)
- Express server → Google Sheets memory: uses shared state (evidence: `index.js`)
- Google Sheets memory → Security helpers: decodes credentials (evidence: `config/memory.ts`)
- Google Sheets memory → Web helpers: uses helpers (evidence: `config/memory.ts`)
- Google Sheets memory → Google Sheets: reads and writes (evidence: `config/memory.ts`)
