Kossisoroyce commited on
Commit
fe020db
·
verified ·
1 Parent(s): 72d8b2c

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ task_categories:
4
+ - tabular-classification
5
+ language:
6
+ - en
7
+ tags:
8
+ - substandard-falsified-medicines
9
+ - herbal-medicine
10
+ - traditional-medicine
11
+ - contamination
12
+ - adulteration
13
+ - synthetic
14
+ - sub-saharan-africa
15
+ pretty_name: Herbal & Traditional Medicine Safety (SSA)
16
+ size_categories:
17
+ - 10K<n<100K
18
+ configs:
19
+ - config_name: traditional_healer_practice
20
+ data_files: data/herbal_traditional_healer.csv
21
+ default: true
22
+ - config_name: herbal_retail_market
23
+ data_files: data/herbal_retail_market.csv
24
+ - config_name: hospital_herb_drug_interaction
25
+ data_files: data/herbal_hospital_interaction.csv
26
+ ---
27
+
28
+ # Herbal & Traditional Medicine Safety in Sub-Saharan Africa
29
+
30
+ ## Abstract
31
+
32
+ Synthetic dataset modelling herbal/traditional medicine safety including contamination, adulteration, herb-drug interactions, and health outcomes across three settings in SSA. ~80% of Africans use traditional medicine; heavy metal contamination, microbial hazards, and adulteration with synthetic drugs are major safety concerns.
33
+
34
+ ## Parameterization Evidence
35
+
36
+ | Parameter | Value | Source | Year |
37
+ | --- | --- | --- | --- |
38
+ | Heavy metal contamination (Pb, Cd, Hg, As) in herbals | Contamination | Frontiers Pharmacol | 2020 |
39
+ | Adulteration with synthetic drugs, pesticides, microbes | Adulteration | IntechOpen | 2018 |
40
+ | Microbial and heavy metal contamination review | Safety | BMC Complement Med | 2023 |
41
+ | Agranulocytosis, meningitis, multi-organ failure | Harm | PubMed 22843016 | 2012 |
42
+
43
+ ## Validation
44
+
45
+ ![Validation Report](validation_report.png)
46
+
47
+ ## Usage
48
+
49
+ ```python
50
+ from datasets import load_dataset
51
+ ds = load_dataset("electricsheepafrica/herbal-traditional-medicine-safety", "traditional_healer_practice")
52
+ ```
53
+
54
+ ## References
55
+
56
+ 1. Frontiers Pharmacology. Heavy metal contamination in herbal medicines. 2020.
57
+ 2. IntechOpen. Toxicity and safety of herbal medicines in Africa. 2018.
58
+ 3. BMC Complement Med. Microbial and heavy metal contamination review. 2023.
59
+ 4. PubMed 22843016. Contamination and adulteration of HMPs. 2012.
60
+
61
+ ## Citation
62
+
63
+ ```bibtex
64
+ @dataset{electricsheepafrica_herbal_traditional_medicine_safety_2025,
65
+ title={Herbal and Traditional Medicine Safety in Sub-Saharan Africa},
66
+ author={Electric Sheep Africa},
67
+ year={2025},
68
+ publisher={HuggingFace},
69
+ url={https://huggingface.co/datasets/electricsheepafrica/herbal-traditional-medicine-safety}
70
+ }
71
+ ```
72
+
73
+ ## License
74
+
75
+ CC-BY-4.0
data/herbal_hospital_interaction.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/herbal_retail_market.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/herbal_traditional_healer.csv ADDED
The diff for this file is too large to render. See raw diff
 
