File size: 11,043 Bytes
1a1870f
abd5633
4d7b304
 
abd5633
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1a1870f
abd5633
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
---
tags:
- synthetic
- synthetic-data
- tabular-classification
- traditional-medicine
- safety
- africa
- healthcare
- pharmacovigilance
task_categories:
- tabular-classification
- other
task_ids:
- tabular-multi-class-classification
language: []
pretty_name: Traditional Medicine Safety Dataset
size_categories:
- 10K<n<100K
---

# Traditional Medicine Safety Dataset

## Description
A synthetic tabular dataset for traditional and complementary medicine safety in African populations. Models safety risks in the most widely used healthcare system on the continent.

## Dataset Statistics

| Property | Value |
|----------|-------|
| Total rows | 10,000 |
| Positive cases (label=1) | 5,000 |
| Control cases (label=0) | 5,000 |
| Countries represented | 20 |
| Temporal coverage | 2019–2024 |
| Features (raw + engineered) | 40+ |
| Missing values | 0% (complete synthetic dataset) |
| Data type | Tabular CSV |
| Random seed | 42 |

## Class Balance & Distribution

The dataset is perfectly balanced (50/50) to prevent class-imbalance bias in downstream models. Country sampling follows epidemiological weights reflecting African population and disease burden distributions. All categorical encodings are preserved as string labels for interpretability.

## Research Gap
80% of Africans use traditional medicine but there is virtually no structured safety data. Herb-drug interactions, hepatotoxicity, practitioner regulation, dosage standardisation, and paediatric vulnerability are all critically underdocumented.

## African Healthcare Context
- 80% use traditional medicine as primary care
- <10% of healers are registered
- Hepatotoxicity is a leading cause of acute liver failure
- Limited integration policies outside South Africa, Ghana, Nigeria
- Bioprospecting concerns complicate research

## Intelligence Sources

| Source | URL |
|--------|-----|
| WHO TM Strategy | https://www.who.int/publications/i/item/9789240033895 |
| African Union | https://au.int/ |
| SA TMC | https://tmc.co.za/ |
| NMEDA Nigeria | https://nmeda.gov.ng/ |

## Columns

| Column | Type | Description |
|--------|------|-------------|
| country | string | Country |
| patient_age | int | Age |
| gender | string | Gender |
| practitioner_type | string | Type |
| years_practicing | int | Experience |
| reason_for_visit | string | Condition |
| herb_type | string | Herb type |
| preparation_method | string | Preparation |
| administration_route | string | Route |
| dosage_known | int | Known |
| frequency_daily | int | Frequency |
| duration_weeks | int | Duration |
| concurrent_western_meds | string | Concurrent |
| disclosure_to_doctor | int | Disclosure |
| adverse_event | string | Event |
| severity | string | Severity |
| time_to_onset_days | int | Onset |
| outcome | string | Outcome |
| hospitalisation_required | int | Hospital |
| previous_adverse_events | int | Prior |
| registration_status | int | Registered |
| quality_control | int | QC |
| label | int | 1 = adverse, 0 = safe |

## Engineered Features

| Feature | Description |
|---------|-------------|
| practitioner_experience_score | Years + registration + QC |
| herb_risk_score | Prep + route + dosage + frequency |
| concurrent_med_risk | Interaction severity |
| care_integration_score | Disclosure - risk |
| patient_vulnerability | Age + prior events |
| event_severity_score | Weighted severity |
| high_risk_traditional | Composite flag |

## Feature Engineering Methodology

Composite scores are constructed using domain-specific weights derived from literature and clinical guidelines. Each score is rounded to 2 decimal places for reproducibility. Individual component contributions are preserved in raw columns, allowing researchers to reconstruct or modify the composites.

**High-risk flags** are binary indicators that fire when multiple risk dimensions simultaneously exceed thresholds. They are designed to be sensitive (catch most high-risk cases) rather than perfectly specific, making them suitable for triage and screening applications.

## Feature Importance Notes

Based on preliminary Random Forest analysis:
- Composite risk scores typically rank in the top-5 most important features
- Country indicator variables provide strong geographic signal
- Temporal features (year, season) capture secular trends
- Interaction effects between infrastructure and patient-level variables are significant
- Always validate feature importance on held-out test sets to avoid leakage

## Supported Use Cases
- Adverse event prediction
- Herb-drug interaction modelling
- Practitioner risk profiling
- QC benchmarking
- Integration policy design
- Paediatric safety
- Regulatory evaluation

## Advanced Modelling Approaches

- **Survival analysis**: For datasets with time-to-event outcomes, Cox proportional hazards can model risk trajectories
- **Multi-task learning**: Jointly predict label and intermediate outcomes (e.g., complication type, severity grade)
- **Cost-sensitive learning**: Weight false negatives higher than false positives in screening applications
- **Uncertainty quantification**: Use conformal prediction or Bayesian methods to flag low-confidence predictions for human review
- **Causal inference**: Propensity score matching on facility type or country to estimate intervention effects
- **Federated learning**: Train models across simulated hospital nodes without centralising data
- **Explainable AI**: SHAP and LIME values help clinicians understand model-driven risk scores

