<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hmkachha</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hmkachha"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Hmkachha"/>
	<updated>2026-09-11T17:48:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142873</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142873"/>
		<updated>2021-12-24T00:08:19Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
In terms of performance, one of the most common problems faced in ORMs is the N+1 query problem. This query problem is a result when a query is made on the result of previous query. That is, when our application tries to retrive data from its database and then loops through the resulting data to get various results. This problem is normally not seen in small applications where the data is small and there are less requests and queries. But if we want to make a scalable application, it becomes important to handle the N+1 query problem from start otherwise the performance of the application will decrease as the application codebase gets bigger and more queries gets fired.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries (1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. This reduces the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
The Bullet Gem has been programmed in such a way that it helps in reducing the number of queries the application makes. This helps in increasing the application performance. When the user runs their application, the bullet gem will watch the queries that the application makes and will notify the user/programmer of the places where eager loading (N+1 queries) can be applied. That is, it will show places where eager loading is needed and where it is not needed. &lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
Adding bullet gem:&lt;br /&gt;
&lt;br /&gt;
[[File:Gemfileimg.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
To Install:&lt;br /&gt;
&lt;br /&gt;
'''You can install it as a gem:'''&lt;br /&gt;
	gem install bullet&lt;br /&gt;
&lt;br /&gt;
or '''add this into a Gemfile (Bundler):'''&lt;br /&gt;
	gem 'bullet', group: 'development'&lt;br /&gt;
&lt;br /&gt;
'''To enable the Bullet gem with generate command:'''&lt;br /&gt;
	bundle exec rails g bullet:install&lt;br /&gt;
&lt;br /&gt;
The generate command will auto generate the default configuration and may ask to include in the test environment as well. See below for custom configuration in development.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Developmentrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
Once everything is set, you can run your application. The bullet gem will find places in the code (only the one being used while accessing the application) where eager loading is needed. The user can find the bullet logs at 'logs/bullet.log'&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
&lt;br /&gt;
====Courses, Assignments, Questionnaires, Users====&lt;br /&gt;
&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
[[File:Tree_display_controllerrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here FolderNode.includes(:folder) will retrieve all the folder records relating to each FolderNode using 2 queries (1 for FolderNode, 1 for folder associations relating to folder nodes), so that when each loop accesses the folder for a folder node , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
[[File:Flash_notificationserb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
[[File:Userrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here User.includes(:parent, :role, parent: [:parent, :role]) will retrieve all the parent and role records relating to each User using 2 queries (1 for User, 1 for parent and role associations relating to User), so that when each loop accesses the parent and role record for a User , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
====Review Report, Author Feedback Report====&lt;br /&gt;
&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
[[File:Feedback_response_maprb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here AssignmentTeam.includes(:users) will retrieve all the user records relating to each team using 2 queries (1 for team, 1 for users associations relating to Team), so that when each loop accesses the user for a team , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
[[File:Feedback_reporterb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here @review_responses.includes([:response_map]) will retrieve all the response map records relating to each response using 2 queries (1 for response, 1 for response map associations relating to each response), so that when each loop accesses the response map for a response, no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
====Impersonating a User====&lt;br /&gt;
&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
[[File:Instructorrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here assignments.includes(:participants) will retrieve all the participant records relating to each assignment using 2 queries (1 for assignment, 1 for participants associations relating to assignment), so that when each loop accesses the participant for a assignment , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
Here p_s.includes(:user, user: [:role]) will retrieve all the user and role records relating to each participant using 2 queries(1 for participant, 1 for user and role associations relating to participant), so that when each loop accesses the user and role record for a participant , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
[[File:Student_task_nrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here assignment_participants.includes([:assignment, :topic]) will retrieve all the assignment and topic records relating to each participant using 2 queries (1 for participant, 1 for assignment and topic associations relating to participant), so that when each loop accesses the assignment and topic record for a participant , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
==Challenges faced during implementation==&lt;br /&gt;
&lt;br /&gt;
* Review Report shows 'Nil Class error' when we try to open it. So we couldn't proceed further with it.&lt;br /&gt;
* When we tried to improve performance for 'Users' which is basically how fast list of all users in expertiza loads, we found some N+1 issues using bullet gem, but even after fixing all the N+1 issues for users, the page load time improved by just 2-3 seconds which seems like an insignificant changes in page load time as compared to the actual page load time of more than a minute.&lt;br /&gt;
* We worked on VCL version of expertiza, which uses Ruby version 2.3, and so the latest version of bullet gem - 6.1.5 works on it seamlessly, but the beta version in original expertiza repository uses Ruby version 2.2.7p, due to which latest version of bullet gem is not compatible with it. As a result, we had to downgrade bullet gem version to 5.7.6 in order to make it compatible with Ruby version - 2.2.7p of beta branch of expertiza GitHub reporsitory. &lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142863</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142863"/>
		<updated>2021-12-20T14:32:57Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
In terms of performance, one of the most common problems faced in ORMs is the N+1 query problem. This query problem is a result when a query is made on the result of previous query. That is, when our application tries to retrive data from its database and then loops through the resulting data to get various results. This problem is normally not seen in small applications where the data is small and there are less requests and queries. But if we want to make a scalable application, it becomes important to handle the N+1 query problem from start otherwise the performance of the application will decrease as the application codebase gets bigger and more queries gets fired.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
The Bullet Gem has been programmed in such a way that it helps in reducing the number of queries the application makes. This helps in increasing the application performance. When the user runs their application, the bullet gem will watch the queries that the application makes and will notify the user/programmer of the places where eager loading (N+1 queries) can be applied. That is, it will show places where eager loading is needed and where it is not needed. &lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
Adding bullet gem:&lt;br /&gt;
&lt;br /&gt;
[[File:Gemfileimg.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
To Install:&lt;br /&gt;
&lt;br /&gt;
'''You can install it as a gem:'''&lt;br /&gt;
	gem install bullet&lt;br /&gt;
&lt;br /&gt;
or '''add this into a Gemfile (Bundler):'''&lt;br /&gt;
	gem 'bullet', group: 'development'&lt;br /&gt;
&lt;br /&gt;
'''To enable the Bullet gem with generate command:'''&lt;br /&gt;
	bundle exec rails g bullet:install&lt;br /&gt;
&lt;br /&gt;
The generate command will auto generate the default configuration and may ask to include in the test environment as well. See below for custom configuration in development.rb&lt;br /&gt;
&lt;br /&gt;
[[File:Developmentrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
Once everything is set, you can run your application. The bullet gem will find places in the code (only the one being used while accessing the application) where eager loading is needed. The user can find the bullet logs at 'logs/bullet.log'&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
[[File:Tree_display_controllerrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here FolderNode.includes(:folder) will retrieve all the folder records relating to each FolderNode using 2 queries(1 for FolderNode, 1 for folder associations relating to folder nodes), so that when each loop accesses the folder for a folder node , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
[[File:Feedback_response_maprb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here AssignmentTeam.includes(:users) will retrieve all the user records relating to each team using 2 queries(1 for team, 1 for users associations relating to Team), so that when each loop accesses the user for a team , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
[[File:Instructorrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here assignments.includes(:participants) will retrieve all the participant records relating to each assignment using 2 queries(1 for assignment, 1 for participants associations relating to assignment), so that when each loop accesses the participant for a assignment , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
Here p_s.includes(:user, user: [:role]) will retrieve all the user and role records relating to each participant using 2 queries(1 for participant, 1 for user and role associations relating to participant), so that when each loop accesses the user and role record for a participant , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
[[File:Student_task_nrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here assignment_participants.includes([:assignment, :topic]) will retrieve all the assignment and topic records relating to each participant using 2 queries(1 for participant, 1 for assignment and topic associations relating to participant), so that when each loop accesses the assignment and topic record for a participant , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
[[File:Userrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here User.includes(:parent, :role, parent: [:parent, :role]) will retrieve all the parent and role records relating to each User using 2 queries(1 for User, 1 for parent and role associations relating to User), so that when each loop accesses the parent and role record for a User , no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
[[File:Feedback_reporterb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here @review_responses.includes([:response_map]) will retrieve all the response map records relating to each response using 2 queries(1 for response, 1 for response map associations relating to each response), so that when each loop accesses the response map for a response, no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries as compared to large number of queries which slows down the system.&lt;br /&gt;
&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
[[File:Flash_notificationserb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142862</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142862"/>
		<updated>2021-12-20T14:00:51Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
In terms of performance, one of the most common problems faced in ORMs is the N+1 query problem. This query problem is a result when a query is made on the result of previous query. That is, when our application tries to retrive data from its database and then loops through the resulting data to get various results. This problem is normally not seen in small applications where the data is small and there are less requests and queries. But if we want to make a scalable application, it becomes important to handle the N+1 query problem from start otherwise the performance of the application will decrease as the application codebase gets bigger and more queries gets fired.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
The Bullet Gem has been programmed in such a way that it helps in reducing the number of queries the application makes. This helps in increasing the application performance. When the user runs their application, the bullet gem will watch the queries that the application makes and will notify the user/programmer of the places where eager loading (N+1 queries) can be applied. That is, it will show places where eager loading is needed and where it is not needed. &lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
To Install:&lt;br /&gt;
&lt;br /&gt;
'''You can install it as a gem:'''&lt;br /&gt;
	gem install bullet&lt;br /&gt;
&lt;br /&gt;
or '''add this into a Gemfile (Bundler):'''&lt;br /&gt;
	gem 'bullet', group: 'development'&lt;br /&gt;
&lt;br /&gt;
'''To enable the Bullet gem with generate command:'''&lt;br /&gt;
	bundle exec rails g bullet:install&lt;br /&gt;
&lt;br /&gt;
The generate command will auto generate the default configuration and may ask to include in the test environment as well. See below for custom configuration.&lt;br /&gt;
&lt;br /&gt;
Once everythings is set, you can run your application. The bullet gem will find places in the code (only the one being used while accessing the application) where eager loading is needed. The user can find the bullet logs at 'logs/bullet.log'&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
[[File:Tree_display_controllerrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
[[File:Feedback_response_maprb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
[[File:Instructorrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
[[File:Student_task_nrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
[[File:Userrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
[[File:Feedback_reporterb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
[[File:Flash_notificationserb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:''' Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
* '''development.rb'''&lt;br /&gt;
[[File:Developmentrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''Gemfile'''&lt;br /&gt;
[[File:Gemfileimg.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142861</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142861"/>
		<updated>2021-12-20T13:58:11Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
In terms of performance, one of the most common problems faced in ORMs is the N+1 query problem. This query problem is a result when a query is made on the result of previous query. That is, when our application tries to retrive data from its database and then loops through the resulting data to get various results. This problem is normally not seen in small applications where the data is small and there are less requests and queries. But if we want to make a scalable application, it becomes important to handle the N+1 query problem from start otherwise the performance of the application will decrease as the application codebase gets bigger and more queries gets fired.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
The Bullet Gem has been programmed in such a way that it helps in reducing the number of queries the application makes. This helps in increasing the application performance. When the user runs their application, the bullet gem will watch the queries that the application makes and will notify the user/programmer of the places where eager loading (N+1 queries) can be applied. That is, it will show places where eager loading is needed and where it is not needed. &lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
To Install:&lt;br /&gt;
&lt;br /&gt;
'''You can install it as a gem:'''&lt;br /&gt;
	gem install bullet&lt;br /&gt;
&lt;br /&gt;
or '''add this into a Gemfile (Bundler):'''&lt;br /&gt;
	gem 'bullet', group: 'development'&lt;br /&gt;
&lt;br /&gt;
'''To enable the Bullet gem with generate command:'''&lt;br /&gt;
	bundle exec rails g bullet:install&lt;br /&gt;
&lt;br /&gt;
The generate command will auto generate the default configuration and may ask to include in the test environment as well. See below for custom configuration.&lt;br /&gt;
&lt;br /&gt;
Once everythings is set, you can run your application. The bullet gem will find places in the code (only the one being used while accessing the application) where eager loading is needed. The user can find the bullet logs at 'logs/bullet.log'&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
[[File:Tree_display_controllerrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
[[File:Feedback_response_maprb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
[[File:Instructorrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
[[File:Student_task_nrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
[[File:Userrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
[[File:Feedback_reporterb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
[[File:Flash_notificationserb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''development.rb'''&lt;br /&gt;
[[File:Developmentrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''Gemfile'''&lt;br /&gt;
[[File:Gemfileimg.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142860</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142860"/>
		<updated>2021-12-20T13:56:54Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
In terms of performance, one of the most common problems faced in ORMs is the N+1 query problem. This query problem is a result when a query is made on the result of previous query. That is, when our application tries to retrive data from its database and then loops through the resulting data to get various results. This problem is normally not seen in small applications where the data is small and there are less requests and queries. But if we want to make a scalable application, it becomes important to handle the N+1 query problem from start otherwise the performance of the application will decrease as the application codebase gets bigger and more queries gets fired.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
The Bullet Gem has been programmed in such a way that it helps in reducing the number of queries the application makes. This helps in increasing the application performance. When the user runs their application, the bullet gem will watch the queries that the application makes and will notify the user/programmer of the places where eager loading (N+1 queries) can be applied. That is, it will show places where eager loading is needed and where it is not needed. &lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
To Install:&lt;br /&gt;
&lt;br /&gt;
'''You can install it as a gem:'''&lt;br /&gt;
	gem install bullet&lt;br /&gt;
&lt;br /&gt;
or '''add this into a Gemfile (Bundler):'''&lt;br /&gt;
	gem 'bullet', group: 'development'&lt;br /&gt;
&lt;br /&gt;
'''To enable the Bullet gem with generate command:'''&lt;br /&gt;
	bundle exec rails g bullet:install&lt;br /&gt;
&lt;br /&gt;
The generate command will auto generate the default configuration and may ask to include in the test environment as well. See below for custom configuration.&lt;br /&gt;
&lt;br /&gt;
Once everythings is set, you can run your application. The bullet gem will find places in the code (only the one being used while accessing the application) where eager loading is needed. The user can find the bullet logs at 'logs/bullet.log'&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
[[File:Tree_display_controllerrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
[[File:Feedback_response_maprb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
[[File:Instructorrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
[[File:Student_task_nrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
[[File:Userrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
[[File:Feedback_reporterb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
[[File:Flash_notificationserb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''development.rb'''&lt;br /&gt;
[[File:Developmentrb.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
* '''Gemfile'''&lt;br /&gt;
[[File:Gemfileimg.png | 700px]]&lt;br /&gt;
&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Developmentrb.png&amp;diff=142859</id>
		<title>File:Developmentrb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Developmentrb.png&amp;diff=142859"/>
		<updated>2021-12-20T13:47:19Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Flash_notificationserb.png&amp;diff=142858</id>
		<title>File:Flash notificationserb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Flash_notificationserb.png&amp;diff=142858"/>
		<updated>2021-12-20T13:47:02Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Feedback_reporterb.png&amp;diff=142857</id>
		<title>File:Feedback reporterb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Feedback_reporterb.png&amp;diff=142857"/>
		<updated>2021-12-20T13:46:45Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Userrb.png&amp;diff=142856</id>
		<title>File:Userrb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Userrb.png&amp;diff=142856"/>
		<updated>2021-12-20T13:46:28Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Student_task_nrb.png&amp;diff=142855</id>
		<title>File:Student task nrb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Student_task_nrb.png&amp;diff=142855"/>
		<updated>2021-12-20T13:45:46Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Student_taskrb.png&amp;diff=142854</id>
		<title>File:Student taskrb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Student_taskrb.png&amp;diff=142854"/>
		<updated>2021-12-20T13:44:17Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Gemfileimglock.png&amp;diff=142853</id>
		<title>File:Gemfileimglock.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Gemfileimglock.png&amp;diff=142853"/>
		<updated>2021-12-20T13:43:18Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Gemfileimg.png&amp;diff=142852</id>
		<title>File:Gemfileimg.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Gemfileimg.png&amp;diff=142852"/>
		<updated>2021-12-20T13:42:39Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructorrb.png&amp;diff=142851</id>
		<title>File:Instructorrb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Instructorrb.png&amp;diff=142851"/>
		<updated>2021-12-20T13:42:22Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Feedback_response_maprb.png&amp;diff=142850</id>
		<title>File:Feedback response maprb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Feedback_response_maprb.png&amp;diff=142850"/>
		<updated>2021-12-20T13:42:08Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Tree_display_controllerrb.png&amp;diff=142849</id>
		<title>File:Tree display controllerrb.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Tree_display_controllerrb.png&amp;diff=142849"/>
		<updated>2021-12-20T13:41:40Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142848</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142848"/>
		<updated>2021-12-20T13:32:31Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Bullet Gem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
In terms of performance, one of the most common problems faced in ORMs is the N+1 query problem. This query problem is a result when a query is made on the result of previous query. That is, when our application tries to retrive data from its database and then loops through the resulting data to get various results. This problem is normally not seen in small applications where the data is small and there are less requests and queries. But if we want to make a scalable application, it becomes important to handle the N+1 query problem from start otherwise the performance of the application will decrease as the application codebase gets bigger and more queries gets fired.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
The Bullet Gem has been programmed in such a way that it helps in reducing the number of queries the application makes. This helps in increasing the application performance. When the user runs their application, the bullet gem will watch the queries that the application makes and will notify the user/programmer of the places where eager loading (N+1 queries) can be applied. That is, it will show places where eager loading is needed and where it is not needed. &lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
To Install:&lt;br /&gt;
&lt;br /&gt;
'''You can install it as a gem:'''&lt;br /&gt;
	gem install bullet&lt;br /&gt;
&lt;br /&gt;
or '''add this into a Gemfile (Bundler):'''&lt;br /&gt;
	gem 'bullet', group: 'development'&lt;br /&gt;
&lt;br /&gt;
'''To enable the Bullet gem with generate command:'''&lt;br /&gt;
	bundle exec rails g bullet:install&lt;br /&gt;
&lt;br /&gt;
The generate command will auto generate the default configuration and may ask to include in the test environment as well. See below for custom configuration.&lt;br /&gt;
&lt;br /&gt;
Once everythings is set, you can run your application. The bullet gem will find places in the code (only the one being used while accessing the application) where eager loading is needed. The user can find the bullet logs at 'logs/bullet.log'&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''development.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''Gemfile'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142847</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142847"/>
		<updated>2021-12-20T13:32:06Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Bullet Gem */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
In terms of performance, one of the most common problems faced in ORMs is the N+1 query problem. This query problem is a result when a query is made on the result of previous query. That is, when our application tries to retrive data from its database and then loops through the resulting data to get various results. This problem is normally not seen in small applications where the data is small and there are less requests and queries. But if we want to make a scalable application, it becomes important to handle the N+1 query problem from start otherwise the performance of the application will decrease as the application codebase gets bigger and more queries gets fired.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
The Bullet Gem has been programmed in such a way that it helps in reducing the number of queries the application makes. This helps in increasing the application performance. When the user runs their application, the bullet gem will watch the queries that the application makes and will notify the user/programmer of the places where eager loading (N+1 queries) can be applied. That is, it will show places where eager loading is needed and where it is not needed. &lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
To Install:&lt;br /&gt;
&lt;br /&gt;
'''You can install it as a gem:'''&lt;br /&gt;
	gem install bullet&lt;br /&gt;
&lt;br /&gt;
or '''add this into a Gemfile (Bundler):'''&lt;br /&gt;
	gem 'bullet', group: 'development'&lt;br /&gt;
&lt;br /&gt;
'''To enable the Bullet gem with generate command'''&lt;br /&gt;
	bundle exec rails g bullet:install&lt;br /&gt;
&lt;br /&gt;
The generate command will auto generate the default configuration and may ask to include in the test environment as well. See below for custom configuration.&lt;br /&gt;
&lt;br /&gt;
Once everythings is set, you can run your application. The bullet gem will find places in the code (only the one being used while accessing the application) where eager loading is needed. The user can find the bullet logs at 'logs/bullet.log'&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''development.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''Gemfile'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142846</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142846"/>
		<updated>2021-12-20T13:30:41Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
In terms of performance, one of the most common problems faced in ORMs is the N+1 query problem. This query problem is a result when a query is made on the result of previous query. That is, when our application tries to retrive data from its database and then loops through the resulting data to get various results. This problem is normally not seen in small applications where the data is small and there are less requests and queries. But if we want to make a scalable application, it becomes important to handle the N+1 query problem from start otherwise the performance of the application will decrease as the application codebase gets bigger and more queries gets fired.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
The Bullet Gem has been programmed in such a way that it helps in reducing the number of queries the application makes. This helps in increasing the application performance. When the user runs their application, the bullet gem will watch the queries that the application makes and will notify the user/programmer of the places where eager loading (N+1 queries) can be applied. That is, it will show places where eager loading is needed and where it is not needed. &lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
Install&lt;br /&gt;
You can install it as a gem:&lt;br /&gt;
	gem install bullet&lt;br /&gt;
&lt;br /&gt;
or add it into a Gemfile (Bundler):&lt;br /&gt;
	gem 'bullet', group: 'development'&lt;br /&gt;
&lt;br /&gt;
enable the Bullet gem with generate command&lt;br /&gt;
	bundle exec rails g bullet:install&lt;br /&gt;
&lt;br /&gt;
The generate command will auto generate the default configuration and may ask to include in the test environment as well. See below for custom configuration.&lt;br /&gt;
&lt;br /&gt;
Once everythings is set, you can run your application. The bullet gem will find places in the code (only the one being used while accessing the application) where eager loading is needed. The user can find the bullet logs at 'logs/bullet.log'&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''development.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''Gemfile'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142845</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142845"/>
		<updated>2021-12-17T21:17:01Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Code changes to resolve N+1 Problem in Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''development.rb'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
* '''Gemfile'''&lt;br /&gt;
'''Explanation:'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142844</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142844"/>
		<updated>2021-12-17T21:16:26Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
* Gemfile&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
* '''tree_display_controller.rb'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
* '''feedback_response_map'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
* '''instructor.rb'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
* '''student_task.rb'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
* '''user.rb'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
* '''_feedback_report.html.erb'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
* '''_flash_notifications.html.erb'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
* '''development.rb'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
* '''Gemfile'''&lt;br /&gt;
'''Explanation'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142843</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142843"/>
		<updated>2021-12-17T21:12:59Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Code changes to resolve N+1 Problem in Expertiza */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
'''tree_display_controller.rb'''&lt;br /&gt;
'''Bold text'''&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142842</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142842"/>
		<updated>2021-12-17T21:11:54Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Important Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171 GitHub pull request link]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142841</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142841"/>
		<updated>2021-12-17T21:11:24Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
===Files that are modified in this project===&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
&lt;br /&gt;
===Code changes to resolve N+1 Problem in Expertiza===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/2171]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142840</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142840"/>
		<updated>2021-12-17T21:07:59Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
&lt;br /&gt;
===N+1 problem===&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
'''How eager loading solves the problem'''&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
'''How 'includes' method helps in eager loading'''&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
===Bullet Gem===&lt;br /&gt;
&lt;br /&gt;
'''How bullet gem helps in solving N+1 problem'''&lt;br /&gt;
&lt;br /&gt;
'''How to use bullet gem in rails'''&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified in this project'''&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
&lt;br /&gt;
'''Code changes to resolve N+1 Problem in Expertiza'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;br /&gt;
* [https://youtu.be/OYZvNVa3GZ8 Youtube Video Link]&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142839</id>
		<title>Use of bullet gem and .includes to speed up db accesses</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Use_of_bullet_gem_and_.includes_to_speed_up_db_accesses&amp;diff=142839"/>
		<updated>2021-12-17T21:05:27Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: Created page with &amp;quot;==Introduction== === Team === Dr. Gehringer (mentor), * Harsh Kachhadia (hmkachha) * Tirth Patel (tdpatel2)  ==N+1 problem background==  ==How eager loading solves the problem...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Tirth Patel (tdpatel2)&lt;br /&gt;
&lt;br /&gt;
==N+1 problem background==&lt;br /&gt;
&lt;br /&gt;
==How eager loading solves the problem==&lt;br /&gt;
&lt;br /&gt;
To solve the N+1 problem, we use a process called 'eager loading'. In general, whenever code requests for a resource using db query, a query is fired to the database and the particular resource is fetched. In lazy loading, only the resources required at the moment are fetched and if in future more resources or entities are needed, then additional queries are fired into database. This significantly increases the number of queries fired whenever there is some loop construct in the code. This results into slow page load speed. As opposed to lazy loading, by using eager loading, we load additional required entities which we might require in near future, along with the main resource required by the query. Especially, during loops such as .each, eager loading significantly lowers the page load time, due to less queries fired resulting from additional data loaded from a single main resource query.&lt;br /&gt;
&lt;br /&gt;
For instance, if we are firing a query to fetch all participants, and then loop through all the participants using .each to display their course name, then using eager loading, we can load all the course names for all participants in the same query in which all the participants are fetched from the database, as opposed to individual queries fired to access course names for individual participants in lazy loading. &lt;br /&gt;
&lt;br /&gt;
==How 'includes' method helps in eager loading==&lt;br /&gt;
&lt;br /&gt;
In Rails, 'includes' method specifies model associations to be included in the result set of the query being fired to the database.&lt;br /&gt;
&lt;br /&gt;
For eg. current_user.participants.includes(:assignment, assignment: [:course]).each{|p| course_ids &amp;lt;&amp;lt; p.assignment.course.id if p.assignment and p.assignment.course&lt;br /&gt;
&lt;br /&gt;
What happened is Post.includes(:user) told ActiveRecord to retrieve the corresponding user records from the database immediately after the initial request for all posts. Since the records of users were already in the memory, post.user.username could be retrieved by only one query. Now, even if we have 10,000 posts in our database, we can execute the example code above by just 2 queries! This is a huge difference.&lt;br /&gt;
&lt;br /&gt;
Here participants.includes(:assignment, assignment: [:course]) will retrieve all the assignment and course records relating to each participant using 2 queries(1 for participants, 1 for assignments and courses relating to participants), so that when each loop accesses the assignment and course for a participant using 'p.assignment.course' or 'p.assignment', no new query will be fired. Thus, reducing the number of queries using 'includes' method to 2 queries even if we have 1000 participants as compared to 2000 queries.&lt;br /&gt;
&lt;br /&gt;
==How bullet gem helps in solving N+1 problem==&lt;br /&gt;
&lt;br /&gt;
===How to use bullet gem in rails====&lt;br /&gt;
&lt;br /&gt;
==Overview of changes we made during this project==&lt;br /&gt;
&lt;br /&gt;
With the use of above mentioned bullet gem, we found the locations in the expertiza code, where eager loading needs to be implemented, by looking at the stack trace recorded in bullet.log file by bullet gem. Bullet gem locates these code locations, as we navigate throughout the website.&lt;br /&gt;
&lt;br /&gt;
For this project, we targeted the following areas of expertiza, those which loads very slow and needs eager loading.&lt;br /&gt;
&lt;br /&gt;
'''tree_display_controller'''&lt;br /&gt;
* Courses&lt;br /&gt;
* Assignments&lt;br /&gt;
* Questionnaires&lt;br /&gt;
* Users &lt;br /&gt;
&lt;br /&gt;
'''grades_controller'''&lt;br /&gt;
* view (View scores)&lt;br /&gt;
&lt;br /&gt;
'''review_mapping_controller'''&lt;br /&gt;
* list_mappings&lt;br /&gt;
&lt;br /&gt;
'''reports_controller'''&lt;br /&gt;
* Review report&lt;br /&gt;
* Author-feedback report&lt;br /&gt;
* Teammate-review report&lt;br /&gt;
* Answer-tagging report&lt;br /&gt;
&lt;br /&gt;
'''student_task_controller'''&lt;br /&gt;
* Impersonating a student&lt;br /&gt;
 &lt;br /&gt;
We navigated through the UI, that use the code in above mentioned controllers, during which bullet gem located the code locations in these files where eager loading has to be implemented using 'includes' method.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified in this project'''&lt;br /&gt;
&lt;br /&gt;
* tree_display_controller.rb&lt;br /&gt;
* feedback_response_map&lt;br /&gt;
* instructor.rb&lt;br /&gt;
* student_task.rb&lt;br /&gt;
* user.rb&lt;br /&gt;
* _feedback_report.html.erb&lt;br /&gt;
* _flash_notifications.html.erb&lt;br /&gt;
* development.rb&lt;br /&gt;
&lt;br /&gt;
'''Code changes to resolve N+1 Problem in Expertiza'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been modified in the above mentioned files and also as this is more of a refactoring project, automatic testing was done by checking whether the existing tests pass or not.&lt;br /&gt;
&lt;br /&gt;
Manual testing was done by navigating the UI to the locations using the code from the files that were modified. All manual tests are passed.&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;br /&gt;
* [https://youtu.be/OYZvNVa3GZ8 Youtube Video Link]&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138877</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138877"/>
		<updated>2021-05-01T02:59:20Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Important Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Design Pattern'''&lt;br /&gt;
&lt;br /&gt;
In order to achieve the primary tasks of integrating the API along with making the application more extensible, the team implemented a more extensive application of the '''Facade''' design pattern to decouple the details of the calling the APIs from the caller method (here - makeArequest method). This design pattern helped us achieve the decoupling and abstraction of implementation code base (makeARequest Function) of API call from the calling function (getReviewFeedback function). Later, refactoring of _response_analysis.html.erb partial further decoupled the implementation. Thus, in a nutshell, application of facade pattern along with some refactoring lead to a decoupled implementation of integration of all 3 API calls.&lt;br /&gt;
&lt;br /&gt;
=== UI Screenshots===&lt;br /&gt;
&lt;br /&gt;
* '''Frontend: '''This image shows the flow of control for a '''reviewer'''.&lt;br /&gt;
[[File:Steps_metric.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Metric_table.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;br /&gt;
* [https://youtu.be/OYZvNVa3GZ8 Youtube Video Link]&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138800</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138800"/>
		<updated>2021-04-30T18:43:44Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Design Pattern'''&lt;br /&gt;
&lt;br /&gt;
In order to achieve the primary tasks of integrating the API along with making the application more extensible, the team implemented a more extensive application of the '''Facade''' design pattern to decouple the details of the calling the APIs from the caller method (here - makeArequest method). This design pattern helped us achieve the decoupling and abstraction of implementation code base (makeARequest Function) of API call from the calling function (getReviewFeedback function). Later, refactoring of _response_analysis.html.erb partial further decoupled the implementation. Thus, in a nutshell, application of facade pattern along with some refactoring lead to a decoupled implementation of integration of all 3 API calls.&lt;br /&gt;
&lt;br /&gt;
=== UI Screenshots===&lt;br /&gt;
&lt;br /&gt;
* '''Frontend: '''This image shows the flow of control for a '''reviewer'''.&lt;br /&gt;
[[File:Steps_metric.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Metric_table.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138799</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138799"/>
		<updated>2021-04-30T18:42:17Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* UI Screenshots */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Design Pattern'''&lt;br /&gt;
&lt;br /&gt;
In order to achieve the primary tasks of integrating the API along with making the application more extensible, the team implemented a more extensive application of the '''Facade''' design pattern to decouple the details of the calling the APIs from the caller method (here - makeArequest method). This design pattern helped us achieve the decoupling and abstraction of implementation code base (makeARequest Function) of API call from the calling function (getReviewFeedback function). Later, refactoring of _response_analysis.html.erb partial further decoupled the implementation. Thus, in a nutshell, application of facade pattern along with some refactoring lead to a decoupled implementation of integration of all 3 API calls.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
=== UI Screenshots===&lt;br /&gt;
&lt;br /&gt;
* '''Frontend: '''This image shows the flow of control for a '''reviewer'''.&lt;br /&gt;
[[File:Steps_metric.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Metric_table.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138798</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138798"/>
		<updated>2021-04-30T18:41:55Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Sample UI Screenshots that will be worked upon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Design Pattern'''&lt;br /&gt;
&lt;br /&gt;
In order to achieve the primary tasks of integrating the API along with making the application more extensible, the team implemented a more extensive application of the '''Facade''' design pattern to decouple the details of the calling the APIs from the caller method (here - makeArequest method). This design pattern helped us achieve the decoupling and abstraction of implementation code base (makeARequest Function) of API call from the calling function (getReviewFeedback function). Later, refactoring of _response_analysis.html.erb partial further decoupled the implementation. Thus, in a nutshell, application of facade pattern along with some refactoring lead to a decoupled implementation of integration of all 3 API calls.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
=== UI Screenshots===&lt;br /&gt;
&lt;br /&gt;
* '''Frontend: '''This image shows the flow of control for a '''reviewer'''.&lt;br /&gt;
[[File:Steps_metric.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Metric_table.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Steps_metric.png&amp;diff=138795</id>
		<title>File:Steps metric.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Steps_metric.png&amp;diff=138795"/>
		<updated>2021-04-30T18:40:27Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138794</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138794"/>
		<updated>2021-04-30T18:40:02Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Design Pattern'''&lt;br /&gt;
&lt;br /&gt;
In order to achieve the primary tasks of integrating the API along with making the application more extensible, the team implemented a more extensive application of the '''Facade''' design pattern to decouple the details of the calling the APIs from the caller method (here - makeArequest method). This design pattern helped us achieve the decoupling and abstraction of implementation code base (makeARequest Function) of API call from the calling function (getReviewFeedback function). Later, refactoring of _response_analysis.html.erb partial further decoupled the implementation. Thus, in a nutshell, application of facade pattern along with some refactoring lead to a decoupled implementation of integration of all 3 API calls.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
=== Sample UI Screenshots that will be worked upon ===&lt;br /&gt;
&lt;br /&gt;
* '''Frontend: '''This image shows the flow of control for a '''reviewer'''.&lt;br /&gt;
[[File:Steps_metric.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Metric_table.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138792</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138792"/>
		<updated>2021-04-30T17:49:18Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Implementation Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
'''Design Pattern'''&lt;br /&gt;
&lt;br /&gt;
In order to achieve the primary tasks of integrating the API along with making the application more extensible, the team implemented a more extensive application of the '''Facade''' design pattern to decouple the details of the calling the APIs from the caller method (here - makeArequest method). This design pattern helped us achieve the decoupling and abstraction of implementation code base (makeARequest Function) of API call from the calling function (getReviewFeedback function). Later, refactoring of _response_analysis.html.erb partial further decoupled the implementation. Thus, in a nutshell, application of facade pattern along with some refactoring lead to a decoupled implementation of integration of all 3 API calls.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Metric_table.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138791</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138791"/>
		<updated>2021-04-30T17:31:17Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Metric_table.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138790</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138790"/>
		<updated>2021-04-30T17:23:25Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The tests we wrote are passing on Travis CI, but after we synced new changes from original expertiza beta branch, the new tests that came with the pulled changes are failing and they have nothing to do with our current implementation. This is the reason for build failing on the pull request. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Metric_table.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Metric_table.png&amp;diff=138789</id>
		<title>File:Metric table.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Metric_table.png&amp;diff=138789"/>
		<updated>2021-04-30T17:23:02Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138788</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138788"/>
		<updated>2021-04-30T17:15:53Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Testing plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The tests we wrote are passing on Travis CI, but after we synced new changes from original expertiza beta branch, the new tests that came with the pulled changes are failing and they have nothing to do with our current implementation. This is the reason for build failing on the pull request. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138787</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138787"/>
		<updated>2021-04-30T17:12:11Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Testing plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png|800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138786</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138786"/>
		<updated>2021-04-30T17:11:37Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Testing plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png 800px]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138785</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138785"/>
		<updated>2021-04-30T17:10:58Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Testing plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png 800px]]&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138784</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138784"/>
		<updated>2021-04-30T17:10:37Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
[[File:Rspectests.png]]&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspectests.png&amp;diff=138783</id>
		<title>File:Rspectests.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Rspectests.png&amp;diff=138783"/>
		<updated>2021-04-30T17:09:37Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138782</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138782"/>
		<updated>2021-04-30T17:06:23Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Implementation Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
* response_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138781</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138781"/>
		<updated>2021-04-30T17:06:02Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Implementation Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _response_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138780</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138780"/>
		<updated>2021-04-30T17:05:25Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* API Action */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _rseponse_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138779</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138779"/>
		<updated>2021-04-30T17:04:49Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _rseponse_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://expertiza.csc.ncsu.edu/index.php/CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm Expertiza wiki page link] (the link is mentioned here for records. It redirects to this same page.)&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138777</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138777"/>
		<updated>2021-04-30T17:02:32Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _rseponse_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;br /&gt;
* [https://github.com/harshkachhadia/expertiza/tree/beta Github Repository Link for this expertiza fork]  (make sure you change branch to 'beta' branch if the page doesn't load by default to beta branch)&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138776</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138776"/>
		<updated>2021-04-30T17:00:59Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Project Background */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _rseponse_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[File:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
To inspect implementation in detail, check out the 'Javascript Functionality'&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, the configuration for this functionality on which metrics to display in the table, can be set by the&lt;br /&gt;
 instructor. Instructor can change which metric to display or not display in feedback by changing the value for that&lt;br /&gt;
 particular metric as 'true' or 'false'.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view using the 'new' or 'edit' method.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138774</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138774"/>
		<updated>2021-04-30T16:48:10Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: /* Team */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor),&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[FIle:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _rseponse_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we can setup the configuration for this functionality on which metrics to display in the table, which can be set by the&lt;br /&gt;
 instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138773</id>
		<title>CSC/ECE 517 Spring 2021 - E2112. Integrate Suggestion Detection Algorithm</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2021_-_E2112._Integrate_Suggestion_Detection_Algorithm&amp;diff=138773"/>
		<updated>2021-04-30T16:47:44Z</updated>

		<summary type="html">&lt;p&gt;Hmkachha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
=== Team ===&lt;br /&gt;
Dr. Gehringer (mentor)&lt;br /&gt;
John Bumgardner (mentor)&lt;br /&gt;
* Harsh Kachhadia (hmkachha)&lt;br /&gt;
* Parimal Mehta (pmehta3)&lt;br /&gt;
* Jatin Chinchkar (jchinch)&lt;br /&gt;
* Jordan Farthing (mjfarthi)&lt;br /&gt;
&lt;br /&gt;
==Project Background==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
&lt;br /&gt;
[[FIle:Review_metric.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Implementation Overview ===&lt;br /&gt;
&lt;br /&gt;
Initially, we had planned to work on the work already done by the previous students [https://github.com/expertiza/expertiza/pull/1427 Spring 2019 pull request]. But later on we faced many issues such as: 1) The API call links were outdated 2) The new link that we found were incompatible with the previous work 3) The planned task of adding new API calls as per Carl Colglaizer's Framework turned out to be irrelevant or not required for this project, so we dropped it.  &lt;br /&gt;
&lt;br /&gt;
So we decided to start with integrating these API Calls from scratch.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Features we added in this project'''&lt;br /&gt;
* Setting up a config file 'review_metric.yml' where instructor can select what review metric to display for the current assignments&lt;br /&gt;
* Based on the selection made by professor, API calls(sentiment, problem, sugegstion) are made and a colorful table is displayed below the review form for student to review&lt;br /&gt;
* The total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
'''Files that are modified or added in this project'''&lt;br /&gt;
* review_metrics.yml&lt;br /&gt;
* response.html.erb&lt;br /&gt;
* _rseponse_analysis.html.erb&lt;br /&gt;
* response_controller.rb&lt;br /&gt;
* load_config.rb&lt;br /&gt;
&lt;br /&gt;
=== Javascript Functionality ===&lt;br /&gt;
&lt;br /&gt;
In the partial view file _response_analysis.html.erb file, we added new javascript functions to make, process and display output of API calls.&lt;br /&gt;
&lt;br /&gt;
* ''' review_metric.yml config file'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we can setup the configuration for this functionality on which metrics to display in the table, which can be set by the&lt;br /&gt;
 instructor.&lt;br /&gt;
&lt;br /&gt;
[[File:Configfile.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response_controller.rb'''&lt;br /&gt;
&lt;br /&gt;
 In this file, we added a method 'fetch_review_metric' which fetches the configurations set by instructor in the review_metric.yml file by &lt;br /&gt;
 the instructor and passes those fetched values to the response.html.erb view.&lt;br /&gt;
&lt;br /&gt;
[[File:Response_controller.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' response.html.rb'''&lt;br /&gt;
&lt;br /&gt;
 Here, we added a line that renders the partial _response_analysis.html.erb after the Save button to show the 'get review feedback' button and &lt;br /&gt;
 display the metrics table. Also, we fetch the passed configuration data here.&lt;br /&gt;
&lt;br /&gt;
[[File:response_html.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - fetch_response_comments() function'''&lt;br /&gt;
&lt;br /&gt;
 This function fetches the comments written by the user in the review form and formats the collected comments as per the expectation of the API&lt;br /&gt;
  calls.&lt;br /&gt;
&lt;br /&gt;
[[File:Fetchcomments.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - getReviewFeedback() function'''&lt;br /&gt;
&lt;br /&gt;
 This function makes calls to respective APIs and get their output based on the configuration received from the review_metrics.yml file.&lt;br /&gt;
&lt;br /&gt;
[[File:Makesapicalls.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - makeARequest() function'''&lt;br /&gt;
&lt;br /&gt;
 This is the driver function for making API call request to any url and data that is passed to it.&lt;br /&gt;
&lt;br /&gt;
[[File:Makearequest.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - combine_api_output() function'''&lt;br /&gt;
&lt;br /&gt;
 This function combines the output received from different API responses, combines them and formats the combined data to one that is suitable for &lt;br /&gt;
 table generation.&lt;br /&gt;
&lt;br /&gt;
[[File:Combineapioutput.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* ''' _response_analysis.html.erb - generateTable() function'''&lt;br /&gt;
&lt;br /&gt;
 This code generates a colorful table dynamically on the UI so that the reviewer can get a visual feedback on the comments that he/she wrote.&lt;br /&gt;
&lt;br /&gt;
[[File:Generatetable.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== API Details/Endpoints Appendix I ===&lt;br /&gt;
&lt;br /&gt;
Here are the various endpoints for the deployment of Suggestion Detection Algorithm.&lt;br /&gt;
&lt;br /&gt;
(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.)&lt;br /&gt;
&lt;br /&gt;
* http://152.7.99.200:5000/problem for problem metrics only&lt;br /&gt;
* https://peerlogic.csc.ncsu.edu/sentiment/analyze_reviews_bulk for sentiment metrics only&lt;br /&gt;
* http://152.7.99.200:5000/suggestions for suggestions metrics only&lt;br /&gt;
&lt;br /&gt;
===API Action===&lt;br /&gt;
&lt;br /&gt;
In order to make the API call, the partial view &amp;quot;_response_analysis.html.erb&amp;quot; is rendered in &amp;quot;response.html.erb&amp;quot; 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 &amp;quot;Get review feedback button&amp;quot; the comments will be sent to these api calls in the following json format: &lt;br /&gt;
&lt;br /&gt;
Below is a sample input &lt;br /&gt;
  '''Sample Input:'''&lt;br /&gt;
 &lt;br /&gt;
    {&amp;quot;reviews&amp;quot; : [&lt;br /&gt;
    { &lt;br /&gt;
          &amp;quot;id&amp;quot; : 1,&lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
          &amp;quot;id&amp;quot; : 2,        &lt;br /&gt;
          &amp;quot;text&amp;quot; : &amp;quot;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.&amp;quot;&lt;br /&gt;
    } &lt;br /&gt;
                ]}&lt;br /&gt;
&lt;br /&gt;
Once the request is sent, we expect the output to be in the following format:&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for sentiment analysis API call)'''&lt;br /&gt;
    {&amp;quot;sentiments&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;neg&amp;quot;: &amp;quot;0.00&amp;quot;,&lt;br /&gt;
            &amp;quot;neu&amp;quot;: &amp;quot;0.95&amp;quot;,&lt;br /&gt;
            &amp;quot;pos&amp;quot;: &amp;quot;0.05&amp;quot;,&lt;br /&gt;
            &amp;quot;sentiment&amp;quot;: &amp;quot;0.11&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for problem detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;problems&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
'''Sample Output: (for suggestion detection API call)'''&lt;br /&gt;
    {&amp;quot;reviews&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 1,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 1.&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: 2,&lt;br /&gt;
            &amp;quot;suggestions&amp;quot;: &amp;quot;Present&amp;quot;,&lt;br /&gt;
            &amp;quot;text&amp;quot;: &amp;quot;Comment 2.&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]}&lt;br /&gt;
&lt;br /&gt;
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 &amp;quot;Get Review Feedback&amp;quot; button. Also, the total time taken for making these API calls will be displayed below the table.&lt;br /&gt;
&lt;br /&gt;
==Testing plan==&lt;br /&gt;
We aim to perform automatic and manual testing for this project in order to achieve better reliability for this implementation.&lt;br /&gt;
&lt;br /&gt;
As for this project, very few lines of code have been written in ruby (fetch_review_metric method in response_controller.rb) we will be testing that method in response controller using rspec tests.&lt;br /&gt;
&lt;br /&gt;
'''Rspec tests for the same have been written in response_controller_spec.rb'''&lt;br /&gt;
&lt;br /&gt;
===View Tests===&lt;br /&gt;
* The functionality was written on the client side in javascript solely in _response_analysis.html.erb&lt;br /&gt;
* To test this view, any type of review must be accessible as a student.&lt;br /&gt;
* There is a button at the bottom of the review called 'Get Review Feedback'.&lt;br /&gt;
* When pressing button, API calls are issued and the metrics will show up within the table (a sample of which is displayed below).&lt;br /&gt;
* API calls are slow and will take time to process until the 'Loading...' text disappears.&lt;br /&gt;
* You can modify the comments and click the 'Get Review Feedback' button again to get new feedback, that too can be achieved without the need of saving the review, but still saving the review first is a better option to approach this.&lt;br /&gt;
* All the review feedback for the comments will be displayed in a colorful table. &lt;br /&gt;
&lt;br /&gt;
=== Sample image of the table ===&lt;br /&gt;
&lt;br /&gt;
[[File:Table_metrics.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Important Links==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/expertiza/expertiza/pull/1952 Github Pull Request]&lt;br /&gt;
* [https://docs.google.com/document/d/1uzr5pybVKYr_K1Q8wSd4t-Id9nqTt3k1ePseDjY-RJg/edit#heading=h.fxfungdw1d5r Google Doc Project Description]&lt;/div&gt;</summary>
		<author><name>Hmkachha</name></author>
	</entry>
</feed>