{ "info": { "author": "Joseph Kato", "author_email": "joseph@jdkato.io", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6" ], "description": "\n# OpenPDI [![Build Status](https://travis-ci.org/OpenPDI/openpdi.svg?branch=master)](https://travis-ci.org/OpenPDI/openpdi) [![code style](https://img.shields.io/badge/code%20style-black-%23000.svg)](https://github.com/OpenPDI/openpdi) [![DOI](https://zenodo.org/badge/153943607.svg)](https://zenodo.org/badge/latestdoi/153943607) [![Thanks](https://img.shields.io/badge/say-thanks-ff69b4.svg?&logo=gratipay&logoColor=white)](#say-thanks)\n\nOpenPDI is an unofficial effort to document and standardize data submitted to\nthe [Police Data Initiative][3] (PDI). The goal is to make the data more accessible\nby addressing a number of issues related to a lack of\nstandardization—namely,\n\n- **File types**: While some agencies make use if the\n [Socrata Open Data API](https://dev.socrata.com/), many provide their data\n in raw `.csv`, `.xlsx`, or `.xls` files of varying structures.\n- **Column names**: Many columns that represent the same data (e.g., the race\n police officer) are named differently across departments, cities, and states.\n- **Value formats**: Dates, times, and other comparable fields are submitted in\n many different formats.\n- **Column availability**: It's currently very difficult to identify data\n sources that contain certain columns—e.g., *Use of Force* data\n specifying the hire date of the involved officer(s).\n\n## Getting Started\n\n###### Installation\n\n```shell\n$ pip install openpdi\n```\n\n###### Usage\n\n| Dataset | ID | Source |\n|-------------------|-------|-------------------------------------------------------------|\n| [Use of Force][1] | `uof` | https://www.policedatainitiative.org/datasets/use-of-force/ |\n\n```python\nimport csv\nimport openpdi\n\n# The library has a single entry point:\ndataset = openpdi.Dataset(\n # The dataset ID (see the table above).\n \"uof\",\n # Limit the data sources to a specific state using its two-letter code.\n #\n # Default: `scope=[]`.\n scope=[\"TX\"],\n # A list of columns that must be provided in every data source included in\n # this dataset. See `openpdi/meta/{ID}/schema.json` for the available\n # columns.\n #\n # Default: `columns=[]`.\n columns=[\"reason\"],\n # If `True`, only return the user-specified columns -- i.e., those listed\n # in the `columns` parameter.\n #\n # Default: `strict=False`.\n strict=False)\n\n# The names of the agencies included in this dataset:\nprint(dataset.agencies)\n\n# The URLs of the external data sources inlcuded in this dataset:\nprint(dataset.sources)\n\n# `gen` is a generator object for iterating over the CSV-formatted dataset.\ngen = dataset.download()\n\n# Write to a CSV file:\nwith open(\"dataset.csv\", \"w+\") as f:\n writer = csv.writer(f, delimiter=\",\", quoting=csv.QUOTE_ALL)\n writer.writerows(gen)\n```\n\n## Datasets\n\nIn an attempt to avoid unnecessary bloat (in terms of GBs), we don't actually store any PDI data in this repository. Instead, we store small, JSON-formatted descriptions of externally hosted datasets—for example, [`uof/CA/meta.json`](https://github.com/OpenPDI/openpdi/blob/master/openpdi/meta/uof/CA/meta.json):\n\n```json\n[\n {\n \"url\": \"https://www.norwichct.org/Archive.aspx?AMID=61&Type=Recent\",\n \"type\": \"csv\",\n \"start\": 1,\n \"columns\": {\n \"date\": {\n \"index\": 0,\n \"specifier\": \"%m/%d/%Y\"\n },\n \"city\": {\n \"raw\": \"Richmond\"\n },\n \"state\": {\n \"raw\": \"CA\"\n },\n \"service_type\": {\n \"index\": 1\n },\n \"force_type\": {\n \"index\": 10\n },\n \"light_conditions\": {\n \"index\": 8\n },\n \"weather_conditions\": {\n \"index\": 7\n },\n \"reason\": {\n \"index\": 2\n },\n \"officer_injured\": {\n \"index\": 6\n },\n \"officer_race\": {\n \"index\": 9\n },\n \"subject_injured\": {\n \"index\": 5\n },\n \"aggravating_factors\": {\n \"index\": 3\n },\n \"arrested\": {\n \"index\": 4\n }\n }\n }\n]\n```\n\nThis file describes a Use of Force (`uof`) dataset from Richmond, CA. Each entry in the `columns` array maps a column from the externally-hosted data to a column in the dataset's schema file ([`uof/schema.json`](https://github.com/OpenPDI/openpdi/blob/master/openpdi/meta/uof/schema.json)).\n\n![flow][4]\n\nThe `schema.json` file assigns a `format` to every possible column in a particular dataset, which is a Python function tasked with standardizing a raw column value (see [`openpdi/validators.py`](https://github.com/OpenPDI/openpdi/blob/master/openpdi/validators.py)).\n\n[1]: https://github.com/jdkato/OpenPDI/tree/master/openpdi/meta/uof\n[2]: https://www.policedatainitiative.org/datasets/use-of-force/\n[3]: https://www.policedatainitiative.org/\n[4]: https://user-images.githubusercontent.com/8785025/49119503-6975ac80-f25d-11e8-9310-802492815b39.png\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/OpenPDI/openpdi", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "openpdi", "package_url": "https://pypi.org/project/openpdi/", "platform": "", "project_url": "https://pypi.org/project/openpdi/", "project_urls": { "Homepage": "https://github.com/OpenPDI/openpdi" }, "release_url": "https://pypi.org/project/openpdi/0.1.3/", "requires_dist": [ "requests", "tabulate" ], "requires_python": ">=3.6.0", "summary": "A library for working with data submitted to the PDI.", "version": "0.1.3" }, "last_serial": 4622664, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1bf46434546acbeba2a063c0ed593763", "sha256": "b818c3fec69e0d50a7d70c92e70f99bc2a880f57b706b1e3f39f65cb3291612a" }, "downloads": -1, "filename": "openpdi-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1bf46434546acbeba2a063c0ed593763", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 14902, "upload_time": "2018-11-25T01:02:37", "url": "https://files.pythonhosted.org/packages/85/81/532d9d3920d6cbdf87364920bf5306b315494e978545d28dadf27f332935/openpdi-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1bfa57eef9d00d472f29af87c634a84d", "sha256": "99ce94d6ec5d9353976a231090301cba68f4a13b49159d738db47402993cecfa" }, "downloads": -1, "filename": "openpdi-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1bfa57eef9d00d472f29af87c634a84d", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 11848, "upload_time": "2018-11-25T01:02:39", "url": "https://files.pythonhosted.org/packages/50/50/dd56765d2e11eddceab6b84071b0021b6263511a94d320efcb966d52b19c/openpdi-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "350a781f32538cc2f56e5fea22548fbe", "sha256": "a947b92a5cd173e4bd2ac54efd9f4616a2523cb23b0ce32e5d32bd0135370b70" }, "downloads": -1, "filename": "openpdi-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "350a781f32538cc2f56e5fea22548fbe", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 14902, "upload_time": "2018-11-25T01:10:03", "url": "https://files.pythonhosted.org/packages/f0/b4/56496cf8d2a747afe9ce4f2b52a95be73707a09912f1ebee5e0f2f4b2f93/openpdi-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "91875a63ed3dde2b793f1d3c6e479237", "sha256": "cc521e5675107de93bb4fa32c4d9d7d3bb896d9612e459b2b46c48f48e41713f" }, "downloads": -1, "filename": "openpdi-0.1.1.tar.gz", "has_sig": false, "md5_digest": "91875a63ed3dde2b793f1d3c6e479237", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 11855, "upload_time": "2018-11-25T01:10:04", "url": "https://files.pythonhosted.org/packages/84/24/f76ee732d3e6ba1d92b6b20dc733c7c7e36418bf72e2f96821a81148f628/openpdi-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "9224b7193c1a42e70a02ae627ea58f4c", "sha256": "5cd119aefb1fa9ee47cd0ebaaa6418fa768de6fdc2dd42bf5fcaa8f9709aaf90" }, "downloads": -1, "filename": "openpdi-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9224b7193c1a42e70a02ae627ea58f4c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 15702, "upload_time": "2018-12-09T02:22:30", "url": "https://files.pythonhosted.org/packages/75/6d/060184689ca3016ff7145c50148bfc1ead004584a98064ec5f28d4ebd923/openpdi-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8a19e604192fe5297b92a7c8949d101b", "sha256": "c05c78048eeb7703a04fa0b071d470254518a07e1b1f0dce5d2478b49fb9ad4f" }, "downloads": -1, "filename": "openpdi-0.1.2.tar.gz", "has_sig": false, "md5_digest": "8a19e604192fe5297b92a7c8949d101b", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 14636, "upload_time": "2018-12-09T02:22:32", "url": "https://files.pythonhosted.org/packages/7a/4e/fe10cd0d9526f113c8685649afdc70728d3c4dc3ccbebe9abbc9a5e269f8/openpdi-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "7343bd9852ece022688f3739b6862187", "sha256": "c59ca70f74fb726edd339aecefde78c8d3fca49c92004d070898a4d41556dbe7" }, "downloads": -1, "filename": "openpdi-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7343bd9852ece022688f3739b6862187", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 16568, "upload_time": "2018-12-20T21:48:41", "url": "https://files.pythonhosted.org/packages/2c/13/fa6d7950499a739af0888586f1dc0f27d57fe0ac886ffa18d67e8a895abf/openpdi-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "48d95506cb18eb27985243a16ecf01eb", "sha256": "813ae903bd1243226c42f47bd94f5957b59937786f1bb517546012d4f1fa3d24" }, "downloads": -1, "filename": "openpdi-0.1.3.tar.gz", "has_sig": false, "md5_digest": "48d95506cb18eb27985243a16ecf01eb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 13680, "upload_time": "2018-12-20T21:48:42", "url": "https://files.pythonhosted.org/packages/26/5e/6bbfcbcd6e1ba960e049d47703f3951cc0e0a59885e0fe2bd82a29ec10f0/openpdi-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7343bd9852ece022688f3739b6862187", "sha256": "c59ca70f74fb726edd339aecefde78c8d3fca49c92004d070898a4d41556dbe7" }, "downloads": -1, "filename": "openpdi-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7343bd9852ece022688f3739b6862187", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 16568, "upload_time": "2018-12-20T21:48:41", "url": "https://files.pythonhosted.org/packages/2c/13/fa6d7950499a739af0888586f1dc0f27d57fe0ac886ffa18d67e8a895abf/openpdi-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "48d95506cb18eb27985243a16ecf01eb", "sha256": "813ae903bd1243226c42f47bd94f5957b59937786f1bb517546012d4f1fa3d24" }, "downloads": -1, "filename": "openpdi-0.1.3.tar.gz", "has_sig": false, "md5_digest": "48d95506cb18eb27985243a16ecf01eb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 13680, "upload_time": "2018-12-20T21:48:42", "url": "https://files.pythonhosted.org/packages/26/5e/6bbfcbcd6e1ba960e049d47703f3951cc0e0a59885e0fe2bd82a29ec10f0/openpdi-0.1.3.tar.gz" } ] }