import pandas as pd  # Module made to filter and analyze data
from datetime import datetime, timedelta  # Module made for string -> date parsing and date -> string formatting
import geopandas as gpd
import matplotlib.pyplot as plt
import descartes
from shapely.geometry import Point, Polygon
# https://www.denvergov.org/opendata/dataset/city-and-county-of-denver-crime
# data = gpd.read_file('data/crime.shp')  # Read in file
# print(data.filter(['FIRST_OCCURRENCE_DATE']).head(5))
# # Next lets remove all data created within the last month (30.5 days) to reduce error (noisy data)
# month_ago = (datetime.now() - timedelta(days=30.5)).strftime('%m/%d/%y %H:%M:%S %p')
# # Lets keep current and only take the past 3 years worth of data
# three_year_ago = (datetime.now() - timedelta(days=(365.25*3))).strftime('%m/%d/%y %H:%M:%S %p')
# data['FIRST_OCCURRENCE_DATE'] = pd.to_datetime(data['FIRST_OCCURRENCE_DATE'], format='%m/%d/%Y %H:%M:%S %p')
# # ----------------------------------------------------------------------------------------
# # Filter rows and columns
# filtered_data = data[(data['IS_CRIME'] == 1) &
#                      (data['FIRST_OCCURRENCE_DATE'] < datetime.strptime(month_ago, '%m/%d/%y %H:%M:%S %p')) &
#                      (data['FIRST_OCCURRENCE_DATE'] > datetime.strptime(three_year_ago, '%m/%d/%y %H:%M:%S %p'))
#                     ].filter(['GEO_LON', 'GEO_LAT', 'geometry'])
#
# crime_map = filtered_data
# -------- Potential Future ----------------------------------------------
street_map = gpd.read_file('data/street_centerline.shp')
# https://www.denvergov.org/opendata/dataset/city-and-county-of-denver-county-boundary V:1.0.54
# -------------------------------------------------------------------
# Plot crime points
fig, ax = plt.subplots(figsize=(15, 15))
street_map.plot(ax=ax)
plt.show()
# ----------------------------------------------------------------------------------------


