Skip to content

Changelog

All notable changes to this project will be documented in this file.

0.2.1

  • Breaking: crimepy.nibrs.codes.STATES is now the name of each numeric state code (it was STATE_NAMES), and codes.STATE_ABBREVIATIONS is the postal abbreviation (it was STATES).
  • Each codebook of crimepy.nibrs.codes.CODEBOOKS is also public by itself (such as codes.RACES and codes.WEAPONS). The "clearances" codebook is codes.EXCEPTIONAL_CLEARANCES, and the "divisions" codebook is codes.SUBREGIONS. codes.OFFENSES has the name, category, whom or what it is against, and group of each offense code.
  • crimepy.nibrs.codes.OFFENSE_TYPES lists the offense codes of each type: whom or what they are against ("Person", "Property", "Society", and "Not a Crime"), and "National Security Offenses", "Rape Offenses", "Sex Offenses", and "Immigration Offenses".
  • The code follows the house style throughout: lines of at most 80 characters (the tables in docstrings are now lists), section markers that group the members of each module and class, and a full docstring for every function and method, tests and private ones included.

0.2.0

  • Breaking: crimepy keeps its data in amos's workspace (amos 0.6.0), not in a "crimepy_data" folder of the home folder. The data folder is now the "crime" folder (options.DATA_SUBFOLDER) of the data folder of the workspace that holds the "code" folder (such as "projects/data/crime" for code in "projects/code"; see amos's Clerk), so NIBRS is in "data/crime/nibrs", beside the "studies" folder of amos projects' results. CRIMEPY_DATA, options.DATA_FOLDER (now None unless CRIMEPY_DATA is set), and a folder argument still name another. Move an existing "crimepy_data" folder's "nibrs" folder there (or set CRIMEPY_DATA) to keep its downloads and tables. Requires amos 0.6.0.

0.1.0

  • Breaking: crimepy is built on amos datasets. crimepy.nibrs.load, load_tables, read, and tables.build (and its builders) return amos.Datasets, whose data is the table, and take label, task, and groups for modeling. crimepy.nibrs.load_frame returns a plain data frame, as load did. crimepy.combine.stack and merge return datasets, and crimepy.analyze.count returns a new dataset of counts, whose label is the counts.
  • Every analysis is an amos technique: population_rates, crime_rates, percent_change, crosstab, and coverage join count_crimes, crime_trend, and clearance_rates. The functions of crimepy.analyze apply them, take datasets or data frames, and keep their tables in a dataset's tables. crime_rates loads the agencies of the data's years and states when it is given none.
  • The functions of crimepy.plot take datasets, which keep their figures in figures, and crimepy.nibrs.decode decodes a dataset in place.
  • Downloads of master files that break (as they do when the CDE's 15-minute link expires during a slow download) resume where they stopped, with a new link.
  • crimepy requires amos 0.4.1.
  • The README has a BibTeX entry for citing crimepy, and CITATION.cff has the date of the release.

0.0.1

  • Initial version, from the snickerdoodle template, built on amos.
  • crimepy.nibrs downloads the FBI's NIBRS master files for any year from 1991 (download), converts them to parquet files (convert), and loads their tables into pandas for any years, states, and columns (load). It reads every era of the files: the three batch header records before 2013, the fields added in 2013, fixed-length and variable-length records, and archives compressed with Deflate64.
  • crimepy.nibrs.layouts has the position of every field, from the FBI's record descriptions and from fields found in the files, and crimepy.nibrs.codes has the label of every code.
  • crimepy.nibrs.tables joins the segments of incidents into tables of incidents, victims, offenses, offenders, and arrestees, with the details of their incidents and agencies.
  • crimepy.combine stacks and joins tables while keeping their categories.
  • crimepy.analyze counts events, makes trends, crime rates, clearance rates, and cross-tabulations, and measures reporting coverage.
  • crimepy.plot draws trends, the most common values, events by hour and day, and age pyramids.
  • amos techniques: load_nibrs, decode_nibrs, count_crimes, crime_trend, clearance_rates, trend_plot, top_values, time_heatmap, and age_pyramid.
  • A command line interface: crimepy nibrs years, download, convert, and export, and crimepy project.