Giter Club home page Giter Club logo

recommendations's Introduction

Recommendations

Build Status codecov

Description

The recommendations resource is a representation a product recommendation based on another product. In essence it is just a relationship between two products that "go together" (e.g., radio and batteries, printers and ink, shirts and pants, etc.). It could also recommend based on what other customers have purchased like "customers who bought item A usually buy item B". Recommendations should have a recommendation type like cross-sell, upsell, accessory, etc. This way a product page could request all of the up-sells for a product.

API routes

  • root: HTTP GET /
  • list: HTTP GET /recommendations
  • query: HTTP GET /recommendations?product-id={product_id}&customer-id={customer_id}&recommend-type={recommend_type}
  • read: HTTP GET /recommendations/{id}
  • create: HTTP POST /recommendations
  • update: HTTP PUT /recommendations/{id}
  • delete: HTTP DELETE /recommendations/{id}
  • success: HTTP PUT /recommendations/{id}/success
  • swagger API doc: HTTP GET /apidocs

Application URL: (deployed on IBM Cloud)

dev link: https://nyu-recommendation-service-f19.mybluemix.net/

prod link: https://nyu-recommendation-service-fa19.mybluemix.net/

CI/CD Pipeline URL:

https://cloud.ibm.com/devops/pipelines/9b0d5bad-8e9f-4aae-83c8-dd2d02a415c8?env_id=ibm:yp:us-east

To run the Flask app

vagrant up
vagrant ssh
cd /vagrant
honcho start

then on your own machine, visit: http://localhost:5000/

recommendations's People

Contributors

cheryl1223 avatar qijinze911 avatar hi348 avatar yayunfan avatar

Watchers

James Cloos avatar  avatar

Forkers

qijinze911 hi348

recommendations's Issues

Implement "Success" Action API

As a user
I need a way to determine how successful each recommendation is
So that I can determine how effective my model is for determining relationships

Assumptions:

  • Success can be measured by a counter that tracks sales. So each time a recommendation is listed and results in a sale of the recommended product to that customer, the counter should be incremented.

Acceptance Criteria:

When I call HTTP PUT /recommendations/{rec-id}/success
The success counter should be incremented for RecID

Implement a Recommendation factory

As a developer
I need more test data to test my service
So that test results are more reliable

Assumptions:

  • None

Acceptance Criteria:

Given a call to the factory
When doing tests
Then a bunch of random Recommendation will be generated

Implement Read api

As a user
I need a way to access specific records
So that it can be used on a product page or reviewed to confirm that it is correct.

Assumptions:

  • As opposed to query, this is just to access a single record (I think)
  • Once again, we can modify the example file to match our needs.

Acceptance Criteria:

When I call HTTP GET /recommendations/{rec-id}
the return should be the specified record with all of it's values.

Design the database

As a developer
I need database
So that I can store and get my resources

Assumptions:

  • Use SQLAlchemy for completing an MVP

Acceptance Criteria:

the database will provide all data we need for completing the recommendation service

Implement Query API

As a user
I need to be able to query the database
So that I can load specifics types of recommendations for a given product

Assumptions:

  • The user should pass product id, and relation type as parameters
  • GET /recommendations/productid should return all products related to productid

Acceptance Criteria:

When I call HTTP GET /recommendations?product-id=123&type=upscale&customer-id=111
I should get a list of all products listed as a relation to "productid" with relationship type "category"

Create Test Scenario For Update

As a product owner
I need behavior testing with intuitive language
So that I can be sure that integration can be done safely and the behavior can be understood by non-coders.

Assumptions:

  • Selenium should already be implemented for ui testing

Acceptance Criteria:

When I type honcho start, then behave
Then I should see all scenarios passing
And I should not see any failing or skipped scenarios

Create .travis.yml File and Set up Travis CI

As a developer
I need to have a good work CI to use
So that make it easier and more safety to merge

Assumptions:

  • Use Travis CI

Acceptance Criteria:

Given using Travis CI
When connect Travis CI to our organization
Then create .travis.yml file in our organization

Implement the API that create an entry in Database

As a developer
I need CREATE api
So that we can create a new entry in the database

