Python Topic #5 — Learning by Doing

CCRS California Crashes
Business Intelligence Risk Discovery Report

A multidimensional Power BI report documenting hypotheses, findings, and evaluative analysis over California crash data from 2019–2025. This topic bridges SQL exploration and Machine Learning by identifying the variables that showed consistent risk signal before predictive modeling.

Informe multidimensional en Power BI que documenta hipótesis, hallazgos y análisis valorativo sobre datos de accidentes de California entre 2019 y 2025. Este tópico conecta la exploración SQL con Machine Learning al identificar las variables que mostraron señal consistente de riesgo antes del modelado predictivo.

2,906,173Total crashesAccidentes totales
1,626,464Injured personsPersonas lesionadas
28,522FatalitiesFallecidos
0.98%Overall fatality rateTasa fatal global

Report Logic

Lógica del Informe

1

Hypothesis: Fatality does not evolve proportionally to crash volume

Hipótesis: La mortalidad no evoluciona proporcionalmente al volumen de accidentes

Hypothesis. Years with the most crashes are not necessarily the years with the highest severity.
Hipótesis. Los años con más accidentes no necesariamente son los años con mayor severidad.
YearCrashes% CrashesInjured% InjuredKilled% KilledFatality Rate
2022405,24913.94%226,30413.91%4,66116.34%1.15%
2021422,98014.55%228,35914.04%4,59016.09%1.09%
2023409,81514.10%230,84414.19%4,26914.97%1.04%
2020374,75712.90%205,02912.61%4,08114.31%1.09%
2024416,91714.35%236,84714.56%4,03014.13%0.97%
2019478,18916.45%270,24816.62%3,78713.28%0.79%
2025398,26613.70%228,83314.07%3,10410.88%0.78%
Total2,906,173100.00%1,626,464100.00%28,522100.00%0.98%
Findings. 2019 has the highest crash volume, but 2022 has the highest fatalities and fatality rate. Severity increased strongly during 2020–2022 and then declined through 2025.
Hallazgos. 2019 tiene el mayor volumen de accidentes, pero 2022 presenta el mayor número de fallecidos y la mayor tasa de fatalidad. La severidad aumentó fuertemente entre 2020–2022 y luego descendió hacia 2025.
Evaluative analysis. Crash volume alone does not explain mortality. Temporal context carries risk signal and should be considered in downstream models.
Análisis valorativo. El volumen de accidentes por sí solo no explica la mortalidad. El contexto temporal contiene señal de riesgo y debe considerarse en modelos posteriores.
2

Hypothesis: Collision type separates frequency from severity

Hipótesis: El tipo de colisión separa frecuencia de severidad

CodeCollision TypeCrashes% CrashesInjuredKilledFatality Rate
CREAR END872,06930.01%507,4962,6610.31%
BSIDE SWIPE617,19321.24%170,0441,1450.19%
EHIT OBJECT517,56317.81%181,8416,7691.31%
DBROADSIDE517,18217.80%471,4524,5770.88%
AHEAD-ON134,2024.62%121,1093,5102.62%
GVEHICLE/PEDESTRIAN84,5502.91%77,4957,2128.53%
HOTHER79,3462.73%32,1457030.89%
FOVERTURNED69,9432.41%55,4861,8652.67%
Total2,906,173100.00%1,626,46428,5220.98%
Findings. Rear-end crashes dominate volume, but Vehicle/Pedestrian has the highest fatality rate and the highest death count among collision types.
Hallazgos. Rear End domina el volumen, pero Vehicle/Pedestrian tiene la mayor tasa de fatalidad y la mayor cantidad de fallecidos entre los tipos de colisión.
Evaluative analysis. Prioritizing by volume alone would mislead decision-makers. Collision type must be evaluated by both frequency and severity.
Análisis valorativo. Priorizar solo por volumen llevaría a conclusiones incorrectas. El tipo de colisión debe evaluarse por frecuencia y severidad.
3

Hypothesis: Administrative codes need semantic translation

Hipótesis: Los códigos administrativos necesitan traducción semántica

