# tejaskinge29/anemia-detection architecture

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

- Interactive diagram: https://gitdiagram.com/tejaskinge29/anemia-detection
- Repository: https://github.com/tejaskinge29/anemia-detection

## Overview

This Flask application accepts patient details and a blood-smear image, validates and preprocesses the image, combines model classification with CBC-based rules, and generates a downloadable PDF report. The main backend and report generator were sampled; the frontend JavaScript appears to expect JSON, while the sampled Flask route renders HTML, so that integration is shown only as a request. Reported capabilities such as image augmentation and transfer learning are not separately represented because their runtime implementation is not present in the sampled source.

Main entry points: [`app.py`](https://github.com/tejaskinge29/anemia-detection/blob/main/app.py) (Flask routes), [`templates/index.html`](https://github.com/tejaskinge29/anemia-detection/blob/main/templates/index.html) (Upload and results UI), [`static/css/js/script.js`](https://github.com/tejaskinge29/anemia-detection/blob/main/static/css/js/script.js) (Form interactions), [`pdf.py`](https://github.com/tejaskinge29/anemia-detection/blob/main/pdf.py) (PDF report generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_ui["Upload and results UI<br/>[index.html]"]
  node_browser["Form interactions<br/>[script.js]"]
end

subgraph group_diagnosis["Diagnosis"]
  node_flask["Flask routes<br/>[app.py]"]
  node_image["Image validation and preprocessing<br/>[app.py]"]
  node_classifier["Model and CBC classification<br/>[app.py]"]
  node_model["Trained model<br/>[M_Anemia.h5]"]
end

subgraph group_reports["Reports and files"]
  node_uploads[("Uploaded images")]
  node_reportgen["PDF report generation<br/>[pdf.py]"]
  node_reports[("Generated reports")]
end

node_user(("Medical user"))

node_user -->|"uses"| node_ui
node_ui -->|"loads"| node_browser
node_browser -->|"posts form"| node_flask
node_flask -->|"saves image"| node_uploads
node_flask -->|"validates and preprocesses"| node_image
node_flask -->|"requests diagnosis"| node_classifier
node_classifier -->|"predicts with"| node_model
node_flask -->|"requests report"| node_reportgen
node_reportgen -->|"writes PDF"| node_reports
node_flask -->|"serves download"| node_reports

click node_ui "https://github.com/tejaskinge29/anemia-detection/blob/main/templates/index.html"
click node_browser "https://github.com/tejaskinge29/anemia-detection/blob/main/static/css/js/script.js"
click node_flask "https://github.com/tejaskinge29/anemia-detection/blob/main/app.py"
click node_image "https://github.com/tejaskinge29/anemia-detection/blob/main/app.py"
click node_classifier "https://github.com/tejaskinge29/anemia-detection/blob/main/app.py"
click node_model "https://github.com/tejaskinge29/anemia-detection/blob/main/M_Anemia.h5"
click node_uploads "https://github.com/tejaskinge29/anemia-detection/tree/main/uploads"
click node_reportgen "https://github.com/tejaskinge29/anemia-detection/blob/main/pdf.py"
click node_reports "https://github.com/tejaskinge29/anemia-detection/tree/main/reports"

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_ui,node_browser,node_user toneBlue
class node_flask,node_image,node_classifier,node_model toneAmber
class node_uploads,node_reportgen,node_reports toneMint
```

## Components

### Web experience

- [Upload and results UI](https://github.com/tejaskinge29/anemia-detection/blob/main/templates/index.html): `templates/index.html`
- [Form interactions](https://github.com/tejaskinge29/anemia-detection/blob/main/static/css/js/script.js): `static/css/js/script.js`

### Diagnosis

- [Flask routes](https://github.com/tejaskinge29/anemia-detection/blob/main/app.py): `app.py`
- [Image validation and preprocessing](https://github.com/tejaskinge29/anemia-detection/blob/main/app.py): `app.py`
- [Model and CBC classification](https://github.com/tejaskinge29/anemia-detection/blob/main/app.py): `app.py`
- [Trained model](https://github.com/tejaskinge29/anemia-detection/blob/main/M_Anemia.h5): `M_Anemia.h5`

### Reports and files

- [Uploaded images](https://github.com/tejaskinge29/anemia-detection/tree/main/uploads): `uploads`
- [PDF report generation](https://github.com/tejaskinge29/anemia-detection/blob/main/pdf.py): `pdf.py`
- [Generated reports](https://github.com/tejaskinge29/anemia-detection/tree/main/reports): `reports`

### Other components

- **Medical user**

## Connections

- Medical user → Upload and results UI: uses
- Upload and results UI → Form interactions: loads
- Form interactions → Flask routes: posts form
- Flask routes → Uploaded images: saves image
- Flask routes → Image validation and preprocessing: validates and preprocesses
- Flask routes → Model and CBC classification: requests diagnosis
- Model and CBC classification → Trained model: predicts with
- Flask routes → PDF report generation: requests report
- PDF report generation → Generated reports: writes PDF
- Flask routes → Generated reports: serves download
