Datasets:
Tasks:
Tabular Classification
Formats:
csv
Languages:
English
Size:
10K - 100K
Tags:
disability
intellectual-disability
developmental-delays
early-intervention
special-education
Synthetic
License:
Upload folder using huggingface_hub
Browse files- README.md +73 -0
- data/intdis_district.csv +0 -0
- data/intdis_rural.csv +0 -0
- data/intdis_urban.csv +0 -0
- generate_dataset.py +180 -0
- requirements.txt +3 -0
- validate_dataset.py +88 -0
- validation_report.png +3 -0
README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- disability
|
| 9 |
+
- intellectual-disability
|
| 10 |
+
- developmental-delays
|
| 11 |
+
- early-intervention
|
| 12 |
+
- special-education
|
| 13 |
+
- synthetic
|
| 14 |
+
- sub-saharan-africa
|
| 15 |
+
pretty_name: Intellectual Disability & Developmental Delays (SSA)
|
| 16 |
+
size_categories:
|
| 17 |
+
- 10K<n<100K
|
| 18 |
+
configs:
|
| 19 |
+
- config_name: urban_specialist_centre
|
| 20 |
+
data_files: data/intdis_urban.csv
|
| 21 |
+
default: true
|
| 22 |
+
- config_name: district_integrated
|
| 23 |
+
data_files: data/intdis_district.csv
|
| 24 |
+
- config_name: rural_community
|
| 25 |
+
data_files: data/intdis_rural.csv
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
# Intellectual Disability & Developmental Delays in Sub-Saharan Africa
|
| 29 |
+
|
| 30 |
+
## Abstract
|
| 31 |
+
|
| 32 |
+
Synthetic dataset modelling intellectual disability causes, diagnosis, early intervention, education, and family support across three service tiers in SSA. Prevalence 1-3% globally, higher in LMICs; perinatal asphyxia, malnutrition, infections are major causes.
|
| 33 |
+
|
| 34 |
+
## Parameterization Evidence
|
| 35 |
+
|
| 36 |
+
| Parameter | Value | Source | Year |
|
| 37 |
+
| --- | --- | --- | --- |
|
| 38 |
+
| ID prevalence 1-3% globally; higher in LMICs | Burden | WHO | 2023 |
|
| 39 |
+
| Causes: asphyxia, malaria, meningitis, malnutrition | Aetiology | Lancet | 2022 |
|
| 40 |
+
| <0.1 psychiatrists per 100K in most SSA | Workforce | WHO Atlas | 2020 |
|
| 41 |
+
|
| 42 |
+
## Validation
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
|
| 46 |
+
## Usage
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from datasets import load_dataset
|
| 50 |
+
ds = load_dataset("electricsheepafrica/intellectual-disability-developmental", "urban_specialist_centre")
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## References
|
| 54 |
+
|
| 55 |
+
1. WHO. Intellectual disability fact sheet. 2023.
|
| 56 |
+
2. Lancet. Developmental disabilities in SSA. 2022.
|
| 57 |
+
3. WHO Mental Health Atlas. 2020.
|
| 58 |
+
|
| 59 |
+
## Citation
|
| 60 |
+
|
| 61 |
+
```bibtex
|
| 62 |
+
@dataset{electricsheepafrica_intellectual_disability_2025,
|
| 63 |
+
title={Intellectual Disability and Developmental Delays in Sub-Saharan Africa},
|
| 64 |
+
author={Electric Sheep Africa},
|
| 65 |
+
year={2025},
|
| 66 |
+
publisher={HuggingFace},
|
| 67 |
+
url={https://huggingface.co/datasets/electricsheepafrica/intellectual-disability-developmental}
|
| 68 |
+
}
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## License
|
| 72 |
+
|
| 73 |
+
CC-BY-4.0
|
data/intdis_district.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/intdis_rural.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/intdis_urban.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generate_dataset.py
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Generate synthetic intellectual disability & developmental delays dataset for SSA.
|
| 2 |
+
|
| 3 |
+
Research-based parameterization:
|
| 4 |
+
- WHO: Intellectual disability prevalence 1-3% globally; higher in
|
| 5 |
+
LMICs due to malnutrition, infections, birth complications.
|
| 6 |
+
- Lancet: In SSA, causes include perinatal asphyxia, malaria,
|
| 7 |
+
meningitis, malnutrition, iodine deficiency, consanguinity.
|
| 8 |
+
- Few specialized services; <0.1 psychiatrists per 100K in most SSA;
|
| 9 |
+
stigma major barrier; institutionalization declining but community
|
| 10 |
+
services lacking.
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
from __future__ import annotations
|
| 14 |
+
|
| 15 |
+
from pathlib import Path
|
| 16 |
+
|
| 17 |
+
import numpy as np
|
| 18 |
+
import pandas as pd
|
| 19 |
+
|
| 20 |
+
SEED = 42
|
| 21 |
+
N_PER_SCENARIO = 10_000
|
| 22 |
+
|
| 23 |
+
YEAR_RANGE = np.arange(2010, 2025)
|
| 24 |
+
YEAR_WEIGHTS = np.linspace(0.85, 1.3, len(YEAR_RANGE))
|
| 25 |
+
YEAR_WEIGHTS = YEAR_WEIGHTS / YEAR_WEIGHTS.sum()
|
| 26 |
+
|
| 27 |
+
SCENARIOS = {
|
| 28 |
+
"urban_specialist_centre": {
|
| 29 |
+
"setting_probs": {"specialist_centre": 0.30, "paediatric_hospital": 0.25,
|
| 30 |
+
"special_school": 0.25, "private_clinic": 0.20},
|
| 31 |
+
"cause_probs": {"perinatal_asphyxia": 0.20, "genetic_chromosomal": 0.15,
|
| 32 |
+
"meningitis_encephalitis": 0.12, "malnutrition": 0.10,
|
| 33 |
+
"iodine_deficiency": 0.05, "congenital_infection": 0.08,
|
| 34 |
+
"trauma": 0.05, "unknown": 0.25},
|
| 35 |
+
"diagnosis_rate": 0.40,
|
| 36 |
+
"early_intervention_pct": 0.15,
|
| 37 |
+
"special_education_pct": 0.30,
|
| 38 |
+
"family_support_pct": 0.20,
|
| 39 |
+
},
|
| 40 |
+
"district_integrated": {
|
| 41 |
+
"setting_probs": {"district_hospital": 0.30, "health_centre": 0.25,
|
| 42 |
+
"community_programme": 0.25, "inclusive_school": 0.20},
|
| 43 |
+
"cause_probs": {"perinatal_asphyxia": 0.25, "malnutrition": 0.15,
|
| 44 |
+
"meningitis_encephalitis": 0.12, "malaria_cerebral": 0.10,
|
| 45 |
+
"iodine_deficiency": 0.08, "congenital_infection": 0.08,
|
| 46 |
+
"genetic_chromosomal": 0.07, "unknown": 0.15},
|
| 47 |
+
"diagnosis_rate": 0.15,
|
| 48 |
+
"early_intervention_pct": 0.05,
|
| 49 |
+
"special_education_pct": 0.10,
|
| 50 |
+
"family_support_pct": 0.08,
|
| 51 |
+
},
|
| 52 |
+
"rural_community": {
|
| 53 |
+
"setting_probs": {"health_post": 0.30, "community_home": 0.30,
|
| 54 |
+
"traditional_healer": 0.15, "cbr_programme": 0.25},
|
| 55 |
+
"cause_probs": {"perinatal_asphyxia": 0.25, "malnutrition": 0.20,
|
| 56 |
+
"meningitis_encephalitis": 0.10, "malaria_cerebral": 0.10,
|
| 57 |
+
"iodine_deficiency": 0.10, "congenital_infection": 0.05,
|
| 58 |
+
"genetic_chromosomal": 0.05, "unknown": 0.15},
|
| 59 |
+
"diagnosis_rate": 0.05,
|
| 60 |
+
"early_intervention_pct": 0.02,
|
| 61 |
+
"special_education_pct": 0.03,
|
| 62 |
+
"family_support_pct": 0.03,
|
| 63 |
+
},
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
SCENARIO_FILES = {
|
| 67 |
+
"urban_specialist_centre": "intdis_urban.csv",
|
| 68 |
+
"district_integrated": "intdis_district.csv",
|
| 69 |
+
"rural_community": "intdis_rural.csv",
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
def _choice(rng, prob_map):
|
| 74 |
+
keys = list(prob_map.keys())
|
| 75 |
+
weights = np.array(list(prob_map.values()), dtype=float)
|
| 76 |
+
weights = weights / weights.sum()
|
| 77 |
+
return rng.choice(keys, p=weights)
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def _simulate_scenario(name, params, seed):
|
| 81 |
+
rng = np.random.default_rng(seed)
|
| 82 |
+
records = []
|
| 83 |
+
|
| 84 |
+
for idx in range(N_PER_SCENARIO):
|
| 85 |
+
year = int(rng.choice(YEAR_RANGE, p=YEAR_WEIGHTS))
|
| 86 |
+
setting = _choice(rng, params["setting_probs"])
|
| 87 |
+
age = int(np.clip(rng.lognormal(np.log(8), 0.8), 0, 40))
|
| 88 |
+
sex = rng.choice(["male", "female"], p=[0.55, 0.45])
|
| 89 |
+
|
| 90 |
+
cause = _choice(rng, params["cause_probs"])
|
| 91 |
+
severity = rng.choice(["mild", "moderate", "severe", "profound"],
|
| 92 |
+
p=[0.40, 0.30, 0.20, 0.10])
|
| 93 |
+
comorbid_epilepsy = int(rng.random() < 0.20)
|
| 94 |
+
comorbid_cerebral_palsy = int(rng.random() < 0.12)
|
| 95 |
+
comorbid_autism = int(rng.random() < 0.05)
|
| 96 |
+
age_at_concern = int(np.clip(rng.exponential(2), 0, 10))
|
| 97 |
+
|
| 98 |
+
# Diagnosis & assessment
|
| 99 |
+
formally_diagnosed = int(rng.random() < params["diagnosis_rate"])
|
| 100 |
+
developmental_screening = int(rng.random() < params["diagnosis_rate"] * 1.5)
|
| 101 |
+
iq_assessed = int(formally_diagnosed and rng.random() < 0.30)
|
| 102 |
+
age_at_diagnosis = int(np.clip(age_at_concern + rng.exponential(3), 1, 15)) if formally_diagnosed else 0
|
| 103 |
+
|
| 104 |
+
# Interventions
|
| 105 |
+
early_intervention = int(age < 6 and rng.random() < params["early_intervention_pct"])
|
| 106 |
+
speech_therapy = int(rng.random() < 0.05)
|
| 107 |
+
occupational_therapy = int(rng.random() < 0.04)
|
| 108 |
+
behavioural_support = int(rng.random() < 0.05)
|
| 109 |
+
medication = int(comorbid_epilepsy and rng.random() < 0.40)
|
| 110 |
+
|
| 111 |
+
# Education
|
| 112 |
+
school_enrolled = int(age >= 5 and rng.random() < (0.60 if formally_diagnosed else 0.30))
|
| 113 |
+
special_education = int(school_enrolled and rng.random() < params["special_education_pct"])
|
| 114 |
+
inclusive_education = int(school_enrolled and not special_education and rng.random() < 0.15)
|
| 115 |
+
dropped_out = int(school_enrolled and rng.random() < 0.30)
|
| 116 |
+
|
| 117 |
+
# Family & social
|
| 118 |
+
family_support = int(rng.random() < params["family_support_pct"])
|
| 119 |
+
caregiver_burden = int(rng.random() < 0.60)
|
| 120 |
+
caregiver_mental_health = int(caregiver_burden and rng.random() < 0.30)
|
| 121 |
+
stigma_experienced = int(rng.random() < 0.45)
|
| 122 |
+
social_isolation = int(stigma_experienced and rng.random() < 0.50)
|
| 123 |
+
abuse_neglect_risk = int(rng.random() < 0.15)
|
| 124 |
+
|
| 125 |
+
# Barriers
|
| 126 |
+
financial_barrier = int(rng.random() < 0.55)
|
| 127 |
+
awareness_barrier = int(rng.random() < 0.50)
|
| 128 |
+
no_services_available = int(rng.random() < 0.45)
|
| 129 |
+
|
| 130 |
+
# Outcomes
|
| 131 |
+
daily_living_skills = rng.choice(["independent", "supervised", "dependent"],
|
| 132 |
+
p=[0.20, 0.40, 0.40] if severity in ("mild", "moderate")
|
| 133 |
+
else [0.05, 0.25, 0.70])
|
| 134 |
+
community_participation = int(rng.random() < (0.35 if family_support else 0.15))
|
| 135 |
+
|
| 136 |
+
record = {
|
| 137 |
+
"record_id": f"{name[:3].upper()}-{idx:05d}",
|
| 138 |
+
"scenario": name,
|
| 139 |
+
"year": year,
|
| 140 |
+
"setting": setting,
|
| 141 |
+
"age": age,
|
| 142 |
+
"sex": sex,
|
| 143 |
+
"cause": cause,
|
| 144 |
+
"severity": severity,
|
| 145 |
+
"comorbid_epilepsy": comorbid_epilepsy,
|
| 146 |
+
"comorbid_cerebral_palsy": comorbid_cerebral_palsy,
|
| 147 |
+
"formally_diagnosed": formally_diagnosed,
|
| 148 |
+
"developmental_screening": developmental_screening,
|
| 149 |
+
"early_intervention": early_intervention,
|
| 150 |
+
"speech_therapy": speech_therapy,
|
| 151 |
+
"medication": medication,
|
| 152 |
+
"school_enrolled": school_enrolled,
|
| 153 |
+
"special_education": special_education,
|
| 154 |
+
"inclusive_education": inclusive_education,
|
| 155 |
+
"dropped_out": dropped_out,
|
| 156 |
+
"family_support": family_support,
|
| 157 |
+
"caregiver_burden": caregiver_burden,
|
| 158 |
+
"stigma_experienced": stigma_experienced,
|
| 159 |
+
"abuse_neglect_risk": abuse_neglect_risk,
|
| 160 |
+
"financial_barrier": financial_barrier,
|
| 161 |
+
"no_services_available": no_services_available,
|
| 162 |
+
"daily_living_skills": daily_living_skills,
|
| 163 |
+
"community_participation": community_participation,
|
| 164 |
+
}
|
| 165 |
+
records.append(record)
|
| 166 |
+
|
| 167 |
+
return pd.DataFrame(records)
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
def main():
|
| 171 |
+
output_dir = Path("data")
|
| 172 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 173 |
+
for idx, (name, params) in enumerate(SCENARIOS.items()):
|
| 174 |
+
df = _simulate_scenario(name, params, SEED + idx * 211)
|
| 175 |
+
df.to_csv(output_dir / SCENARIO_FILES[name], index=False)
|
| 176 |
+
print(f"Saved {name} -> {SCENARIO_FILES[name]}")
|
| 177 |
+
|
| 178 |
+
|
| 179 |
+
if __name__ == "__main__":
|
| 180 |
+
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,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Validate synthetic intellectual disability & developmental delays 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 |
+
"urban_specialist_centre": "intdis_urban.csv",
|
| 12 |
+
"district_integrated": "intdis_district.csv",
|
| 13 |
+
"rural_community": "intdis_rural.csv",
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
COLORS = {"urban_specialist_centre": "#e6550d", "district_integrated": "#756bb1", "rural_community": "#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 |
+
dx_cols = ["formally_diagnosed", "developmental_screening", "early_intervention"]
|
| 32 |
+
dx = df.groupby("scenario")[dx_cols].mean() * 100
|
| 33 |
+
dx.plot(kind="bar", ax=axes[0])
|
| 34 |
+
axes[0].set_title("Diagnosis & Early Intervention (%)")
|
| 35 |
+
axes[0].legend(fontsize=7)
|
| 36 |
+
|
| 37 |
+
cau = df.groupby(["scenario", "cause"]).size().groupby(level=0).apply(lambda s: s / s.sum())
|
| 38 |
+
cau.unstack().plot(kind="bar", stacked=True, ax=axes[1])
|
| 39 |
+
axes[1].set_title("Cause Distribution")
|
| 40 |
+
axes[1].legend(fontsize=4)
|
| 41 |
+
|
| 42 |
+
edu_cols = ["school_enrolled", "special_education", "inclusive_education", "dropped_out"]
|
| 43 |
+
edu = df.groupby("scenario")[edu_cols].mean() * 100
|
| 44 |
+
edu.plot(kind="bar", ax=axes[2])
|
| 45 |
+
axes[2].set_title("Education (%)")
|
| 46 |
+
axes[2].legend(fontsize=6)
|
| 47 |
+
|
| 48 |
+
soc_cols = ["family_support", "caregiver_burden", "stigma_experienced", "abuse_neglect_risk"]
|
| 49 |
+
soc = df.groupby("scenario")[soc_cols].mean() * 100
|
| 50 |
+
soc.plot(kind="bar", ax=axes[3])
|
| 51 |
+
axes[3].set_title("Family & Social (%)")
|
| 52 |
+
axes[3].legend(fontsize=6)
|
| 53 |
+
|
| 54 |
+
sev = df.groupby(["scenario", "severity"]).size().groupby(level=0).apply(lambda s: s / s.sum())
|
| 55 |
+
sev.unstack().plot(kind="bar", stacked=True, ax=axes[4])
|
| 56 |
+
axes[4].set_title("Severity Distribution")
|
| 57 |
+
axes[4].legend(fontsize=7)
|
| 58 |
+
|
| 59 |
+
bar_cols = ["financial_barrier", "no_services_available"]
|
| 60 |
+
bar = df.groupby("scenario")[bar_cols].mean() * 100
|
| 61 |
+
bar.plot(kind="bar", ax=axes[5])
|
| 62 |
+
axes[5].set_title("Barriers (%)")
|
| 63 |
+
axes[5].legend(fontsize=7)
|
| 64 |
+
|
| 65 |
+
com_cols = ["comorbid_epilepsy", "comorbid_cerebral_palsy"]
|
| 66 |
+
com = df.groupby("scenario")[com_cols].mean() * 100
|
| 67 |
+
com.plot(kind="bar", ax=axes[6])
|
| 68 |
+
axes[6].set_title("Comorbidities (%)")
|
| 69 |
+
axes[6].legend(fontsize=7)
|
| 70 |
+
|
| 71 |
+
dls = df.groupby(["scenario", "daily_living_skills"]).size().groupby(level=0).apply(lambda s: s / s.sum())
|
| 72 |
+
dls.unstack().plot(kind="bar", stacked=True, ax=axes[7])
|
| 73 |
+
axes[7].set_title("Daily Living Skills")
|
| 74 |
+
axes[7].legend(fontsize=7)
|
| 75 |
+
|
| 76 |
+
plt.tight_layout()
|
| 77 |
+
fig.savefig(output_path, dpi=200)
|
| 78 |
+
plt.close(fig)
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def main() -> None:
|
| 82 |
+
df = load_data()
|
| 83 |
+
plot_validation(df, Path("validation_report.png"))
|
| 84 |
+
print("Saved validation_report.png")
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
if __name__ == "__main__":
|
| 88 |
+
main()
|
validation_report.png
ADDED
|
Git LFS Details
|