Giter Site home page Giter Site logo

user_recommendation's Introduction

User Recommendation System

This is a Django-based web application for a user recommendation system, which uses PostgreSQL as the database and provides a REST API endpoint for user recommendations.

Table of Contents

Getting Started

Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/gr1nch3/user_recommendation.git
    cd user_recommendation
  2. Set up environment variables:

    Create a .env file in the root directory of the project and add the following environment variables:

    POSTGRES_HOST=db
    POSTGRES_PORT=5432
    POSTGRES_DB=recdb
    POSTGRES_USER=postgres
    POSTGRES_PASSWORD=insecure-postgres
    DJANGO_DEBUG=True

Running the Application

  1. Build and run the Docker containers:

    docker compose up build

    This command will build the Docker images and start the containers for the web application, PostgreSQL database, and pgAdmin.

  2. Apply database migrations:

    docker compose run --rm web python manage.py migrate
  3. Import Data to the database: There are .txt files that contains filtered data in the filtered/* folder. There is a file for user, tweet and a hashtag table for relational purposes. To populate the data in the database, use the following commands:

    # command to populate the user database (do this first)
    docker compose exec web python manage.py populate_users
    
    # next command to populate the tweets
    docker compose exec web python manage.py populate_tweets
    
    # command to populate the hashtags
    docker compose exec web python manage.py populate_hashtags
    
    # command to add popular hashtags to ensure better recomendation
    docker compose exec web python manage.py update_hashtags

    The malformed_duplicate_filter.py file contains code to generate the files in the filtered folder from the query2_ref.txt file in the challenge/dataset/* folder. You can delete the files from the filtered folder and generate new ones should you ever feel the need to.

  4. Access the application:

    The application will be accessible at http://localhost:8000. The endpoint for the user recommendation test should be like:

    GET http://localhost:8000/q2?user_id=102482331&type=both&phrase=una&hashtag=%23RE
    
  5. Access pgAdmin:

    pgAdmin will be accessible at http://localhost:5050. Use the following credentials to log in:

Running Tests

To run the tests, execute the following command:

docker compose exec web python manage.py test

user_recommendation's People

Contributors

gr1nch3 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.