# truthdead/alphapred architecture

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

- Interactive diagram: https://gitdiagram.com/truthdead/alphapred
- Repository: https://github.com/truthdead/alphapred

## Overview

AlphaPred is a Flask web app for screening alpha-thalassemia carriers from blood-test measurements. The visible workflow collects form values, encodes gender and measurements, invokes a persisted XGBoost model, and renders its prediction. The README also describes a second classifier that distinguishes silent carriers from traits, but the sampled app calls only the first model; its implementation and integration are not verified here. Edges for the documented second stage are therefore dashed and uncited.

Main entry points: [`app.py`](https://github.com/truthdead/alphapred/blob/main/app.py) (Flask request handler), [`templates/index.html`](https://github.com/truthdead/alphapred/blob/main/templates/index.html) (Screening form), [`XGBClassifier.py`](https://github.com/truthdead/alphapred/blob/main/XGBClassifier.py) (XGBoost inference), [`XGB2.pkl`](https://github.com/truthdead/alphapred/blob/main/XGB2.pkl) (Carrier model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_form["Screening form<br/>[index.html]"]
  node_webapp["Flask request handler<br/>[app.py]"]
  node_result["Prediction display<br/>[index.html]"]
end

subgraph group_prediction["Prediction"]
  node_features["Feature encoding<br/>[app.py]"]
  node_classifier["XGBoost inference<br/>[XGBClassifier.py]"]
  node_model1[("Carrier model<br/>[XGB2.pkl]")]
end

subgraph group_stages["Diagnostic stages"]
  node_model2["Carrier subtype model"]
end

node_clinician(("Clinician"))

node_clinician -->|"enters measurements"| node_form
node_form -->|"submits values"| node_webapp
node_webapp -->|"encodes inputs"| node_features
node_webapp -->|"calls predictions"| node_classifier
node_classifier -->|"loads and predicts"| node_model1
node_webapp -->|"renders prediction"| node_result
node_model1 -.->|"classifies carriers"| node_model2

click node_form "https://github.com/truthdead/alphapred/blob/main/templates/index.html"
click node_webapp "https://github.com/truthdead/alphapred/blob/main/app.py"
click node_features "https://github.com/truthdead/alphapred/blob/main/app.py"
click node_classifier "https://github.com/truthdead/alphapred/blob/main/XGBClassifier.py"
click node_model1 "https://github.com/truthdead/alphapred/blob/main/XGB2.pkl"
click node_result "https://github.com/truthdead/alphapred/blob/main/templates/index.html"
click node_model2 "https://github.com/truthdead/alphapred/blob/main/alpha-thalassemia-classifier-1"

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_form,node_webapp,node_result toneBlue
class node_features,node_classifier,node_model1 toneAmber
class node_model2 toneMint
class node_clinician toneIndigo
```

## Components

### Web interface

- [Screening form](https://github.com/truthdead/alphapred/blob/main/templates/index.html): `templates/index.html`
- [Flask request handler](https://github.com/truthdead/alphapred/blob/main/app.py): `app.py`
- [Prediction display](https://github.com/truthdead/alphapred/blob/main/templates/index.html): `templates/index.html`

### Prediction

- [Feature encoding](https://github.com/truthdead/alphapred/blob/main/app.py): `app.py`
- [XGBoost inference](https://github.com/truthdead/alphapred/blob/main/XGBClassifier.py): `XGBClassifier.py`
- [Carrier model](https://github.com/truthdead/alphapred/blob/main/XGB2.pkl): `XGB2.pkl`

### Diagnostic stages

- [Carrier subtype model](https://github.com/truthdead/alphapred/blob/main/alpha-thalassemia-classifier-1): `alpha-thalassemia-classifier-1`

### Other components

- **Clinician**

## Connections

- Clinician → Screening form: enters measurements (evidence: `README.md`)
- Screening form → Flask request handler: submits values (evidence: `app.py`)
- Flask request handler → Feature encoding: encodes inputs (evidence: `app.py`)
- Flask request handler → XGBoost inference: calls predictions (evidence: `app.py`)
- XGBoost inference → Carrier model: loads and predicts (evidence: `XGBClassifier.py`)
- Flask request handler → Prediction display: renders prediction (evidence: `app.py`)
- Carrier model → Carrier subtype model: classifies carriers