generate_dataset.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Generate synthetic herbal & traditional medicine safety dataset for SSA.
2
+
3
+ Research-based parameterization:
4
+ - Frontiers Pharmacology (2020): Heavy metal contamination in herbal
5
+ medicines; Pb, Cd, Hg, As detected across multiple countries.
6
+ - IntechOpen: Adulteration with synthetic drugs, pesticides, microbes,
7
+ heavy metals; hepatotoxicity, nephrotoxicity major concerns.
8
+ - BMC Complement Med (2023): Microbial and heavy metal contamination;
9
+ safety concerns linked to global herbal trade increase.
10
+ - PubMed 22843016: Contamination/adulteration causes agranulocytosis,
11
+ meningitis, multi-organ failure, death.
12
+ - WHO: ~80% of African population uses traditional medicine; regulation
13
+ inadequate in most SSA countries.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ from pathlib import Path
19
+
20
+ import numpy as np
21
+ import pandas as pd
22
+
23
+ SEED = 42
24
+ N_PER_SCENARIO = 10_000
25
+
26
+ YEAR_RANGE = np.arange(2010, 2025)
27
+ YEAR_WEIGHTS = np.linspace(0.85, 1.3, len(YEAR_RANGE))
28
+ YEAR_WEIGHTS = YEAR_WEIGHTS / YEAR_WEIGHTS.sum()
29
+
30
+ SCENARIOS = {
31
+ "traditional_healer_practice": {
32
+ "setting_probs": {"rural_healer": 0.40, "urban_healer": 0.25,
33
+ "traditional_market": 0.20, "community": 0.15},
34
+ "product_probs": {"herbal_decoction": 0.30, "herbal_powder": 0.20,
35
+ "plant_extract": 0.15, "mixed_herbal": 0.15,
36
+ "animal_product": 0.10, "mineral_preparation": 0.10},
37
+ "heavy_metal_contamination_pct": 0.30,
38
+ "microbial_contamination_pct": 0.35,
39
+ "adulteration_pct": 0.15,
40
+ "hepatotoxicity_pct": 0.08,
41
+ "regulated_pct": 0.05,
42
+ "concurrent_conventional_pct": 0.25,
43
+ },
44
+ "herbal_retail_market": {
45
+ "setting_probs": {"herbal_shop": 0.35, "pharmacy_herbal_section": 0.20,
46
+ "open_market": 0.25, "online_seller": 0.20},
47
+ "product_probs": {"packaged_herbal": 0.30, "herbal_supplement": 0.20,
48
+ "herbal_tea": 0.15, "herbal_capsule": 0.15,
49
+ "topical_herbal": 0.10, "imported_herbal": 0.10},
50
+ "heavy_metal_contamination_pct": 0.20,
51
+ "microbial_contamination_pct": 0.25,
52
+ "adulteration_pct": 0.20,
53
+ "hepatotoxicity_pct": 0.05,
54
+ "regulated_pct": 0.15,
55
+ "concurrent_conventional_pct": 0.35,
56
+ },
57
+ "hospital_herb_drug_interaction": {
58
+ "setting_probs": {"hospital": 0.35, "primary_care": 0.25,
59
+ "HIV_clinic": 0.20, "oncology_clinic": 0.20},
60
+ "product_probs": {"herbal_decoction": 0.20, "herbal_supplement": 0.20,
61
+ "herbal_capsule": 0.15, "mixed_herbal": 0.15,
62
+ "african_potato": 0.10, "sutherlandia": 0.08,
63
+ "other_traditional": 0.12},
64
+ "heavy_metal_contamination_pct": 0.15,
65
+ "microbial_contamination_pct": 0.15,
66
+ "adulteration_pct": 0.10,
67
+ "hepatotoxicity_pct": 0.10,
68
+ "regulated_pct": 0.10,
69
+ "concurrent_conventional_pct": 0.70,
70
+ },
71
+ }
72
+
73
+ SCENARIO_FILES = {
74
+ "traditional_healer_practice": "herbal_traditional_healer.csv",
75
+ "herbal_retail_market": "herbal_retail_market.csv",
76
+ "hospital_herb_drug_interaction": "herbal_hospital_interaction.csv",
77
+ }
78
+
79
+
80
+ def _choice(rng, prob_map):
81
+ keys = list(prob_map.keys())
82
+ weights = np.array(list(prob_map.values()), dtype=float)
83
+ weights = weights / weights.sum()
84
+ return rng.choice(keys, p=weights)
85
+
86
+
87
+ def _simulate_scenario(name, params, seed):
88
+ rng = np.random.default_rng(seed)
89
+ records = []
90
+
91
+ for idx in range(N_PER_SCENARIO):
92
+ year = int(rng.choice(YEAR_RANGE, p=YEAR_WEIGHTS))
93
+ setting = _choice(rng, params["setting_probs"])
94
+ age = int(np.clip(rng.normal(38, 16), 1, 80))
95
+ sex = rng.choice(["male", "female"], p=[0.40, 0.60])
96
+ product_type = _choice(rng, params["product_probs"])
97
+
98
+ indication = rng.choice(["malaria_fever", "stomach_GI", "sexual_enhancement",
99
+ "HIV_immune_boost", "diabetes", "hypertension",
100
+ "pain_inflammation", "fertility", "skin_disease", "other"],
101
+ p=[0.15, 0.12, 0.10, 0.10, 0.08, 0.08,
102
+ 0.12, 0.08, 0.07, 0.10])
103
+
104
+ # Contamination
105
+ heavy_metal = int(rng.random() < params["heavy_metal_contamination_pct"])
106
+ lead_detected = int(heavy_metal and rng.random() < 0.50)
107
+ mercury_detected = int(heavy_metal and rng.random() < 0.25)
108
+ arsenic_detected = int(heavy_metal and rng.random() < 0.20)
109
+ microbial = int(rng.random() < params["microbial_contamination_pct"])
110
+ aflatoxin = int(microbial and rng.random() < 0.15)
111
+ ecoli = int(microbial and rng.random() < 0.30)
112
+ salmonella = int(microbial and rng.random() < 0.10)
113
+
114
+ # Adulteration
115
+ adulterated = int(rng.random() < params["adulteration_pct"])
116
+ synthetic_drug_added = int(adulterated and rng.random() < 0.40)
117
+ steroid_added = int(adulterated and rng.random() < 0.20)
118
+ sildenafil_added = int(adulterated and indication == "sexual_enhancement" and rng.random() < 0.30)
119
+ pesticide_residue = int(rng.random() < 0.10)
120
+
121
+ # Health effects
122
+ any_contamination = int(heavy_metal or microbial or adulterated)
123
+ hepatotoxicity = int(rng.random() < params["hepatotoxicity_pct"])
124
+ nephrotoxicity = int(heavy_metal and rng.random() < 0.05)
125
+ gi_adverse = int(rng.random() < 0.08)
126
+ skin_reaction = int(rng.random() < 0.04)
127
+ hospitalisation = int((hepatotoxicity or nephrotoxicity) and rng.random() < 0.30)
128
+ death = int(hospitalisation and rng.random() < 0.05)
129
+
130
+ # Herb-drug interactions
131
+ concurrent_conventional = int(rng.random() < params["concurrent_conventional_pct"])
132
+ disclosed_to_doctor = int(concurrent_conventional and rng.random() < 0.20)
133
+ interaction_risk = int(concurrent_conventional and rng.random() < 0.15)
134
+ interaction_type = rng.choice(["CYP_inhibition", "CYP_induction", "pharmacodynamic",
135
+ "absorption", "unknown"],
136
+ p=[0.30, 0.20, 0.25, 0.15, 0.10]) if interaction_risk else "none"
137
+
138
+ # Regulation & quality
139
+ registered_product = int(rng.random() < params["regulated_pct"])
140
+ label_present = int(rng.random() < 0.30)
141
+ dosage_specified = int(label_present and rng.random() < 0.40)
142
+ quality_tested = int(rng.random() < 0.02)
143
+ traditional_healer_registered = int(rng.random() < 0.10)
144
+
145
+ any_adverse = int(hepatotoxicity or nephrotoxicity or gi_adverse or interaction_risk)
146
+
147
+ record = {
148
+ "record_id": f"{name[:3].upper()}-{idx:05d}",
149
+ "scenario": name,
150
+ "year": year,
151
+ "setting": setting,
152
+ "age": age,
153
+ "sex": sex,
154
+ "product_type": product_type,
155
+ "indication": indication,
156
+ "heavy_metal_contaminated": heavy_metal,
157
+ "lead_detected": lead_detected,
158
+ "mercury_detected": mercury_detected,
159
+ "microbial_contaminated": microbial,
160
+ "aflatoxin": aflatoxin,
161
+ "adulterated": adulterated,
162
+ "synthetic_drug_added": synthetic_drug_added,
163
+ "pesticide_residue": pesticide_residue,
164
+ "hepatotoxicity": hepatotoxicity,
165
+ "nephrotoxicity": nephrotoxicity,
166
+ "gi_adverse": gi_adverse,
167
+ "hospitalisation": hospitalisation,
168
+ "death": death,
169
+ "concurrent_conventional": concurrent_conventional,
170
+ "disclosed_to_doctor": disclosed_to_doctor,
171
+ "interaction_risk": interaction_risk,
172
+ "interaction_type": interaction_type,
173
+ "registered_product": registered_product,
174
+ "label_present": label_present,
175
+ "quality_tested": quality_tested,
176
+ "any_adverse": any_adverse,
177
+ }
178
+ records.append(record)
179
+
180
+ return pd.DataFrame(records)
181
+
182
+
183
+ def main():
184
+ output_dir = Path("data")
185
+ output_dir.mkdir(parents=True, exist_ok=True)
186
+ for idx, (name, params) in enumerate(SCENARIOS.items()):
187
+ df = _simulate_scenario(name, params, SEED + idx * 211)
188
+ df.to_csv(output_dir / SCENARIO_FILES[name], index=False)
189
+ print(f"Saved {name} -> {SCENARIO_FILES[name]}")
190
+
191
+
192
+ if __name__ == "__main__":
193
+ main()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ numpy>=1.24
2
+ pandas>=2.0
3
+ matplotlib>=3.7
validate_dataset.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Validate synthetic herbal & traditional medicine safety dataset."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ import matplotlib.pyplot as plt
8
+ import pandas as pd
9
+
10
+ SCENARIO_FILES = {
11
+ "traditional_healer_practice": "herbal_traditional_healer.csv",
12
+ "herbal_retail_market": "herbal_retail_market.csv",
13
+ "hospital_herb_drug_interaction": "herbal_hospital_interaction.csv",
14
+ }
15
+
16
+ COLORS = {"traditional_healer_practice": "#e6550d", "herbal_retail_market": "#756bb1", "hospital_herb_drug_interaction": "#31a354"}
17
+
18
+
19
+ def load_data() -> pd.DataFrame:
20
+ frames = []
21
+ for scenario, filename in SCENARIO_FILES.items():
22
+ df = pd.read_csv(Path("data") / filename)
23
+ frames.append(df)
24
+ return pd.concat(frames, ignore_index=True)
25
+
26
+
27
+ def plot_validation(df: pd.DataFrame, output_path: Path) -> None:
28
+ fig, axes = plt.subplots(4, 2, figsize=(14, 16))
29
+ axes = axes.flatten()
30
+
31
+ cont_cols = ["heavy_metal_contaminated", "microbial_contaminated", "adulterated", "pesticide_residue"]
32
+ cont = df.groupby("scenario")[cont_cols].mean() * 100
33
+ cont.plot(kind="bar", ax=axes[0])
34
+ axes[0].set_title("Contamination & Adulteration (%)")
35
+ axes[0].legend(fontsize=6)
36
+
37
+ health_cols = ["hepatotoxicity", "nephrotoxicity", "gi_adverse", "hospitalisation", "death"]
38
+ health = df.groupby("scenario")[health_cols].mean() * 100
39
+ health.plot(kind="bar", ax=axes[1])
40
+ axes[1].set_title("Health Outcomes (%)")
41
+ axes[1].legend(fontsize=6)
42
+
43
+ prod = df.groupby(["scenario", "product_type"]).size().groupby(level=0).apply(lambda s: s / s.sum())
44
+ prod.unstack().plot(kind="bar", stacked=True, ax=axes[2])
45
+ axes[2].set_title("Product Type Distribution")
46
+ axes[2].legend(fontsize=5)
47
+
48
+ ind = df.groupby(["scenario", "indication"]).size().groupby(level=0).apply(lambda s: s / s.sum())
49
+ ind.unstack().plot(kind="bar", stacked=True, ax=axes[3])
50
+ axes[3].set_title("Indication Distribution")
51
+ axes[3].legend(fontsize=4)
52
+
53
+ int_cols = ["concurrent_conventional", "disclosed_to_doctor", "interaction_risk"]
54
+ intc = df.groupby("scenario")[int_cols].mean() * 100
55
+ intc.plot(kind="bar", ax=axes[4])
56
+ axes[4].set_title("Herb-Drug Interaction Risk (%)")
57
+ axes[4].legend(fontsize=7)
58
+
59
+ hm_cols = ["lead_detected", "mercury_detected"]
60
+ hm = df.groupby("scenario")[hm_cols].mean() * 100
61
+ hm.plot(kind="bar", ax=axes[5])
62
+ axes[5].set_title("Heavy Metal Detection (%)")
63
+ axes[5].legend(fontsize=7)
64
+
65
+ reg_cols = ["registered_product", "label_present", "quality_tested"]
66
+ reg = df.groupby("scenario")[reg_cols].mean() * 100
67
+ reg.plot(kind="bar", ax=axes[6])
68
+ axes[6].set_title("Regulation & Quality (%)")
69
+ axes[6].legend(fontsize=7)
70
+
71
+ adul_cols = ["synthetic_drug_added"]
72
+ adul = df.groupby("scenario")[adul_cols].mean() * 100
73
+ adul.plot(kind="bar", ax=axes[7])
74
+ axes[7].set_title("Synthetic Drug Adulteration (%)")
75
+ axes[7].legend(fontsize=7)
76
+
77
+ plt.tight_layout()
78
+ fig.savefig(output_path, dpi=200)
79
+ plt.close(fig)
80
+
81
+
82
+ def main() -> None:
83
+ df = load_data()
84
+ plot_validation(df, Path("validation_report.png"))
85
+ print("Saved validation_report.png")
86
+
87
+
88
+ if __name__ == "__main__":
89
+ main()
validation_report.png ADDED

Git LFS Details

  • SHA256: ed3882723248343f80fa07455d82691e687f5397690a1d5fb2bd9c5335fbe23d
  • Pointer size: 131 Bytes
  • Size of remote file: 308 kB