--- license: cc-by-4.0 language: - en task_categories: - tabular-classification tags: - traffic - safety - australia - queensland - crashes - tabular - osint - government-data - lightgbm size_categories: - 100K © State of Queensland (Department of Transport and Main Roads) 2026. Licensed CC-BY 4.0. Source: data.qld.gov.au, dataset 'Crash data from Queensland roads', version rqC45037 (2025-06), retrieved 2026-04-30. Retrieval date: **2026-04-30**. Dataset version: **rqC45037**. ## Quick start ```python from datasets import load_dataset ds = load_dataset("Mattysmittttt/qld-traffic-crashes-clean") print(ds) # DatasetDict({ # train: Dataset(...), # validation: Dataset(...), # test: Dataset(...), # }) df_train = ds["train"].to_pandas() ``` ## Splits — temporal, not random Random splits leak future information into training and inflate test metrics on data with temporal structure (vehicle safety, infrastructure, and recording practices all change over time). We hold out the most recent complete year as test: - **train**: 2011–2022, n = **152,842** - **validation**: 2023, n = **13,622** - **test**: 2024, n = **14,358** Pre-2011 rows from the raw source are not included in the modelling slice because Property-Damage-Only crashes stopped being recorded after 2010-12-31 (so the class distribution is incompatible). ## Cleaning applied From the raw 415,407 rows we drop: - 87,808 rows total: PDO crashes, plus rows with missing or out-of-QLD coordinates. - 0 rows for duplicate `crash_id` (the source is already deduplicated). We then: - Lowercase + strip every categorical string; collapse `Unknown`, `Not coded`, blank tokens to NaN. - Coerce numeric columns from text (`crash_year`, `crash_hour`, coordinates, casualty counts, vehicle counts). - Convert the bucketed `crash_speed_limit` strings to ordinal km/h (`50/60/70/90/110`); the original bucket string is preserved as `crash_speed_limit_band` for transparency. - Derive `is_weekend` from the day-of-week field. ## Class distribution per split | split | n | fatal | hospitalisation | medical treatment | minor injury | | --- | --- | --- | --- | --- | --- | | train | 152,842 | 2,806 (1.84%) | 66,547 (43.54%) | 62,889 (41.15%) | 20,600 (13.48%) | | validation | 13,622 | 260 (1.91%) | 6,719 (49.32%) | 4,514 (33.14%) | 2,129 (15.63%) | | test | 14,358 | 273 (1.90%) | 7,051 (49.11%) | 4,409 (30.71%) | 2,625 (18.28%) | Fatal crashes are **~1.85% of the modelling rows** — a familiar but challenging imbalance. The fatal-vs-not binary task is the natural complement to the multi-class severity task. ## Schema Every column on the cleaned dataset, with its role for downstream modelling. The `crashrisk-qld-severity` and `crashrisk-qld-fatal` models train on rows × the **✅ feature** columns only; **🚫 LEAKAGE** columns are kept on the dataset (so the schema is self-documenting) but never reach a training feature matrix — `tests/test_no_leakage.py` enforces that. | column | dtype | role | missing % | n_unique (train) | | --- | --- | --- | --- | --- | | `crash_id` | str | 🆔 identifier (dedup only) | 0.00% | 152,842 | | `crash_severity` | string | 🎯 target (multiclass severity) — 🚫 leakage as a feature | 0.00% | 4 | | `crash_year` | int64 | ✅ feature | 0.00% | 12 | | `crash_month` | string | ✅ feature | 0.00% | 12 | | `crash_day_of_week` | string | ✅ feature | 0.00% | 7 | | `crash_hour` | int64 | ✅ feature | 0.00% | 24 | | `crash_nature` | string | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 15 | | `crash_type` | string | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 4 | | `crash_longitude` | float64 | ✅ feature | 0.00% | 127,660 | | `crash_latitude` | float64 | ✅ feature | 0.00% | 127,804 | | `crash_street` | string | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 0.00% | 15,220 | | `crash_street_intersecting` | string | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 57.08% | 9,408 | | `state_road_name` | string | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 53.09% | 619 | | `loc_suburb` | string | ✅ feature | 0.00% | 2,869 | | `loc_local_government_area` | string | ✅ feature | 0.00% | 78 | | `loc_post_code` | float64 | ✅ feature | 0.00% | 445 | | `loc_police_division` | string | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 0.00% | 337 | | `loc_police_district` | string | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 0.00% | 15 | | `loc_police_region` | string | ✅ feature | 0.00% | 7 | | `loc_queensland_transport_region` | string | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 0.00% | 5 | | `loc_main_roads_region` | string | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 0.00% | 6 | | `loc_abs_statistical_area_2` | string | ✅ feature | 0.00% | 527 | | `loc_abs_statistical_area_3` | string | ✅ feature | 0.00% | 82 | | `loc_abs_statistical_area_4` | string | ✅ feature | 0.00% | 19 | | `loc_abs_remoteness` | string | ✅ feature | 0.00% | 5 | | `loc_state_electorate` | string | ✅ feature | 0.00% | 93 | | `loc_federal_electorate` | string | ✅ feature | 0.00% | 30 | | `crash_controlling_authority` | string | ✅ feature | 0.08% | 2 | | `crash_roadway_feature` | string | ✅ feature | 0.00% | 15 | | `crash_traffic_control` | string | ✅ feature | 0.00% | 16 | | `crash_speed_limit_band` | string | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 0.00% | 5 | | `crash_road_surface_condition` | string | ✅ feature | 0.00% | 4 | | `crash_atmospheric_condition` | string | ✅ feature | 0.00% | 4 | | `crash_lighting_condition` | string | ✅ feature | 0.00% | 4 | | `crash_road_horiz_align` | string | ✅ feature | 0.00% | 3 | | `crash_road_vert_align` | string | ✅ feature | 0.00% | 4 | | `crash_dca_code` | float64 | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 87 | | `crash_dca_description` | string | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 87 | | `crash_dca_group_description` | string | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 22 | | `dca_key_approach_dir` | string | 🚫 LEAKAGE — excluded from training feature matrix | 2.25% | 6 | | `count_casualty_fatality` | int64 | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 6 | | `count_casualty_hospitalised` | int64 | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 15 | | `count_casualty_medicallytreated` | int64 | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 15 | | `count_casualty_minorinjury` | int64 | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 11 | | `count_casualty_total` | int64 | 🚫 LEAKAGE — excluded from training feature matrix | 0.00% | 21 | | `count_unit_car` | int64 | ✅ feature | 0.00% | 12 | | `count_unit_motorcycle_moped` | int64 | ✅ feature | 0.00% | 6 | | `count_unit_truck` | int64 | ✅ feature | 0.00% | 5 | | `count_unit_bus` | int64 | ✅ feature | 0.00% | 4 | | `count_unit_bicycle` | int64 | ✅ feature | 0.00% | 7 | | `count_unit_pedestrian` | int64 | ✅ feature | 0.00% | 7 | | `count_unit_other` | int64 | ✅ feature | 0.00% | 5 | | `crash_month_num` | Int8 | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 0.00% | 12 | | `crash_day_of_week_num` | Int8 | ⊘ kept on dataset, excluded from features (high cardinality / redundant) | 0.00% | 7 | | `is_weekend` | boolean | ✅ feature | 0.00% | 2 | | `crash_speed_limit` | Int16 | ✅ feature | 0.00% | 5 | ## Limitations - **Reported crashes only.** Under-reporting is differential: minor injuries are more likely to go unreported than fatal crashes, and remote regions report less consistently than urban. - **Class imbalance.** Fatal ~1.85%; metrics that don't account for this (raw accuracy) are misleading. Use macro-F1 / PR-AUC. - **Geographic precision varies.** Some rows have only suburb-level location; others have full lat/lon. We drop rows where lat/lon is missing or outside the QLD bounding box. - **Temporal drift.** A 2011–2024 span includes meaningful changes in vehicle safety standards, infrastructure, and recording practices. Predictions for 2025+ should be taken with appropriate scepticism. - **Severity-label vocabulary mismatch with the upstream casualties aggregate.** The locations table uses *Fatal / Hospitalisation / Medical treatment / Minor injury / Property damage only*; the casualties aggregate uses *Fatality / Hospitalised / Medically treated / Minor injury*. We do not join the tables, but downstream users should be aware. ## Companion artifacts - **Severity classifier**: [Mattysmittttt/crashrisk-qld-severity](https://huggingface.co/Mattysmittttt/crashrisk-qld-severity) - **Fatal binary classifier**: [Mattysmittttt/crashrisk-qld-fatal](https://huggingface.co/Mattysmittttt/crashrisk-qld-fatal) - **Interactive demo (Gradio Space)**: [Mattysmittttt/crashrisk-qld-demo](https://huggingface.co/spaces/Mattysmittttt/crashrisk-qld-demo) ## Citation ``` @dataset{crashrisk_qld_clean_2026, title = {QLD Traffic Crashes (Cleaned)}, author = {Mattysmittttt}, year = {2026}, publisher = {Hugging Face}, version = {1.0.0 (source: rqC45037)}, url = {https://huggingface.co/datasets/Mattysmittttt/qld-traffic-crashes-clean}, note = {Derived from Queensland Department of Transport and Main Roads, 'Crash data from Queensland roads', version rqC45037 (2025-06). Licensed CC-BY 4.0.} } ``` ## License Cleaned dataset released under **CC-BY 4.0**, matching the upstream source license. Attribution must be preserved on any derivative work.