crimepy 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crimepy-0.1.0/.cruft.json +33 -0
- crimepy-0.1.0/.editorconfig +31 -0
- crimepy-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- crimepy-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- crimepy-0.1.0/.github/dependabot.yml +16 -0
- crimepy-0.1.0/.github/workflows/ci.yml +150 -0
- crimepy-0.1.0/.github/workflows/publish.yml +34 -0
- crimepy-0.1.0/.github/workflows/validate_codecov.yml +15 -0
- crimepy-0.1.0/.gitignore +139 -0
- crimepy-0.1.0/.pre-commit-config.yaml +41 -0
- crimepy-0.1.0/.python-version +1 -0
- crimepy-0.1.0/CHANGELOG.md +55 -0
- crimepy-0.1.0/CITATION.cff +28 -0
- crimepy-0.1.0/CODE_OF_CONDUCT.md +79 -0
- crimepy-0.1.0/CONTRIBUTING.md +73 -0
- crimepy-0.1.0/LICENSE +15 -0
- crimepy-0.1.0/PKG-INFO +318 -0
- crimepy-0.1.0/README.md +280 -0
- crimepy-0.1.0/codecov.yml +9 -0
- crimepy-0.1.0/docs/advanced.md +254 -0
- crimepy-0.1.0/docs/changelog.md +1 -0
- crimepy-0.1.0/docs/code_of_conduct.md +1 -0
- crimepy-0.1.0/docs/contributing.md +1 -0
- crimepy-0.1.0/docs/css/material.css +4 -0
- crimepy-0.1.0/docs/css/mkdocstrings.css +28 -0
- crimepy-0.1.0/docs/index.md +1 -0
- crimepy-0.1.0/docs/license.md +1 -0
- crimepy-0.1.0/docs/recipes.md +120 -0
- crimepy-0.1.0/docs/scripts/gen_ref_nav.py +38 -0
- crimepy-0.1.0/docs/tutorial.md +160 -0
- crimepy-0.1.0/mkdocs.yml +155 -0
- crimepy-0.1.0/pyproject.toml +270 -0
- crimepy-0.1.0/src/crimepy/__init__.py +25 -0
- crimepy-0.1.0/src/crimepy/analyze.py +295 -0
- crimepy-0.1.0/src/crimepy/cli.py +185 -0
- crimepy-0.1.0/src/crimepy/combine.py +154 -0
- crimepy-0.1.0/src/crimepy/nibrs/__init__.py +71 -0
- crimepy-0.1.0/src/crimepy/nibrs/cde.py +345 -0
- crimepy-0.1.0/src/crimepy/nibrs/codes.py +693 -0
- crimepy-0.1.0/src/crimepy/nibrs/layouts.py +473 -0
- crimepy-0.1.0/src/crimepy/nibrs/munge.py +305 -0
- crimepy-0.1.0/src/crimepy/nibrs/reader.py +614 -0
- crimepy-0.1.0/src/crimepy/nibrs/store.py +315 -0
- crimepy-0.1.0/src/crimepy/nibrs/tables.py +494 -0
- crimepy-0.1.0/src/crimepy/nibrs/techniques.py +180 -0
- crimepy-0.1.0/src/crimepy/options.py +33 -0
- crimepy-0.1.0/src/crimepy/plot.py +336 -0
- crimepy-0.1.0/src/crimepy/techniques.py +542 -0
- crimepy-0.1.0/src/crimepy/utilities.py +193 -0
- crimepy-0.1.0/tests/conftest.py +135 -0
- crimepy-0.1.0/tests/test_analysis.py +294 -0
- crimepy-0.1.0/tests/test_main.py +18 -0
- crimepy-0.1.0/tests/test_nibrs_reader.py +209 -0
- crimepy-0.1.0/tests/test_nibrs_store.py +280 -0
- crimepy-0.1.0/uv.lock +5664 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": "https://github.com/WithPrecedent/snickerdoodle",
|
|
3
|
+
"commit": "51b83c5f5273e9f66d7860b84f574b58f08050c4",
|
|
4
|
+
"checkout": null,
|
|
5
|
+
"context": {
|
|
6
|
+
"cookiecutter": {
|
|
7
|
+
"project_name": "crimepy",
|
|
8
|
+
"package_name": "crimepy",
|
|
9
|
+
"repo_name": "crimepy",
|
|
10
|
+
"author_name": "Corey Rayburn Yung",
|
|
11
|
+
"author_email": "coreyrayburnyung@gmail.com",
|
|
12
|
+
"github_user": "WithPrecedent",
|
|
13
|
+
"description": "Accessible tools for downloading, combining, munging, analyzing, and plotting crime data",
|
|
14
|
+
"version": "0.0.1",
|
|
15
|
+
"url": "https://github.com/WithPrecedent/crimepy",
|
|
16
|
+
"development_status": "Development Status :: 3 - Alpha",
|
|
17
|
+
"license": "Apache Software License 2.0",
|
|
18
|
+
"badge_style": "for-the-badge",
|
|
19
|
+
"github_actions": true,
|
|
20
|
+
"pre_commit": true,
|
|
21
|
+
"dependabot": true,
|
|
22
|
+
"mkdocs": true,
|
|
23
|
+
"mypy": true,
|
|
24
|
+
"pypi": true,
|
|
25
|
+
"code_coverage": true,
|
|
26
|
+
"commit_to_github": false,
|
|
27
|
+
"virtual_environment": false,
|
|
28
|
+
"_template": "https://github.com/WithPrecedent/snickerdoodle",
|
|
29
|
+
"_commit": "51b83c5f5273e9f66d7860b84f574b58f08050c4"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"directory": null
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Sets default formatting options for many editors and IDEs
|
|
2
|
+
|
|
3
|
+
# https://editorconfig.org/
|
|
4
|
+
|
|
5
|
+
root = true
|
|
6
|
+
|
|
7
|
+
[*]
|
|
8
|
+
charset = utf-8
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
indent_size = 4
|
|
11
|
+
indent_style = space
|
|
12
|
+
trim_trailing_whitespace = true
|
|
13
|
+
|
|
14
|
+
# Docstrings and comments use max_line_length = 80
|
|
15
|
+
[*.py]
|
|
16
|
+
max_line_length = 80
|
|
17
|
+
|
|
18
|
+
# The JSON files contain newlines inconsistently
|
|
19
|
+
[*.json]
|
|
20
|
+
indent_size = 2
|
|
21
|
+
insert_final_newline = ignore
|
|
22
|
+
|
|
23
|
+
# Makefiles always use tabs for indentation
|
|
24
|
+
[Makefile]
|
|
25
|
+
indent_style = tab
|
|
26
|
+
|
|
27
|
+
[*.{yml,yaml,toml,html}]
|
|
28
|
+
indent_size = 2
|
|
29
|
+
|
|
30
|
+
[*.md]
|
|
31
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: unconfirmed
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
|
|
12
|
+
A clear and concise description of what the bug is.
|
|
13
|
+
|
|
14
|
+
**To Reproduce**
|
|
15
|
+
|
|
16
|
+
Steps to reproduce the behavior:
|
|
17
|
+
1. Go to '...'
|
|
18
|
+
2. Run command '...'
|
|
19
|
+
3. Scroll down to '...'
|
|
20
|
+
4. See error
|
|
21
|
+
|
|
22
|
+
**Expected behavior**
|
|
23
|
+
|
|
24
|
+
A clear and concise description of what you expected to happen.
|
|
25
|
+
|
|
26
|
+
**Screenshots**
|
|
27
|
+
|
|
28
|
+
If applicable, add screenshots to help explain your problem.
|
|
29
|
+
|
|
30
|
+
**System (please complete the following information):**
|
|
31
|
+
|
|
32
|
+
- `crimepy` version: [e.g. 0.2.1]
|
|
33
|
+
- Python version: [e.g. 3.12]
|
|
34
|
+
- OS: [Windows/Linux/MacOS]
|
|
35
|
+
|
|
36
|
+
**Additional context**
|
|
37
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: feature
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
|
|
12
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
13
|
+
|
|
14
|
+
**Describe the solution you'd like**
|
|
15
|
+
|
|
16
|
+
A clear and concise description of what you want to happen.
|
|
17
|
+
|
|
18
|
+
**Describe alternatives you've considered**
|
|
19
|
+
|
|
20
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
21
|
+
|
|
22
|
+
**Additional context**
|
|
23
|
+
|
|
24
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Automatically updates dependency versions using dependabot.
|
|
2
|
+
|
|
3
|
+
version: 2
|
|
4
|
+
updates:
|
|
5
|
+
|
|
6
|
+
# Maintains the Python dependencies in `pyproject.toml` and `uv.lock`
|
|
7
|
+
- package-ecosystem: uv
|
|
8
|
+
directory: "/"
|
|
9
|
+
schedule:
|
|
10
|
+
interval: weekly
|
|
11
|
+
|
|
12
|
+
# Maintains the versions of the GitHub Actions used in `.github/workflows`
|
|
13
|
+
- package-ecosystem: github-actions
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: weekly
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Automatically performs jobs upon a commit push or pull-request
|
|
2
|
+
|
|
3
|
+
# This Action builds, tests, and lints the package. It uploads test
|
|
4
|
+
# coverage to Codecov. Then, it builds the
|
|
5
|
+
# documentation and deploys it on GitHub Pages.
|
|
6
|
+
|
|
7
|
+
# If the commit message matches a semantic version (e.g. "v0.1.2"), a GitHub
|
|
8
|
+
# release will be created by the `create_github_release` job.
|
|
9
|
+
|
|
10
|
+
name: continuous integration
|
|
11
|
+
|
|
12
|
+
# Allows this Action to be called by a push to `main` or a pull request. Only
|
|
13
|
+
# pushes to `main` are included so that a pull request does not run every job
|
|
14
|
+
# twice (once for the push to its branch and once for the pull request).
|
|
15
|
+
on:
|
|
16
|
+
push:
|
|
17
|
+
branches: [main]
|
|
18
|
+
pull_request:
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: write
|
|
22
|
+
pull-requests: write
|
|
23
|
+
# Lets the Codecov upload authenticate with OIDC instead of a stored token.
|
|
24
|
+
id-token: write
|
|
25
|
+
|
|
26
|
+
env:
|
|
27
|
+
DISABLE_MKDOCS_2_WARNING: "true"
|
|
28
|
+
|
|
29
|
+
jobs:
|
|
30
|
+
|
|
31
|
+
build_and_test:
|
|
32
|
+
runs-on: ${{ matrix.os }}
|
|
33
|
+
strategy:
|
|
34
|
+
fail-fast: false
|
|
35
|
+
matrix:
|
|
36
|
+
python-version: ["3.11", "3.12", "3.13", "3.14"]
|
|
37
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
38
|
+
# Makes every `uv` command use the matrix version. Otherwise, `uv run`
|
|
39
|
+
# recreates the environment with the version in ".python-version".
|
|
40
|
+
env:
|
|
41
|
+
UV_PYTHON: ${{ matrix.python-version }}
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- name: checkout repository
|
|
45
|
+
uses: actions/checkout@v7
|
|
46
|
+
|
|
47
|
+
- name: install python
|
|
48
|
+
uses: actions/setup-python@v7
|
|
49
|
+
with:
|
|
50
|
+
python-version: ${{ matrix.python-version }}
|
|
51
|
+
|
|
52
|
+
- name: install uv
|
|
53
|
+
uses: astral-sh/setup-uv@v10.2.0
|
|
54
|
+
|
|
55
|
+
- name: install dependencies
|
|
56
|
+
run: uv sync
|
|
57
|
+
|
|
58
|
+
- name: run tests
|
|
59
|
+
run: uv run pytest tests --cov --cov-report=xml
|
|
60
|
+
|
|
61
|
+
# Requires the Codecov GitHub App to be installed on the repository's
|
|
62
|
+
# account. Codecov merges the uploads from every job in the matrix.
|
|
63
|
+
- name: upload coverage to codecov
|
|
64
|
+
uses: codecov/codecov-action@v7
|
|
65
|
+
with:
|
|
66
|
+
files: coverage.xml
|
|
67
|
+
use_oidc: true
|
|
68
|
+
|
|
69
|
+
lint_and_format:
|
|
70
|
+
runs-on: ubuntu-latest
|
|
71
|
+
|
|
72
|
+
steps:
|
|
73
|
+
- name: checkout repository
|
|
74
|
+
uses: actions/checkout@v7
|
|
75
|
+
|
|
76
|
+
- name: install uv
|
|
77
|
+
uses: astral-sh/setup-uv@v10.2.0
|
|
78
|
+
|
|
79
|
+
- name: install dependencies
|
|
80
|
+
run: uv sync
|
|
81
|
+
|
|
82
|
+
# The hooks only need to run once, so they are here instead of in the
|
|
83
|
+
# `build_and_test` matrix.
|
|
84
|
+
- name: run pre-commit
|
|
85
|
+
run: uv run pre-commit run -a --show-diff-on-failure
|
|
86
|
+
|
|
87
|
+
- name: run ruff
|
|
88
|
+
run: uv run ruff check --no-fix --output-format=github
|
|
89
|
+
|
|
90
|
+
- name: run mypy
|
|
91
|
+
run: uv run mypy
|
|
92
|
+
|
|
93
|
+
document_and_deploy:
|
|
94
|
+
runs-on: ubuntu-latest
|
|
95
|
+
|
|
96
|
+
steps:
|
|
97
|
+
- name: checkout repository
|
|
98
|
+
uses: actions/checkout@v7
|
|
99
|
+
|
|
100
|
+
- name: install uv
|
|
101
|
+
uses: astral-sh/setup-uv@v10.2.0
|
|
102
|
+
|
|
103
|
+
- name: install dependencies
|
|
104
|
+
run: uv sync
|
|
105
|
+
|
|
106
|
+
# Creates the HTML report that `mkdocs-coverage` adds to the documentation.
|
|
107
|
+
- name: create coverage report
|
|
108
|
+
run: uv run pytest tests --cov --cov-report=html
|
|
109
|
+
|
|
110
|
+
- name: build documentation with mkdocs
|
|
111
|
+
run: uv run mkdocs build
|
|
112
|
+
|
|
113
|
+
- name: deploy documentation to github pages
|
|
114
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
115
|
+
run: uv run mkdocs gh-deploy --force --clean --verbose
|
|
116
|
+
|
|
117
|
+
# Only releases if a line of the commit message is a semantic version (e.g.
|
|
118
|
+
# "v0.1.2"), so the version can be followed by other lines, such as a
|
|
119
|
+
# "Co-Authored-By:" trailer. The release notes are the version's section of
|
|
120
|
+
# CHANGELOG.md. Releases are only made from the `main` branch and after the
|
|
121
|
+
# tests and linters pass.
|
|
122
|
+
create_github_release:
|
|
123
|
+
name: create github release
|
|
124
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
125
|
+
needs: [build_and_test, lint_and_format]
|
|
126
|
+
runs-on: ubuntu-latest
|
|
127
|
+
|
|
128
|
+
steps:
|
|
129
|
+
- name: checkout repository
|
|
130
|
+
uses: actions/checkout@v7
|
|
131
|
+
|
|
132
|
+
- name: create github release
|
|
133
|
+
env:
|
|
134
|
+
GH_TOKEN: ${{ github.token }}
|
|
135
|
+
run: |
|
|
136
|
+
version=$(git log -1 --format=%B | grep -m 1 -oxE 'v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?' | cut -c 2- || true)
|
|
137
|
+
if [ -z "$version" ]; then
|
|
138
|
+
echo "The commit message has no version line, so no release was made."
|
|
139
|
+
exit 0
|
|
140
|
+
fi
|
|
141
|
+
if gh release view "v$version" > /dev/null 2>&1; then
|
|
142
|
+
echo "::notice::Release v$version already exists."
|
|
143
|
+
exit 0
|
|
144
|
+
fi
|
|
145
|
+
awk -v v="$version" '$1 == "##" && $2 == v {found = 1; next} found && /^## / {exit} found' CHANGELOG.md > notes.md
|
|
146
|
+
if ! grep -q '[^[:space:]]' notes.md; then
|
|
147
|
+
echo "::error::Could not find an entry for $version in CHANGELOG.md"
|
|
148
|
+
exit 1
|
|
149
|
+
fi
|
|
150
|
+
gh release create "v$version" --title "Release: $version" --notes-file notes.md --target "$GITHUB_SHA"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Securely publishes the repository on PyPI
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# To make this action work, you need to configure PyPI properly, using this
|
|
5
|
+
# guide: https://docs.pypi.org/trusted-publishers/adding-a-publisher/
|
|
6
|
+
|
|
7
|
+
name: publish
|
|
8
|
+
|
|
9
|
+
# Allows this Action to be called by other Actions or through GitHub
|
|
10
|
+
on: [workflow_call, workflow_dispatch]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
|
|
14
|
+
pypi_publish:
|
|
15
|
+
name: publish to pypi
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
permissions:
|
|
18
|
+
# This permission is needed for private repositories.
|
|
19
|
+
contents: read
|
|
20
|
+
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
21
|
+
id-token: write
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- name: get repository
|
|
25
|
+
uses: actions/checkout@v7
|
|
26
|
+
|
|
27
|
+
- name: install uv
|
|
28
|
+
uses: astral-sh/setup-uv@v10.2.0
|
|
29
|
+
|
|
30
|
+
- name: build package
|
|
31
|
+
run: uv build
|
|
32
|
+
|
|
33
|
+
- name: push to pypi
|
|
34
|
+
run: uv publish
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
name: validate_codecov
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
paths: [codecov.yml]
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
validate-codecov-config:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v7
|
|
14
|
+
- name: Validate codecov configuration
|
|
15
|
+
run: curl -sSL --fail-with-body --data-binary @codecov.yml https://codecov.io/validate
|
crimepy-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Byte-compiled
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer Logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit Testing
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
*.py,cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
db.sqlite3-journal
|
|
61
|
+
|
|
62
|
+
# Flask
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx
|
|
70
|
+
docs/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
target/
|
|
74
|
+
|
|
75
|
+
# Jupyter
|
|
76
|
+
.ipynb_checkpoints
|
|
77
|
+
|
|
78
|
+
# IPython
|
|
79
|
+
profile_default/
|
|
80
|
+
ipython_config.py
|
|
81
|
+
|
|
82
|
+
# pipenv
|
|
83
|
+
Pipfile.lock
|
|
84
|
+
|
|
85
|
+
# Celery
|
|
86
|
+
celerybeat-schedule
|
|
87
|
+
celerybeat.pid
|
|
88
|
+
|
|
89
|
+
# SageMath
|
|
90
|
+
*.sage.py
|
|
91
|
+
|
|
92
|
+
# Environments
|
|
93
|
+
.env
|
|
94
|
+
.venv
|
|
95
|
+
env/
|
|
96
|
+
venv/
|
|
97
|
+
ENV/
|
|
98
|
+
env.bak/
|
|
99
|
+
venv.bak/
|
|
100
|
+
|
|
101
|
+
# Spyder
|
|
102
|
+
.spyderproject
|
|
103
|
+
.spyproject
|
|
104
|
+
|
|
105
|
+
# Rope
|
|
106
|
+
.ropeproject
|
|
107
|
+
|
|
108
|
+
# MkDocs
|
|
109
|
+
/site
|
|
110
|
+
|
|
111
|
+
# mypy
|
|
112
|
+
.mypy_cache/
|
|
113
|
+
.dmypy.json
|
|
114
|
+
dmypy.json
|
|
115
|
+
|
|
116
|
+
# Pyre
|
|
117
|
+
.pyre/
|
|
118
|
+
|
|
119
|
+
# VS Code
|
|
120
|
+
.vscode/
|
|
121
|
+
|
|
122
|
+
# VS Code counter
|
|
123
|
+
.VSCodeCounter/
|
|
124
|
+
|
|
125
|
+
# PyCharm
|
|
126
|
+
.idea/
|
|
127
|
+
|
|
128
|
+
# PDM
|
|
129
|
+
.copier-answers.yml
|
|
130
|
+
.idea/
|
|
131
|
+
.pdm-plugins/
|
|
132
|
+
.pdm-python
|
|
133
|
+
__pypackages__/
|
|
134
|
+
|
|
135
|
+
# Cython
|
|
136
|
+
cython_debug/
|
|
137
|
+
|
|
138
|
+
# Ruff
|
|
139
|
+
/.ruff_cache/
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
|
|
3
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
|
+
rev: "v6.0.0"
|
|
5
|
+
hooks:
|
|
6
|
+
- id: check-added-large-files
|
|
7
|
+
# The lock file lists every package and its hashes.
|
|
8
|
+
exclude: ^uv\.lock$
|
|
9
|
+
- id: check-ast
|
|
10
|
+
- id: check-json
|
|
11
|
+
- id: check-toml
|
|
12
|
+
- id: detect-private-key
|
|
13
|
+
- id: end-of-file-fixer
|
|
14
|
+
- id: trailing-whitespace
|
|
15
|
+
|
|
16
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
17
|
+
# Ruff version.
|
|
18
|
+
rev: v0.16.9
|
|
19
|
+
hooks:
|
|
20
|
+
# Run the linter. The formatter is not used because it removes the spaces
|
|
21
|
+
# around "=" in keyword arguments and moves closing brackets onto their own
|
|
22
|
+
# lines (see CONTRIBUTING.md).
|
|
23
|
+
- id: ruff
|
|
24
|
+
args: [ --fix ]
|
|
25
|
+
|
|
26
|
+
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
27
|
+
# uv version.
|
|
28
|
+
rev: 0.12.20
|
|
29
|
+
hooks:
|
|
30
|
+
- id: uv-lock
|
|
31
|
+
|
|
32
|
+
- repo: https://github.com/jsh9/pydoclint
|
|
33
|
+
rev: 0.10.1
|
|
34
|
+
hooks:
|
|
35
|
+
- id: pydoclint
|
|
36
|
+
args:
|
|
37
|
+
- --style=google
|
|
38
|
+
- --check-return-types=False
|
|
39
|
+
- --arg-type-hints-in-docstring=False
|
|
40
|
+
- --check-class-attributes=False
|
|
41
|
+
- --skip-checking-raises=True
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.11
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
<!-- insertion marker -->
|
|
6
|
+
|
|
7
|
+
## 0.1.0
|
|
8
|
+
|
|
9
|
+
* **Breaking:** `crimepy` is built on `amos` datasets.
|
|
10
|
+
`crimepy.nibrs.load`, `load_tables`, `read`, and `tables.build` (and its
|
|
11
|
+
builders) return `amos.Dataset`s, whose `data` is the table, and take
|
|
12
|
+
`label`, `task`, and `groups` for modeling. `crimepy.nibrs.load_frame`
|
|
13
|
+
returns a plain data frame, as `load` did. `crimepy.combine.stack` and
|
|
14
|
+
`merge` return datasets, and `crimepy.analyze.count` returns a new dataset
|
|
15
|
+
of counts, whose label is the counts.
|
|
16
|
+
* Every analysis is an `amos` technique: `population_rates`, `crime_rates`,
|
|
17
|
+
`percent_change`, `crosstab`, and `coverage` join `count_crimes`,
|
|
18
|
+
`crime_trend`, and `clearance_rates`. The functions of `crimepy.analyze`
|
|
19
|
+
apply them, take datasets or data frames, and keep their tables in a
|
|
20
|
+
dataset's `tables`. `crime_rates` loads the agencies of the data's years
|
|
21
|
+
and states when it is given none.
|
|
22
|
+
* The functions of `crimepy.plot` take datasets, which keep their figures in
|
|
23
|
+
`figures`, and `crimepy.nibrs.decode` decodes a dataset in place.
|
|
24
|
+
* Downloads of master files that break (as they do when the CDE's 15-minute
|
|
25
|
+
link expires during a slow download) resume where they stopped, with a new
|
|
26
|
+
link.
|
|
27
|
+
* `crimepy` requires `amos` 0.4.1.
|
|
28
|
+
* The README has a BibTeX entry for citing `crimepy`, and `CITATION.cff` has
|
|
29
|
+
the date of the release.
|
|
30
|
+
|
|
31
|
+
## 0.0.1
|
|
32
|
+
|
|
33
|
+
* Initial version, from the `snickerdoodle` template, built on `amos`.
|
|
34
|
+
* `crimepy.nibrs` downloads the FBI's NIBRS master files for any year from
|
|
35
|
+
1991 (`download`), converts them to parquet files (`convert`), and loads
|
|
36
|
+
their tables into `pandas` for any years, states, and columns (`load`).
|
|
37
|
+
It reads every era of the files: the three batch header records before
|
|
38
|
+
2013, the fields added in 2013, fixed-length and variable-length records,
|
|
39
|
+
and archives compressed with Deflate64.
|
|
40
|
+
* `crimepy.nibrs.layouts` has the position of every field, from the FBI's
|
|
41
|
+
record descriptions and from fields found in the files, and
|
|
42
|
+
`crimepy.nibrs.codes` has the label of every code.
|
|
43
|
+
* `crimepy.nibrs.tables` joins the segments of incidents into tables of
|
|
44
|
+
incidents, victims, offenses, offenders, and arrestees, with the details
|
|
45
|
+
of their incidents and agencies.
|
|
46
|
+
* `crimepy.combine` stacks and joins tables while keeping their categories.
|
|
47
|
+
* `crimepy.analyze` counts events, makes trends, crime rates, clearance
|
|
48
|
+
rates, and cross-tabulations, and measures reporting coverage.
|
|
49
|
+
* `crimepy.plot` draws trends, the most common values, events by hour and
|
|
50
|
+
day, and age pyramids.
|
|
51
|
+
* `amos` techniques: `load_nibrs`, `decode_nibrs`, `count_crimes`,
|
|
52
|
+
`crime_trend`, `clearance_rates`, `trend_plot`, `top_values`,
|
|
53
|
+
`time_heatmap`, and `age_pyramid`.
|
|
54
|
+
* A command line interface: `crimepy nibrs years`, `download`, `convert`,
|
|
55
|
+
and `export`, and `crimepy project`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use crimepy in your research, please cite it as below."
|
|
3
|
+
type: software
|
|
4
|
+
title: "crimepy: Accessible tools for downloading, combining, munging, analyzing, and plotting crime data"
|
|
5
|
+
abstract: >-
|
|
6
|
+
A Python package that downloads the FBI's National Incident-Based
|
|
7
|
+
Reporting System (NIBRS) master files for any year, turns them into flat
|
|
8
|
+
tables for pandas, joins the segments of incidents, and analyzes and plots
|
|
9
|
+
the results, built on amos for reproducible empirical research.
|
|
10
|
+
authors:
|
|
11
|
+
- given-names: Corey Rayburn
|
|
12
|
+
family-names: Yung
|
|
13
|
+
email: coreyrayburnyung@gmail.com
|
|
14
|
+
orcid: "https://orcid.org/0000-0001-6524-9956"
|
|
15
|
+
version: 0.1.0
|
|
16
|
+
date-released: 2026-10-26
|
|
17
|
+
license: Apache-2.0
|
|
18
|
+
repository-code: "https://github.com/WithPrecedent/crimepy"
|
|
19
|
+
url: "https://WithPrecedent.github.io/crimepy"
|
|
20
|
+
keywords:
|
|
21
|
+
- crime
|
|
22
|
+
- criminology
|
|
23
|
+
- empirical legal studies
|
|
24
|
+
- fbi
|
|
25
|
+
- nibrs
|
|
26
|
+
- open science
|
|
27
|
+
- reproducibility
|
|
28
|
+
- uniform crime reporting
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to make participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies within all project spaces, and it also applies when
|
|
49
|
+
an individual is representing the project or its community in public spaces.
|
|
50
|
+
Examples of representing a project or community include using an official
|
|
51
|
+
project e-mail address, posting via an official social media account, or acting
|
|
52
|
+
as an appointed representative at an online or offline event. Representation of
|
|
53
|
+
a project may be further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting any of the following people:
|
|
59
|
+
|
|
60
|
+
* Corey Rayburn Yung (coreyrayburnyung@gmail.com)
|
|
61
|
+
|
|
62
|
+
All complaints will be reviewed and investigated and will result in a response that
|
|
63
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
64
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
65
|
+
Further details of specific enforcement policies may be posted separately.
|
|
66
|
+
|
|
67
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
68
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
69
|
+
members of the project's leadership.
|
|
70
|
+
|
|
71
|
+
## Attribution
|
|
72
|
+
|
|
73
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
74
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
75
|
+
|
|
76
|
+
[homepage]: https://www.contributor-covenant.org
|
|
77
|
+
|
|
78
|
+
For answers to common questions about this code of conduct, see
|
|
79
|
+
https://www.contributor-covenant.org/faq
|