singhshemona / recommend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrec - Readme.md

standard-readme compliant

Let's build a world where recommendations give you a breadth of knowledge, not just depth.

Table of Contents

Objective

This idea started off with the idea of "I don't know what I don't know" when it comes to consuming things like books, music and movies. Every recommendation system is trying to keep you within your bubble of interests but we want to build something that makes you aware of what else is out there, especially to try something new for the first time.

The purpose of this project is to compare a user's book classifications to the total available classifications. One way this is done is by using the Dewey Decimal System. Most data visulizations show what you have consumed but not what you HAVEN'T consumed.

Background

This project uses Flask for the backend in order to return a JSON file to incorporate D3 Zoomable Circle Packing Visualization.

Here are some files which you may find helpful when diving into the project:

  • wrec-schema.jpg - diagram of all the models
  • classify_api_flowchart.jpg - Our project utilizes the Classify API to convert ISBN values to their respective dewey decimal numbers. However, the process isn't straightforward as the API actually returns an XML document of that particular book's data. The XML is converted to JSON, then parsed to find the dewey number value. This process isn't standard hence, a flowchart of the algorithm needed to be created to clarify the steps. There are still some methods missing which need to be added to the flowchart. Here is a snippet of the flowchart: classify_api_snippet

Install

  1. You can either clone the project by runninggit clone https://github.com/singhshemona/recommmend.git in your terminal or fork the project in order to contribute later: See Contributing below.

Back End

  1. Set up your Python virtual environment by running pyvenv venv in that directory and running source venv/bin/activate to active it. Or create a conda environment.

  2. make sure pip is installed

  3. Install Python requirements with pip install -r requirements.txt. You may need to install some build prerequisites; on Debian-like systems, they include the packages python3-dev and libpq-dev. You can try running pip install psycopg2-binary first to see if that solves the issue.

  4. Install PostgreSQL and create an empty database, e.g. createdb wrec

  5. Add environment variables (see next section)

  6. At your terminal, you will need to initialize, migrate and upgrade your database:

    • flask db migrate -m "initial migration
    • flask db migrate
    • flask db upgrade
  7. Then go to each of the following endpoints to upload the tens, hundreds and thousands csv files. The csv files are located in the /app/externalFiles/DDS_directory_structure. The corresponding file needs to be uploaded at it's respective endpoint:

    • DDSGORun0.csv > /category/ten/upload
    • DDSGORun1.csv > /category/hundred/upload
    • DDSGORun2.csv > /category/thousand/upload
  8. At your terminal run flask run. Click on development server shown in your terminal http://127.0.0.1:5000/

Environment variables

Create a .env file at the project level and add the following:

  • FLASK_APP = wrec.py
  • FLASK_DEBUG = 1
  • SECRET_KEY = A 24 character random string can be generated by running python in your terminal and typing the following one line at a time
import secrets
secrets.token_hex(24)
  • DATABASE_URL=postgresql://username:password@hostname/database
  • FLASK_CONFIG=development

Environment variables - additional notes

If you normally log in with username or password, then use the following line: postgresql:///database. It is recommended setting up test and production databases as well.

Front End

  1. npm install
  2. npm start
  3. Open http://localhost:3000 in browser. The page will reload if you make edits.

Wrec API

Contributing

Please follow along this excellent step-by-step guide to learn how to contribute to an open-source project

Quick summary

  1. Make desired changes
  2. Add, commit, push
  3. Open pull request

License

About


Languages

Language:TypeScript 46.0%Language:JavaScript 42.9%Language:HTML 11.1%