Skip to main content

pyccrs

Purpose

California crash data is incredibly rich, and yet is a bit of a hassle to access. pyccrs is my solution. With this package, downloading CCRS data requires just a basic understanding of Python, allowing data analysts to focus on what they do best: last-mile data wrangling, and analysis.

Dependencies

ckanpy

ckanpy is a package I created for pyccrs, which handles interactions with the CKAN database that CCRS data is accessible through.

pydantic

pydantic is used for improving data models, providing type validation, parsing, and stability with respect to bugs.

pandas

pandas is used mainly as an export option, as well as a few filters.

Use Cases

Downloading CCRS Table Data

pyccrs makes it very simple to download CCRS data efficiently, using SQL queries to parse data across all the years of data one wishes to request. SQL queries are generated Pythonically, with no SQL knowledge necessary from the user. For stability, as sometimes a year may be available only through downloading the CSV, such years will be downloaded and filtered accordingly, albeit with a significantly longer load time and memory usage.

For the sake of usability, the easiest way to download CCRS data through pyccrs is by a particular column:

  • Crashes: city name
  • Parties: collision ID
  • People: collision ID

(Note: what CCRS calls "InjuredWitnessPassenger", pyccrs calls "Person", or "People".)

In addition, pyccrs automatically remaps the column names to a standardized, Pythonic format, like "column_name", as opposed to CCRS's un-Pythonic "Column Name".

Each table has its own download function:

  • download_crashes()
  • download_parties()
  • download_people()

Downloading Node-Based Data

pyccrs also allows downloading data as nodes in a graph, which may be the superior data structure for certain analyses. This may be achieved using download_nodes().

Downloading Modeled Data

It is also possible to download data as lists of pydantic models, with the export style option "model".

Documentation

pyccrs also serves as documentation. CCRS metadata is somewhat inaccurate, with some columns inproperly typed or outright missing. One of the objectives of pyccrs, then, is to document the data and enforce that documentation through pydantic models and docstrings.

Contributing

Though functional, there are still many ways this package can be improved. Feel free to look around for leftover TODOs, send a pull request suggesting a change, or reach out to me by email to discuss specific improvements.

Metadata

Release files for pyccrs 0.13.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyccrs 0.13.6
File Size Uploaded Provenance Actions
pyccrs-0.13.6.tar.gz 32.8 kB Without provenance Details for pyccrs-0.13.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyccrs 0.13.6
File Interpreter ABI Platform Actions
pyccrs-0.13.6-py3-none-any.whl Python 3 none any Details for pyccrs-0.13.6-py3-none-any.whl

Total release size: 81.8 kB

Release files / pyccrs-0.13.6.tar.gz

Download URL pyccrs-0.13.6.tar.gz
Size 32.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1b90b8d6c7b45ee62283cfaa91693a25ce0d9fd277301749ec0398591b632dab
BLAKE2b-256 checksum
How to use checksums
b35478950a97a5c144f01277bef9596417159ede43c592ed83a05987b76835d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pyccrs-0.13.6-py3-none-any.whl

Download URL pyccrs-0.13.6-py3-none-any.whl
Size 49.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06bb0f222cb517a764315a5bcb4e69c02403e0ca92c13d1618e8d1570d654ba8
BLAKE2b-256 checksum
How to use checksums
9035cd06de33c16a93e509934224f959e0d4876fb93cc4fa1aac102b5d1030d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pyccrs 0.13.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.13.6 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page