File size: 7,166 Bytes
0439ee0
f6356c7
0439ee0
 
f6356c7
 
 
0439ee0
f6356c7
 
0439ee0
f6356c7
 
 
 
 
 
 
 
 
 
 
 
 
2ec4e32
f6356c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ec4e32
f6356c7
2ec4e32
f6356c7
2ec4e32
b6ce15c
 
0439ee0
f6356c7
2ec4e32
b6ce15c
0439ee0
f6356c7
0439ee0
f6356c7
 
 
 
0439ee0
 
 
b6ce15c
0439ee0
f6356c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0439ee0
 
 
b6ce15c
0439ee0
f6356c7
 
0439ee0
f6356c7
0439ee0
 
 
f6356c7
0439ee0
 
 
 
 
 
 
 
 
 
f6356c7
0439ee0
 
 
 
 
f6356c7
 
0439ee0
f6356c7
 
 
0439ee0
 
 
f6356c7
0439ee0
 
 
f6356c7
 
0439ee0
f6356c7
0439ee0
 
 
 
 
 
f6356c7
 
 
 
0439ee0
 
 
 
b6ce15c
0439ee0
f6356c7
 
0439ee0
f6356c7
 
0439ee0
f6356c7
 
0439ee0
 
 
b6ce15c
0439ee0
 
f6356c7
 
0439ee0
 
f6356c7
 
0439ee0
 
 
f6356c7
0439ee0
f6356c7
0439ee0
f6356c7
0439ee0
 
 
 
 
b6ce15c
0439ee0
 
 
f6356c7
 
0439ee0
 
 
b6ce15c
0439ee0
 
 
 
 
f6356c7
0439ee0
 
 
 
b6ce15c
0439ee0
 
 
 
 
 
 
 
 
 
 
b6ce15c
0439ee0
f6356c7
 
 
0439ee0
 
 
b6ce15c
0439ee0
5d22eeb
0439ee0
 
 
b6ce15c
0439ee0
 
 
 
 
b6ce15c
0439ee0
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
---
pretty_name: "Blood Donation Registry — Synthetic Donors, Prevalence & Compatibility"
license: cc-by-4.0
language:
  - en
size_categories:
  - 10K<n<100K
task_categories:
  - tabular-classification
  - tabular-regression
tags:
  - blood-donation
  - transfusion
  - healthcare-operations
  - decision-support
  - risk-scoring
  - calibration
  - thresholding
  - synthetic
  - tabular-data
annotations_creators:
  - no-annotation
source_datasets:
  - synthetic
configs:
  - config_name: ml_ready
    data_files:
      - split: train
        path: "data/blood_donation_registry_ml_ready.csv"
  - config_name: population_distribution
    data_files:
      - split: train
        path: "data/blood_population_distribution.csv"
  - config_name: compatibility_lookup
    data_files:
      - split: train
        path: "data/blood_compatibility_lookup.csv"
  - config_name: data_dictionary
    data_files:
      - split: train
        path: "data/data_dictionary.csv"
---

# 🩸 Blood Donation Registry — Synthetic Donors, Prevalence & Compatibility

Synthetic, decision-focused tables for blood donation operations: donor eligibility/deferrals, donation history, rare blood types, country-level prevalence, and RBC transfusion compatibility (ABO/Rh).

**Synthetic data** (safe for experimentation and teaching)  
**Not clinical/medical ground truth** — do not use for real-world medical decisions.

---

## 📦 What’s inside

This repo provides **four loadable dataset configs** via `datasets.load_dataset`:

- **`ml_ready`** *(default / recommended)* → donor-level ML-ready table
- **`population_distribution`** → country-level blood type prevalence
- **`compatibility_lookup`** → RBC transfusion compatibility matrix (8×8)
- **`data_dictionary`** → column-level documentation (all files)

---

## 🚀 Quick start (Hugging Face)

```python
from datasets import load_dataset

repo_id = "tarekmasryo/blood-donation-registry-dataset"

donors = load_dataset(repo_id, "ml_ready")["train"].to_pandas()
pop    = load_dataset(repo_id, "population_distribution")["train"].to_pandas()
compat = load_dataset(repo_id, "compatibility_lookup")["train"].to_pandas()

# Example join: add country population + Rh- rate to each donor
donors = donors.merge(
    pop[["country_code", "population_size", "rh_negative_rate"]],
    on="country_code",
    how="left",
)
print(donors.shape)
print(donors.head(3))
```

> Tip: `load_dataset(repo_id)` will load the first config (here: `ml_ready`).

---

## 🗂️ Data files

### 1) `data/blood_donation_registry_ml_ready.csv` (30,000 rows × 27 columns)

Donor-level snapshot with a fixed reference date:

