Ontlametse Kossisoroyce commited on
Commit
4d8a13f
·
0 Parent(s):

Duplicate from electricsheepafrica/oral-health-dental-disease

Browse files

Co-authored-by: Kossiso Udodi Royce <Kossisoroyce@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.avro filter=lfs diff=lfs merge=lfs -text
4
+ *.bin filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
7
+ *.ftz filter=lfs diff=lfs merge=lfs -text
8
+ *.gz filter=lfs diff=lfs merge=lfs -text
9
+ *.h5 filter=lfs diff=lfs merge=lfs -text
10
+ *.joblib filter=lfs diff=lfs merge=lfs -text
11
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
13
+ *.mds filter=lfs diff=lfs merge=lfs -text
14
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
+ *.model filter=lfs diff=lfs merge=lfs -text
16
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
17
+ *.npy filter=lfs diff=lfs merge=lfs -text
18
+ *.npz filter=lfs diff=lfs merge=lfs -text
19
+ *.onnx filter=lfs diff=lfs merge=lfs -text
20
+ *.ot filter=lfs diff=lfs merge=lfs -text
21
+ *.parquet filter=lfs diff=lfs merge=lfs -text
22
+ *.pb filter=lfs diff=lfs merge=lfs -text
23
+ *.pickle filter=lfs diff=lfs merge=lfs -text
24
+ *.pkl filter=lfs diff=lfs merge=lfs -text
25
+ *.pt filter=lfs diff=lfs merge=lfs -text
26
+ *.pth filter=lfs diff=lfs merge=lfs -text
27
+ *.rar filter=lfs diff=lfs merge=lfs -text
28
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
29
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
31
+ *.tar filter=lfs diff=lfs merge=lfs -text
32
+ *.tflite filter=lfs diff=lfs merge=lfs -text
33
+ *.tgz filter=lfs diff=lfs merge=lfs -text
34
+ *.wasm filter=lfs diff=lfs merge=lfs -text
35
+ *.xz filter=lfs diff=lfs merge=lfs -text
36
+ *.zip filter=lfs diff=lfs merge=lfs -text
37
+ *.zst filter=lfs diff=lfs merge=lfs -text
38
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
39
+ # Audio files - uncompressed
40
+ *.pcm filter=lfs diff=lfs merge=lfs -text
41
+ *.sam filter=lfs diff=lfs merge=lfs -text
42
+ *.raw filter=lfs diff=lfs merge=lfs -text
43
+ # Audio files - compressed
44
+ *.aac filter=lfs diff=lfs merge=lfs -text
45
+ *.flac filter=lfs diff=lfs merge=lfs -text
46
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
47
+ *.ogg filter=lfs diff=lfs merge=lfs -text
48
+ *.wav filter=lfs diff=lfs merge=lfs -text
49
+ # Image files - uncompressed
50
+ *.bmp filter=lfs diff=lfs merge=lfs -text
51
+ *.gif filter=lfs diff=lfs merge=lfs -text
52
+ *.png filter=lfs diff=lfs merge=lfs -text
53
+ *.tiff filter=lfs diff=lfs merge=lfs -text
54
+ # Image files - compressed
55
+ *.jpg filter=lfs diff=lfs merge=lfs -text
56
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
57
+ *.webp filter=lfs diff=lfs merge=lfs -text
58
+ # Video files - compressed
59
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
60
+ *.webm filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ task_categories:
4
+ - tabular-classification
5
+ language:
6
+ - en
7
+ tags:
8
+ - healthcare
9
+ - oral-health
10
+ - dental-caries
11
+ - periodontal
12
+ - noma
13
+ - dentistry
14
+ - sub-saharan-africa
15
+ - lmic
16
+ pretty_name: "Oral Health & Dental Disease (Caries, Periodontal, Noma, Treatment Access)"
17
+ size_categories:
18
+ - 10K<n<100K
19
+ configs:
20
+ - config_name: dental_clinic
21
+ data_files: data/oral_dental_clinic.csv
22
+ - config_name: district_hospital
23
+ data_files: data/oral_district_hospital.csv
24
+ default: true
25
+ - config_name: rural_health_centre
26
+ data_files: data/oral_rural_health_centre.csv
27
+ ---
28
+
29
+ # Oral Health & Dental Disease Dataset
30
+
31
+ ## Abstract
32
+
33
+ This dataset provides **30,000 simulated oral health records** (10,000 per scenario) from sub-Saharan Africa. Each record contains 40+ variables including dental caries, DMFT score, periodontal disease, noma, oral cancer, treatment access, barriers, and outcomes. Three settings: dental clinic (23% care-seeking), district hospital (16%), and rural health centre (8%).
34
+
35
+ ## 1. Introduction
36
+
37
+ Africa bears the largest global increase in oral diseases (WHO 2024). The six major conditions are dental caries, periodontal disease, oral cancer, oral HIV manifestations, noma, and cleft lip/palate. DMFT scores average ~4 in SSA adults. Untreated caries is the most prevalent condition. The dentist-to-population ratio is <1:100,000 in many SSA countries. Noma (cancrum oris) persists in extreme poverty with 70-90% CFR if untreated.
38
+
39
+ **This dataset is entirely simulated. It must not be used for clinical decision-making.**
40
+
41
+ ## 2. Methodology
42
+
43
+ ### 2.1 Parameterization
44
+
45
+ | Parameter | Value | Source |
46
+ | --- | --- | --- |
47
+ | Dental caries prevalence | ~55% | WHO 2022 |
48
+ | Untreated caries | ~80% of caries | WHO Africa 2024 |
49
+ | DMFT (age 12) | ~2.6 | PubMed 2021 |
50
+ | Periodontal disease | ~17% | WHO 2022 |
51
+ | Dentist ratio | <1:100K | WHO Africa |
52
+ | Noma in malnourished children | ~0.5% | WHO Africa |
53
+ | Extraction dominates treatment | ~50% | BMC PH 2021 |
54
+
55
+ ### 2.2 Scenario Design
56
+
57
+ | Scenario | Dentist | Restorative | X-ray | Care-Seeking |
58
+ | --- | --- | --- | --- | --- |
59
+ | Dental clinic | Yes | Yes | Yes | 23% |
60
+ | District hospital | Yes | No | No | 16% |
61
+ | Rural health centre | No | No | No | 8% |
62
+
63
+ ## 3. Schema
64
+
65
+ | Column | Type | Description |
66
+ | --- | --- | --- |
67
+ | id | int | Unique identifier |
68
+ | age_years | int | Age |
69
+ | sex | categorical | M / F |
70
+ | dental_caries | binary | Dental caries |
71
+ | dmft_score | int | DMFT score |
72
+ | untreated_caries | binary | Untreated caries |
73
+ | periodontal_disease | binary | Periodontal disease |
74
+ | periodontal_severity | categorical | mild / moderate / severe |
75
+ | tooth_loss | int | Teeth lost |
76
+ | oral_cancer | binary | Oral cancer |
77
+ | noma | binary | Noma (cancrum oris) |
78
+ | dental_pain | binary | Dental pain |
79
+ | dental_abscess | binary | Abscess |
80
+ | sugary_diet | binary | High sugar diet |
81
+ | fluoride_toothpaste | binary | Fluoride paste use |
82
+ | brushing_frequency | categorical | never / occasional / once / twice daily |
83
+ | sought_dental_care | binary | Sought care |
84
+ | treatment_received | categorical | extraction / filling / scaling / antibiotics / pain_relief / traditional |
85
+ | barrier_to_care | categorical | cost / distance / no_dentist / fear / not_severe / traditional |
86
+ | pain_resolved | binary | Pain resolved |
87
+
88
+ ## 4. Validation
89
+
90
+ <p align="center">
91
+ <img src="validation_report.png" alt="Validation Report" width="100%">
92
+ </p>
93
+
94
+ Key validation checks:
95
+
96
+ - **Caries**: ~55% prevalence ✓
97
+ - **Untreated**: ~80% of caries ✓
98
+ - **Care-seeking gradient**: 23% → 16% → 8% ✓
99
+ - **Extraction dominates** treatment ✓
100
+ - **DMFT mean ~4** ✓
101
+ - **Barriers**: Cost and distance dominant ✓
102
+
103
+ ## 5. Usage
104
+
105
+ ```python
106
+ from datasets import load_dataset
107
+ dataset = load_dataset("electricsheepafrica/oral-health-dental-disease", "district_hospital")
108
+ df = dataset["train"].to_pandas()
109
+ ```
110
+
111
+ ## 6. Limitations
112
+
113
+ - **Simulated**: Not from real dental registries.
114
+ - **No imaging**: No radiographic data.
115
+ - **No clinical exam**: No periodontal probing depths.
116
+ - **Simplified**: No detailed orthodontic data.
117
+ - **No fluoride levels**: No water fluoride concentrations.
118
+
119
+ ## 7. References
120
+
121
+ 1. WHO Africa (2024). Oral health in the African Region.
122
+ 2. WHO (2022). Global Oral Health Status Report.
123
+ 3. PubMed (2021). DMFT in East Africa.
124
+ 4. BMC Public Health (2021). Dental caries in adults SSA.
125
+ 5. WHO Africa. Noma (cancrum oris).
126
+ 6. PubMed (2015). Oral health South Africa.
127
+ 7. PubMed (2021). Dental caries prevalence East Africa.
128
+
129
+ ## Citation
130
+
131
+ ```bibtex
132
+ @dataset{esa_oral_health_2025,
133
+ title={Oral Health and Dental Disease Dataset},
134
+ author={Electric Sheep Africa},
135
+ year={2025},
136
+ publisher={Hugging Face},
137
+ url={https://huggingface.co/datasets/electricsheepafrica/oral-health-dental-disease}
138
+ }
139
+ ```
140
+
141
+ ## License
142
+
143
+ [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/)
data/oral_dental_clinic.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/oral_district_hospital.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/oral_rural_health_centre.csv ADDED
The diff for this file is too large to render. See raw diff
 
