iamjamaal/ghana-adr-detection
Ghana ADR Detection System
Adverse drug reaction (ADR) detection from free-text clinical narratives, built on Ghanaian pharmacovigilance data. Fine-tuned from PubMedBERT with domain-adaptive pretraining (DAPT) on 128k Ghanaian biomedical sentences.
Model Description
This repository contains two production heads trained on the same DAPT backbone:
Production config (Phase 7 Hybrid): clf_phase2b_cohort_study + ner_phase7_cohort_study, threshold 0.55.
Performance
Evaluated with Leave-One-Source-Out (LOSO) cross-validation — each source domain is held out as the test set while the model trains on the remaining three. This measures real cross-domain generalisation across Ghanaian clinical writing styles.
Classification (CLF)
Named Entity Recognition (NER)
Model status: Pilot model — built and actively improved through iterative research phases.
Evaluation methodology: Leave-One-Source-Out (LOSO) — each source domain is held out entirely during training and evaluated as an unseen genre. This is the headline generalization metric above (macro CLF F1 = 0.724, macro NER F1 = 0.655). We also maintain an internal, evolving suite of curated hard cases (Pidgin, dialect, regulatory register, clinical shorthand, minimal pairs) used to diagnose and target specific model weaknesses during development. It's a diagnostic tool, not a benchmark — we don't publish a fixed pass-rate from it here, since the suite and the model are both still changing, and a fixed percentage risks reading as a settled result rather than a snapshot of an active development target.
Training Data
Built from four Ghanaian pharmacovigilance source domains:
Gold dataset: 2,870 annotated sentences Silver dataset: 2,105+ records (DailyMed weak supervision, DrugLens NER, OpenFDA ICSR, synthetic curriculum)
How to Use
from transformers import AutoTokenizer, AutoModelForSequenceClassification
from transformers import AutoModelForTokenClassification
import torch
# Load DAPT backbone tokenizer
tokenizer = AutoTokenizer.from_pretrained("iamjamaal/ghana-adr-detection", subfolder="dapt-backbone")
# Load CLF head (production fold: cohort_study)
clf_model = AutoModelForSequenceClassification.from_pretrained(
"iamjamaal/ghana-adr-detection",
subfolder="checkpoints/clf_phase2b_cohort_study/clf_best"
)
# Load NER head (production fold: cohort_study)
ner_model = AutoModelForTokenClassification.from_pretrained(
"iamjamaal/ghana-adr-detection",
subfolder="checkpoints/ner_phase7_cohort_study/ner_best"
)
text = "Patient developed severe oculogyric crisis after starting haloperidol."
# CLF inference
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
logits = clf_model(**inputs).logits
prob_adr = torch.softmax(logits, dim=-1)[0][1].item()
contains_adr = prob_adr >= 0.55
print(f"ADR: {contains_adr} (p={prob_adr:.3f})")Repo Structure
dapt-backbone/ # DAPT backbone (config + safetensors)
checkpoints/
clf_phase2b_case_report/clf_best/ # CLF checkpoint — case_report fold
clf_phase2b_cohort_study/clf_best/ # CLF checkpoint — cohort_study fold ← production
clf_phase2b_fda_newsletter/clf_best/
clf_phase2b_qualitative_interview/clf_best/
ner_phase7_case_report/ner_best/ # NER checkpoint — case_report fold
ner_phase7_cohort_study/ner_best/ # NER checkpoint — cohort_study fold ← production
ner_phase7_fda_newsletter/ner_best/
ner_phase7_qualitative_interview/ner_best/
ner_phase7_qualitative_interview_seed/ner_best/Code & Demo
- Pipeline code: github.com/iamjamaal/ghana-pharmacovigilance-ai
- Live demo: Flask app with single-sentence analysis, batch upload, and Yellow Card–style reporting
Limitations
- Trained on Ghanaian pharmacovigilance sources; performance may degrade on clinical text from other regions.
- NER F1 on
SEVERITYandPATIENT_DEMOis lower thanDRUG/ADRdue to limited annotation density. - Ghanaian Pidgin and dialect constructions improve batch regression scores but may not generalise to other West African Pidgin variants.
Citation
@misc{ghana-adr-2026,
title = {Ghana ADR Detection System},
author = {Nabila, Noah Jamal},
year = {2026},
url = {https://huggingface.co/iamjamaal/ghana-adr-detection}
}License
Code: MIT | Model weights: MIT | Dataset annotations: CC-BY-4.0
