Skip to main content
100%

NY Car Crashes Loading Data

✓ Published0🌍 Public
JJose Morales
Last edited Sep 3, 2025
Created on Sep 3, 2025
Forked from Loading Data

This example demonstrates asynchronous data loading in D3 v7. It fetches a CSV file containing 500 records from NYC OpenData’s Motor Vehicle Collisions – Vehicles dataset, filtered to sedans. The visualization initially shows a loading state, then parses the CSV with `d3.csvParse` and converts the UNIQUE_ID field to numeric values using a `for` loop. The processed data is stored in a state object and displayed as a JSON-formatted text preview inside a `<pre>` element via `d3.select` and `.text()`.

AI-generated description

Car Crash Subset Dataset

This dataset is a subset of the “Motor Vehicle Collisions – Vehicles” dataset available from NYC OpenData.

To create this subset, I filtered the full dataset (approximately 4.42 million rows) to include only sedans involved in crashes. I selected only the first 500 entries, as there were many entries.

While the original dataset contains many more columns, the following are included in this subset:

  • UNIQUE_ID – A unique identifier generated by the NYC record system (sequential ordinal attribute)
  • CRASH_DATE – The date of the crash (temporal attribute)
  • VEHICLE_MAKE – The manufacturer of the car involved (categorical attribute)
  • VEHICLE_MODEL – The model of the car involved (categorical attribute)
  • VEHICLE_DAMAGE – Location on the vehicle where most of the damage occurred (categorical attribute)
  • DRIVER_SEX – The gender of the driver (categorical attribute)
  • CONTRIBUTING_FACTOR_1 – A primary factor contributing to the crash (categorical attribute)
  • CONTRIBUTING_FACTOR_2 – A secondary factor contributing to the crash (categorical attribute)
MIT Licensed

Similar vizzes