# singhamit55/dermai architecture

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

- Interactive diagram: https://gitdiagram.com/singhamit55/dermai
- Repository: https://github.com/singhamit55/dermai

## Overview

DermAI is a browser-based acne-severity analysis and skincare guidance app. The main user flow is to upload or capture a skin image, send it to the Flask API for assessment, and view the result; the app also offers explanations, chat, routine guidance, and scan history. The README documents several capabilities whose implementation is not fully visible in the excerpts, so those links are cited to the README. The shipped backend excerpt shows heuristic image assessment, while the README describes EfficientNet; training code also includes a baseline and a reference CNN pipeline.

Main entry points: [`app.py`](https://github.com/singhamit55/dermai/blob/master/app.py) (Flask API routes), [`app.js`](https://github.com/singhamit55/dermai/blob/master/app.js) (Routine and progress UI), [`features.py`](https://github.com/singhamit55/dermai/blob/master/features.py) (Image features), [`explain.py`](https://github.com/singhamit55/dermai/blob/master/explain.py) (LIME explanations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_capture["Image capture<br/>[app.js]"]
  node_results["Analysis results<br/>[app.js]"]
  node_history[("Scan history<br/>[app.js]")]
  node_web_routines["Routine and progress UI<br/>[app.js]"]
  node_chat_ui["Assistant chat UI<br/>[app.js]"]
end

subgraph group_api["Assessment API"]
  node_api["Flask API routes<br/>[app.py]"]
  node_image_assess["Image assessment<br/>[app.py]"]
  node_clinical_summary["Clinical summary<br/>[app.py]"]
  node_chat_service["Chat service<br/>[app.py]"]
  node_routine_service["Routine and profile<br/>[app.py]"]
  node_progress_service["Progress endpoint<br/>[app.py]"]
end

subgraph group_ml["Model and explanation"]
  node_features["Image features<br/>[features.py]"]
  node_lime["LIME explanations<br/>[explain.py]"]
  node_baseline_training["Baseline training<br/>[train_baseline.py]"]
  node_cnn_training["EfficientNet reference"]
  node_xai["Tri-layer XAI<br/>[app.py]"]
end

subgraph group_guidance["Care guidance"]
  node_llm["LLM provider"]
end

node_user(("User"))

node_user -->|"uploads or captures"| node_capture
node_capture -->|"submits image"| node_api
node_api -->|"routes assessment"| node_image_assess
node_image_assess -->|"extracts features"| node_features
node_image_assess -->|"builds summary"| node_clinical_summary
node_api -->|"returns assessment"| node_results
node_results -->|"tracks scans"| node_history
node_user -->|"views routine"| node_web_routines
node_web_routines -->|"requests routine"| node_routine_service
node_api -->|"routes plan and profile"| node_routine_service
node_web_routines -.->|"requests progress"| node_progress_service
node_api -->|"routes progress"| node_progress_service
node_user -->|"asks skincare questions"| node_chat_ui
node_chat_ui -->|"requests chat completion"| node_llm
node_chat_ui -.->|"requests assistant reply"| node_chat_service
node_api -->|"routes chat"| node_chat_service
node_chat_service -->|"requests model reply"| node_llm
node_image_assess -.->|"generates visualizations"| node_xai
node_baseline_training -->|"extracts training features"| node_features
node_lime -->|"reuses feature functions"| node_features
node_cnn_training -.->|"documents Grad-CAM approach"| node_xai

click node_capture "https://github.com/singhamit55/dermai/blob/master/app.js"
click node_results "https://github.com/singhamit55/dermai/blob/master/app.js"
click node_history "https://github.com/singhamit55/dermai/blob/master/app.js"
click node_web_routines "https://github.com/singhamit55/dermai/blob/master/app.js"
click node_chat_ui "https://github.com/singhamit55/dermai/blob/master/app.js"
click node_api "https://github.com/singhamit55/dermai/blob/master/app.py"
click node_image_assess "https://github.com/singhamit55/dermai/blob/master/app.py"
click node_clinical_summary "https://github.com/singhamit55/dermai/blob/master/app.py"
click node_chat_service "https://github.com/singhamit55/dermai/blob/master/app.py"
click node_routine_service "https://github.com/singhamit55/dermai/blob/master/app.py"
click node_progress_service "https://github.com/singhamit55/dermai/blob/master/app.py"
click node_features "https://github.com/singhamit55/dermai/blob/master/features.py"
click node_lime "https://github.com/singhamit55/dermai/blob/master/explain.py"
click node_baseline_training "https://github.com/singhamit55/dermai/blob/master/train_baseline.py"
click node_cnn_training "https://github.com/singhamit55/dermai/blob/master/train_cnn_efficientnet.py"
click node_xai "https://github.com/singhamit55/dermai/blob/master/app.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_capture,node_results,node_history,node_web_routines,node_chat_ui,node_user toneBlue
class node_api,node_image_assess,node_clinical_summary,node_chat_service,node_routine_service,node_progress_service toneAmber
class node_features,node_lime,node_baseline_training,node_cnn_training,node_xai toneMint
class node_llm toneRose
```

## Components

### Web experience

- [Image capture](https://github.com/singhamit55/dermai/blob/master/app.js): `app.js`
- [Analysis results](https://github.com/singhamit55/dermai/blob/master/app.js): `app.js`
- [Scan history](https://github.com/singhamit55/dermai/blob/master/app.js): `app.js`
- [Routine and progress UI](https://github.com/singhamit55/dermai/blob/master/app.js): `app.js`
- [Assistant chat UI](https://github.com/singhamit55/dermai/blob/master/app.js): `app.js`

### Assessment API

- [Flask API routes](https://github.com/singhamit55/dermai/blob/master/app.py): `app.py`
- [Image assessment](https://github.com/singhamit55/dermai/blob/master/app.py): `app.py`
- [Clinical summary](https://github.com/singhamit55/dermai/blob/master/app.py): `app.py`
- [Chat service](https://github.com/singhamit55/dermai/blob/master/app.py): `app.py`
- [Routine and profile](https://github.com/singhamit55/dermai/blob/master/app.py): `app.py`
- [Progress endpoint](https://github.com/singhamit55/dermai/blob/master/app.py): `app.py`

### Model and explanation

- [Image features](https://github.com/singhamit55/dermai/blob/master/features.py): `features.py`
- [LIME explanations](https://github.com/singhamit55/dermai/blob/master/explain.py): `explain.py`
- [Baseline training](https://github.com/singhamit55/dermai/blob/master/train_baseline.py): `train_baseline.py`
- [EfficientNet reference](https://github.com/singhamit55/dermai/blob/master/train_cnn_efficientnet.py): `train_cnn_efficientnet.py`
- [Tri-layer XAI](https://github.com/singhamit55/dermai/blob/master/app.py): `app.py`

### Care guidance

- **LLM provider**

### Other components

- **User**

## Connections

- User → Image capture: uploads or captures (evidence: `README.md`)
- Image capture → Flask API routes: submits image (evidence: `README.md`)
- Flask API routes → Image assessment: routes assessment (evidence: `app.py`)
- Image assessment → Image features: extracts features (evidence: `app.py`)
- Image assessment → Clinical summary: builds summary (evidence: `app.py`)
- Flask API routes → Analysis results: returns assessment (evidence: `README.md`)
- Analysis results → Scan history: tracks scans (evidence: `README.md`)
- User → Routine and progress UI: views routine (evidence: `README.md`)
- Routine and progress UI → Routine and profile: requests routine (evidence: `README.md`)
- Flask API routes → Routine and profile: routes plan and profile (evidence: `app.py`)
- Routine and progress UI → Progress endpoint: requests progress
- Flask API routes → Progress endpoint: routes progress (evidence: `app.py`)
- User → Assistant chat UI: asks skincare questions (evidence: `README.md`)
- Assistant chat UI → LLM provider: requests chat completion (evidence: `app.js`)
- Assistant chat UI → Chat service: requests assistant reply
- Flask API routes → Chat service: routes chat (evidence: `app.py`)
- Chat service → LLM provider: requests model reply (evidence: `app.py`)
- Image assessment → Tri-layer XAI: generates visualizations (evidence: `app.py`)
- Baseline training → Image features: extracts training features (evidence: `train_baseline.py`)
- LIME explanations → Image features: reuses feature functions (evidence: `explain.py`)
- EfficientNet reference → Tri-layer XAI: documents Grad-CAM approach
