| """Generate synthetic radon & indoor radiation exposure dataset for SSA. |
| |
| Research-based parameterization: |
| - WHO Fact Sheet: Radon causes 3-14% of lung cancers; reference level |
| 100 Bq/m³, action level 300 Bq/m³. |
| - PMC12277776: Indoor radon exposure in Africa critical review; growing |
| concern; classified IARC Group 1 carcinogen. |
| - PMC12081354: Radon = ~50% of human radiation exposure; originates from |
| granite, brick, sand, cement, gypsum. |
| - PubMed 40334468: Nigerian buildings (homes, schools, workplaces) |
| monitored; significant public health concern. |
| - PMC12331818: SA community near granite geology; alpha particles from |
| radon daughters damage lung cells. |
| - Second leading cause of lung cancer globally after smoking. |
| """ |
|
|
| 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 = { |
| "granite_geology_rural": { |
| "setting_probs": {"rural_granite": 0.50, "peri_urban": 0.30, "mining_town": 0.20}, |
| "building_probs": {"mud_brick": 0.30, "concrete_block": 0.25, |
| "stone_granite": 0.25, "corrugated_iron": 0.15, "modern": 0.05}, |
| "radon_gm": 120, "radon_gsd": 2.2, |
| "ventilation_poor_pct": 0.55, |
| "smoking_prev": 0.15, |
| "lung_cancer_base": 0.003, |
| "measurement_pct": 0.02, |
| }, |
| "urban_residential": { |
| "setting_probs": {"urban_formal": 0.40, "urban_informal": 0.35, "peri_urban": 0.25}, |
| "building_probs": {"concrete_block": 0.40, "brick": 0.25, |
| "corrugated_iron": 0.15, "modern": 0.15, "mud_brick": 0.05}, |
| "radon_gm": 60, "radon_gsd": 2.0, |
| "ventilation_poor_pct": 0.35, |
| "smoking_prev": 0.20, |
| "lung_cancer_base": 0.002, |
| "measurement_pct": 0.05, |
| }, |
| "occupational_underground": { |
| "setting_probs": {"underground_mine": 0.45, "tunnel_cave": 0.20, |
| "basement_building": 0.20, "industrial": 0.15}, |
| "building_probs": {"underground": 0.45, "concrete_block": 0.25, |
| "stone_granite": 0.15, "modern": 0.10, "other": 0.05}, |
| "radon_gm": 250, "radon_gsd": 2.5, |
| "ventilation_poor_pct": 0.45, |
| "smoking_prev": 0.20, |
| "lung_cancer_base": 0.005, |
| "measurement_pct": 0.08, |
| }, |
| } |
|
|
| SCENARIO_FILES = { |
| "granite_geology_rural": "radon_granite_rural.csv", |
| "urban_residential": "radon_urban_residential.csv", |
| "occupational_underground": "radon_occupational.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(40, 15), 18, 80)) |
| sex = rng.choice(["male", "female"], p=[0.50, 0.50]) |
| building_type = _choice(rng, params["building_probs"]) |
|
|
| |
| ventilation_poor = int(rng.random() < params["ventilation_poor_pct"]) |
| floor_level = rng.choice(["ground_basement", "first", "upper"], |
| p=[0.60, 0.25, 0.15]) |
|
|
| |
| vent_mult = 1.5 if ventilation_poor else 1.0 |
| floor_mult = 1.3 if floor_level == "ground_basement" else 0.8 if floor_level == "upper" else 1.0 |
| geology_mult = 1.3 if building_type in ("stone_granite", "underground") else 1.0 |
|
|
| radon_bqm3 = float(np.clip( |
| rng.lognormal(np.log(params["radon_gm"] * vent_mult * floor_mult * geology_mult), |
| np.log(params["radon_gsd"])), |
| 5, 3000)) |
|
|
| above_who_100 = int(radon_bqm3 > 100) |
| above_action_300 = int(radon_bqm3 > 300) |
|
|
| |
| hours_indoors_day = float(np.clip(rng.normal(16, 3), 8, 23)) |
| exposure_years = int(np.clip(rng.normal(15, 8), 1, 50)) |
| occupancy_factor = hours_indoors_day / 24 |
| cumulative_exposure = float(radon_bqm3 * occupancy_factor * exposure_years) |
|
|
| smoking = int(rng.random() < params["smoking_prev"]) |
| |
| risk_mult = (cumulative_exposure / 500) * (5.0 if smoking else 1.0) |
|
|
| |
| lung_cancer = int(age >= 40 and rng.random() < np.clip( |
| params["lung_cancer_base"] * risk_mult, 0, 0.05)) |
|
|
| |
| chronic_cough = int(rng.random() < np.clip(0.05 + risk_mult * 0.02, 0, 0.20)) |
| dyspnoea = int(rng.random() < np.clip(0.04 + risk_mult * 0.01, 0, 0.15)) |
|
|
| |
| radon_measured = int(rng.random() < params["measurement_pct"]) |
| aware_of_radon = int(rng.random() < 0.05) |
| mitigation_installed = int(above_action_300 and radon_measured and rng.random() < 0.10) |
| ventilation_improved = int(radon_measured and rng.random() < 0.15) |
| sub_slab_depressurization = int(mitigation_installed and rng.random() < 0.20) |
|
|
| |
| sealed_floor = int(rng.random() < 0.30) |
| cracks_in_floor = int(rng.random() < 0.40) |
| uranium_geology = int(setting in ("underground_mine", "rural_granite", "mining_town") and |
| rng.random() < 0.30) |
|
|
| any_health_effect = int(lung_cancer or chronic_cough or dyspnoea) |
|
|
| record = { |
| "record_id": f"{name[:3].upper()}-{idx:05d}", |
| "scenario": name, |
| "year": year, |
| "setting": setting, |
| "age": age, |
| "sex": sex, |
| "building_type": building_type, |
| "floor_level": floor_level, |
| "ventilation_poor": ventilation_poor, |
| "radon_bqm3": round(radon_bqm3, 1), |
| "above_who_100": above_who_100, |
| "above_action_300": above_action_300, |
| "hours_indoors_day": round(hours_indoors_day, 1), |
| "exposure_years": exposure_years, |
| "cumulative_exposure": round(cumulative_exposure, 0), |
| "smoking": smoking, |
| "lung_cancer": lung_cancer, |
| "chronic_cough": chronic_cough, |
| "dyspnoea": dyspnoea, |
| "radon_measured": radon_measured, |
| "aware_of_radon": aware_of_radon, |
| "mitigation_installed": mitigation_installed, |
| "ventilation_improved": ventilation_improved, |
| "sealed_floor": sealed_floor, |
| "cracks_in_floor": cracks_in_floor, |
| "uranium_geology": uranium_geology, |
| "any_health_effect": any_health_effect, |
| } |
| 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() |
|
|