Assumptions:

  • we use SQLAlchemy to mock real database

Acceptance Criteria:

Given URIs to create one entry (HTTP POST /recommendations)
When running the test or calling from web browser
Then a new entry in the database will be created and all test cases pass

Create Test Scenario For Query

As a product owner
I need behavior testing with intuitive language
So that I can be sure that integration can be done safely and the behavior can be understood by non-coders.

Assumptions:

  • Selenium should already be implemented for ui testing

Acceptance Criteria:

When I type honcho start, then behave
Then I should see all scenarios passing
And I should not see any failing or skipped scenarios

Create setup.cfg

As a developer
I need run test suite easily.
So that team workers can just type nosetests to run test suite

Assumptions:

  • set up setup.cfg files to make it easy to test suite.

Acceptance Criteria:

Given nosetests options
When create setup.cfg
Then team workers can just type nosetests to run the test suite.

Decide on UI details and create prototype

As a developer
I need UI
So that provide a more easy testing environment

Assumptions:
*

Acceptance Criteria:

Given the service is running 
When visit the UI page
Then all provided features can be reached

add a new action for RESET

As a developer
I need delete all entries in the database
So that it's easier to do BDD

Assumptions:

  • Required for BDD testing

Acceptance Criteria:

Given 
When visit /recommendations/reset
Then all entries in the database will be deleted

Specify the URL for each API

As a developer for RESTful microservice
I need different URLs for different APIs
So that the URLs are RESTful and meaningful

Assumptions:

  • We should refer to the class slides to make sure that we are following given standards.

Acceptance Criteria:

When comparing our design to the design specified in the class slides
We should be able to confirm that our URLs follow the set of rules laid out in said slides.

Push application to IBM Cloud and go to URL of service to ensure it works

As a developer
I need IBM Cloud to deploy the project and to test whether it runs well
So that to make sure later development environment is fine.

Assumptions:

  • Have done all the preparation for the deployment

Acceptance Criteria:

Push application to IBM Cloud successfully
All of the URL of service can be accessed

Add Test Scenario for Read

As a product owner
I need behavior testing with intuitive language
So that I can be sure that integration can be done safely and the behavior can be understood by non-coders.

Assumptions:

  • Selenium should already be implemented for ui testing

Acceptance Criteria:

When I type honcho start, then behave
Then I should see all scenarios passing
And I should not see any failing or skipped scenarios

Test SQLAlchemy on IBM Cloud

As a developer
I need database on IBM Cloud for my application
So that I can store my data

Assumptions:

  • we are not sure if SQLAlchemy will work on IBM Cloud, if it doesn't work, we should use another database

Acceptance Criteria:

Given no change to the current database configuration based on SQLAlchemy
When deploying to IBM Cloud
Then the database is well set

Create IBM Cloud Organization

As a Developer
I need a cloud account
So that I can deploy our program onto said coud.

Assumptions:

  • We will be using IBM Cloud

Acceptance Criteria:

When I try to log in
Then I should be logged in

Create Test Scenario for Success API

As a product owner
I need behavior testing with intuitive language
So that I can be sure that integration can be done safely and the behavior can be understood by non-coders.

Assumptions:

  • Selenium should already be implemented for ui testing

Acceptance Criteria:

When I type honcho start, then behave
Then I should see all scenarios passing
And I should not see any failing or skipped scenarios

Add honcho to requirements.txt

As a developer
I need to add honcho to requirements.txt
So that to make sure honcho start command works with my Procfile

Assumptions:

  • Have done other tasks about requirements.txt file and Procfile

Acceptance Criteria:

Command: honcho start works with my Procfile

Implement the api to list all entries in the database

As a developer
I need API to list all the entries in the database.
So that when working on recommendation service we can easily have the information of the entries.

Assumptions:

  • all inventory and customer information are in database

Acceptance Criteria:

Given I am a developer,
When I call "HTTP GET /recommendations"
Then all information of entries in the database will be listed.

Implement error handlers

As a developer
I need error handling
So that when error happens the user will be notified

Assumptions:

  • ...

Acceptance Criteria:

Given invalid URLs
When calling the service from web browser
Then corresponding error message and error code will show up

