AshenFdo/synthetic_blood_request_urgency_dataset
Viewer β’ Updated β’ 2.5k β’ 57
A fine-tuned DistilBERT model for binary text classification that automatically determines whether a blood donation request is an emergency or not an emergency.
This model is part of my personal project to build an AI-powered blood donation mobile application for Sri Lanka β designed to prioritize life-critical requests and alert nearby donors faster.
| Property | Details |
|---|---|
| Base Model | distilbert/distilbert-base-uncased |
| Task | Binary Text Classification |
| Labels | emergency, not_emergency |
| Training Dataset | AshenFdo/synthetic_blood_request_urgency_dataset |
| Evaluation Accuracy | 100% (eval set) |
| Training Epochs | 10 |
| Language | English |
| Domain | Healthcare / Blood Donation (Sri Lanka) |
| License | Apache 2.0 |
This model is designed to be integrated into a Sri Lanka blood donation mobile application. When a user posts a blood request, the model reads the description and classifies it as:
emergency β triggers immediate alerts to nearby donorsnot_emergency β listed normally in the donor feedBlood Donation App (Sri Lanka)
β
βΌ
User posts a blood request
β
βΌ
π€ This Model (Emergency Classifier)
βββββββββββββββββββββββββββββββββββββ
Reads the request description
β
ββββΆ emergency β π¨ Immediately alert nearby donors
β
ββββΆ not_emergency β π List normally in the donor feed
from transformers import pipeline
classifier = pipeline("text-classification", model="AshenFdo/emergency_blood_request_classifier")
result = classifier("O negative blood required urgently at Karapitiya Hospital. We are out of time.")
print(result)
# [{'label': 'emergency', 'score': 0.999...}]
result = classifier("Organizing AB+ blood for an upcoming planned operation at Kandy National Hospital.")
print(result)
# [{'label': 'not_emergency', 'score': 0.999...}]
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("AshenFdo/emergency_blood_request_classifier")
model = AutoModelForSequenceClassification.from_pretrained("AshenFdo/emergency_blood_request_classifier")
text = "EMERGENCY: Kandy National Hospital ICU urgently needs A- blood. Patient is critical."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
logits = model(**inputs).logits
predicted_class_id = logits.argmax().item()
label = model.config.id2label[predicted_class_id]
print(f"Prediction: {label}")
# Prediction: emergency
from transformers import pipeline
classifier = pipeline("text-classification", model="AshenFdo/emergency_blood_request_classifier")
requests = [
"Need O- blood for a routine hospital visit at Negombo Hospital.",
"My sister is in Kandy Hospital ICU with organ failure. We desperately need B+ blood. Pls help!",
"Community blood donation drive at Colombo town hall this Saturday.",
"URGENT: Karapitiya hospital needs AB- blood. Bus accident, multiple casualties.",
]
results = classifier(requests)
for req, res in zip(requests, results):
print(f"[{res['label']}] {req[:60]}...")
emergency and 1,250 not_emergency| Label | Description |
|---|---|
emergency |
Patient is in a critical or life-threatening condition requiring blood immediately. Typically includes keywords like "urgent", "critical", "out of time", "severe hemorrhage", ICU references, or accident/trauma scenarios. |
not_emergency |
Routine, planned, or replacement donation requests. Includes scheduled surgeries, chronic condition support, community blood drives, and replacement donor programs. |
| Parameter | Value |
|---|---|
| Learning Rate | 1e-4 |
| Train Batch Size | 32 |
| Eval Batch Size | 32 |
| Epochs | 10 |
| Optimizer | AdamW (fused) |
| LR Scheduler | Linear |
| Seed | 42 |
| Epoch | Training Loss | Validation Loss | Accuracy |
|---|---|---|---|
| 1 | 0.0954 | 0.0107 | 0.998 |
| 2 | 0.0041 | 0.0010 | 1.000 |
| 3 | 0.0109 | 0.0017 | 0.998 |
| 4 | 0.0001 | 0.0001 | 1.000 |
| 5β10 | ~0.0000 | ~0.0000 | 1.000 |
| Description | Expected Label |
|---|---|
| "HOSPITAL EMERGENCY: Ratnapura Hospital urgently requires AB- blood for a critical patient." | emergency |
| "O negative blood required urgently at Karapitiya Hospital. We are out of time." | emergency |
| "Need O+ blood ASAP. Friend is in Ragama hospital surgical ICU with a burst spleen." | emergency |
| "Organizing AB+ blood for an upcoming planned operation at Kandy National Hospital." | not_emergency |
| "Blood donation campaign at the Ratnapura clock tower organized by the local association." | not_emergency |
| "Advance donor support for an elective surgery at Ratnapura Hospital. A- needed." | not_emergency |
If you use this model in your research or project, please cite it as:
@model{AshenFdo_emergency_blood_request_classifier_2025,
author = {AshenFdo},
title = {Emergency Blood Request Classifier},
year = {2025},
publisher = {HuggingFace},
url = {https://huggingface.co/AshenFdo/emergency_blood_request_classifier}
}
Built with the goal of saving lives β one donation at a time. π©Έ
Base model
distilbert/distilbert-base-uncased