CCRS California Crashes
Informe Analítico Ejecutivo

Preguntas, hipótesis, queries, resultados y valoración profesional sobre la base CaliforniaCrashes.dbo.Crashes, construida con datos abiertos del California Crash Reporting System.

CCRS California Crashes
Executive Analytical Report

Questions, hypotheses, SQL queries, results, and professional assessment based on CaliforniaCrashes.dbo.Crashes, built from California Crash Reporting System open data.

Resumen ejecutivo

Este informe demuestra cómo datos abiertos de accidentes de tránsito pueden convertirse en inteligencia operacional usando Python, SQL Server y análisis progresivo basado en preguntas. El trabajo integró 2,906,173 registros de California Crashes entre 2019 y 2025 en una tabla SQL Server local y luego desarrolló un análisis de severidad, letalidad, peatones e iluminación.

2,906,173
Registros analizados
2019–2025
Años integrados
8.53%
Fatality rate Vehicle/Pedestrian
34.74%
Fatality rate peatón con luces no funcionales
Mensaje clave: el volumen de accidentes y el riesgo de fatalidad cuentan historias distintas. Los accidentes con peatones y las condiciones de baja iluminación emergen como focos críticos de severidad.

Contenido

  1. Contexto del análisis
  2. Validación histórica de carga
  3. KPI histórico
  4. Fatality Rate por año
  5. Frecuencia por tipo de colisión
  6. Letalidad por tipo de accidente
  7. Evolución de peatones fallecidos
  8. Accidentes de peatones y tasa de fatalidad
  9. Ciudades con mayor riesgo peatonal
  10. Ciudad + iluminación
  11. Iluminación a nivel estatal
  12. Lecciones y narrativa ejecutiva

0. Contexto del análisis

Después de cargar los archivos CCRS de California desde 2019 hasta 2025, el objetivo dejó de ser técnico y pasó a ser analítico: preguntar mejor, validar hipótesis y convertir registros operacionales en inteligencia de negocio.

2,906,173
Registros cargados
2019–2025
Años integrados
dbo.Crashes
Tabla final
CCRS
Fuente Open Data
SQL ServerPython ETLOpen DataTraffic SafetyBusiness RulesRisk Intelligence

Fuente: California Crash Reporting System (CCRS), California Open Data Portal.

1. Validación histórica de carga

¿La carga de 2019 a 2025 quedó correctamente distribuida por año?

SELECT
    Source_Year,
    COUNT(*) AS TotalRows
FROM dbo.Crashes
GROUP BY Source_Year
ORDER BY Source_Year;
AñoRegistros
2019478,189
2020374,757
2021422,980
2022405,249
2023409,815
2024416,917
2025398,266
  • Los siete años esperados aparecen en la tabla final.
  • El total validado por SQL Server es 2,906,173 registros.
  • La tabla dbo.Crashes quedó lista para análisis histórico, no solo para pruebas de carga.

La carga quedó validada directamente en SQL Server. Esto confirma que el ETL no solo ejecutó, sino que integró correctamente los años esperados en una tabla histórica única.

2. KPI histórico: accidentes, fallecidos y lesionados

La cantidad de accidentes puede bajar, pero la severidad puede subir. Por eso no basta con contar eventos; hay que medir muertos, lesionados y tasas.

SELECT
    Source_Year,
    COUNT(*) AS TotalCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS TotalKilled,
    SUM(TRY_CAST(NumberInjured AS INT)) AS TotalInjured
FROM dbo.Crashes
GROUP BY Source_Year
ORDER BY Source_Year;
AñoAccidentesFallecidosLesionados
2019478,1893,787270,248
2020374,7574,081205,029
2021422,9804,590228,359
2022405,2494,661226,304
2023409,8154,269230,844
2024416,9174,030236,847
2025398,2663,104228,833
  • 2019 tuvo el mayor volumen de accidentes: 478,189.
  • 2020 bajó a 374,757 accidentes, pero subió a 4,081 fallecidos.
  • 2022 tuvo el mayor número absoluto de fallecidos: 4,661.
  • 2025 redujo fallecidos a 3,104, el valor más bajo del periodo mostrado.

El 2020 muestra una caída fuerte en accidentes frente a 2019, pero las fatalidades suben. Esta diferencia confirma que volumen y severidad son dimensiones distintas. El dato sugiere un cambio de comportamiento vial durante y después del periodo COVID: menos eventos, pero eventos más letales.

