An ETL for fetching/cleaning St. Louis crime data sets.
Project description
geocrime-stl
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:
- Temporal Filtering: Because the SLMPD frequently updates historical records retroactively, this utility isolates and preserves only the records belonging to the target month.
- 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:
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/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geocrime_stl-0.1.1.tar.gz.
File metadata
- Download URL: geocrime_stl-0.1.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88755c53b110ff034698d799f70aea8f0a05a45d4c4a6d8240e499622b003f6b
|
|
| MD5 |
31a7741b4770a97a4e05887417a7d768
|
|
| BLAKE2b-256 |
203b6775968be0e9143908905e1b4577caa2c656a3e24eb12718fb8c2938083a
|
File details
Details for the file geocrime_stl-0.1.1-py3-none-any.whl.
File metadata
- Download URL: geocrime_stl-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a1b2dc19498116446df104e13e7403c3ddaf6443afa877807323ef2f632a8b3
|
|
| MD5 |
8eb42cda72ed228e80120a3a62893f48
|
|
| BLAKE2b-256 |
b79a6e4c394598b6143d98cc269c430499715b5c60f1c3137e822bda053c2d21
|