- `as_of_date = 2024-12-31`

**Key groups**

- **Identity & geography:** `donor_id` (unique), `country_code`, `region`
- **Profile:** `age`, `sex` (M/F), `bmi`, `smoker` (0/1), `chronic_condition_flag` (0/1)
- **Eligibility & deferrals:** `eligibility_status`, `eligible_to_donate` (0/1), `deferral_reason`
- **Donation behavior/history:** `donation_count_last_12m`, `lifetime_donation_count`, `first_donation_year`,
  `years_since_first_donation`, `last_donation_date`, `recency_days`, `is_regular_donor` (0/1),
  `donor_age_at_first_donation`, `preferred_site`
- **Blood context:** `blood_type` (8 types), `is_rare_type` (0/1), `blood_type_country_prevalence`
- **Engineered score (optional):** `donation_propensity_score`

**Outcome columns**

- `donated_next_6m` (0/1)
- `next_6m_donation_count` (0–3)

---

### 2) `data/blood_population_distribution.csv` (39 rows × 12 columns)

Country-level population + blood type prevalence:

- keys: `country_code`, `region`
- `population_size`
- proportions: `p_o_pos`, `p_o_neg`, `p_a_pos`, `p_a_neg`, `p_b_pos`, `p_b_neg`, `p_ab_pos`, `p_ab_neg`
- `rh_negative_rate`

**Integrity expectation:** blood type proportions sum to **1.0** per country.

---

### 3) `data/blood_compatibility_lookup.csv` (64 rows × 4 columns)

RBC transfusion compatibility matrix:

- `donor_blood_type`, `recipient_blood_type`
- `compatible_for_rbc_transfusion` (0/1)
- `compatibility_level`: `ideal | acceptable | incompatible`

---

### 4) `data/data_dictionary.csv`

Column-level documentation for all files:

- `file`, `column_name`, `type`, `description`, `allowed_values_or_range`, `missing_values`

---

## 🔗 Relationships

- `blood_donation_registry_ml_ready.country_code``blood_population_distribution.country_code`

- `blood_donation_registry_ml_ready.blood_type_country_prevalence`
  is derived from the matching country prevalence proportions.

- `blood_compatibility_lookup`
  provides rule-based compatibility for donor/recipient blood type pairs.

---

## 🧪 Recommended tasks

### 1) Donation likelihood (binary classification)
- Target: `donated_next_6m`
- Suggested evaluation: ROC-AUC, PR-AUC, F1 + **calibration** (reliability curve / Brier score)

### 2) Donation frequency (count prediction)
- Target: `next_6m_donation_count`
- Suggested evaluation: MAE, RMSE (optional Poisson/ordinal baselines)

### 3) Decision policy under constraints
Turn probabilities into an outreach policy:
- choose an operating threshold under **capacity/budget**
- compare FP/FN tradeoffs
- validate stability across segments (region, rare types, eligibility)

### 4) Rare-blood operations analytics
- analyze `is_rare_type` by country prevalence
- explore compatibility-aware matching using the lookup matrix

---

## 🧯 Modeling notes (avoid leakage / shortcuts)

- `donated_next_6m` is derived from `next_6m_donation_count` → use **one** outcome as the target.
- `eligible_to_donate` overlaps with `eligibility_status` → keep one for simpler baselines.
- `eligible_to_donate == 0` implies `donated_next_6m == 0` → for behavior modeling, consider training on `eligible_to_donate == 1`.
- `donation_propensity_score` is engineered; exclude it for “feature-only” benchmark baselines.

---

## ✅ Data quality expectations

- `donor_id` is unique (no duplicate donors)
- no duplicate rows
- snapshot consistency (`as_of_date` fixed)
- `recency_days` aligns with `as_of_date - last_donation_date`
- country codes match the prevalence table keys
- compatibility lookup covers all 8×8 donor/recipient pairs

---

## 🧬 Synthetic data generation (high-level)

Records are simulated to reflect realistic constraints and patterns:
- eligibility rules and deferral reasons (age/BMI/health flags)
- donation history distributions and recency behavior
- country-level blood type prevalence used to derive per-donor prevalence context
- ABO/Rh compatibility rules encoded in the lookup table

Synthetic distributions may not match any specific real-world population.

---

## ⚠️ Limitations

- snapshot-style dataset (not a full longitudinal event log beyond history fields)
- synthetic distributions may differ from real operational settings
- engineered signals (e.g., `donation_propensity_score`) can act as shortcut features if used without care

---

## 🧾 Citation

Tarek Masryo. (2025). *Blood Donation Registry — Synthetic Donors, Prevalence & Compatibility*.

---

## 📜 License

CC BY 4.0 — attribution required.

---

## 👤 Author

Tarek Masryo