Primary Factor CodeCrashes% CrashesInjuredKilledFatality Rate
A2,683,55692.34%1,549,46927,0141.01%
B75,0092.58%18,7723460.46%
D73,8242.54%33,7735240.71%
C71,6742.47%23,7526230.87%
Blank/Other2,1100.07%698150.71%
Total2,906,173100.00%1,626,46428,5220.98%
Findings. Code A represents 92.34% of crashes, but the code alone has limited explanatory value without its operational meaning.
Hallazgos. El código A representa el 92.34% de los accidentes, pero el código por sí solo tiene valor explicativo limitado sin su significado operacional.
Evaluative analysis. This step led to a key modeling decision: use more meaningful violation groupings instead of raw administrative codes.
Análisis valorativo. Este paso condujo a una decisión clave de modelado: usar agrupaciones de infracciones más interpretables en lugar de códigos administrativos crudos.
4

Hypothesis: Pedestrian action codes contain hidden severity signal

Hipótesis: Los códigos de acción peatonal contienen señal oculta de severidad

CodeCrashes% CrashesInjuredKilledFatality Rate
A2,777,77495.58%1,511,77420,4750.74%
B40,6691.40%39,2261,2563.09%
D24,9040.86%21,7202,83511.38%
Blank/Other23,0100.79%16,0731070.47%
E22,9150.79%21,1293,32314.50%
F12,9020.44%13,1244323.35%
C3,4390.12%3,116922.68%
G5600.02%30220.36%
Total2,906,173100.00%1,626,46428,5220.98%
Findings. Codes D and E show extremely high fatality rates, but the codes required translation into pedestrian behaviors to become actionable.
Hallazgos. Los códigos D y E muestran tasas de fatalidad extremadamente altas, pero los códigos requirieron traducción a comportamientos peatonales para volverse accionables.
Evaluative analysis. Code-level BI revealed a signal; description-level BI explained it.
Análisis valorativo. El BI por código reveló la señal; el BI por descripción permitió explicarla.
5

Hypothesis: Some variables describe outcomes, not causes

Hipótesis: Algunas variables describen resultados, no causas

Special ConditionCrashes% CrashesInjuredKilledFatality Rate
Blank / Normal2,755,57294.82%1,577,3819,1760.33%
Private Property65,0192.24%14,41770.01%
On-Duty Emergency Vehicle20,2210.70%7,10010.00%
Fatal16,6840.57%11,38218,188109.01%
Late-Reported14,4160.50%5,509-1-0.01%
School Bus Collision7,9020.27%1,54400.00%
Courtesy Report6,4680.22%2,68300.00%
Total2,906,173100.00%1,626,46428,5220.98%
Findings. “Fatal” produces an impossible 109.01% fatality rate because some fatal crashes include more than one death. This is not a cause; it is an outcome label.
Hallazgos. “Fatal” produce una tasa imposible de 109.01% porque algunos accidentes fatales incluyen más de una muerte. No es una causa; es una etiqueta de resultado.
Evaluative analysis. Special Condition was flagged as potential data leakage and excluded from predictive feature selection.
Análisis valorativo. Special Condition fue marcada como posible fuga de información y excluida de la selección de variables predictivas.
6

Hypothesis: Pedestrian behavior directly affects fatality risk

Hipótesis: El comportamiento peatonal afecta directamente el riesgo fatal

Pedestrian Action DescriptionCrashes% CrashesInjuredKilledFatality Rate
NO PEDESTRIANS INVOLVED2,777,77495.58%1,511,77420,4750.74%
CROSSING IN CROSS WALK AT INTERSECTION40,6691.40%39,2261,2563.09%
CROSSING - NOT IN CROSSWALK24,9040.86%21,7202,83511.38%
OTHER / UNKNOWN23,0100.79%16,0731070.47%
IN ROAD - INCLUDES SHOULDER22,9150.79%21,1293,32314.50%
Total2,906,173100.00%1,626,46428,5220.98%
Findings. “In Road / Shoulder” reaches 14.50%, while “Crossing Not in Crosswalk” reaches 11.38%. Crosswalk at intersection is far lower at 3.09%.
Hallazgos. “In Road / Shoulder” alcanza 14.50%, mientras “Crossing Not in Crosswalk” alcanza 11.38%. Crosswalk en intersección es mucho menor con 3.09%.
Evaluative analysis. Protected pedestrian infrastructure appears associated with lower fatality risk. This variable became one of the strongest candidates for ML.
Análisis valorativo. La infraestructura peatonal protegida parece asociarse con menor riesgo fatal. Esta variable se convirtió en una de las candidatas más fuertes para ML.
7

