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