Git Product home page Git Product logo

verve_test's Introduction

Verve Code Test

Introduction

Welcome to the Verve code test. The test is broken into two parts

  • Code Review
  • Implementation of a new recommendation system

You are free to tackle the sections in any order. Please take as much or as little time as you need in order to complete the test to your satisfaction. We recommend that test should take a couple of hours (2-3) rather than days. All we ask is that you let us know, truthfully, how much time you spent on the test. There is no right or wrong amount of time, this info will simply help us with context when reviewing the results.

Imagine that someone in your sprint team was working on a story and just went off sick and left this story on your lap with his few notes in the code. Take a look at the existing code and provide an honest code review (in the way you'd normally do when you'd be providing feedback on a Pull Request of your teammate) and then work to finish off as much as you can do before sending it all back to us.

What we are looking for from you is:

  • Code review of the Python code
  • A working recommendation system in Python
  • โ€ฆ along with some notes on possible refinements

Pre-Requisites

Before starting this code test you should ensure that you have the following environment setup.

  • Python 3.6

Required dependencies

To install Python dependencies, run the following command:

make install

This script will create a Python virtualenv and install requirements in it using pip.

Additional dependencies

To give you a working system you can install Docker, though it's not required to complete the test:

The running system uses an AMQP Broker to relay messages from a little Python helper service. We tested this with rabbitmq which can be quickly deployed locally using the rabbitmq:latest docker image:

make rabbit

Story Specification

The new Python RewardsEngine will receive sale messages in the following format:

{"type": "sale", "item_id": 7, "cost": "3.35", "currency": "GBP", "user_id": 987654}

Users are given points for their purchases based on a simple algorithm already implemented in the Rewards Engine but you'll need a simple way to store the number of points the user has accumulated. This new system will make reward-recommendations based on the current total of points the user has. Currently there are only a few types of rewards which are detailed here:

{
  "rewards": [
    {"name": "General Ticket", "points": 100, "max_per_user": 5},
    {"name": "VIP Ticket", "points": 1000, "max_per_user": 1},
    {"name": "Weekend Ticket", "points": 250, "max_per_user": 2},
    {"name": "Free Drink Voucher", "points": 50, "max_per_user": 10},
    {"name": "Free Limo to event", "points": 5000, "max_per_user": 1}
  ]
}

What we need you to do is to return a suggested list of rewards that the user can buy with their points. So for example:

  • if the sales for a user gives them a total of 600 points you could suggest a basket with 2x 'Weekend Ticket's and a 'General Ticket'.

How you make the selection is up to you. Just provide a list of rewards that the user can buy up to their current point total.

Be mindful that some rewards can only be bought by a user specific number of times. This is defined in the rewards dictionary as well.

This list can be sent back via the Queue Service using the JSON format:

{"type":"rewards-recommendation","rewards":[...]}

Environment

To run current test suite, enter this command:

make test

To generate sales data for testing, you can run SalesService in this way:

make sales

To use and test RewardsService, run this:

make rewards

verve_test's People

Contributors

minhlongdo 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.