generate_dataset.py ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Literature-Informed Oral Health & Dental Disease Dataset
4
+ =========================================================
5
+
6
+ Generates realistic synthetic records of oral health patients in
7
+ sub-Saharan Africa, including dental caries, periodontal disease,
8
+ noma, oral cancer, treatment access, and outcomes.
9
+
10
+ References (web-searched):
11
+ -----------
12
+ [1] WHO Africa 2024. Africa has largest global increase in
13
+ oral diseases. 6 major conditions: caries, periodontal,
14
+ oral cancer, oral HIV, noma, cleft lip/palate.
15
+ [2] WHO 2022. Global Oral Health Status Report. Untreated
16
+ caries is most prevalent condition globally.
17
+ [3] PubMed 2021. DMFT in East Africa: 2.57 at age 12,
18
+ 4.04 at age 15. High caries burden.
19
+ [4] BMC Public Health 2021. Dental caries in adults SSA.
20
+ Limited access to dental care.
21
+ [5] WHO Africa. Noma (cancrum oris) persists in extreme
22
+ poverty. CFR 70-90% untreated. Disfiguring.
23
+ [6] PubMed 2015. Oral health South Africa: DMFT trends,
24
+ national surveys, fluoride.
25
+ [7] Dentist ratio in SSA: <1 per 100,000 population in
26
+ many countries. WHO target 1:7500.
27
+ """
28
+
29
+ import numpy as np
30
+ import pandas as pd
31
+ import argparse
32
+ import os
33
+
34
+ SCENARIOS = {
35
+ 'dental_clinic': {
36
+ 'description': 'Urban dental clinic with dentist, basic '
37
+ 'restorative/extraction capability, X-ray '
38
+ '(e.g., university dental clinics Nairobi, '
39
+ 'Lagos, Addis Ababa)',
40
+ 'dentist_available': True,
41
+ 'restorative_available': True,
42
+ 'xray_available': True,
43
+ 'fluoride_programme': True,
44
+ 'treatment_mod': 1.0,
45
+ },
46
+ 'district_hospital': {
47
+ 'description': 'District hospital with dental officer, '
48
+ 'extraction only, no restorative '
49
+ '(e.g., district hospitals Tanzania, Malawi)',
50
+ 'dentist_available': True,
51
+ 'restorative_available': False,
52
+ 'xray_available': False,
53
+ 'fluoride_programme': False,
54
+ 'treatment_mod': 0.6,
55
+ },
56
+ 'rural_health_centre': {
57
+ 'description': 'Rural health centre, no dental professional, '
58
+ 'basic pain relief, referral '
59
+ '(e.g., rural CHCs DRC, Niger, Chad)',
60
+ 'dentist_available': False,
61
+ 'restorative_available': False,
62
+ 'xray_available': False,
63
+ 'fluoride_programme': False,
64
+ 'treatment_mod': 0.2,
65
+ },
66
+ }
67
+
68
+
69
+ def generate_dataset(n=10000, seed=42, scenario='district_hospital'):
70
+ rng = np.random.default_rng(seed)
71
+ sc = SCENARIOS[scenario]
72
+
73
+ records = []
74
+
75
+ for idx in range(n):
76
+ rec = {'id': idx + 1}
77
+
78
+ # ── 1. Demographics ──
79
+ rec['age_years'] = max(2, min(80, int(rng.normal(28, 18))))
80
+ rec['sex'] = rng.choice(['M', 'F'], p=[0.48, 0.52])
81
+ rec['child'] = 1 if rec['age_years'] < 18 else 0
82
+ rec['education'] = rng.choice(
83
+ ['none', 'primary', 'secondary', 'tertiary'],
84
+ p=[0.20, 0.35, 0.35, 0.10])
85
+ rec['urban'] = 1 if rng.random() < 0.40 else 0
86
+
87
+ # ── 2. Risk factors ──
88
+ rec['tobacco_use'] = 0
89
+ if rec['age_years'] >= 15:
90
+ rec['tobacco_use'] = 1 if rng.random() < 0.12 else 0
91
+ rec['sugary_diet'] = 1 if rng.random() < 0.55 else 0
92
+ rec['fluoride_toothpaste'] = 1 if rng.random() < (0.50 if rec['urban'] else 0.20) else 0
93
+ rec['brushing_frequency'] = rng.choice(
94
+ ['never', 'occasional', 'once_daily', 'twice_daily'],
95
+ p=[0.15, 0.25, 0.40, 0.20])
96
+ rec['hiv_positive'] = 1 if rng.random() < 0.06 else 0
97
+ rec['diabetes'] = 0
98
+ if rec['age_years'] >= 30:
99
+ rec['diabetes'] = 1 if rng.random() < 0.08 else 0
100
+ rec['malnutrition'] = 0
101
+ if rec['child']:
102
+ rec['malnutrition'] = 1 if rng.random() < 0.15 else 0
103
+
104
+ # ── 3. Dental caries [2][3] ──
105
+ caries_prob = 0.40
106
+ if rec['sugary_diet']:
107
+ caries_prob += 0.15
108
+ if rec['brushing_frequency'] in ('never', 'occasional'):
109
+ caries_prob += 0.10
110
+ if not rec['fluoride_toothpaste']:
111
+ caries_prob += 0.05
112
+ rec['dental_caries'] = 1 if rng.random() < min(caries_prob, 0.80) else 0
113
+
114
+ rec['dmft_score'] = 0
115
+ if rec['dental_caries']:
116
+ if rec['child']:
117
+ rec['dmft_score'] = max(0, min(20, int(rng.exponential(3))))
118
+ else:
119
+ rec['dmft_score'] = max(0, min(32, int(rng.exponential(5))))
120
+
121
+ rec['untreated_caries'] = 0
122
+ if rec['dental_caries']:
123
+ rec['untreated_caries'] = 1 if rng.random() < 0.80 else 0
124
+
125
+ # ── 4. Periodontal disease ──
126
+ rec['periodontal_disease'] = 0
127
+ if rec['age_years'] >= 15:
128
+ perio_prob = 0.20
129
+ if rec['tobacco_use']:
130
+ perio_prob *= 1.5
131
+ if rec['diabetes']:
132
+ perio_prob *= 1.5
133
+ if rec['hiv_positive']:
134
+ perio_prob *= 1.3
135
+ rec['periodontal_disease'] = 1 if rng.random() < min(perio_prob, 0.60) else 0
136
+
137
+ rec['periodontal_severity'] = 'none'
138
+ if rec['periodontal_disease']:
139
+ rec['periodontal_severity'] = rng.choice(
140
+ ['mild', 'moderate', 'severe'],
141
+ p=[0.30, 0.45, 0.25])
142
+
143
+ rec['tooth_loss'] = 0
144
+ if rec['periodontal_severity'] == 'severe' or rec['dmft_score'] > 8:
145
+ rec['tooth_loss'] = max(0, min(20, int(rng.exponential(3))))
146
+
147
+ # ── 5. Other conditions [1][5] ──
148
+ rec['oral_cancer'] = 0
149
+ if rec['age_years'] >= 40:
150
+ oc_prob = 0.005
151
+ if rec['tobacco_use']:
152
+ oc_prob *= 3
153
+ rec['oral_cancer'] = 1 if rng.random() < oc_prob else 0
154
+
155
+ rec['noma'] = 0
156
+ if rec['child'] and rec['malnutrition']:
157
+ rec['noma'] = 1 if rng.random() < 0.005 else 0
158
+
159
+ rec['oral_hiv_manifestation'] = 0
160
+ if rec['hiv_positive']:
161
+ rec['oral_hiv_manifestation'] = 1 if rng.random() < 0.30 else 0
162
+
163
+ rec['cleft_lip_palate'] = 0
164
+ if rec['age_years'] < 10:
165
+ rec['cleft_lip_palate'] = 1 if rng.random() < 0.002 else 0
166
+
167
+ rec['dental_trauma'] = 0
168
+ if rec['age_years'] < 18:
169
+ rec['dental_trauma'] = 1 if rng.random() < 0.05 else 0
170
+
171
+ rec['dental_abscess'] = 0
172
+ if rec['untreated_caries']:
173
+ rec['dental_abscess'] = 1 if rng.random() < 0.10 else 0
174
+
175
+ rec['dental_pain'] = 0
176
+ if rec['dental_caries'] or rec['periodontal_disease'] or rec['dental_abscess']:
177
+ rec['dental_pain'] = 1 if rng.random() < 0.60 else 0
178
+
179
+ # ── 6. Treatment access [4][7] ──
180
+ rec['sought_dental_care'] = 0
181
+ if rec['dental_pain'] or rec['dental_abscess']:
182
+ rec['sought_dental_care'] = 1 if rng.random() < (0.50 * sc['treatment_mod'] + 0.10) else 0
183
+
184
+ rec['treatment_received'] = 'none'
185
+ if rec['sought_dental_care']:
186
+ if sc['restorative_available']:
187
+ rec['treatment_received'] = rng.choice(
188
+ ['extraction', 'filling', 'scaling', 'antibiotics', 'pain_relief'],
189
+ p=[0.35, 0.25, 0.10, 0.15, 0.15])
190
+ elif sc['dentist_available']:
191
+ rec['treatment_received'] = rng.choice(
192
+ ['extraction', 'antibiotics', 'pain_relief'],
193
+ p=[0.50, 0.25, 0.25])
194
+ else:
195
+ rec['treatment_received'] = rng.choice(
196
+ ['pain_relief', 'traditional_remedy', 'referral'],
197
+ p=[0.40, 0.35, 0.25])
198
+
199
+ rec['barrier_to_care'] = 'none'
200
+ if not rec['sought_dental_care'] and rec['dental_pain']:
201
+ rec['barrier_to_care'] = rng.choice(
202
+ ['cost', 'distance', 'no_dentist', 'fear',
203
+ 'not_severe_enough', 'traditional_preference'],
204
+ p=[0.25, 0.20, 0.20, 0.15, 0.10, 0.10])
205
+
206
+ rec['fluoride_varnish'] = 0
207
+ if rec['child'] and sc['fluoride_programme']:
208
+ rec['fluoride_varnish'] = 1 if rng.random() < 0.20 else 0
209
+
210
+ rec['oral_health_education'] = 0
211
+ if rec['sought_dental_care'] and sc['dentist_available']:
212
+ rec['oral_health_education'] = 1 if rng.random() < 0.30 else 0
213
+
214
+ # ── 7. Outcome ──
215
+ rec['pain_resolved'] = 0
216
+ if rec['treatment_received'] not in ('none', 'referral'):
217
+ rec['pain_resolved'] = 1 if rng.random() < 0.70 else 0
218
+
219
+ rec['complication'] = 0
220
+ if rec['dental_abscess'] and rec['treatment_received'] == 'none':
221
+ rec['complication'] = 1 if rng.random() < 0.15 else 0
222
+
223
+ rec['noma_disfigurement'] = 0
224
+ if rec['noma']:
225
+ rec['noma_disfigurement'] = 1 if rng.random() < 0.80 else 0
226
+
227
+ records.append(rec)
228
+
229
+ df = pd.DataFrame(records)
230
+
231
+ print(f"\n{'='*65}")
232
+ print(f"Oral Health — {scenario} (n={n}, seed={seed})")
233
+ print(f"{'='*65}")
234
+ print(f"\n Dental caries: {df['dental_caries'].mean()*100:.1f}%")
235
+ print(f" Untreated: {df['untreated_caries'].mean()*100:.1f}%")
236
+ print(f" Periodontal: {df['periodontal_disease'].mean()*100:.1f}%")
237
+ print(f" Dental pain: {df['dental_pain'].mean()*100:.1f}%")
238
+ print(f" Sought care: {df['sought_dental_care'].mean()*100:.1f}%")
239
+ print(f" Mean DMFT: {df[df['dental_caries']==1]['dmft_score'].mean():.1f}")
240
+
241
+ return df
242
+
243
+
244
+ if __name__ == '__main__':
245
+ parser = argparse.ArgumentParser(
246
+ description='Generate oral health dataset')
247
+ parser.add_argument('--scenario', type=str, default='district_hospital',
248
+ choices=list(SCENARIOS.keys()))
249
+ parser.add_argument('--n', type=int, default=10000)
250
+ parser.add_argument('--seed', type=int, default=42)
251
+ parser.add_argument('--output', type=str, default=None)
252
+ parser.add_argument('--all-scenarios', action='store_true')
253
+ args = parser.parse_args()
254
+
255
+ os.makedirs('data', exist_ok=True)
256
+
257
+ if args.all_scenarios:
258
+ for sc_name in SCENARIOS:
259
+ df = generate_dataset(n=args.n, seed=args.seed, scenario=sc_name)
260
+ out = os.path.join('data', f'oral_{sc_name}.csv')
261
+ df.to_csv(out, index=False)
262
+ print(f" -> Saved to {out}\n")
263
+ else:
264
+ df = generate_dataset(n=args.n, seed=args.seed, scenario=args.scenario)
265
+ out = args.output or os.path.join('data', f'oral_{args.scenario}.csv')
266
+ df.to_csv(out, index=False)
267
+ print(f" -> Saved to {out}")
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,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Validation & Diagnostic Visualization for Oral Health Dataset."""
3
+
4
+ import pandas as pd
5
+ import numpy as np
6
+ import matplotlib.pyplot as plt
7
+ import os
8
+
9
+ SCENARIOS = ['dental_clinic', 'district_hospital', 'rural_health_centre']
10
+
11
+
12
+ def load_scenarios(data_dir='data'):
13
+ dfs = {}
14
+ for sc in SCENARIOS:
15
+ path = os.path.join(data_dir, f'oral_{sc}.csv')
16
+ if os.path.exists(path):
17
+ dfs[sc] = pd.read_csv(path)
18
+ return dfs
19
+
20
+
21
+ def make_report(dfs, output='validation_report.png'):
22
+ fig, axes = plt.subplots(4, 2, figsize=(16, 22))
23
+ fig.suptitle('Oral Health & Dental Disease — Validation Report',
24
+ fontsize=16, fontweight='bold', y=0.98)
25
+ df = dfs.get('district_hospital', list(dfs.values())[0])
26
+ colors = ['#2ecc71', '#f39c12', '#e74c3c']
27
+
28
+ ax = axes[0, 0]
29
+ conditions = ['dental_caries', 'untreated_caries', 'periodontal_disease',
30
+ 'dental_pain', 'dental_abscess', 'tooth_loss']
31
+ c_labels = ['Caries', 'Untreated', 'Periodontal', 'Pain', 'Abscess', 'Tooth Loss']
32
+ vals = [df[c].mean() * 100 if c != 'tooth_loss' else (df[c] > 0).mean() * 100 for c in conditions]
33
+ ax.bar(range(6), vals, color='#e74c3c', alpha=0.7)
34
+ ax.set_xticks(range(6))
35
+ ax.set_xticklabels(c_labels, fontsize=8, rotation=15)
36
+ for i, v in enumerate(vals):
37
+ ax.text(i, v + 0.5, f'{v:.0f}%', ha='center', fontsize=8)
38
+ ax.set_ylabel('Prevalence (%)')
39
+ ax.set_title('Oral Disease Burden (caries most prevalent)')
40
+
41
+ ax = axes[0, 1]
42
+ x = np.arange(len(SCENARIOS))
43
+ care = [dfs[sc]['sought_dental_care'].mean() * 100 for sc in SCENARIOS if sc in dfs]
44
+ ax.bar(x, care, color=colors, alpha=0.8)
45
+ ax.set_xticks(x)
46
+ ax.set_xticklabels(['Dental Clinic', 'District', 'Rural'], fontsize=9)
47
+ for i, v in enumerate(care):
48
+ ax.text(i, v + 0.5, f'{v:.0f}%', ha='center', fontsize=10)
49
+ ax.set_ylabel('Care-Seeking Rate (%)')
50
+ ax.set_title('Dental Care Access (<1 dentist/100K in SSA)')
51
+
52
+ ax = axes[1, 0]
53
+ caries_pts = df[df['dental_caries'] == 1]
54
+ if len(caries_pts) > 0:
55
+ ax.hist(caries_pts['dmft_score'], bins=20, color='#3498db', alpha=0.7, edgecolor='white')
56
+ ax.set_xlabel('DMFT Score')
57
+ ax.set_title('DMFT Distribution (mean ~4 in SSA)')
58
+
59
+ ax = axes[1, 1]
60
+ treatments = df[df['treatment_received'] != 'none']['treatment_received'].value_counts()
61
+ if len(treatments) > 0:
62
+ t_colors = ['#e74c3c', '#f39c12', '#3498db', '#2ecc71', '#9b59b6', '#e67e22']
63
+ ax.pie(treatments.values,
64
+ labels=[s.replace('_', ' ').title() for s in treatments.index],
65
+ autopct='%1.0f%%', colors=t_colors[:len(treatments)],
66
+ startangle=90, textprops={'fontsize': 8})
67
+ ax.set_title('Treatment Type (extraction dominates)')
68
+
69
+ ax = axes[2, 0]
70
+ barriers = df[df['barrier_to_care'] != 'none']['barrier_to_care'].value_counts()
71
+ if len(barriers) > 0:
72
+ ax.barh(range(len(barriers)), barriers.values, color='#3498db', alpha=0.8)
73
+ ax.set_yticks(range(len(barriers)))
74
+ ax.set_yticklabels([s.replace('_', ' ').title() for s in barriers.index], fontsize=8)
75
+ ax.set_xlabel('Count')
76
+ ax.set_title('Barriers to Dental Care')
77
+
78
+ ax = axes[2, 1]
79
+ risks = ['sugary_diet', 'tobacco_use', 'fluoride_toothpaste', 'diabetes']
80
+ r_labels = ['Sugary Diet', 'Tobacco', 'Fluoride Paste', 'Diabetes']
81
+ caries_y = df[df['dental_caries'] == 1]
82
+ caries_n = df[df['dental_caries'] == 0]
83
+ if len(caries_y) > 0 and len(caries_n) > 0:
84
+ vc = [caries_y[r].mean() * 100 for r in risks]
85
+ vn = [caries_n[r].mean() * 100 for r in risks]
86
+ w = 0.3
87
+ ax.bar(np.arange(4) - w/2, vc, w, label='Caries', color='#e74c3c', alpha=0.8)
88
+ ax.bar(np.arange(4) + w/2, vn, w, label='No Caries', color='#2ecc71', alpha=0.8)
89
+ ax.set_xticks(np.arange(4))
90
+ ax.set_xticklabels(r_labels, fontsize=8)
91
+ ax.set_ylabel('Prevalence (%)')
92
+ ax.set_title('Risk Factors vs Caries')
93
+ ax.legend(fontsize=8)
94
+
95
+ ax = axes[3, 0]
96
+ children = df[df['child'] == 1]
97
+ adults = df[df['child'] == 0]
98
+ cats = ['Caries', 'Pain', 'Sought Care']
99
+ if len(children) > 0 and len(adults) > 0:
100
+ vc = [children['dental_caries'].mean()*100, children['dental_pain'].mean()*100,
101
+ children['sought_dental_care'].mean()*100]
102
+ va = [adults['dental_caries'].mean()*100, adults['dental_pain'].mean()*100,
103
+ adults['sought_dental_care'].mean()*100]
104
+ w = 0.3
105
+ ax.bar(np.arange(3) - w/2, vc, w, label='Children', color='#3498db', alpha=0.8)
106
+ ax.bar(np.arange(3) + w/2, va, w, label='Adults', color='#e74c3c', alpha=0.8)
107
+ ax.set_xticks(np.arange(3))
108
+ ax.set_xticklabels(cats, fontsize=9)
109
+ ax.set_ylabel('Rate (%)')
110
+ ax.set_title('Children vs Adults')
111
+ ax.legend(fontsize=8)
112
+
113
+ ax = axes[3, 1]
114
+ brush = df['brushing_frequency'].value_counts()
115
+ b_order = ['never', 'occasional', 'once_daily', 'twice_daily']
116
+ vals = [brush.get(b, 0) for b in b_order]
117
+ ax.bar(range(4), vals, color=['#e74c3c', '#f39c12', '#3498db', '#2ecc71'], alpha=0.8)
118
+ ax.set_xticks(range(4))
119
+ ax.set_xticklabels(['Never', 'Occasional', 'Once/Day', 'Twice/Day'], fontsize=8)
120
+ ax.set_ylabel('Count')
121
+ ax.set_title('Brushing Frequency')
122
+
123
+ plt.tight_layout(rect=[0, 0, 1, 0.97])
124
+ plt.savefig(output, dpi=150, bbox_inches='tight')
125
+ print(f'Saved validation report to {output}')
126
+ plt.close()
127
+
128
+
129
+ if __name__ == '__main__':
130
+ dfs = load_scenarios()
131
+ if dfs:
132
+ make_report(dfs)
validation_report.png ADDED

Git LFS Details

  • SHA256: 37c0e2453293043e4ff5a381e17bdc32ff835bb7bd229336da5d7b7082bff2dc
  • Pointer size: 131 Bytes
  • Size of remote file: 274 kB