vpd-crime-data-exploration
)Project complete in accordance with DSCI 532 for the UBC MDS Program 2022-23
The repository hosts the source code of an exploration of the VPD Crime Data. For information on the intention, research questions, as well as a more detailed description of the data, please read the proposal instead.
The objective of this dashboard it to enable users to make inferences on the (aggregated) crime data in Vancouver, BC between 2003 to 2022.
The latest version at master
is deployed here.
On the left, the user can choose to drill down on the aggregated crime data. The three filters are:
After the selection, the user can see the plots on the right updated on the fly. On the top, there is a time series line chart. By choosing other tabs there, the user can choose not to facet the data, facet it by offence type, and facet it by neighbourhood. At the bottom, there is a heatmap which plots offence type against neighbourhood.
If you are considering to contribute, hack, or simply fork this app, great! Before moving on, make sure your computer has Python development environment set up. IDEs like Visual Studio Code are optional. Developing on POSIX (Linux) or Mac is recommmended, but Windows should also work.
The latest copy of this code can be downloaded by:
git clone https://github.com/netsgnut/vpd-crime-data-exploration
cd vpd-crime-data-exploration
virtualenv
Create a virtualenv
under the folder .venv
, in the project root folder.
(Note that you can also use other tools to create a virtual environment.)
python -m venv .venv
virtualenv
. .venv/bin/activate
pip install -r src/requirements.txt
To run it via Flask locally:
cd src
python app.py
Or, alternatively, you could enable the debug mode with:
cd src
DEBUG=1 python app.py
There is a script at src/process_data.py
that reads the raw crimedata_csv_AllNeighbourhoods_AllYears.csv
(extracted from the ZIP downloaded from the data portal) in data/raw/
and process it to be data/processed/crimedata_aggregated.csv
. Normally, you don't need to run it because both files are provided. But if you would like to tweak the parameters and/or update it to the latest dataset, you can modify the script there.
Thank you for your interest! Make sure to review the CONTRIBUTING.md
and CODE_OF_CONDUCT.md
for more information!
The CSV files under data/
directory are works/direct derivative of works from the VPD Crime Data.
Copyright (c) 2003-2022 Vancouver Police Department
Unless otherwise specified, the materials in this repository are covered under this copyright statement:
Copyright (c) 2023 Kelvin Wong
The software and associated documentation files are licensed under the MIT License. You may find a copy of the license at LICENSE
.
NOTE: Regarding the assumptions of the dataset, please refer to the
VPD OpenData Crime Incidents Description.pdf
included in thedata/raw/crimedata_csv_AllNeighbourhoods_AllYears.zip
file file.