diff --git a/package.json b/package.json index 5aa952d56..219cca2d6 100644 --- a/package.json +++ b/package.json @@ -15,9 +15,11 @@ "html-webpack-plugin": "^3.2.0", "jest": "^24.9.0", "leaflet": "^1.5.1", + "moment": "^2.24.0", "proptypes": "^1.1.0", "react": "^16.8.6", "react-burger-menu": "^2.6.13", + "react-datepicker": "^2.12.1", "react-dom": "^16.8.6", "react-leaflet": "^2.4.0", "react-leaflet-choropleth": "^2.0.0", @@ -39,10 +41,10 @@ "deploy": "gh-pages -d dist" }, "devDependencies": { - "@babel/core": "^7.7.2", + "@babel/core": "^7.8.4", "@babel/plugin-proposal-class-properties": "^7.7.0", - "@babel/preset-env": "^7.7.1", - "@babel/preset-react": "^7.7.0", + "@babel/preset-env": "^7.8.4", + "@babel/preset-react": "^7.8.3", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", "css-loader": "^3.2.0", @@ -54,12 +56,14 @@ "eslint-plugin-jsx-a11y": "^6.2.3", "eslint-plugin-react": "^7.17.0", "eslint-plugin-react-hooks": "^1.7.0", + "extract-text-webpack-plugin": "^4.0.0-beta.0", "file-loader": "^4.2.0", + "mini-css-extract-plugin": "^0.9.0", "node-sass": "^4.12.0", "sass-loader": "^8.0.0", "style-loader": "^1.0.0", "webpack": "^4.41.2", - "webpack-cli": "^3.3.10", + "webpack-cli": "^3.3.11", "webpack-dev-server": "^3.9.0" } } diff --git a/public/index.html b/public/index.html index 625b5240f..c1c2571a2 100644 --- a/public/index.html +++ b/public/index.html @@ -3,6 +3,7 @@ + \'{}\''.format(startDate), + 'createddate < \'{}\''.format(endDate), + 'ncname IN ({})'.format(ncs), + 'requesttype IN ({})'.format(requests)] + result = self.dataAccess.query(items, filters) + + return result diff --git a/server/src/services/sqlIngest.py b/server/src/services/sqlIngest.py index d864270dc..08cc9a155 100644 --- a/server/src/services/sqlIngest.py +++ b/server/src/services/sqlIngest.py @@ -1,11 +1,11 @@ import os -import sqlalchemy as db -import pandas as pd -from configparser import ConfigParser +import time import numpy as np +import pandas as pd +import sqlalchemy as db from sodapy import Socrata -import time -import databaseOrm # Contains database specs and field definitions +from .databaseOrm import tableFields, insertFields, readFields # Contains db specs and field definitions +from configparser import ConfigParser class DataHandler: @@ -17,9 +17,9 @@ def __init__(self, config=None, configFilePath=None, separator=','): self.filePath = None self.configFilePath = configFilePath self.separator = separator - self.fields = databaseOrm.tableFields - self.insertParams = databaseOrm.insertFields - self.readParams = databaseOrm.readFields + self.fields = tableFields + self.insertParams = insertFields + self.readParams = readFields self.dialect = None def loadConfig(self, configFilePath): @@ -177,7 +177,7 @@ def populateFullDatabase(self, yearRange=range(2015, 2021)): Default operation is to fetch data from 2015-2020 !!! Be aware that each fresh import will wipe the existing staging table''' - print('Performing fresh ' + self.dialect + ' population from Socrata data sources') + print('Performing {} population from data source'.format(self.dialect)) tableInit = False globalTimer = time.time() for y in yearRange: diff --git a/src/components/common/Button.jsx b/src/components/common/Button.jsx index 995c6a4ee..70adfe440 100644 --- a/src/components/common/Button.jsx +++ b/src/components/common/Button.jsx @@ -24,6 +24,8 @@ const Button = ({ isStatic, disabled, style, + icon, + iconStyle, }) => { // Dynamically generates button className from props to comply with Bulma styling modifiers. const buttonClassName = classNames('button', { @@ -53,7 +55,14 @@ const Button = ({ className={buttonClassName} style={style} > - {label} + {icon && ( + + + + )} + + {label} + ); }; @@ -78,6 +87,8 @@ Button.propTypes = { isStatic: PropTypes.bool, disabled: PropTypes.bool, style: PropTypes.shape({}), + iconStyle: PropTypes.shape({}), + icon: PropTypes.string, }; Button.defaultProps = { @@ -97,4 +108,6 @@ Button.defaultProps = { isStatic: false, disabled: false, style: undefined, + iconStyle: undefined, + icon: undefined, }; diff --git a/src/components/common/CONSTANTS.js b/src/components/common/CONSTANTS.js index f96f3c2fc..16e0e631b 100644 --- a/src/components/common/CONSTANTS.js +++ b/src/components/common/CONSTANTS.js @@ -23,6 +23,69 @@ export const MONTHS = [ 'December', ]; +export const REQUEST_TYPES = [ + { + type: 'Dead Animal', + abbrev: 'DAN', + color: '#4FEFEF', + }, + { + type: 'Homeless Encampment', + abbrev: 'HLE', + color: '#ECB800', + }, + { + type: 'Single Streetlight', + abbrev: 'SSL', + color: '#AD7B56', + }, + { + type: 'Multiple Streetlight', + abbrev: 'MSL', + color: '#F7ADAD', + }, + { + type: 'Feedback', + abbrev: 'FBK', + color: '#FFE6B7', + }, + { + type: 'Bulky Items', + abbrev: 'BLK', + color: '#FF0000', + }, + { + type: 'E-Waste', + abbrev: 'EWT', + color: '#DDEC9F', + }, + { + type: 'Metal/Household Appliances', + abbrev: 'MHA', + color: '#B8D0FF', + }, + { + type: 'Graffiti', + abbrev: 'GFT', + color: '#2368D0', + }, + { + type: 'Illegal Dumping', + abbrev: 'ILD', + color: '#6A8011', + }, + { + type: 'Other', + abbrev: 'OTH', + color: '#6D7C93', + }, + + /* + * Is 'Report Water Waste' still a valid request type? + * If so, we're missing it on the front end mockups. + */ +]; + export const REQUESTS = [ 'Bulky Items', 'Dead Animal Removal', diff --git a/src/components/common/Checkbox.jsx b/src/components/common/Checkbox.jsx index 97cfadbe8..8a20b676f 100644 --- a/src/components/common/Checkbox.jsx +++ b/src/components/common/Checkbox.jsx @@ -10,6 +10,7 @@ const Checkbox = ({ name, value, checked, + style, /* * Props below correspond with Bulma modifiers. * wikiki.github.io/form/checkradio/ @@ -48,7 +49,7 @@ const Checkbox = ({ checked={checked} disabled={disabled} /> -