3. Fatality Rate por año

¿Los accidentes fueron menos frecuentes pero más letales durante 2020–2022?

SELECT
    Source_Year,
    COUNT(*) AS TotalCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS TotalKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT)) * 100.0 /
        COUNT(*)
        AS DECIMAL(10,4)
    ) AS FatalityRatePct
FROM dbo.Crashes
GROUP BY Source_Year
ORDER BY Source_Year;
AñoAccidentesFallecidosFatality Rate %
2019478,1893,7870.7919
2020374,7574,0811.0890
2021422,9804,5901.0852
2022405,2494,6611.1502
2023409,8154,2691.0417
2024416,9174,0300.9666
2025398,2663,1040.7794
  • 2022 fue el peor año por tasa de fatalidad: 1.1502%.
  • 2020 tuvo menos accidentes que 2019, pero una tasa mucho más alta.
  • 2025 muestra la mejor tasa de la serie: 0.7794%, incluso ligeramente mejor que 2019.

Este query cambia la narrativa. No se trata de decir “hubo menos accidentes”; se trata de entender que algunos años tuvieron menos frecuencia, pero mayor severidad. La tasa normalizada es la métrica que permite ver el riesgo real.

4. Frecuencia por tipo de colisión

¿Cómo evolucionan los tipos de accidente por año?

SELECT
    Source_Year,
    Collision_Type_Code,
    COUNT(*) AS TotalCrashes
FROM dbo.Crashes
GROUP BY
    Source_Year,
    Collision_Type_Code
ORDER BY
    Source_Year,
    Collision_Type_Code;

El código C = REAR END se mantiene como el tipo más frecuente en todos los años revisados.

AñoC = Rear End
2019158,474
2020104,981
2021126,485
2022120,450
2023120,836
  • El código C = REAR END domina consistentemente por volumen.
  • 2019 tuvo 158,474 REAR END crashes, el mayor volumen observado en la muestra.
  • La caída de 2020 también se observa en REAR END, bajando a 104,981.

REAR END domina por frecuencia, pero eso no significa que sea el principal problema de mortalidad. Esta diferencia llevó al siguiente análisis: separar frecuencia de letalidad.

5. Letalidad por tipo de accidente

El accidente más común no necesariamente es el más peligroso.

SELECT
    Collision_Type_Code,
    COUNT(*) AS TotalCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS TotalKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT))*100.0 /
        COUNT(*)
        AS DECIMAL(10,4)
    ) AS FatalityRatePct
FROM dbo.Crashes
WHERE Collision_Type_Code IS NOT NULL
GROUP BY Collision_Type_Code
ORDER BY FatalityRatePct DESC;
CodeTipoCrashesKilledFatality Rate %
GVehicle/Pedestrian84,5507,2128.5299
FOverturned69,9431,8652.6665
AHead-On134,2023,5102.6155
EHit Object517,5636,7691.3079
HOther793,4607,0330.8860
DBroadside517,1824,5770.8850
CRear End872,0692,6610.3051
BSide Swipe617,1931,1450.1855
  • G = Vehicle/Pedestrian es el tipo más letal: 8.5299%.
  • F = Overturned y A = Head-On superan el 2.6% de letalidad.
  • C = Rear End tiene el mayor volumen, pero una tasa mucho menor: 0.3051%.
  • B = Side Swipe tiene la menor tasa relativa: 0.1855%.

El código G, accidentes vehículo/peatón, es el más letal por gran diferencia. Aunque REAR END es el más frecuente, su letalidad relativa es baja. Esto obliga a separar dashboards de volumen y dashboards de severidad.

6. Evolución de peatones fallecidos

¿Los peatones mejoraron o empeoraron entre 2019 y 2025?

SELECT
    Source_Year,
    SUM(
        CASE
            WHEN Collision_Type_Code='G'
            THEN TRY_CAST(NumberKilled AS INT)
            ELSE 0
        END
    ) AS PedestrianKilled
FROM dbo.Crashes
GROUP BY Source_Year
ORDER BY Source_Year;
AñoPeatones fallecidos
2019960
2020963
20211,127
20221,167
20231,107
20241,076
2025812
  • Las muertes de peatones suben desde 960 en 2019 hasta 1,167 en 2022.
  • 2022 es el pico absoluto de peatones fallecidos.
  • 2025 baja a 812, una reducción fuerte frente a 2024.

