This repo contains the code necessary to setup the database and all analyses used in my post 14 Million Bike Rides in The Windy City (2013 - 2017) - An Analysis of Chicago’s Bikeshare System.
download_concat_data.sh
Downloads the raw trip data from 2013 - 2017 into the sub-directory /data within the current folder and concatenates the raw trip data into one file.
01_create_schema.sql
02_import.sql
c) Cleans the raw trip and station data and maps the station data onto community areas and census tracts.
03_tables_for_analyses.sql
SQL queries and analyses can be found in analyses/
.
Additionally, if one wants to recreate the static heat map, look at get_legs_routes_key_rm.R
.
NOTE: This may cost $$$$ with the new pricing changes Google implemented with their Google Maps API mid-July 2018. May want to consider looking into OSRM as a free, open-source alternative.
The legs can then be imported using 04_import_legs.sh
, making sure to run it from the top level directory of the repo or the following command in a unix terminal:
psql chicago-divvy-data -c "SET datestyle = 'ISO, MDY'; COPY legs FROM 'ABSOLUTE_PATH/data/legs_start_end.csv' CSV HEADER;".
- Review Indexes
- Review transports.R - OVER and WINDOW functions