Skip to main content

geocrime-stl

License: MIT Python 3.10+

A Python utility for cleaning and standardizing St. Louis Metropolitan Police Department (SLMPD) crime data for spatial analysis.

✨ Features

  • End-to-End ETL: Fetch, clean, and standardize monthly SLMPD crime data files automatically.
  • Spatial Formats: Convert cleaned DataFrames seamlessly into GeoJSON, GeoPackage (GPKG), or CSV.
  • Analysis Ready: Access built-in methods for minimal data summarization and visualization.

🌐 Data Source & Disclaimer

This utility programmatically fetches publicly available crime data directly from the St. Louis Metropolitan Police Department (SLMPD) Stats Page.

⚠️ Data Disclaimer & Limitations:

  • Availability: This tool relies entirely on the upstream availability and hosting structure of the SLMPD website. If their servers are down or their URL layout changes, the extraction pipeline may fail.
  • Data Integrity & Spatial Boundaries: The data processed is strictly "as-is" from the published monthly files. To ensure high data quality for spatial analysis, this utility applies two strict filtering constraints:
    1. Temporal Filtering: Because the SLMPD frequently updates historical records retroactively, this utility isolates and preserves only the records belonging to the target month.
    2. Spatial Clipping: Records containing invalid, malformed, or erroneous latitude/longitude coordinates that plot completely outside the official St. Louis city boundaries are automatically dropped.
  • Project Status: This is an independent, open-source utility. It is not affiliated with, endorsed by, or officially maintained by the SLMPD or the City of St. Louis.

🚀 Quick Start

Install

pip install geocrime-stl

Fetch/Clean/Visualize Data

import geocrime_stl as gc

data_pkg = gc.run_pipeline(4, 2026)

gc.generate_monthly_metrics(data_pkg)

gc.plot_monthly_maps(data_pkg)

🛠️ Local Setup (Alternative)

If you want to run the demo notebook locally or explore the source code, you can clone the repository directly:

git clone https://github.com/lweber89/geocrime-stl.git
cd geocrime-stl
pip install -e .

📓 Demo & Tutorial

To see a step-by-step walkthrough of the entire ETL process, check out the interactive Jupyter notebook included in this package:

👉 View the Demo Notebook

Note: If you have cloned the repository locally, you can open this file using Jupyter Lab or Jupyter Notebook to run the cells yourself.

🤝 Contributing & Pull Requests

Thank you for your interest in the project!

⚠️ Please Note: This is a personal project I developed and maintain in an effort to better understand the implementation of Python in geospatial data engineering / solutions architecture. I am not accepting pull requests or code contributions at this time.

If you find a bug or have an idea, feel free to open an Issue to let me know, or feel free to fork the repository and adapt it for your own personal needs!

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Project Links

GitHub Repository: https://github.com/lweber89/geocrime-stl

PyPI Home: https://pypi.org/project/geocrime-stl/

Metadata

Release files for geocrime-stl 0.1.3

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

Source distribution (sdist)

Source distribution for geocrime-stl 0.1.3
File Size Uploaded Provenance
geocrime_stl-0.1.3.tar.gz 64.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for geocrime-stl 0.1.3
File Interpreter ABI Platform
geocrime_stl-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 129.1 kB

Release files / geocrime_stl-0.1.3.tar.gz

Download URL geocrime_stl-0.1.3.tar.gz
Size 64.8 kB
Tags Source
SHA-256 checksum
How to use checksums
95a2ad9d2da46884e24de7edcf1519906c1a0981ddb0a94fc755aef71113f997
BLAKE2b-256 checksum
How to use checksums
5e9f74d99fdf3ff11685548f9f0a9347bc997fbff8f86f3fe28110b64f7ad54d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / geocrime_stl-0.1.3-py3-none-any.whl

Download URL geocrime_stl-0.1.3-py3-none-any.whl
Size 64.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fecbf94530306a25a4bf4c13ee1e67294ebe5510d2137f4b758b070d41646a2
BLAKE2b-256 checksum
How to use checksums
e8d9a41894a86b0050e5ba686e417d849af0028f0c224ca82405ad832f85f98c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for geocrime-stl 0.1.3

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.

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