El pico de muertes de peatones ocurre en 2022. La reducción en 2025 es fuerte y abre una pregunta de política pública: ¿qué cambió entre 2022 y 2025?

7. Accidentes de peatones y tasa de fatalidad por año

La mejora de 2025 puede venir por menos accidentes de peatones, menor severidad o ambas cosas.

SELECT
    Source_Year,
    COUNT(*) AS PedestrianCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS PedestrianKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT))*100.0 /
        COUNT(*)
        AS DECIMAL(10,2)
    ) AS PedestrianFatalityRate
FROM dbo.Crashes
WHERE Collision_Type_Code = 'G'
GROUP BY Source_Year
ORDER BY Source_Year;
AñoPedestrian CrashesPedestrian KilledFatality Rate %
201913,8819606.92
202010,3889639.27
202111,1561,12710.10
202211,7881,1679.90
202312,4701,1078.88
202412,7811,0768.42
202512,0868126.72
  • 2021 fue el peor año por tasa de fatalidad peatonal: 10.10%.
  • En 2020 hubo menos accidentes peatonales que en 2019, pero mayor tasa de fatalidad.
  • 2025 presenta una mejora notable y cae por debajo del nivel 2019.

La recuperación de 2025 no solo reduce muertes absolutas; también reduce la tasa. Esto sugiere una mejora real de severidad, no solamente un cambio de volumen.

8. Ciudades con mayor tasa de fatalidad peatonal

¿Qué ciudades presentan mayor riesgo relativo en accidentes con peatones, usando un umbral mínimo para evitar ruido extremo?

SELECT TOP 25
    City_Name,
    COUNT(*) AS PedestrianCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS PedestrianKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT))*100.0 /
        COUNT(*)
        AS DECIMAL(10,2)
    ) AS PedestrianFatalityRate
FROM dbo.Crashes
WHERE Collision_Type_Code = 'G'
GROUP BY City_Name
HAVING COUNT(*) >= 100
ORDER BY PedestrianFatalityRate DESC;
CityPedestrian CrashesKilledFatality Rate %
Apple Valley1052624.76
Stanton1413323.40
Colton1363022.06
Fountain Valley1152521.74
Victorville2855820.35
Hesperia1552918.71
Unincorporated11,5641,71314.81
  • Apple Valley lidera por tasa: 24.76%.
  • Stanton, Colton y Fountain Valley superan el 21%.
  • Unincorporated combina volumen extremo con riesgo alto: 11,564 accidentes peatonales y 1,713 fallecidos.

Algunas ciudades pequeñas muestran tasas muy altas. Unincorporated no lidera por tasa, pero por volumen absoluto es el gran monstruo. Esto requiere dos lentes: tasa para riesgo relativo y volumen para impacto total.

9. Ciudad + iluminación en accidentes peatonales

Las ciudades de mayor riesgo podrían estar asociadas a oscuridad, falta de iluminación o luces no funcionales.

SELECT TOP 30
    City_Name,
    LightingDescription,
    COUNT(*) AS PedestrianCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS PedestrianKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT)) * 100.0 / COUNT(*)
        AS DECIMAL(10,2)
    ) AS FatalityRate
FROM dbo.Crashes
WHERE Collision_Type_Code = 'G'
GROUP BY City_Name, LightingDescription
HAVING COUNT(*) >= 50
ORDER BY FatalityRate DESC;
CityLightingCrashesKilledFatality Rate %
San JoseDARK-NO STREET LIGHTS732838.36
UnincorporatedDARK-STREET LIGHTS NOT FUNCTIONING612337.70
FresnoDARK-NO STREET LIGHTS963637.50
Los AngelesDARK-STREET LIGHTS NOT FUNCTIONING1605836.25
San DiegoDARK-NO STREET LIGHTS2488233.06
UnincorporatedDARK-NO STREET LIGHTS2,74787031.67
  • Los primeros registros están dominados por DARK-NO STREET LIGHTS y DARK-STREET LIGHTS NOT FUNCTIONING.
  • San Jose / DARK-NO STREET LIGHTS muestra 38.36%.
  • Los Angeles / DARK-STREET LIGHTS NOT FUNCTIONING muestra 36.25%.
  • Unincorporated / DARK-NO STREET LIGHTS combina gran volumen: 2,747 casos y 870 fallecidos.