Implement Update API

As a developer
I need the way to update the inventory we now have.
So that customer can always see the present inventory now.

Assumptions:

  • After customer buy or new products come in, inventory will change and recommendation service will change.

Acceptance Criteria:

Given I am  a service user,
When I call "HTTP PUT /recommendations/{rec-id}"
Then we can have the inventory we present have.

Create Test Scenario for List

As a product owner
I need behavior testing with intuitive language
So that I can be sure that integration can be done safely and the behavior can be understood by non-coders.

Assumptions:

  • Selenium should already be implemented for ui testing

Acceptance Criteria:

When I type honcho start, then behave
Then I should see all scenarios passing
And I should not see any failing or skipped scenarios

Confirm Database and URL Design

As a developer for recommendation service
I need to define the concrete fields and table structure.
So that we can create our APIs based on the database schema.

Assumptions:

  • ...

Acceptance Criteria:

Given all APIs we need to call
When calling those APIs
All the attributes we need can be found in this database.

Set up README.md file

As a user
I need documentation
So that I know how to use the API

Assumptions:

  • All functions are implemented
  • Maybe we'll use swagger? I think he will elaborate on this later.

Acceptance Criteria:

There should be a working link which returns the documentation.

Update your Vagrantfile to download and install the IBM Cloud CLI

As a developer
I need the vagrant environment to include cloud support
So that all members on the team can deploy their code to cloud

Assumptions:
*

Acceptance Criteria:

When I type Vagrant up or Vagrant provision
Then the IBM Cloud CLI should be installed in my virtual machine

Implement the Recommendation class

As a developer for recommendation service
I need a class to define my resource and how it interacts with the database
So that we can call its methods in other APIs

Assumptions:
*

Acceptance Criteria:

Given all APIs we need to call
When calling those APIs
Then  the resource object can provide all methods it needs

Create a Python Flask Cloud Foundry application

As a developer
I need an app to be created in the cloud
So that the code can be deployed to it

Assumptions:

  • It will be a python flask app deployed to IBM Cloud

Acceptance Criteria:

When I click view app
Then it should be visible on the cloud

Create Travis CI Account for Our Organization

As a developer
I need CI to develop code in github
So that to make merge code more easier

Assumptions:

  • Have an Account for Travis CI

Acceptance Criteria:

Given Travis CI to use
When Open Travis CI website
Then Create Travis CI Account

Create UI

As a product owner
I need an intuitive interface
So that I can execute http commands and get results without worrying about syntax.

Assumptions:

  • The UI will call existing functions and routes to return results.

Acceptance Criteria:

When I access the index or "/" route
Then I should see an interface with buttons corresponding to the different fields in the resource model as well as commands including delete, create, update, increment success, etc.

Set up the testing environment

As a developer
I need to have a setup.cfg file and test cases written
So that running nose tests is less tedious

Assumptions:

  • I assume, that the professor will go into more details about setting up tests soon.

Acceptance Criteria:

When I type "nosetests"
the test suite should run.

Unknown

As a user
I need a way to delete records
So that I can get rid of outdated or incorrect recommendation relations.

Assumptions:

  • We can just follow the example code as a guide.

Acceptance Criteria:

When I call HTTP DELETE /recommendations/{rec-id}
The specified item should no longer be in the database

Create Test Scenario For Delete

As a product owner
I need behavior testing with intuitive language
So that I can be sure that integration can be done safely and the behavior can be understood by non-coders.

Assumptions:

  • Selenium should already be implemented for ui testing

Acceptance Criteria:

When I type honcho start, then behave
Then I should see all scenarios passing
And I should not see any failing or skipped scenarios

Set up SQLAlchemy

As a developer
I need an MYP to show the usage of the APIs which can interact with the database
So that I set up the SQLAlchemy to use Object Relational Mapper that gives application developers the full power and flexibility of SQL

Assumptions:

  • we will use another database in the future

Acceptance Criteria:

Given commands to manipulate the database
When calling the REST APIs
Then the SQLAlchemy object will return the database object as a real database does

Create .feature and .steps files and test service running

