CSC/ECE 517 Fall 2019 - E1987. Improving search facility in Expertiza

From Expertiza_Wiki
Jump to navigation Jump to search

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