Los primeros lugares están dominados por condiciones oscuras: sin alumbrado o con alumbrado no funcional. Esto transforma el análisis en una hipótesis operacional clara: la iluminación puede estar asociada de manera fuerte con la severidad peatonal.

10. Iluminación y fatalidad peatonal en todo California

Quitando el ruido de ciudad, ¿qué relación aparece entre iluminación y tasa de fatalidad peatonal a nivel estatal?

SELECT
    LightingDescription,
    COUNT(*) AS PedestrianCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS PedestrianKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT))*100.0 /
        COUNT(*)
        AS DECIMAL(10,2)
    ) AS FatalityRate
FROM dbo.Crashes
WHERE Collision_Type_Code='G'
GROUP BY LightingDescription
ORDER BY FatalityRate DESC;
Lighting ConditionPedestrian CrashesPedestrian KilledFatality Rate %
DARK-STREET LIGHTS NOT FUNCTIONING47516534.74
DARK-NO STREET LIGHTS6,5041,92029.52
DARK-STREET LIGHTS29,5313,66412.41
DUSK-DAWN3,6443078.42
DAYLIGHT44,0661,1442.60

La oscuridad mata. En la muestra histórica 2019–2025, los accidentes peatonales en condiciones DARK-NO STREET LIGHTS tienen una tasa de fatalidad de 29.52%, frente a 2.60% en DAYLIGHT.

Interpretación: DARK-NO STREET LIGHTS fue aproximadamente 11 veces más letal que DAYLIGHT. DARK-STREET LIGHTS NOT FUNCTIONING fue todavía más crítico, con 34.74%.

Este es el hallazgo más fuerte del viaje analítico. La disponibilidad y funcionamiento de la iluminación no aparece como un simple atributo descriptivo; aparece como una variable crítica asociada a la severidad de accidentes con peatones.

11. Lecciones analíticas del proceso

  • Volumen no es riesgo: REAR END domina por frecuencia, pero no por letalidad.
  • Normalizar cambia la historia: Fatality Rate revela lo que el conteo bruto oculta.
  • Los códigos importan: el texto PEDESTRAIN tenía error ortográfico; el código G fue más confiable.
  • La granularidad importa: Año → tipo → peatón → ciudad → iluminación.
  • La IA como partner acelera: cada respuesta del dato generó una pregunta mejor.

12. Narrativa ejecutiva final

El análisis histórico de California Crashes 2019–2025 muestra una reducción fuerte de accidentes en 2020, pero con aumento de letalidad. La severidad alcanza su punto más alto alrededor de 2021–2022 y mejora de forma sostenida hacia 2025.

Los accidentes con peatones representan el tipo más letal por tasa relativa. Dentro de ellos, la iluminación emerge como un factor crítico: los accidentes en oscuridad, especialmente sin alumbrado o con luces no funcionales, presentan tasas de fatalidad dramáticamente superiores a los accidentes en daylight.

Conclusión: este no fue solamente un ejercicio de Python o SQL Server. Fue un caso completo de transformación de datos abiertos en inteligencia operacional, usando preguntas progresivas, business rules, normalización de métricas y análisis valorativo.

PythonSQL ServerOpen DataTraffic SafetyPedestrian RiskLighting AnalysisBusiness Intelligence

Executive Summary

This report demonstrates how public traffic crash data can be transformed into operational intelligence using Python, SQL Server, and progressive question-driven analysis. The work integrated 2,906,173 records from California Crashes between 2019 and 2025 into a local SQL Server table and then developed severity, fatality, pedestrian, and lighting-condition analysis.

2,906,173
Records analyzed
2019–2025
Years integrated
8.53%
Vehicle/Pedestrian fatality rate
34.74%
Pedestrian fatality rate when street lights were not functioning
Key message: crash volume and fatality risk tell different stories. Pedestrian crashes and low-light conditions emerge as critical severity focus areas.

Contents

  1. Analysis context
  2. Historical load validation
  3. Historical KPI
  4. Fatality Rate by year
  5. Frequency by collision type
  6. Fatality by collision type
  7. Pedestrian fatalities over time
  8. Pedestrian crashes and fatality rate
  9. Cities with higher pedestrian fatality rates
  10. City + lighting
  11. Lighting statewide
  12. Lessons and executive narrative

0. Analysis Context

After loading the California CCRS files from 2019 through 2025, the objective moved from a technical exercise to an analytical one: asking better questions, testing hypotheses, and converting operational records into business intelligence.