Hypothesis: Visibility matters more than rain

Hipótesis: La visibilidad importa más que la lluvia

Weather_1Crashes% CrashesInjuredKilledFatality Rate
CLEAR2,481,76285.40%1,401,84324,1430.97%
CLOUDY298,14010.26%159,9733,3161.11%
RAINING93,9153.23%47,7406650.71%
FOG/VISIBILITY10,5720.36%5,8312202.08%
SNOWING3,4490.12%1,453250.72%
OTHER2,5580.09%902271.06%
WIND2,1020.07%1,120301.43%
Total2,906,173100.00%1,626,46428,5220.98%
Findings. Fog/Visibility has the highest fatality rate at 2.08%, while rain is lower than the global average at 0.71%.
Hallazgos. Fog/Visibility tiene la mayor tasa fatal con 2.08%, mientras lluvia queda por debajo del promedio global con 0.71%.
Evaluative analysis. Reduced visibility appears more severe than precipitation itself, supporting later cross-analysis with lighting and time.
Análisis valorativo. La visibilidad reducida parece más severa que la precipitación en sí, apoyando cruces posteriores con iluminación y hora.
8

Hypothesis: Secondary weather validates the visibility signal

Hipótesis: El clima secundario valida la señal de visibilidad

Weather_2Crashes% CrashesInjuredKilledFatality Rate
Blank / None2,829,56897.36%1,585,86927,7440.98%
RAINING58,0842.00%29,7374860.84%
WIND7,1380.25%4,1071572.20%
CLOUDY5,5240.19%3,396360.65%
SNOWING2,3430.08%1,122150.64%
FOG/VISIBILITY2,0790.07%1,238502.41%
OTHER7440.03%502101.34%
HAIL1930.01%12221.04%
Total2,906,173100.00%1,626,46428,5220.98%
Findings. Fog/Visibility again leads severity at 2.41%, and Wind also rises to 2.20%.
Hallazgos. Fog/Visibility vuelve a liderar la severidad con 2.41%, y Wind también sube a 2.20%.
Evaluative analysis. The same signal appears across Weather_1 and Weather_2, strengthening confidence that visibility is a meaningful risk dimension.
Análisis valorativo. La misma señal aparece en Weather_1 y Weather_2, fortaleciendo la confianza en que la visibilidad es una dimensión de riesgo significativa.
9

Hypothesis: Violation groups reveal human risk behavior

Hipótesis: Los grupos de infracción revelan comportamiento humano de riesgo

Violation GroupCrashes% CrashesInjuredKilledFatality Rate
Other / Unclassified866,47629.82%586,33512,0811.39%
DUI / Alcohol245,3448.44%133,5596,0902.48%
Unsafe Turn / Lane Change591,13020.34%229,7864,8460.82%
Unsafe Speed839,42528.88%489,3304,3570.52%
Stop Sign / Right of Way76,5102.63%69,8334930.64%
Lane Violation215,9487.43%62,2563450.16%
Failure To Yield71,3402.45%55,3653100.43%
Total2,906,173100.00%1,626,46428,5220.98%
Findings. DUI/Alcohol has the highest fatality rate at 2.48%, about 2.5 times the global rate. Unsafe Speed dominates volume but not severity.
Hallazgos. DUI/Alcohol tiene la mayor tasa fatal con 2.48%, cerca de 2.5 veces la tasa global. Unsafe Speed domina el volumen, pero no la severidad.
Evaluative analysis. Human behavior became a central analytical theme. Violation Group was selected as a key predictive feature.
Análisis valorativo. El comportamiento humano se convirtió en un tema central del análisis. Violation Group fue seleccionada como variable predictiva clave.
10

Cross-Analysis: Testing whether the signals survive context

Cruces: Probar si las señales sobreviven al contexto

DUI / Alcohol Deep Dive