As a developer
I need to do BDD
So that I have more robust service

Assumptions:

  • the service is running

Acceptance Criteria:

Given The server is running
When I visit the "/"
Then I should see "Recommendation Demo RESTful Service" 
And I should not see "404 Not Found"

Create UI

As a user
I need UI to call recommendation service
So that I'm a happier user

Assumptions:

  • users do not know how to call our service via URLs

Acceptance Criteria:

Given some fields for user to filled in
When visiting the UI page
Then corresponding calls will be made after some user actions

Add test scenario for Create

As a product owner
I need behavior testing with intuitive language
So that I can be sure that integration can be done safely and the behavior can be understood by non-coders.

Assumptions:

  • Selenium should already be implemented for ui testing

Acceptance Criteria:

When I type honcho start, then behave
Then I should see all scenarios passing
And I should not see any failing or skipped scenarios

write the controller

As a ...
I need ...
So that ...

Assumptions:

  • ...

Acceptance Criteria:

Given ...
When ...
Then ...

Set up Flask Environment

As a developer
I need a virtual common environment for all team member to use
So that we can work remotely and all our code will be compatible and can be merged without issue

Assumptions:

  • We will set up a vagrant file to use a Linux setup using Vagrant and VirtualBox.
  • We will use Python with Flask to develop the project.

Acceptance Criteria:

When I type "vagrant up" while in the directory of a cloned repository
I should have access to a full virtual environment where i can use Flask.

Set up ElephantSQL

As a developer
I need database on IBM Cloud for my application
So that I can store and access (CRUD) my data on IBM Cloud

Assumptions:

  • The database we choose works well on IBM Cloud.

Acceptance Criteria:

After we finishing setting up on database IBM Cloud,
When deploying to IBM Cloud
Then the database is well set

Plan for Sprint 1

As a agile team
I need set up all stories for sprint 1
So that I know what to do for any given task in order to make progress towards project completion.

Assumptions:

  • We can use the examples from class to guide us on how to construct stories and to give us hints about what stories are needed.
  • We can also use the HW document to get ideas about what stories to write.

Acceptance Criteria:

When the team is asked "Are we missing anything for our planning phase?"
We should be able to answer "no."
And when asked "Do we know exactly how to proceed for sprint 1?"
We should be able to say "yes."

Use Selenium to conduct your UI testing

As a developer
I need to test the services in the web browser
So that I can test the integration of multiple microservices that share a common user interface easily.

Assumptions:

  • All the microservices codes are fine and Selenium is successfully introduced,

Acceptance Criteria:

Given we have browser installed,
When we initialize Selenium by requesting a web drive and saving it in the behave context,
Then we observe outcomes.

Fix Create Recommendation Test Case Bug

As a product owner
I need the test case to be modified
So that it properly tests the function of my product

Assumptions:

  • This is not actually a problem with the create function. The case is only failing because the db is not empty before the create (which is what the test case is assuming). It probably has to do with how I connected the database. Test cases should not connect to a persistent db.

Acceptance Criteria:

When I type 'nosetests'
Then all test cases should pass

Create the necessary Cloud Foundry metadata files

As a developer
I need Cloud Foundry metadata files like manifest.yml, Procfile, runtime.txt
So that IBM Cloud will know how to deploy my application

Assumptions:

  • we need to deploy our application to IBM Cloud

Acceptance Criteria:

Given all metadata files
When deploying to Cloud
Then IBM Cloud will set up the required environment for our application

Add a Travis CI badge

As a developer
I need Travis CI badge cover
So that I can see how the code is going

Assumptions:

  • Use Travis CI badge to see the code is going well

Acceptance Criteria:

Given using Travis CI badge
When open README.md
Then we can see our code coverage

Implement Other Action(s) API / Review Existing API Decision

As a team member
I need discover all other Action API that needed for recommendation service.
So that the action that cannot be done by the present API could be done.

Assumptions:

  • We need to do things like count customer click times, customer click what product together when make recommendation service.

Acceptance Criteria:

Given I am a service user,
When I call "GET /clickcount" or "GET /clicktogether"
Then the number that one customer click one product for how many times and the list of product that one customer click together.  

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.