2,906,173
Loaded records
2019–2025
Integrated years
dbo.Crashes
Final table
CCRS
Open Data source
SQL ServerPython ETLOpen DataTraffic SafetyBusiness RulesRisk Intelligence

Source: California Crash Reporting System (CCRS), California Open Data Portal.

1. Historical Load Validation

Was the 2019–2025 load correctly distributed by year?

SELECT
    Source_Year,
    COUNT(*) AS TotalRows
FROM dbo.Crashes
GROUP BY Source_Year
ORDER BY Source_Year;
YearRecords
2019478,189
2020374,757
2021422,980
2022405,249
2023409,815
2024416,917
2025398,266
  • All seven expected years are present in the final table.
  • The SQL Server validated total is 2,906,173 records.
  • dbo.Crashes became ready for historical analysis, not just load testing.

The load was validated directly in SQL Server. This confirms the ETL did not merely run; it correctly integrated the expected years into one historical table.

2. Historical KPI: Crashes, Fatalities, and Injuries

Crash counts can decrease while severity increases. Therefore, counting events is not enough; fatalities, injuries, and rates must also be measured.

SELECT
    Source_Year,
    COUNT(*) AS TotalCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS TotalKilled,
    SUM(TRY_CAST(NumberInjured AS INT)) AS TotalInjured
FROM dbo.Crashes
GROUP BY Source_Year
ORDER BY Source_Year;
YearCrashesFatalitiesInjuries
2019478,1893,787270,248
2020374,7574,081205,029
2021422,9804,590228,359
2022405,2494,661226,304
2023409,8154,269230,844
2024416,9174,030236,847
2025398,2663,104228,833
  • 2019 had the highest crash volume: 478,189.
  • 2020 dropped to 374,757 crashes but increased to 4,081 fatalities.
  • 2022 had the highest absolute fatalities: 4,661.
  • 2025 reduced fatalities to 3,104, the lowest value in the period shown.

2020 shows a strong decrease in crashes compared with 2019, but fatalities increased. This confirms that volume and severity are different dimensions. The data suggests a shift in road behavior during and after the COVID period: fewer events, but more lethal events.

3. Fatality Rate by Year

Were crashes less frequent but more lethal during 2020–2022?

SELECT
    Source_Year,
    COUNT(*) AS TotalCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS TotalKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT)) * 100.0 /
        COUNT(*)
        AS DECIMAL(10,4)
    ) AS FatalityRatePct
FROM dbo.Crashes
GROUP BY Source_Year
ORDER BY Source_Year;
YearCrashesFatalitiesFatality Rate %
2019478,1893,7870.7919
2020374,7574,0811.0890
2021422,9804,5901.0852
2022405,2494,6611.1502
2023409,8154,2691.0417
2024416,9174,0300.9666
2025398,2663,1040.7794
  • 2022 was the worst year by fatality rate: 1.1502%.
  • 2020 had fewer crashes than 2019 but a much higher fatality rate.
  • 2025 shows the best rate in the series: 0.7794%, slightly better than 2019.

This query changes the narrative. It is not enough to say “there were fewer crashes”; some years had lower frequency but higher severity. The normalized rate is the metric that reveals real risk.

4. Frequency by Collision Type

How do collision types evolve by year?

SELECT
    Source_Year,
    Collision_Type_Code,
    COUNT(*) AS TotalCrashes
FROM dbo.Crashes
GROUP BY
    Source_Year,
    Collision_Type_Code
ORDER BY
    Source_Year,
    Collision_Type_Code;

Code C = REAR END remains the most frequent collision type across the reviewed years.

YearC = Rear End
2019158,474
2020104,981
2021126,485
2022120,450
2023120,836
  • C = REAR END consistently dominates by volume.
  • 2019 had 158,474 rear-end crashes, the highest observed volume in the sample.
  • The 2020 drop is also visible in rear-end crashes, decreasing to 104,981.

Rear-end crashes dominate by frequency, but that does not mean they are the main fatality problem. This distinction led to the next analysis: separating frequency from lethality.

5. Fatality by Collision Type

The most common collision type is not necessarily the most dangerous.

SELECT
    Collision_Type_Code,
    COUNT(*) AS TotalCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS TotalKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT))*100.0 /
        COUNT(*)
        AS DECIMAL(10,4)
    ) AS FatalityRatePct
