CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
 
(23 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= E1987 - Improving search facility in Expertiza=
==Introduction:==
==Introduction:==


Line 67: Line 68:
Steps to reproduce the proposed workflow:
Steps to reproduce the proposed workflow:
:#Log in to expertiza to view the home page
:#Log in to expertiza to view the home page
:#
:#Go to Manage -> Assignment -> View Reports -> Review Report (View)
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.
:#Type the search criteria in the available search criteria and select the appropriate field from the dropdown.
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.
:#To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.
Line 76: Line 77:
[[File:UseCaseExpertizaSearch.png|center]]
[[File:UseCaseExpertizaSearch.png|center]]


==Proposed Code Changes==
== Code Changes==


The search feature could be implemented in a more RESTful manner by adding it to individual models rather than implementing it as a single controller.
The search feature could be implemented in a more RESTful manner by adding it to individual models rather than implementing it as a single controller.
Line 85: Line 86:
#localhost:port/questionnaire/search?name=<>
#localhost:port/questionnaire/search?name=<>


Following is the list of search attributes for a given entity along with a list of files that would altered in the process.


Therefore in order to perform search every entity required changes in all the three layers
<b>User</b>
*Search fields: username, fullname, email


View : Changes in view are changes added to UI, and it is used to pass search parameters to controller
*Modified Files:
Controller : Parses the changes from UI, essentially takes params[] hash.
#app/views/users/list.html.erb
Model : Bulk of search logic is implemented here, once the model gets the parameters for the search ( hash ), the query is incrementally built using all the params and then executed to get the list of objects.
#app/views/users/_search.html.erb
User changes have been handled differently than for Questionnaire, Assignments and Review because Users follows the traditional RoR scheme, where as others user React for UI. React based View changes are in app/assets/javascripts/tree_display.jsx.
#app/controllers/users_controller.rb
#app/models/user.rb


[edit]User
The search functionality is no longer part of the list method, instead is passed as a parameter to the rendering method. The code has been modularized to separate the search parameter fetching and matching it with the user lists. Redundant search_id field has been removed from the code, the functionality is achieved using the search_uname parameter. Variable names have been renamed to increase readability. Comments have been added to further enhance readability and maintainability of the code.
Search fields
 
username
<b>Assignment</b>
name
*Search fields: assignment_name, assignee_username, assignee_name, due_date_before, due_date_after, created_before, created_after
email
 
Modified files:
*Modified files
app/views/users/list.html.erb
#app/models/assignment_node.rb
app/controllers/users_controller.rb
 
app/models/user.rb
<b>Questionnaire</b>
Modified functions
*Search fields: name, text, course, assignment
UsersController#list : Parses the username, name and email from the params hash.
*Modified files
User#get_user_list : Model returns list of users to the view, changes in this function uses regex to filter out the entries that do not match search params.
#app/models/questionnaire_node.rb
[edit]Assignment
 
Search fields
<b>Review</b>
name
*Search fields: team, text, min_score, max_score
assignee_username
*Modified files
assignee_name
#app/views/review_mapping/_searchbox.html.erb
due_date_before
#app/controllers/review_mapping_controller.rb
due_date_after
created_before
created_after
Modified files
app/assets/javascripts/tree_display.jsx
app/controllers/tree_display_controller.rb
app/models/assignment_node.rb
Modified functions
TreeDisplayController#initialize_fnode_update_children
TreeDisplayController#update_fnode_children
AssignmentNode.get
[edit]Questionnaire
Search fields
name
text
course
assignment
Modified files
app/assets/javascripts/tree_display.jsx
app/controllers/tree_display_controller.rb
app/models/questionnaire_node.rb
Modified functions
TreeDisplayController#get_tmp_res
QuestionnaireNode.get
[edit]Review
Search fields
team
text
min_score
max_score
Modified files
app/views/review_mapping/_searchbox.html.erb
app/controllers/review_mapping_controller.rb
app/helpers/summary_helper.rb
Modified functions
ReviewMappingController#response_report
SummaryHelper#summarize_reviews_by_reviewees


==Database Design==
==Database Design==
Line 163: Line 130:
=== Automated Tests ===
=== Automated Tests ===
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.<br>
Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.<br>
<br>
====Test Details:====
====Test Details:====
=====User Model ( spec/models/user_spec.rb )=====
=====User Model ( spec/models/user_spec.rb )=====
Line 175: Line 141:
# Search by user name and email
# Search by user name and email
# Search for assignments participated
# Search for assignments participated
<br>
=====Assignment Model ( spec/models/assignment_spec.rb )=====
=====Assignment Model ( spec/models/assignment_spec.rb )=====
# Search by user name
# Search by user name
Line 181: Line 146:
# Search by creation date
# Search by creation date
# Search by updated date
# Search by updated date
<br>
=====Rubrics=====
=====Rubrics=====
# Search by name
# Search by name
# Search by courses used in
# Search by courses used in
# Search by assignments used in
# Search by assignments used in
<br>
=====Reviews=====
=====Reviews=====
# Search all reviews of a particular team’s work for particular scores or text strings.   
# Search all reviews of a particular team’s work for particular scores or text strings.   
Line 192: Line 155:
# Search by text comment length
# Search by text comment length
# Search by reviewer and reviewee
# Search by reviewer and reviewee
<br>
=== Manual Tests ===
=== Manual Tests ===
=====Search for User=====
=====Search for User=====
Line 199: Line 160:
# Action: Instructor clicks on manage - > users -> in textbox enters name="student"<br>
# Action: Instructor clicks on manage - > users -> in textbox enters name="student"<br>
# Response: Relevant details of student, name="student" is displayed<br>
# Response: Relevant details of student, name="student" is displayed<br>
<br>
# Action: Instructor clicks on manage - > users -> advanced search->clicks on checkbox student id and enters "5000" and click "ok"<br>
# Action: Instructor clicks on manage - > users -> advanced search->clicks on checkbox student id and enters "5000" and click "ok"<br>
# Response: Relevant details of student, name="student" is displayed<br>
# Response: Relevant details of student, name="student" is displayed<br>
<br>
=====Search for Assignments=====
=====Search for Assignments=====
# Setup create an assignment with name="assignment" and set a due date<br>
# Setup create an assignment with name="assignment" and set a due date<br>
# Action : Instructor clicks on Manage -> Assignments, in textbox enter "assignment" in relevant tab<br>  
# Action : Instructor clicks on Manage -> Assignments, in textbox enter "assignment" in relevant tab<br>  
# Response : Relevant assignment should be displayed<br>
# Response : Relevant assignment should be displayed<br>
<br>
# Action : Instructor clicks on Manage -> Assignments-> drop down and apply filters for due date and enter date and click "ok"<br>
# Action : Instructor clicks on Manage -> Assignments-> drop down and apply filters for due date and enter date and click "ok"<br>
# Response : Relevant assignments should be displayed<br>
# Response : Relevant assignments should be displayed<br>
<br>
=====Search for Questionnaires=====
=====Search for Questionnaires=====
# Setup : Create a Questionnaire, add questions to it<br>
# Setup : Create a Questionnaire, add questions to it<br>
# Action : Log in as instructor,  Manage -> Questionnaires, in text box enter text<br>
# Action : Log in as instructor,  Manage -> Questionnaires, in text box enter text<br>
# Response : Questionnaires matching text are shown<br>
# Response : Questionnaires matching text are shown<br>
<br>
# Action : Log in as instructor,  Manage -> Questionnaires, click advanced search and check creation date and enter value<br>
# Action : Log in as instructor,  Manage -> Questionnaires, click advanced search and check creation date and enter value<br>
# Response : Questionnaires matching text are shown<br>
# Response : Questionnaires matching text are shown<br>
<br>
=====Search for Reviews=====
=====Search for Reviews=====
# Setup : Setup review for an assignment, login as student and then add review <br>
# Setup : Setup review for an assignment, login as student and then add review <br>
# Action : Log in as instructor, Manage -> Assignments, Click on Review Report icon on corresponding assignment<br>
# Action : Log in as instructor, Manage -> Assignments, Click on Review Report icon on corresponding assignment<br>
# Result : Review should be seen<br>
# Result : Review should be seen<br>
<br>
# Action : Click Advanced search, check review by text  and enter text<br>   
# Action : Click Advanced search, check review by text  and enter text<br>   
# Result : Matching review should be visible<br>
# Result : Matching review should be visible<br>
==Team:==
#Nisarg Mayank Chokshi (nmchoks2@ncsu.edu)
#Omkar Nivrutti Kashid (onkashid@ncsu.edu)
#Richa Dua (rdua2@ncsu.edu)
#Steve Victor Menezes  (smeneze@ncsu.edu)
'''Mentor:''' Harsh Agarwal (hagrawa2@ncsu.edu)
==Additional Links:==
Pull Request: https://github.com/expertiza/expertiza/pull/1659 <br>
Github Project Board: https://github.com/stevemenezes/expertiza/projects/1

Latest revision as of 18:59, 11 December 2019

E1987 - Improving search facility in Expertiza

Introduction:

Expertiza is an open source application running on Ruby on Rails. It is used for management of courses and the assignments for respective courses, by the faculties and the students. The manage content section of the application has different views which displays information about the users, courses, assignments, questionnaires, and reviews. The application should have a fully functional search functionality throughout the views, so that a user can search any type of data with ease, on the basis of any number of parameters depending on his requirements. Users should be searched on the basis of one more parameters which include name, full name, email, etc. Similarly, assignments should be searched on the basis of name, created date, updated date, etc. However, the search functionality in the existing application is constrained to just a single parameter for users and assignments. Questionnaires management does not have a search functionality implemented as yet. This project works on improving the search functionality of Expertiza, by adding search bars if not present, introducing advanced search feature where user can search on the basis of more than one parameters and making the search functionality appear more elegant.

Problem Definition:

  1. An instructor or administrator can search for a user by name, user-ID, or other characteristics.
  2. An instructor should be able to search for assignments by name, due date, or other characteristics.
  3. An instructor should be able to search for rubrics (or other questionnaires) by name, or by the courses or assignments they have been used in.
    1. For the instructor, there also needs to be a way to quickly find rubrics (and other questionnaires) that have been used in a single course. It should be possible to search or click somewhere to bring up a list of questionnaires used in the course, expanding only the applicable questionnaires in the list of questionnaires.
    2. One should also be able to search for questionnaires by words used in questions that belong to the questionnaires.
  4. There should be a way to search all reviews of a particular team’s work for particular scores or text strings. Reviews should be able to be filtered by score, text comment length, reviewer and reviewee.
  5. An instructor or administrator should be able to search for all the assignments that a particular user has participated in.
  6. If more than one criteria needs to be specified, there should be an 'Advanced Search' button.

Proposed Solution:

Search for User:

In the current system workflow, we found that the user is unable to search in the Manage Users view. In the proposed workflow, we plan to enable the user to search by all the columns in the UI viz. Name, Full name, Email Address, Role, Parent by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.

Steps to reproduce the proposed workflow:

  1. Log in to expertiza to view the home page
  2. Go to Manage > Users
  3. Type the search string in the search box available on the UI and select the column to search for from the dropdown.
  4. To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.
  5. All the entries that match the specified criteria will be returned.
  6. An empty list is returned if the search criteria doesn't match any valid records in the database.

Search for Assignments:

In the current system implementation, searching via the name of the assignment is supported with partial or complete assignment name. However, the search is case sensitive. In the proposed system, the user will be able to search for an assignment using additional filters such as Creation Date and Updated Date along with Assignment Name. The user will also be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.

To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed.

To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database.

Steps to reproduce the proposed workflow:

  1. Log in to expertiza to view the home page
  2. Go to Manage > Assignments
  3. Type the search criteria in the available search criteria and select the appropriate field from the dropdown.
  4. To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.
  5. All the entries that match the given criteria will be returned.
  6. An empty list is returned if the search criteria doesn't match any valid records in the database.

Search for Questionnaires:

The existing system does not have a search functionality under Questionnaires. The proposed system will implement a search functionality for searching via the name of the questionnaire, the text in the questions within a questionnaire, date of creation, and date updated by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.

To search for an assignment by Creation Date, the user will be prompted with a calendar where he can select a date and all the assignments created on or before the selected date will be displayed.

To apply multiple filters, user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below containing textboxes for all the columns. All assignments that were created before the selected date for Creation Date or Updated Date columns and the ones that match other filters will be returned. A empty list will be returned if the search criteria doesn't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.

Steps to reproduce the proposed workflow:

  1. Log in to expertiza to view the home page
  2. Go to Manage > Questionnaires
  3. Type the search criteria in the available search criteria and select the appropriate field from the dropdown.
  4. To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.
  5. All the entries that match the given criteria will be returned.
  6. An empty list is returned if the search criteria doesn't match any valid records in the database.

Search for Reviews:

The existing system does not have a search functionality under Reviews. The proposed system will implement a search functionality for searching using the attributes like team name, score, reviewer, comment etc. by entering a partial or a complete text that matches with the particular field. We will also allow searching for fields irrespective of the case of the searched string. The user will be able to apply multiple filters at a time and the output of the query will match all the filters applied. If no results are found, an empty list will be returned.

The user will be able to apply multiple filters at a time and the output of the query will match all filters applied. If no results are found, an empty list will be returned.

Steps to reproduce the proposed workflow:

  1. Log in to expertiza to view the home page
  2. Go to Manage -> Assignment -> View Reports -> Review Report (View)
  3. Type the search criteria in the available search criteria and select the appropriate field from the dropdown.
  4. To perform search based on multiple filters, the user can tap on the Advanced Search button adjacent to the Search button, the view renders a hidden div containing textboxes for all the columns, allowing the user to search based on multiple columns.
  5. All the entries that match the given criteria will be returned.
  6. An empty list is returned if the search criteria doesn't match any valid records in the database.

Use Case Diagram

Code Changes

The search feature could be implemented in a more RESTful manner by adding it to individual models rather than implementing it as a single controller.

If we followed this approach the search query would be as follows:

  1. localhost:port/user/search?name=<>
  2. localhost:port/assignment/search?name=<>
  3. localhost:port/questionnaire/search?name=<>

Following is the list of search attributes for a given entity along with a list of files that would altered in the process.

User

  • Search fields: username, fullname, email
  • Modified Files:
  1. app/views/users/list.html.erb
  2. app/views/users/_search.html.erb
  3. app/controllers/users_controller.rb
  4. app/models/user.rb

The search functionality is no longer part of the list method, instead is passed as a parameter to the rendering method. The code has been modularized to separate the search parameter fetching and matching it with the user lists. Redundant search_id field has been removed from the code, the functionality is achieved using the search_uname parameter. Variable names have been renamed to increase readability. Comments have been added to further enhance readability and maintainability of the code.

Assignment

  • Search fields: assignment_name, assignee_username, assignee_name, due_date_before, due_date_after, created_before, created_after
  • Modified files
  1. app/models/assignment_node.rb

Questionnaire

  • Search fields: name, text, course, assignment
  • Modified files
  1. app/models/questionnaire_node.rb

Review

  • Search fields: team, text, min_score, max_score
  • Modified files
  1. app/views/review_mapping/_searchbox.html.erb
  2. app/controllers/review_mapping_controller.rb

Database Design

Below is the simplified version of the ER diagram which displays the relationships between the entity sets. Team_users and assignment_questionnaires are many to many relationships which are implemented in table format as show below.


Relevant Tables



Test Plan:

Automated Tests

Automated tests in RSpec will be added as we implement the search functionality for each modified file. Most of the tests added will be unit tests that cover the use cases for each flow and changes made in the model as per the requirement description.

Test Details:

User Model ( spec/models/user_spec.rb )
  1. Search by user name
  2. Search by user name that does not exist
  3. Search by user email
  4. Search by user email that does not exist
  5. Search by user email containing a substring
  6. Search by user full name
  7. Search by user full name is empty
  8. Search by user name and email
  9. Search for assignments participated
Assignment Model ( spec/models/assignment_spec.rb )
  1. Search by user name
  2. Search by institution
  3. Search by creation date
  4. Search by updated date
Rubrics
  1. Search by name
  2. Search by courses used in
  3. Search by assignments used in
Reviews
  1. Search all reviews of a particular team’s work for particular scores or text strings.
  2. Search by score
  3. Search by text comment length
  4. Search by reviewer and reviewee

Manual Tests

Search for User
  1. Setup: create a user with name="student" and userId="5000"
  2. Action: Instructor clicks on manage - > users -> in textbox enters name="student"
  3. Response: Relevant details of student, name="student" is displayed
  4. Action: Instructor clicks on manage - > users -> advanced search->clicks on checkbox student id and enters "5000" and click "ok"
  5. Response: Relevant details of student, name="student" is displayed
Search for Assignments
  1. Setup create an assignment with name="assignment" and set a due date
  2. Action : Instructor clicks on Manage -> Assignments, in textbox enter "assignment" in relevant tab
  3. Response : Relevant assignment should be displayed
  4. Action : Instructor clicks on Manage -> Assignments-> drop down and apply filters for due date and enter date and click "ok"
  5. Response : Relevant assignments should be displayed
Search for Questionnaires
  1. Setup : Create a Questionnaire, add questions to it
  2. Action : Log in as instructor, Manage -> Questionnaires, in text box enter text
  3. Response : Questionnaires matching text are shown
  4. Action : Log in as instructor, Manage -> Questionnaires, click advanced search and check creation date and enter value
  5. Response : Questionnaires matching text are shown
Search for Reviews
  1. Setup : Setup review for an assignment, login as student and then add review
  2. Action : Log in as instructor, Manage -> Assignments, Click on Review Report icon on corresponding assignment
  3. Result : Review should be seen
  4. Action : Click Advanced search, check review by text and enter text
  5. Result : Matching review should be visible

Team:

  1. Nisarg Mayank Chokshi (nmchoks2@ncsu.edu)
  2. Omkar Nivrutti Kashid (onkashid@ncsu.edu)
  3. Richa Dua (rdua2@ncsu.edu)
  4. Steve Victor Menezes (smeneze@ncsu.edu)

Mentor: Harsh Agarwal (hagrawa2@ncsu.edu)

Additional Links:

Pull Request: https://github.com/expertiza/expertiza/pull/1659
Github Project Board: https://github.com/stevemenezes/expertiza/projects/1