# Byte Trek Reputation Management

## Installation:

### 1. Clone The reporsitory
```bash
➜  git clone http://bytetrek.com:30000/ByteTrek-Projects/review-automation-backend.git
```

### 2. Create a virtual environment and active it.
```bash
➜  python3 -m venv env
➜  source env/bin/activate
```

### 3. Create a mysql database and import the .sql file
```bash
(env) ➜  mysql -u root -h localhost -p                 # mysql -u user -h host -p
mysql> CREATE DATABASE review_automation;
mysql> SHOW DATABASES;                                 # Make sure database is created or not.
exit                                                   # Exit out of the mysql prompt
(env) ➜  mysql -u root -p review_automation < review_automation.sql
# Make sure everything is just fine.
(env) ➜  mysql -u root -h localhost -p
mysql> USE review_automation;
mysql> SHOW TABLES;
```

### 4. Run the development server
```bash
(env) ➜ python manage.py runserver
```

### 5. Add all corn jobs
```bash
(env) ➜ python manage.py crontab add
# Make sure corn job has added successfully
(env) ➜ crontab -l                                     # Return list of cronjobs
```

### 6. Some usefull management command
- Store all un-recorded reviews to the database.
    ```bash
    (env) ➜ python manage.py collect_reviews
    ```
- Get model prediction report.
    ```bash
    (env) ➜ python manage.py model_report n_days
    # Example for last 30 days:
    (env) ➜ python manage.py model_report 30
    ```