FROM dbo.Crashes
WHERE Collision_Type_Code IS NOT NULL
GROUP BY Collision_Type_Code
ORDER BY FatalityRatePct DESC;
CodeTypeCrashesFatalitiesFatality Rate %
GVehicle/Pedestrian84,5507,2128.5299
FOverturned69,9431,8652.6665
AHead-On134,2023,5102.6155
EHit Object517,5636,7691.3079
HOther793,4607,0330.8860
DBroadside517,1824,5770.8850
CRear End872,0692,6610.3051
BSide Swipe617,1931,1450.1855
  • G = Vehicle/Pedestrian is the most lethal type: 8.5299%.
  • F = Overturned and A = Head-On exceed a 2.6% fatality rate.
  • C = Rear End has the highest volume but a much lower fatality rate: 0.3051%.
  • B = Side Swipe has the lowest relative rate: 0.1855%.

Code G, vehicle/pedestrian crashes, is the most lethal by a wide margin. Although rear-end crashes are the most frequent, their relative lethality is low. This forces a separation between volume dashboards and severity dashboards.

6. Pedestrian Fatalities Over Time

Did pedestrian safety improve or worsen between 2019 and 2025?

SELECT
    Source_Year,
    SUM(
        CASE
            WHEN Collision_Type_Code='G'
            THEN TRY_CAST(NumberKilled AS INT)
            ELSE 0
        END
    ) AS PedestrianKilled
FROM dbo.Crashes
GROUP BY Source_Year
ORDER BY Source_Year;
YearPedestrian Fatalities
2019960
2020963
20211,127
20221,167
20231,107
20241,076
2025812
  • Pedestrian fatalities increased from 960 in 2019 to 1,167 in 2022.
  • 2022 was the absolute peak for pedestrian fatalities.
  • 2025 dropped to 812, a strong reduction compared with 2024.

The peak for pedestrian fatalities occurred in 2022. The strong reduction in 2025 opens a public-policy question: what changed between 2022 and 2025?

7. Pedestrian Crashes and Fatality Rate by Year

The 2025 improvement may come from fewer pedestrian crashes, lower severity, or both.

SELECT
    Source_Year,
    COUNT(*) AS PedestrianCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS PedestrianKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT))*100.0 /
        COUNT(*)
        AS DECIMAL(10,2)
    ) AS PedestrianFatalityRate
FROM dbo.Crashes
WHERE Collision_Type_Code = 'G'
GROUP BY Source_Year
ORDER BY Source_Year;
YearPedestrian CrashesPedestrian FatalitiesFatality Rate %
201913,8819606.92
202010,3889639.27
202111,1561,12710.10
202211,7881,1679.90
202312,4701,1078.88
202412,7811,0768.42
202512,0868126.72
  • 2021 was the worst year by pedestrian fatality rate: 10.10%.
  • In 2020 there were fewer pedestrian crashes than in 2019, but the fatality rate increased.
  • 2025 shows a notable improvement and falls below the 2019 level.

The 2025 recovery reduces not only absolute fatalities, but also the fatality rate. This suggests a real improvement in severity, not merely a volume change.

8. Cities with Higher Pedestrian Fatality Rates

Which cities show higher relative risk in pedestrian crashes, using a minimum threshold to reduce extreme noise?

SELECT TOP 25
    City_Name,
    COUNT(*) AS PedestrianCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS PedestrianKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT))*100.0 /
        COUNT(*)
        AS DECIMAL(10,2)
    ) AS PedestrianFatalityRate
FROM dbo.Crashes
WHERE Collision_Type_Code = 'G'
GROUP BY City_Name
HAVING COUNT(*) >= 100
ORDER BY PedestrianFatalityRate DESC;
CityPedestrian CrashesFatalitiesFatality Rate %
Apple Valley1052624.76
Stanton1413323.40
Colton1363022.06
Fountain Valley1152521.74
Victorville2855820.35
Hesperia1552918.71
Unincorporated11,5641,71314.81
  • Apple Valley leads by rate: 24.76%.
  • Stanton, Colton, and Fountain Valley exceed 21%.
  • Unincorporated combines extreme volume with high risk: 11,564 pedestrian crashes and 1,713 fatalities.

Some smaller cities show very high rates. Unincorporated does not lead by rate, but by absolute volume it is the major problem. This requires two lenses: rate for relative risk and volume for total impact.

9. City + Lighting in Pedestrian Crashes

