Datasets:
Upload folder using huggingface_hub
Browse files- README.md +92 -0
- data/asbestos_mining_community.csv +0 -0
- data/asbestos_rural_roofing.csv +0 -0
- data/asbestos_urban_construction.csv +0 -0
- generate_dataset.py +223 -0
- requirements.txt +3 -0
- validate_dataset.py +90 -0
- validation_report.png +3 -0
README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- tabular-classification
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- environmental-health
|
| 9 |
+
- asbestos
|
| 10 |
+
- mesothelioma
|
| 11 |
+
- occupational-health
|
| 12 |
+
- lung-cancer
|
| 13 |
+
- synthetic
|
| 14 |
+
- sub-saharan-africa
|
| 15 |
+
pretty_name: Asbestos Exposure & Mesothelioma (SSA)
|
| 16 |
+
size_categories:
|
| 17 |
+
- 10K<n<100K
|
| 18 |
+
configs:
|
| 19 |
+
- config_name: former_mining_community
|
| 20 |
+
data_files: data/asbestos_mining_community.csv
|
| 21 |
+
default: true
|
| 22 |
+
- config_name: urban_construction
|
| 23 |
+
data_files: data/asbestos_urban_construction.csv
|
| 24 |
+
- config_name: rural_asbestos_roofing
|
| 25 |
+
data_files: data/asbestos_rural_roofing.csv
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
# Asbestos Exposure & Mesothelioma in Sub-Saharan Africa
|
| 29 |
+
|
| 30 |
+
## Abstract
|
| 31 |
+
|
| 32 |
+
Synthetic dataset modelling asbestos exposure pathways, fibre types, and health outcomes (mesothelioma, asbestosis, lung cancer) across three settings in SSA. South Africa was a global leader in asbestos production; Wagner (1960) discovered the mesothelioma link there. WHO Africa reports asbestos use continues despite warnings, particularly in roofing, construction, and brake linings. Latency period is 20-50 years.
|
| 33 |
+
|
| 34 |
+
### Scenarios
|
| 35 |
+
|
| 36 |
+
- **Former Mining Community**: South Africa-type communities near closed asbestos mines with high crocidolite/amosite exposure.
|
| 37 |
+
- **Urban Construction**: Cities with ongoing chrysotile use in building materials and demolition.
|
| 38 |
+
- **Rural Asbestos Roofing**: Widespread asbestos-cement roofing in rural areas with chronic low-level exposure.
|
| 39 |
+
|
| 40 |
+
## Parameterization Evidence
|
| 41 |
+
|
| 42 |
+
| Parameter | Value | Source | Year |
|
| 43 |
+
| --- | --- | --- | --- |
|
| 44 |
+
| Asbestos causes mesothelioma, asbestosis, lung cancer | Health effects | WHO Fact Sheet; IARC Group 1 | 2023 |
|
| 45 |
+
| SA global leader in asbestos production; ban in 2002 | History | ScienceDirect; asbestos.com | 2004 |
|
| 46 |
+
| Wagner (1960) discovered mesothelioma-asbestos link in SA | Discovery | PMC1522094 | 2005 |
|
| 47 |
+
| Asbestos use continues in Africa despite warnings | Ongoing use | WHO Africa | 2023 |
|
| 48 |
+
| Eastern SSA: substantial increases in asbestos lung cancer | GBD trend | PMC12573932 (GBD 2021) | 2024 |
|
| 49 |
+
| Mesothelioma mortality lower than expected in SA due to HIV | Co-morbidity | PubMed 21422006 | 2011 |
|
| 50 |
+
| Latency period 20-50 years | Disease natural history | WHO | 2023 |
|
| 51 |
+
|
| 52 |
+
## Validation
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
|
| 56 |
+
## Usage
|
| 57 |
+
|
| 58 |
+
```python
|
| 59 |
+
from datasets import load_dataset
|
| 60 |
+
ds = load_dataset("electricsheepafrica/asbestos-mesothelioma", "former_mining_community")
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
## Limitations
|
| 64 |
+
|
| 65 |
+
- Synthetic data; not for clinical decision-making.
|
| 66 |
+
- Latency modelling simplified; real exposure-disease relationships are complex.
|
| 67 |
+
- Does not capture legacy contamination mapping or remediation status.
|
| 68 |
+
|
| 69 |
+
## References
|
| 70 |
+
|
| 71 |
+
1. WHO. Asbestos Fact Sheet. 2023.
|
| 72 |
+
2. WHO Africa. Asbestos use continues in Africa. 2023.
|
| 73 |
+
3. PMC1522094. Asbestos-related disease in South Africa. 2005.
|
| 74 |
+
4. Wagner JC. Diffuse pleural mesothelioma and asbestos exposure in SA. *Br J Ind Med*, 1960.
|
| 75 |
+
5. PMC12573932. Global burden of lung cancer from occupational asbestos (GBD 2021). 2024.
|
| 76 |
+
6. PubMed 21422006. Mesothelioma mortality trends in South Africa 1995-2007. 2011.
|
| 77 |
+
|
| 78 |
+
## Citation
|
| 79 |
+
|
| 80 |
+
```bibtex
|
| 81 |
+
@dataset{electricsheepafrica_asbestos_mesothelioma_2025,
|
| 82 |
+
title={Asbestos Exposure and Mesothelioma in Sub-Saharan Africa},
|
| 83 |
+
author={Electric Sheep Africa},
|
| 84 |
+
year={2025},
|
| 85 |
+
publisher={HuggingFace},
|
| 86 |
+
url={https://huggingface.co/datasets/electricsheepafrica/asbestos-mesothelioma}
|
| 87 |
+
}
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## License
|
| 91 |
+
|
| 92 |
+
CC-BY-4.0
|
data/asbestos_mining_community.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/asbestos_rural_roofing.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/asbestos_urban_construction.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
generate_dataset.py
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Generate synthetic asbestos exposure & mesothelioma dataset for SSA.
|
| 2 |
+
|
| 3 |
+
Research-based parameterization:
|
| 4 |
+
- WHO Africa: Asbestos use continues despite warnings; used in roofing,
|
| 5 |
+
insulation, cement pipes, brake linings across SSA.
|
| 6 |
+
- WHO Fact Sheet: Asbestos causes lung/larynx/ovary cancer, mesothelioma,
|
| 7 |
+
asbestosis. All forms carcinogenic (IARC Group 1).
|
| 8 |
+
- South Africa: Global leader in asbestos production; crocidolite/amosite/
|
| 9 |
+
chrysotile all mined. Wagner (1960) discovered mesothelioma link.
|
| 10 |
+
- PMC1522094: Social production of asbestos-related disease in SA;
|
| 11 |
+
asbestosis, lung cancer, mesothelioma since early 1900s.
|
| 12 |
+
- PMC12573932 (GBD 2021): Eastern SSA saw substantial increases in lung
|
| 13 |
+
cancer from occupational asbestos exposure.
|
| 14 |
+
- SA banned asbestos mining in 2002; many SSA countries still use.
|
| 15 |
+
- Latency period: 20-50 years from exposure to mesothelioma.
|
| 16 |
+
- Mesothelioma mortality rates lower than expected in SA due to HIV
|
| 17 |
+
reducing life expectancy (PubMed 21422006).
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
from __future__ import annotations
|
| 21 |
+
|
| 22 |
+
from pathlib import Path
|
| 23 |
+
|
| 24 |
+
import numpy as np
|
| 25 |
+
import pandas as pd
|
| 26 |
+
|
| 27 |
+
SEED = 42
|
| 28 |
+
N_PER_SCENARIO = 10_000
|
| 29 |
+
|
| 30 |
+
YEAR_RANGE = np.arange(2010, 2025)
|
| 31 |
+
YEAR_WEIGHTS = np.linspace(0.85, 1.3, len(YEAR_RANGE))
|
| 32 |
+
YEAR_WEIGHTS = YEAR_WEIGHTS / YEAR_WEIGHTS.sum()
|
| 33 |
+
|
| 34 |
+
SCENARIOS = {
|
| 35 |
+
# Former mining communities (South Africa type)
|
| 36 |
+
"former_mining_community": {
|
| 37 |
+
"setting_probs": {"rural_mining": 0.50, "peri_urban": 0.30, "urban": 0.20},
|
| 38 |
+
"exposure_probs": {"mining_direct": 0.30, "mining_environmental": 0.25,
|
| 39 |
+
"construction": 0.15, "roofing_materials": 0.15,
|
| 40 |
+
"household_exposure": 0.10, "brake_lining": 0.05},
|
| 41 |
+
"fibre_type_probs": {"crocidolite": 0.35, "amosite": 0.25, "chrysotile": 0.30, "mixed": 0.10},
|
| 42 |
+
"exposure_intensity_mean": 3.5, # fibres/mL
|
| 43 |
+
"exposure_years_mean": 15,
|
| 44 |
+
"mesothelioma_rate": 0.008,
|
| 45 |
+
"asbestosis_prev": 0.12,
|
| 46 |
+
"lung_cancer_rate": 0.005,
|
| 47 |
+
"ban_in_place": 0.70,
|
| 48 |
+
"medical_surveillance": 0.15,
|
| 49 |
+
},
|
| 50 |
+
# Urban construction/demolition (ongoing use)
|
| 51 |
+
"urban_construction": {
|
| 52 |
+
"setting_probs": {"urban": 0.45, "peri_urban": 0.35, "industrial": 0.20},
|
| 53 |
+
"exposure_probs": {"construction": 0.30, "roofing_materials": 0.25,
|
| 54 |
+
"demolition": 0.15, "insulation": 0.10,
|
| 55 |
+
"household_exposure": 0.10, "brake_lining": 0.10},
|
| 56 |
+
"fibre_type_probs": {"chrysotile": 0.55, "amosite": 0.15, "crocidolite": 0.10, "mixed": 0.20},
|
| 57 |
+
"exposure_intensity_mean": 1.5,
|
| 58 |
+
"exposure_years_mean": 10,
|
| 59 |
+
"mesothelioma_rate": 0.003,
|
| 60 |
+
"asbestosis_prev": 0.06,
|
| 61 |
+
"lung_cancer_rate": 0.003,
|
| 62 |
+
"ban_in_place": 0.30,
|
| 63 |
+
"medical_surveillance": 0.05,
|
| 64 |
+
},
|
| 65 |
+
# Rural asbestos roofing communities
|
| 66 |
+
"rural_asbestos_roofing": {
|
| 67 |
+
"setting_probs": {"rural": 0.55, "peri_urban": 0.30, "urban": 0.15},
|
| 68 |
+
"exposure_probs": {"roofing_materials": 0.40, "household_exposure": 0.25,
|
| 69 |
+
"water_pipes": 0.10, "construction": 0.10,
|
| 70 |
+
"environmental": 0.10, "brake_lining": 0.05},
|
| 71 |
+
"fibre_type_probs": {"chrysotile": 0.60, "mixed": 0.20, "amosite": 0.10, "crocidolite": 0.10},
|
| 72 |
+
"exposure_intensity_mean": 0.5,
|
| 73 |
+
"exposure_years_mean": 20,
|
| 74 |
+
"mesothelioma_rate": 0.002,
|
| 75 |
+
"asbestosis_prev": 0.03,
|
| 76 |
+
"lung_cancer_rate": 0.002,
|
| 77 |
+
"ban_in_place": 0.15,
|
| 78 |
+
"medical_surveillance": 0.02,
|
| 79 |
+
},
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
SCENARIO_FILES = {
|
| 83 |
+
"former_mining_community": "asbestos_mining_community.csv",
|
| 84 |
+
"urban_construction": "asbestos_urban_construction.csv",
|
| 85 |
+
"rural_asbestos_roofing": "asbestos_rural_roofing.csv",
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def _choice(rng, prob_map):
|
| 90 |
+
keys = list(prob_map.keys())
|
| 91 |
+
weights = np.array(list(prob_map.values()), dtype=float)
|
| 92 |
+
weights = weights / weights.sum()
|
| 93 |
+
return rng.choice(keys, p=weights)
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def _simulate_scenario(name, params, seed):
|
| 97 |
+
rng = np.random.default_rng(seed)
|
| 98 |
+
records = []
|
| 99 |
+
|
| 100 |
+
for idx in range(N_PER_SCENARIO):
|
| 101 |
+
year = int(rng.choice(YEAR_RANGE, p=YEAR_WEIGHTS))
|
| 102 |
+
setting = _choice(rng, params["setting_probs"])
|
| 103 |
+
age = int(np.clip(rng.normal(45, 15), 18, 80))
|
| 104 |
+
sex = rng.choice(["male", "female"], p=[0.65, 0.35])
|
| 105 |
+
|
| 106 |
+
exposure_type = _choice(rng, params["exposure_probs"])
|
| 107 |
+
fibre_type = _choice(rng, params["fibre_type_probs"])
|
| 108 |
+
is_occupational = int(exposure_type in ("mining_direct", "construction", "demolition", "brake_lining"))
|
| 109 |
+
is_environmental = int(exposure_type in ("mining_environmental", "household_exposure",
|
| 110 |
+
"roofing_materials", "environmental", "water_pipes"))
|
| 111 |
+
|
| 112 |
+
exposure_years = int(np.clip(
|
| 113 |
+
rng.normal(params["exposure_years_mean"], 8), 0, 45))
|
| 114 |
+
exposure_intensity = float(np.clip(
|
| 115 |
+
rng.lognormal(np.log(max(params["exposure_intensity_mean"], 0.1)), 0.8),
|
| 116 |
+
0.01, 50))
|
| 117 |
+
if not is_occupational:
|
| 118 |
+
exposure_intensity *= 0.2
|
| 119 |
+
|
| 120 |
+
cumulative_exposure = float(exposure_intensity * exposure_years)
|
| 121 |
+
latency_years = int(np.clip(rng.normal(30, 10), 10, 50))
|
| 122 |
+
time_since_first_exposure = int(np.clip(rng.normal(20, 10), 0, 50))
|
| 123 |
+
|
| 124 |
+
ppe_use = int(is_occupational and rng.random() < 0.10)
|
| 125 |
+
if ppe_use:
|
| 126 |
+
exposure_intensity *= 0.3
|
| 127 |
+
|
| 128 |
+
# Fibre potency (crocidolite > amosite > chrysotile)
|
| 129 |
+
potency = {"crocidolite": 2.0, "amosite": 1.5, "chrysotile": 1.0, "mixed": 1.3}
|
| 130 |
+
risk_mult = cumulative_exposure * potency.get(fibre_type, 1.0) / 20
|
| 131 |
+
|
| 132 |
+
# Health outcomes
|
| 133 |
+
# Mesothelioma (latency 20-50 yrs; crocidolite highest risk)
|
| 134 |
+
mesothelioma = int(time_since_first_exposure >= 15 and rng.random() < np.clip(
|
| 135 |
+
params["mesothelioma_rate"] * risk_mult, 0, 0.05))
|
| 136 |
+
mesothelioma_type = rng.choice(["pleural", "peritoneal"], p=[0.85, 0.15]) if mesothelioma else "none"
|
| 137 |
+
|
| 138 |
+
# Asbestosis (PMC1522094: progressive fibrotic lung disease)
|
| 139 |
+
asbestosis = int(exposure_years >= 5 and rng.random() < np.clip(
|
| 140 |
+
params["asbestosis_prev"] * risk_mult, 0, 0.30))
|
| 141 |
+
|
| 142 |
+
# Lung cancer
|
| 143 |
+
lung_cancer = int(age >= 40 and rng.random() < np.clip(
|
| 144 |
+
params["lung_cancer_rate"] * risk_mult, 0, 0.03))
|
| 145 |
+
smoking = int(rng.random() < 0.15)
|
| 146 |
+
if smoking:
|
| 147 |
+
lung_cancer = int(rng.random() < np.clip(
|
| 148 |
+
params["lung_cancer_rate"] * risk_mult * 5, 0, 0.10)) # synergy
|
| 149 |
+
|
| 150 |
+
# Pleural plaques (early marker)
|
| 151 |
+
pleural_plaques = int(exposure_years >= 10 and rng.random() < np.clip(
|
| 152 |
+
0.10 * risk_mult, 0, 0.40))
|
| 153 |
+
pleural_effusion = int(pleural_plaques and rng.random() < 0.10)
|
| 154 |
+
|
| 155 |
+
# Respiratory symptoms
|
| 156 |
+
dyspnoea = int(rng.random() < np.clip(0.10 + risk_mult * 0.05, 0, 0.35))
|
| 157 |
+
cough_chronic = int(rng.random() < np.clip(0.08 + risk_mult * 0.04, 0, 0.30))
|
| 158 |
+
reduced_fvc = int(asbestosis or rng.random() < np.clip(risk_mult * 0.03, 0, 0.15))
|
| 159 |
+
|
| 160 |
+
any_asbestos_disease = int(mesothelioma or asbestosis or lung_cancer or pleural_plaques)
|
| 161 |
+
|
| 162 |
+
# Compensation & regulation
|
| 163 |
+
ban_in_place = int(rng.random() < params["ban_in_place"])
|
| 164 |
+
medical_surveillance = int(rng.random() < params["medical_surveillance"])
|
| 165 |
+
compensation_claimed = int(any_asbestos_disease and rng.random() < 0.05)
|
| 166 |
+
chest_xray_done = int(rng.random() < 0.10)
|
| 167 |
+
|
| 168 |
+
# HIV co-morbidity (SA context: reduces life expectancy)
|
| 169 |
+
hiv_positive = int(rng.random() < 0.12)
|
| 170 |
+
died = int((mesothelioma and rng.random() < 0.85) or
|
| 171 |
+
(lung_cancer and rng.random() < 0.70))
|
| 172 |
+
|
| 173 |
+
record = {
|
| 174 |
+
"record_id": f"{name[:3].upper()}-{idx:05d}",
|
| 175 |
+
"scenario": name,
|
| 176 |
+
"year": year,
|
| 177 |
+
"setting": setting,
|
| 178 |
+
"age": age,
|
| 179 |
+
"sex": sex,
|
| 180 |
+
"exposure_type": exposure_type,
|
| 181 |
+
"fibre_type": fibre_type,
|
| 182 |
+
"is_occupational": is_occupational,
|
| 183 |
+
"is_environmental": is_environmental,
|
| 184 |
+
"exposure_years": exposure_years,
|
| 185 |
+
"exposure_intensity_f_mL": round(exposure_intensity, 2),
|
| 186 |
+
"cumulative_exposure": round(cumulative_exposure, 1),
|
| 187 |
+
"latency_years": latency_years,
|
| 188 |
+
"time_since_first_exposure": time_since_first_exposure,
|
| 189 |
+
"ppe_use": ppe_use,
|
| 190 |
+
"smoking": smoking,
|
| 191 |
+
"mesothelioma": mesothelioma,
|
| 192 |
+
"mesothelioma_type": mesothelioma_type,
|
| 193 |
+
"asbestosis": asbestosis,
|
| 194 |
+
"lung_cancer": lung_cancer,
|
| 195 |
+
"pleural_plaques": pleural_plaques,
|
| 196 |
+
"pleural_effusion": pleural_effusion,
|
| 197 |
+
"dyspnoea": dyspnoea,
|
| 198 |
+
"cough_chronic": cough_chronic,
|
| 199 |
+
"reduced_fvc": reduced_fvc,
|
| 200 |
+
"any_asbestos_disease": any_asbestos_disease,
|
| 201 |
+
"ban_in_place": ban_in_place,
|
| 202 |
+
"medical_surveillance": medical_surveillance,
|
| 203 |
+
"compensation_claimed": compensation_claimed,
|
| 204 |
+
"chest_xray_done": chest_xray_done,
|
| 205 |
+
"hiv_positive": hiv_positive,
|
| 206 |
+
"died": died,
|
| 207 |
+
}
|
| 208 |
+
records.append(record)
|
| 209 |
+
|
| 210 |
+
return pd.DataFrame(records)
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
def main():
|
| 214 |
+
output_dir = Path("data")
|
| 215 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 216 |
+
for idx, (name, params) in enumerate(SCENARIOS.items()):
|
| 217 |
+
df = _simulate_scenario(name, params, SEED + idx * 211)
|
| 218 |
+
df.to_csv(output_dir / SCENARIO_FILES[name], index=False)
|
| 219 |
+
print(f"Saved {name} -> {SCENARIO_FILES[name]}")
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
if __name__ == "__main__":
|
| 223 |
+
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 asbestos exposure & mesothelioma 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 |
+
"former_mining_community": "asbestos_mining_community.csv",
|
| 12 |
+
"urban_construction": "asbestos_urban_construction.csv",
|
| 13 |
+
"rural_asbestos_roofing": "asbestos_rural_roofing.csv",
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
COLORS = {"former_mining_community": "#e6550d", "urban_construction": "#756bb1", "rural_asbestos_roofing": "#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["cumulative_exposure"], bins=40, alpha=0.5, color=COLORS[s], label=s, range=(0, 100))
|
| 34 |
+
axes[0].set_title("Cumulative Exposure Distribution (f/mL·yr)")
|
| 35 |
+
axes[0].legend(fontsize=7)
|
| 36 |
+
|
| 37 |
+
disease_cols = ["mesothelioma", "asbestosis", "lung_cancer", "pleural_plaques"]
|
| 38 |
+
dis = df.groupby("scenario")[disease_cols].mean() * 100
|
| 39 |
+
dis.plot(kind="bar", ax=axes[1])
|
| 40 |
+
axes[1].set_title("Asbestos-Related Disease (%)")
|
| 41 |
+
axes[1].legend(fontsize=6)
|
| 42 |
+
|
| 43 |
+
ft = df.groupby(["scenario", "fibre_type"]).size().groupby(level=0).apply(lambda s: s / s.sum())
|
| 44 |
+
ft.unstack().plot(kind="bar", stacked=True, ax=axes[2])
|
| 45 |
+
axes[2].set_title("Fibre Type Distribution")
|
| 46 |
+
axes[2].legend(fontsize=7)
|
| 47 |
+
|
| 48 |
+
exp = df.groupby(["scenario", "exposure_type"]).size().groupby(level=0).apply(lambda s: s / s.sum())
|
| 49 |
+
exp.unstack().plot(kind="bar", stacked=True, ax=axes[3])
|
| 50 |
+
axes[3].set_title("Exposure Type Distribution")
|
| 51 |
+
axes[3].legend(fontsize=5)
|
| 52 |
+
|
| 53 |
+
for s in SCENARIO_FILES:
|
| 54 |
+
subset = df[df["scenario"] == s]
|
| 55 |
+
axes[4].scatter(subset["cumulative_exposure"], subset["any_asbestos_disease"],
|
| 56 |
+
s=4, alpha=0.05, color=COLORS[s], label=s)
|
| 57 |
+
axes[4].set_title("Cumulative Exposure vs Disease")
|
| 58 |
+
axes[4].legend(fontsize=7)
|
| 59 |
+
|
| 60 |
+
resp_cols = ["dyspnoea", "cough_chronic", "reduced_fvc"]
|
| 61 |
+
resp = df.groupby("scenario")[resp_cols].mean() * 100
|
| 62 |
+
resp.plot(kind="bar", ax=axes[5])
|
| 63 |
+
axes[5].set_title("Respiratory Symptoms (%)")
|
| 64 |
+
axes[5].legend(fontsize=7)
|
| 65 |
+
|
| 66 |
+
reg_cols = ["ban_in_place", "medical_surveillance", "ppe_use", "chest_xray_done"]
|
| 67 |
+
reg = df.groupby("scenario")[reg_cols].mean() * 100
|
| 68 |
+
reg.plot(kind="bar", ax=axes[6])
|
| 69 |
+
axes[6].set_title("Regulation & Surveillance (%)")
|
| 70 |
+
axes[6].legend(fontsize=6)
|
| 71 |
+
|
| 72 |
+
mort_cols = ["died", "hiv_positive", "compensation_claimed"]
|
| 73 |
+
mort = df.groupby("scenario")[mort_cols].mean() * 100
|
| 74 |
+
mort.plot(kind="bar", ax=axes[7])
|
| 75 |
+
axes[7].set_title("Mortality, HIV & Compensation (%)")
|
| 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
|