🩸 Emergency Blood Request Classifier

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.


πŸ“Œ Model Summary

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

🎯 Intended Use

Primary Use

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 donors
  • πŸ“‹ not_emergency β†’ listed normally in the donor feed

How It Fits the Bigger Picture

Blood 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

Other Potential Uses

  • Urgency triage in healthcare communication platforms
  • Benchmarking lightweight NLP models on medical emergency detection
  • Research on urgency language patterns in South Asian healthcare contexts

⚠️ Limitations

  • Synthetic training data β€” The model was trained on AI-generated data. Real-world requests may use different phrasing, slang, abbreviations, or informal language not well-represented in training.
  • English only β€” Sri Lankan blood requests often appear in Sinhala or Tamil. This model does not support those languages.
  • Sri Lanka context β€” The dataset references Sri Lankan hospitals and cities. Performance on requests from other regions may vary.
  • Not for clinical use β€” This model must not be used as a substitute for medical triage or clinical decision-making. It is an assistive tool for a donor coordination platform only.

πŸš€ Quick Start

Using the Pipeline (Recommended)

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...}]

Loading Model Directly

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

Batch Inference

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]}...")

πŸ“Š Training Details

Dataset

Label Definitions

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.

Hyperparameters

Parameter Value
Learning Rate 1e-4
Train Batch Size 32
Eval Batch Size 32
Epochs 10
Optimizer AdamW (fused)
LR Scheduler Linear
Seed 42

Training Results

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

Framework Versions

  • Transformers: 5.10.1
  • PyTorch: 2.11.0+cu128
  • Datasets: 5.0.0
  • Tokenizers: 0.22.2
  • Training Environment: Google Colab (GPU)

πŸ—‚οΈ Example Predictions

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

πŸ”— Related Resources


πŸ“œ Citation

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. 🩸

Downloads last month
88
Safetensors
Model size
67M params
Tensor type
F32
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for AshenFdo/emergency_blood_request_classifier

Finetuned
(11923)
this model

Dataset used to train AshenFdo/emergency_blood_request_classifier

Space using AshenFdo/emergency_blood_request_classifier 1

Evaluation results

  • accuracy on synthetic_blood_request_urgency_dataset
    self-reported
    1.000