The highest-risk cities may be associated with darkness, lack of street lighting, or non-functioning lights.

SELECT TOP 30
    City_Name,
    LightingDescription,
    COUNT(*) AS PedestrianCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS PedestrianKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT)) * 100.0 / COUNT(*)
        AS DECIMAL(10,2)
    ) AS FatalityRate
FROM dbo.Crashes
WHERE Collision_Type_Code = 'G'
GROUP BY City_Name, LightingDescription
HAVING COUNT(*) >= 50
ORDER BY FatalityRate DESC;
CityLightingCrashesFatalitiesFatality Rate %
San JoseDARK-NO STREET LIGHTS732838.36
UnincorporatedDARK-STREET LIGHTS NOT FUNCTIONING612337.70
FresnoDARK-NO STREET LIGHTS963637.50
Los AngelesDARK-STREET LIGHTS NOT FUNCTIONING1605836.25
San DiegoDARK-NO STREET LIGHTS2488233.06
UnincorporatedDARK-NO STREET LIGHTS2,74787031.67
  • The top results are dominated by DARK-NO STREET LIGHTS and DARK-STREET LIGHTS NOT FUNCTIONING.
  • San Jose / DARK-NO STREET LIGHTS shows 38.36%.
  • Los Angeles / DARK-STREET LIGHTS NOT FUNCTIONING shows 36.25%.
  • Unincorporated / DARK-NO STREET LIGHTS combines large volume: 2,747 cases and 870 fatalities.

The leading rows are dominated by dark conditions: no lighting or non-functioning lighting. This turns the analysis into a clear operational hypothesis: lighting may be strongly associated with pedestrian-crash severity.

10. Lighting and Pedestrian Fatality Across California

Removing city-level noise, what relationship appears between lighting and statewide pedestrian fatality rate?

SELECT
    LightingDescription,
    COUNT(*) AS PedestrianCrashes,
    SUM(TRY_CAST(NumberKilled AS INT)) AS PedestrianKilled,
    CAST(
        SUM(TRY_CAST(NumberKilled AS INT))*100.0 /
        COUNT(*)
        AS DECIMAL(10,2)
    ) AS FatalityRate
FROM dbo.Crashes
WHERE Collision_Type_Code='G'
GROUP BY LightingDescription
ORDER BY FatalityRate DESC;
Lighting ConditionPedestrian CrashesPedestrian FatalitiesFatality Rate %
DARK-STREET LIGHTS NOT FUNCTIONING47516534.74
DARK-NO STREET LIGHTS6,5041,92029.52
DARK-STREET LIGHTS29,5313,66412.41
DUSK-DAWN3,6443078.42
DAYLIGHT44,0661,1442.60

Darkness kills. In the 2019–2025 historical sample, pedestrian crashes under DARK-NO STREET LIGHTS conditions have a fatality rate of 29.52%, compared with 2.60% in DAYLIGHT.

Interpretation: DARK-NO STREET LIGHTS was approximately 11 times more lethal than DAYLIGHT. DARK-STREET LIGHTS NOT FUNCTIONING was even more critical, at 34.74%.

This is the strongest finding of the analytical journey. Lighting availability and functionality do not appear as a simple descriptive attribute; they appear as a critical variable associated with the severity of pedestrian crashes.

11. Analytical Lessons

  • Volume is not risk: rear-end crashes dominate by frequency, but not by lethality.
  • Normalization changes the story: fatality rate reveals what raw counts hide.
  • Codes matter: the text PEDESTRAIN contained a spelling issue; code G was more reliable.
  • Granularity matters: year → type → pedestrian → city → lighting.
  • AI as a partner accelerates the process: every data answer generated a better question.

12. Final Executive Narrative

The historical analysis of California Crashes 2019–2025 shows a sharp decrease in crashes in 2020, but an increase in lethality. Severity reaches its highest point around 2021–2022 and then improves steadily toward 2025.

Pedestrian crashes represent the most lethal crash type by relative rate. Within that segment, lighting emerges as a critical factor: crashes in darkness, especially without street lights or with non-functioning street lights, show dramatically higher fatality rates than daylight crashes.

Conclusion: this was not only a Python or SQL Server exercise. It was a complete case of transforming open data into operational intelligence using progressive questions, business rules, metric normalization, and professional analytical assessment.

PythonSQL ServerOpen DataTraffic SafetyPedestrian RiskLighting AnalysisBusiness Intelligence