You will need to set up Docker to run this code!
To run the code locally, follow the steps below
-
Run
git clone git@github.com:jaspk06/ECE356Project.git
make sure you have your SSH key set up -
cd
into the project repository -
Run
docker-compose up -d
from the project root directory to run the environment. This will create a mysql db container onlocalhost:3306
, nodejs server container onlocalhost:8080
, and React UI onlocalhost:3000
in production mode.
- Download the parsed CSV files
- Move the files to the directory
ECE356Project/client-app/data/*.csv
OR
If you want to locally parse the dataset:
-
Download PP_recipes.csv, PP_users.csv, RAW_interactions.csv, RAW_recipes.csv, and parsed ingr_map.pkl from the dataset
-
Move it to the directory
ECE356Project/client-app/data/*.csv
-
Go into the client-app container using
docker exec -it client-app bash
and runyarn process-data
to process the dataset CSV files.
This is what your directory tree should look like:
├── client-app
│ ├── data
│ │ ├── *.csv
│ ├── src
│ │ ├── ...
│ ├── ...
Click here to view the diagram of the schema
In order to populate the database with the CSVs, they must be moved to inside the container of the MySQL instance. To achieve this, run the command
sh copytodocker.sh
. Then, enter the db container using docker exec -it db bash
. You can then use the mysql CLI from there.
After all the appropriate CSVs have been copied, they can be loaded. For our environment, we can use the command
LOAD DATA LOCAL INFILE 'var/lib/mysql/<CSV_NAME>.csv' INTO TABLE <TABLE_NAME> FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS (col [,col...]);
For example, loading ingredients would look like
LOAD DATA LOCAL INFILE 'var/lib/mysql/PARSED_ingredients.csv' INTO TABLE Ingredients FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 ROWS (aliasID, ingredientName);
Refer to this guide to enable file loading in MySQL. After logging into the MySQL CLI with file loading enabled, run source var/lib/mysql/createtables.sql
in the mysql CLI.