Note: this project is now archived due to issues raised in the Popular Times repo regarding Google's terms of service.
A simple React app that displays when grocery stores are busiest in a community, according to Google's Popular Times data, via the populartimes library. Made in response to COVID-19 and the extra preparation everyone has to do to go grocery shopping. Data for each location is fetched on the server every day using a cron job.
- Clone this repo.
- Create a
data
directory within thepublic
directory. Move over data files from https://whento.shop/data todata
. - run
yarn install
- run
yarn start
- the app will open in your browser using localhost
- To fetch new locations locally, you will need to create a
config.py
file in the python directory. It needs to contain the following:api_key = “yourAPIkey”
, whereyourAPIkey
is an API key for the Google Places API. - Install libraries by running
pip install -r requirements.txt
. You will need to use Python 3. - Run
python python/scraper.py
from the top directory to fetch fresh data for the existing locations.
- Create a new location in the the
locations.json
file in thepublic directory
, with a lat and long location at the centre of where you want to search and an appropriate radius in meters. - Run
python python/getids.py KEY_OF_YOUR_LOCATION
from the top directory. Once you get grocery store locations back, look them over before adding them to the IDs key in the locations file for your location to make sure they should be added. - Run
python python/scrapelocation.py KEY_OF_YOUR_LOCATION
from the top directory in your terminal to get data for the new location. Alternatively, to fetch data for all locations, runpython python/scraper.py
. - Once finished, you will be able to see a file created in the data directory, and the results in the front-end.