CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm

From Expertiza_Wiki
Revision as of 16:38, 29 April 2021 by Hmkachha (talk | contribs)
Jump to navigation Jump to search

Introduction

Team

Dr. Gehringer (mentor) John Bumgardner (mentor)

  • Harsh Kachhadia (hmkachha)
  • Parimal Mehta (pmehta3)
  • Jatin Chinchkar (jchinch)
  • Jordan Farthing (mjfarthi)

Project Background

Peer-review systems like Expertiza utilize a lot of students’ input to determine each other’s performance. At the same time, we hope students learn from the reviews they receive to improve their own performance. In order to make this happen, we would like to have everyone give quality reviews instead of generic ones. Currently we have a few classifiers that can detect useful features of review comments, such as whether they contain suggestions. The suggestion-detection algorithm has been coded as a web service, and other detection algorithms, such as problem detection and sentiment analysis, also exist as newer web services..but they need to be integrated properly using API calls in expertiza code.

How it works

In order to make the API call, the partial view "_response_analysis.html.erb" is rendered in "response.html.erb" view file which will be responsible for sending a JSON input to the web service. The input will contain the review comment written by the user and when the student hits the "Get review feedback button" the comments will be sent to these api calls in the following json format:

Below is a sample input

 Sample Input:

   {"reviews" : [
   { 
         "id" : 1,
         "text" : "this is a sample test. I am writing a long test just to make sure api if working as expected. Earlier had some issue processing the test due to size of the test used in the request api."
   },
   {
         "id" : 2,        
         "text" : "this is a sample test. I am writing a long test just to make sure api if working as expected. Earlier had some issue processing the test due to size of the test used in the request api."
   } 
               ]}

Once the request is sent, we expect the output to be in the following format:

Sample Output: (for sentiment analysis API call)

   {"sentiments": [
       {
           "id": 1,
           "neg": "0.00",
           "neu": "0.95",
           "pos": "0.05",
           "sentiment": "0.11",
           "text": "this is a sample test. I am writing a long test just to make sure api if working as expected. Earlier had some issue processing the test due to size of the test used in the request api."
       },
       {
           "id": 2,
           "neg": "0.00",
           "neu": "0.95",
           "pos": "0.05",
           "sentiment": "0.11",
           "text": "this is a sample test. I am writing a long test just to make sure api if working as expected. Earlier had some issue processing the test due to size of the test used in the request api."
       }
   ]}

Sample Output: (for problem detection API call)

   {"reviews": [
       {
           "id": 1,
           "problems": "Present",
           "text": "this is a sample test. I am writing a long test just to make sure api if working as expected. Earlier had some issue processing the test due to size of the test used in the request api."
       },
       {
           "id": 2,
           "problems": "Present",
           "text": "this is a sample test. I am writing a long test just to make sure api if working as expected. Earlier had some issue processing the test due to size of the test used in the request api."
       }
   ]}

Sample Output: (for suggestion detection API call)

   {"reviews": [
       {
           "id": 1,
           "suggestions": "Present",
           "text": "this is a sample test. I am writing a long test just to make sure api if working as expected. Earlier had some issue processing the test due to size of the test used in the request api."
       },
       {
           "id": 2,
           "suggestions": "Present",
           "text": "this is a sample test. I am writing a long test just to make sure api if working as expected. Earlier had some issue processing the test due to size of the test used in the request api."
       }
   ]}

These outputs (which is a JSON) will be parsed and the concerned metrics such as the sentiment, problem and suggestion will be extracted so the user will be able to view a summarized result of how well their review comments are. In addition, the result will be presented in a colorful tabular format to the user after they hit the "Get Review Feedback" button. Also, the total time taken for making these API calls will be displayed below the table.

Flowchart to Describe Plan of Action and Flow of control


Previous work and our Plan of Action

Spring 2019 pull request

  • They had a functional suggestion detection API call that successfully communicated with the PeerLogic Server and retrieved the output, but as PeerLogic Server is no longer functioning, we need to make an API call to the new server(Peer Reviews NLP Server) and corresponding codes changes have to made.
  • They included their API call in response_controller.rb using JavaScript and Ruby, which needs to be Refactored into a single model file.
  • Expertiza team also has a new web service for problem detection(in a review response) and sentiment analysis. That needs to be integrated by making corresponding API calls too.
  • They were able to display the cumulative output for the reviews on a new page. They displayed all of the information returned from the endpoint. But the display did not contain the problem detection API output nor did it record or display the time taken for to receive back the response from the Peer Reviews NLP Server.
  • The time taken needs to be displayed on the UI. (UI from previous work is shown, which will be reworked upon.)
  • Since the new files they added are too clunky, badly named, files are too long (such as response_controller.rb), etc. The previous work needs to be refactored and reworked upon to have a smooth and lag-free implementation.

  • Since the code is added in the controller, which will be refactored as mentioned above points, and tests for the same needs to be written too.


Design Patterns

In order to achieve the primary tasks of integrating the API along with making the application more extensible, the team proposes using a more extensive application of the Facade design pattern to decouple the details of the calling of Peer Reviews NLP API from the caller controller (here - response_controller). This design pattern will help us achieve the decoupling and abstraction of implementation code base of API call from the calling controller just like mailers in rails. Later, refactoring of response controller and metrics.rb model will further decouple the implementation. Thus, in a nutshell, application of facade pattern along with some refactoring will lead to a decoupled implementation of integration of Peer Reviews NLP API call.


Sample UI Screenshots that will be worked upon

  • Frontend: This image shows the flow of control for a student reviewer.

  • Frontend: The image shows the information regarding the reviews sent by the APIs to the student reviewer

API Details/Endpoints Appendix I

Here are the various endpoints for the deployment of Suggestion Detection Algorithm.

(We can't make the API links unclickable for this design doc, but clicking on them won't lead you anywhere. They are just endpoints and are mentioned here for reference only.)

Testing plan

We aims to perform extensive testing for this project in order to achieve better reliability for this implementation.

Projects files that will be changed(projected) and will be tested:

  • _response_analysis.html.erb

Tests

  • The functionality was written client side in javascript solely in _response_analysis.html.erb
  • To test this view, any type of review must be accessible as a student
  • There is a button at the bottom of the review called Get Review Feedback.
  • When pressing button, API calls are issued and the metrics will show up within the table.
  • API calls are slow and will take time to process on click
  • Save review will allow for a new metric calculation to occur
  • All functionality associated with this table will be displayed

View Tests