Kossisoroyce commited on
Commit
6650617
·
verified ·
1 Parent(s): 2fc3abc

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
+ - antibiotics
10
+ - AMR
11
+ - drug-quality
12
+ - synthetic
13
+ - sub-saharan-africa
14
+ pretty_name: Antibiotic Quality & AMR Acceleration (SSA)
15
+ size_categories:
16
+ - 10K<n<100K
17
+ configs:
18
+ - config_name: community_otc_access
19
+ data_files: data/antibiotic_community.csv
20
+ default: true
21
+ - config_name: hospital_referral
22
+ data_files: data/antibiotic_hospital.csv
23
+ - config_name: cross_border_unregulated
24
+ data_files: data/antibiotic_cross_border.csv
25
+ ---
26
+
27
+ # Antibiotic Quality & AMR Acceleration in Sub-Saharan Africa
28
+
29
+ ## Abstract
30
+
31
+ Synthetic dataset modelling antibiotic quality, substandard/falsified prevalence, antibiotic use patterns, and AMR outcomes across three market settings in SSA. SF antibiotics are neglected drivers of AMR; sulfamethoxazole-trimethoprim, ampicillin, amoxicillin, ciprofloxacin have highest failure rates in Africa.
32
+
33
+ ## Parameterization Evidence
34
+
35
+ | Parameter | Value | Source | Year |
36
+ | --- | --- | --- | --- |
37
+ | SF antibiotics = neglected drivers of AMR | Association | BMJ Global Health | 2022 |
38
+ | Cotrimoxazole highest failure; amoxicillin, cipro follow | Prevalence | CIDRAP / BMJ GH | 2022 |
39
+ | SF antibiotics quantitatively associated with AMR | Mechanism | BMJ Global Health | 2025 |
40
+ | SF antimicrobials in East Africa; evolving problem | SSA data | PLOS ONE | 2024 |
41
+ | API issues most frequent quality problem | Quality | CIDRAP | 2022 |
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/antibiotic-quality-amr", "community_otc_access")
52
+ ```
53
+
54
+ ## References
55
+
56
+ 1. BMJ Global Health. SF antibiotics: neglected drivers of AMR. 2022.
57
+ 2. BMJ Global Health. SF antibiotics associated with AMR prevalence. 2025.
58
+ 3. PLOS ONE. SF antimicrobials in East Africa. 2024.
59
+ 4. Frontiers. Activities to reduce SF antibiotics in Africa. 2025.
60
+
61
+ ## Citation
62
+
63
+ ```bibtex
64
+ @dataset{electricsheepafrica_antibiotic_quality_amr_2025,
65
+ title={Antibiotic Quality and AMR Acceleration in Sub-Saharan Africa},
66
+ author={Electric Sheep Africa},
67
+ year={2025},
68
+ publisher={HuggingFace},
69
+ url={https://huggingface.co/datasets/electricsheepafrica/antibiotic-quality-amr}
70
+ }
71
+ ```
72
+
73
+ ## License
74
+
75
+ CC-BY-4.0
data/antibiotic_community.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/antibiotic_cross_border.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/antibiotic_hospital.csv ADDED
The diff for this file is too large to render. See raw diff
 
generate_dataset.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Generate synthetic antibiotic quality & AMR acceleration dataset for SSA.
2
+
3
+ Research-based parameterization:
4
+ - BMJ Global Health (2022): SF antibiotics are neglected drivers of AMR;
5
+ sulfamethoxazole-trimethoprim highest failure frequency, followed by
6
+ ampicillin, amoxicillin, ciprofloxacin, tetracycline.
7
+ - BMJ Global Health (2025): SF antibiotics quantitatively associated
8
+ with AMR prevalence.
9
+ - PLOS ONE (2024): SF antimicrobials in East Africa; dynamic and
10
+ evolving problem.
11
+ - Frontiers (2025): SF antibiotics particularly prevalent in Africa;
12
+ contributes to AMR burden.
13
+ - CIDRAP: API issues most frequent quality problem; highest failure
14
+ rates in Africa and Asia.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from pathlib import Path
20
+
21
+ import numpy as np
22
+ import pandas as pd
23
+
24
+ SEED = 42
25
+ N_PER_SCENARIO = 10_000
26
+
27
+ YEAR_RANGE = np.arange(2010, 2025)
28
+ YEAR_WEIGHTS = np.linspace(0.85, 1.3, len(YEAR_RANGE))
29
+ YEAR_WEIGHTS = YEAR_WEIGHTS / YEAR_WEIGHTS.sum()
30
+
31
+ SCENARIOS = {
32
+ "community_otc_access": {
33
+ "setting_probs": {"community_pharmacy": 0.30, "drug_shop": 0.30,
34
+ "informal_vendor": 0.25, "market_stall": 0.15},
35
+ "antibiotic_probs": {"amoxicillin": 0.25, "cotrimoxazole": 0.20, "ciprofloxacin": 0.15,
36
+ "metronidazole": 0.12, "doxycycline": 0.10, "ampicillin": 0.08,
37
+ "tetracycline": 0.05, "azithromycin": 0.05},
38
+ "sf_prevalence": 0.30,
39
+ "no_prescription_pct": 0.70,
40
+ "incomplete_course_pct": 0.45,
41
+ "api_failure_pct": 0.25,
42
+ "amr_base_rate": 0.35,
43
+ "quality_tested_pct": 0.02,
44
+ },
45
+ "hospital_referral": {
46
+ "setting_probs": {"district_hospital": 0.35, "regional_hospital": 0.25,
47
+ "tertiary_hospital": 0.20, "private_clinic": 0.20},
48
+ "antibiotic_probs": {"amoxicillin": 0.15, "ceftriaxone": 0.20, "ciprofloxacin": 0.15,
49
+ "gentamicin": 0.10, "metronidazole": 0.10, "azithromycin": 0.10,
50
+ "meropenem": 0.05, "vancomycin": 0.05, "cotrimoxazole": 0.10},
51
+ "sf_prevalence": 0.12,
52
+ "no_prescription_pct": 0.15,
53
+ "incomplete_course_pct": 0.20,
54
+ "api_failure_pct": 0.10,
55
+ "amr_base_rate": 0.40,
56
+ "quality_tested_pct": 0.08,
57
+ },
58
+ "cross_border_unregulated": {
59
+ "setting_probs": {"border_market": 0.35, "unlicensed_shop": 0.25,
60
+ "mobile_vendor": 0.20, "online_seller": 0.20},
61
+ "antibiotic_probs": {"amoxicillin": 0.20, "cotrimoxazole": 0.20, "tetracycline": 0.15,
62
+ "ciprofloxacin": 0.12, "ampicillin": 0.10, "chloramphenicol": 0.08,
63
+ "doxycycline": 0.08, "erythromycin": 0.07},
64
+ "sf_prevalence": 0.42,
65
+ "no_prescription_pct": 0.85,
66
+ "incomplete_course_pct": 0.55,
67
+ "api_failure_pct": 0.35,
68
+ "amr_base_rate": 0.45,
69
+ "quality_tested_pct": 0.01,
70
+ },
71
+ }
72
+
73
+ SCENARIO_FILES = {
74
+ "community_otc_access": "antibiotic_community.csv",
75
+ "hospital_referral": "antibiotic_hospital.csv",
76
+ "cross_border_unregulated": "antibiotic_cross_border.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(25, 18), 0, 80))
95
+ sex = rng.choice(["male", "female"], p=[0.48, 0.52])
96
+
97
+ antibiotic = _choice(rng, params["antibiotic_probs"])
98
+ indication = rng.choice(["respiratory_infection", "UTI", "skin_wound",
99
+ "diarrhoea", "STI", "surgical_prophylaxis", "other"],
100
+ p=[0.25, 0.15, 0.15, 0.15, 0.10, 0.10, 0.10])
101
+ no_prescription = int(rng.random() < params["no_prescription_pct"])
102
+ self_medication = int(no_prescription and rng.random() < 0.70)
103
+ incomplete_course = int(rng.random() < params["incomplete_course_pct"])
104
+ dose_subtherapeutic = int(rng.random() < 0.15)
105
+
106
+ manufacturer = rng.choice(["local_generic", "indian_generic", "chinese_generic",
107
+ "who_prequalified", "branded_originator", "unknown"],
108
+ p=[0.15, 0.30, 0.20, 0.15, 0.10, 0.10])
109
+
110
+ # Quality
111
+ is_sf = int(rng.random() < params["sf_prevalence"])
112
+ is_falsified = int(is_sf and rng.random() < 0.30)
113
+ is_substandard = int(is_sf and not is_falsified)
114
+
115
+ if is_falsified:
116
+ api_pct = float(np.clip(rng.normal(10, 15), 0, 40))
117
+ elif is_substandard:
118
+ api_pct = float(np.clip(rng.normal(60, 15), 20, 84))
119
+ else:
120
+ api_pct = float(np.clip(rng.normal(97, 4), 85, 115))
121
+
122
+ api_failure = int(api_pct < 85)
123
+ dissolution_failure = int(is_sf and rng.random() < 0.40)
124
+ contamination_detected = int(is_sf and rng.random() < 0.05)
125
+ wrong_ingredient = int(is_falsified and rng.random() < 0.15)
126
+
127
+ # AMR outcomes
128
+ sf_amr_mult = 1.8 if is_sf else 1.0
129
+ incomplete_mult = 1.5 if incomplete_course else 1.0
130
+ amr_detected = int(rng.random() < np.clip(
131
+ params["amr_base_rate"] * sf_amr_mult * incomplete_mult, 0, 0.80))
132
+ esbl_producer = int(amr_detected and rng.random() < 0.25)
133
+ mrsa = int(amr_detected and rng.random() < 0.10)
134
+ mdr = int(amr_detected and rng.random() < 0.15)
135
+
136
+ # Clinical outcomes
137
+ treatment_failure = int(rng.random() < np.clip(
138
+ 0.10 * sf_amr_mult * incomplete_mult, 0, 0.40))
139
+ hospitalisation = int(treatment_failure and rng.random() < 0.20)
140
+ sepsis = int(hospitalisation and rng.random() < 0.15)
141
+ death = int(sepsis and rng.random() < 0.10)
142
+ adr = int(contamination_detected or (is_sf and rng.random() < 0.03))
143
+
144
+ # Surveillance
145
+ quality_tested = int(rng.random() < params["quality_tested_pct"])
146
+ culture_sensitivity_done = int(setting in ("district_hospital", "regional_hospital",
147
+ "tertiary_hospital") and rng.random() < 0.15)
148
+ amr_reported = int(culture_sensitivity_done and amr_detected and rng.random() < 0.50)
149
+ antibiogram_available = int(culture_sensitivity_done and rng.random() < 0.30)
150
+
151
+ any_adverse = int(treatment_failure or adr or death)
152
+
153
+ record = {
154
+ "record_id": f"{name[:3].upper()}-{idx:05d}",
155
+ "scenario": name,
156
+ "year": year,
157
+ "setting": setting,
158
+ "age": age,
159
+ "sex": sex,
160
+ "antibiotic": antibiotic,
161
+ "indication": indication,
162
+ "no_prescription": no_prescription,
163
+ "self_medication": self_medication,
164
+ "incomplete_course": incomplete_course,
165
+ "manufacturer": manufacturer,
166
+ "is_substandard_falsified": is_sf,
167
+ "is_falsified": is_falsified,
168
+ "is_substandard": is_substandard,
169
+ "api_pct_label": round(api_pct, 1),
170
+ "api_failure": api_failure,
171
+ "dissolution_failure": dissolution_failure,
172
+ "wrong_ingredient": wrong_ingredient,
173
+ "amr_detected": amr_detected,
174
+ "esbl_producer": esbl_producer,
175
+ "mrsa": mrsa,
176
+ "mdr": mdr,
177
+ "treatment_failure": treatment_failure,
178
+ "hospitalisation": hospitalisation,
179
+ "sepsis": sepsis,
180
+ "death": death,
181
+ "adr": adr,
182
+ "quality_tested": quality_tested,
183
+ "culture_sensitivity_done": culture_sensitivity_done,
184
+ "amr_reported": amr_reported,
185
+ "any_adverse": any_adverse,
186
+ }
187
+ records.append(record)
188
+
189
+ return pd.DataFrame(records)
190
+
191
+
192
+ def main():
193
+ output_dir = Path("data")
194
+ output_dir.mkdir(parents=True, exist_ok=True)
195
+ for idx, (name, params) in enumerate(SCENARIOS.items()):
196
+ df = _simulate_scenario(name, params, SEED + idx * 211)
197
+ df.to_csv(output_dir / SCENARIO_FILES[name], index=False)
198
+ print(f"Saved {name} -> {SCENARIO_FILES[name]}")
199
+
200
+
201
+ if __name__ == "__main__":
202
+ 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,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Validate synthetic antibiotic quality & AMR acceleration 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
+ "community_otc_access": "antibiotic_community.csv",
12
+ "hospital_referral": "antibiotic_hospital.csv",
13
+ "cross_border_unregulated": "antibiotic_cross_border.csv",
14
+ }
15
+
16
+ COLORS = {"community_otc_access": "#e6550d", "hospital_referral": "#756bb1", "cross_border_unregulated": "#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
+ for s in SCENARIO_FILES:
32
+ subset = df[df["scenario"] == s]
33
+ axes[0].hist(subset["api_pct_label"], bins=50, alpha=0.5, color=COLORS[s], label=s, range=(0, 120))
34
+ axes[0].axvline(85, color="red", ls="--", lw=1, label="85% threshold")
35
+ axes[0].set_title("API Content (% of label)")
36
+ axes[0].legend(fontsize=6)
37
+
38
+ sf_cols = ["is_substandard_falsified", "is_falsified", "is_substandard"]
39
+ sf = df.groupby("scenario")[sf_cols].mean() * 100
40
+ sf.plot(kind="bar", ax=axes[1])
41
+ axes[1].set_title("SF Prevalence (%)")
42
+ axes[1].legend(fontsize=7)
43
+
44
+ abx = df.groupby(["scenario", "antibiotic"]).size().groupby(level=0).apply(lambda s: s / s.sum())
45
+ abx.unstack().plot(kind="bar", stacked=True, ax=axes[2])
46
+ axes[2].set_title("Antibiotic Distribution")
47
+ axes[2].legend(fontsize=4)
48
+
49
+ amr_cols = ["amr_detected", "esbl_producer", "mrsa", "mdr"]
50
+ amr = df.groupby("scenario")[amr_cols].mean() * 100
51
+ amr.plot(kind="bar", ax=axes[3])
52
+ axes[3].set_title("AMR Outcomes (%)")
53
+ axes[3].legend(fontsize=7)
54
+
55
+ use_cols = ["no_prescription", "self_medication", "incomplete_course"]
56
+ use = df.groupby("scenario")[use_cols].mean() * 100
57
+ use.plot(kind="bar", ax=axes[4])
58
+ axes[4].set_title("Antibiotic Use Patterns (%)")
59
+ axes[4].legend(fontsize=7)
60
+
61
+ out_cols = ["treatment_failure", "hospitalisation", "sepsis", "death"]
62
+ out = df.groupby("scenario")[out_cols].mean() * 100
63
+ out.plot(kind="bar", ax=axes[5])
64
+ axes[5].set_title("Clinical Outcomes (%)")
65
+ axes[5].legend(fontsize=7)
66
+
67
+ src = df.groupby(["scenario", "manufacturer"]).size().groupby(level=0).apply(lambda s: s / s.sum())
68
+ src.unstack().plot(kind="bar", stacked=True, ax=axes[6])
69
+ axes[6].set_title("Manufacturer Origin")
70
+ axes[6].legend(fontsize=5)
71
+
72
+ qa_cols = ["quality_tested", "culture_sensitivity_done", "amr_reported"]
73
+ qa = df.groupby("scenario")[qa_cols].mean() * 100
74
+ qa.plot(kind="bar", ax=axes[7])
75
+ axes[7].set_title("Surveillance & Testing (%)")
76
+ axes[7].legend(fontsize=7)
77
+
78
+ plt.tight_layout()
79
+ fig.savefig(output_path, dpi=200)
80
+ plt.close(fig)
81
+
82
+
83
+ def main() -> None:
84
+ df = load_data()
85
+ plot_validation(df, Path("validation_report.png"))
86
+ print("Saved validation_report.png")
87
+
88
+
89
+ if __name__ == "__main__":
90
+ main()
validation_report.png ADDED

Git LFS Details

  • SHA256: f26a6bcccec4cccfb402fd79fd6191a738af430fb80ba6a85afb70a3a27acc96
  • Pointer size: 131 Bytes
  • Size of remote file: 351 kB