## Usage

```python
from datasets import load_dataset

dataset = load_dataset("electricsheepafrica/africa-traditional-medicine-safety", split="train")
df = dataset.to_pandas()
```

```python
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report, roc_auc_score

df = pd.read_csv("data/processed/traditional_features.csv")
X = df.select_dtypes(include=["int", "float"]).drop(columns=["label"])
y = df["label"]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, stratify=y, random_state=42)
clf = RandomForestClassifier(random_state=42)
clf.fit(X_train, y_train)
print(classification_report(y_test, clf.predict(X_test)))
print("ROC-AUC:", roc_auc_score(y_test, clf.predict_proba(X_test)[:, 1]))
```

## Data Generation
1. Positive cases with adverse events and risky use
2. Controls with safe use and known dosages
3. Leakage filtering for no events
4. Balanced 5,000 + 5,000
5. Experience, risk, and vulnerability features
6. Seed 42

## Preprocessing Recommendations

1. **One-hot encode** categorical columns (country, facility type, region, etc.)
2. **Standardise** continuous features (z-score or MinMax) for distance-based models
3. **Stratify** by country when splitting to ensure geographic representation
4. **Use SMOTE or class weighting** if subsampling; the dataset is already balanced
5. **Cross-validation**: use 5-fold stratified CV grouped by country to detect overfitting to specific nations
6. **Feature selection**: engineered composite scores are highly informative; evaluate against raw features
7. **Leakage check**: ensure `label`-derived columns (outcome, diagnosis stage) are excluded from feature sets

## Baseline Performance Expectations

| Model | Expected Accuracy | Expected ROC-AUC | Notes |
|-------|------------------|------------------|-------|
| Logistic Regression | 0.72–0.78 | 0.78–0.84 | Good interpretability baseline |
| Random Forest | 0.82–0.88 | 0.88–0.93 | Handles non-linear interactions well |
| XGBoost / LightGBM | 0.85–0.91 | 0.91–0.95 | Best tabular performance |
| Neural Network (MLP) | 0.80–0.86 | 0.85–0.90 | Requires scaling; risk of overfitting |
| Linear SVM | 0.74–0.80 | 0.80–0.85 | Sensitive to scaling |

These are approximate ranges on a stratified train/test split (80/20). Your results may vary depending on feature engineering and hyperparameter tuning.

## Statistical Properties

- **Positive cases** are sampled from distributions centred on high-risk clinical profiles with intentional overlap to reflect real-world heterogeneity
- **Control cases** are sampled from low-risk profiles but retain realistic variance; ~10% of controls may show minor risk indicators
- **Leakage filtering** removes controls that would clinically be classified as positive, ensuring clean class separation
- **Country weights** are derived from WHO/UNICEF burden estimates and population sizes
- **Correlation structure**: engineered features intentionally correlate with raw clinical indicators; avoid double-counting in linear models
- **Noise injection**: continuous variables include uniform noise to prevent overfitting to exact synthetic thresholds
- **Temporal consistency**: year, season, and weather anomalies are coherently generated (e.g., drought months correlate with yield reductions)

## Validation Checklist

Before using this dataset for research or production:
- [ ] Verify class balance in your train/test splits
- [ ] Check for unexpected correlations between engineered features and labels
- [ ] Validate that high-risk flags behave as expected on edge cases
- [ ] Confirm country stratification does not dominate model predictions spuriously
- [ ] Test model generalisation by holding out one or more countries entirely

## Limitations
- Synthetic data
- Simplified herb categories
- Binary outcome

## Ethical Considerations
- Respect traditional knowledge systems
- Avoid stigmatising healers or users
- Support integration
- Community consent
- Protect practitioner identities

## Data Governance & Protection

- **Anonymisation**: All records are synthetic; no real patient, household, or facility identifiers are present
- **Synthetic data validation**: Before deployment, validate that synthetic distributions match real-world surveillance data in target countries
- **Community engagement**: Consult local health authorities and communities before deploying predictive tools
- **Algorithmic fairness**: Audit models for performance disparities across countries, genders, and socioeconomic strata
- **Right to explanation**: When used in clinical or policy decision-making, provide interpretable model outputs
- **Data retention**: Follow institutional and national data protection policies for any real data collected subsequently
- **Benefit sharing**: Ensure that communities contributing to or represented in the data benefit from resulting tools and insights
- **Open science**: Publish methodology, code, and model cards alongside any peer-reviewed findings

## Recommended Splits
- Train: 70%
- Validation: 15%
- Test: 15%

## Citation
```bibtex
@dataset{traditional_medicine_africa_2024,
  title = {Traditional Medicine Safety Dataset},
  author = {Electric Sheep Africa},
  year = {2024},
  url = {https://huggingface.co/datasets/electricsheepafrica/africa-traditional-medicine-safety}
}
```

## License
CC BY-SA 4.0

## Contact
electricsheepafrica@proton.me

## Version History
- v1.0 — Initial release