245,344DUI / Alcohol crashes
6,090DUI / Alcohol fatalities
2.48%DUI fatality rate
≈2.5xvs. global fatality rate
DUI + WeatherCrashesKilledFatality Rate
CLEAR212,5185,1862.44%
CLOUDY22,1297173.24%
RAINING7,410971.31%
FOG/VISIBILITY1,278534.15%
Total DUI245,3446,0902.48%
DUI + Time BucketCrashesKilledFatality Rate
22:00 - 00:0039,0868862.27%
00:00 - 02:0037,9411,0492.76%
20:00 - 22:0036,2347181.98%
18:00 - 20:0029,8006612.22%
02:00 - 04:0029,0377522.59%
04:00 - 06:0010,9503983.63%
06:00 - 08:005,9242384.02%
Total DUI245,3446,0902.48%
Cross findings. DUI remains severe across contexts. Visibility problems and late-night / early-morning buckets amplify risk.
Hallazgos cruzados. DUI mantiene alta severidad en distintos contextos. Los problemas de visibilidad y los bloques de noche/madrugada amplifican el riesgo.
Evaluative analysis. These cross-filters demonstrate that fatality risk is not explained by one variable alone. Risk emerges through combinations: DUI + time + visibility + collision context.
Análisis valorativo. Estos filtros cruzados demuestran que el riesgo fatal no se explica por una sola variable. El riesgo emerge por combinaciones: DUI + hora + visibilidad + contexto de colisión.
11

Fatal Crashes Only: Profiling deaths instead of all crashes

Sólo accidentes fatales: Perfilar muertes en lugar de todos los accidentes

When filtering NumberKilled > 0, the analysis changes meaning. Fatality Rate is no longer useful because the dataset is already restricted to fatal crashes. The relevant questions become: Which categories contribute the most fatal crashes and fatalities?

Al filtrar NumberKilled > 0, el análisis cambia de significado. Fatality Rate deja de ser útil porque el conjunto ya está restringido a accidentes fatales. Las preguntas relevantes pasan a ser: ¿Qué categorías concentran más accidentes fatales y fallecidos?

26,370Fatal crashes
28,524Fatalities in fatal-crash profile
20.19%Fatal crashes from DUI
16.43%Fatal crashes in 2022
Findings. The fatal-crash-only view confirms recurring themes: DUI/Alcohol, late-day/night periods, visibility issues, and years 2021–2022 remain highly visible in the profile.
Hallazgos. La vista sólo de accidentes fatales confirma temas recurrentes: DUI/Alcohol, períodos tarde/noche, problemas de visibilidad y años 2021–2022 siguen apareciendo con fuerza.
Evaluative analysis. The same variables that appeared in overall severity analysis also appear when isolating fatal crashes. This consistency supports their selection for Machine Learning.
Análisis valorativo. Las mismas variables que aparecieron en el análisis general de severidad también aparecen al aislar accidentes fatales. Esta consistencia respalda su selección para Machine Learning.
12

Variables Selected for Machine Learning

Variables Seleccionadas para Machine Learning

Collision_Type_DescriptionPedestrianActionDescViolation_GroupCrash_Time_2H_BucketWeather_1Source_YearCity_Name / GIS later

Transition hypothesis. The variables discovered through Power BI should contain predictive signal for identifying fatal versus non-fatal crashes.
Hipótesis de transición. Las variables descubiertas mediante Power BI deben contener señal predictiva para identificar accidentes fatales vs no fatales.
Methodological bridge. Topic #5 documents how BI identified the candidate variables. Topic #6 will validate whether those variables generalize when training on 2019–2025 and testing against real 2026 data.
Puente metodológico. El Topic #5 documenta cómo BI identificó las variables candidatas. El Topic #6 validará si esas variables generalizan al entrenar con 2019–2025 y probar contra datos reales de 2026.

Executive Conclusion

Conclusión Ejecutiva

The Power BI risk discovery process demonstrated that crash severity is not driven by volume alone. The strongest signals emerged from the intersection of collision type, pedestrian behavior, violation group, time of day, and visibility-related conditions. Business Intelligence did more than summarize the data: it created the analytical foundation for predictive modeling.

El proceso de descubrimiento de riesgo en Power BI demostró que la severidad de los accidentes no depende únicamente del volumen. Las señales más fuertes emergieron de la intersección entre tipo de colisión, comportamiento peatonal, grupo de infracción, hora del día y condiciones relacionadas con visibilidad. Business Intelligence hizo más que resumir datos: creó la base analítica para el modelado predictivo.

Source workflow: CCRS open data → SQL Server → Power BI multidimensional analysis → selected variables for ML validation.