CSC/ECE 517 Fall 2020 - E2079. Improve Search Facility In Expertiza

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

The Expertiza project takes advantage of peer-review among students to allow them to learn from each other. It is an open-source application running on Ruby on Rails. It is used for the 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 that display 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 parameter which includes 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 an advanced search feature where user can search on the basis of more than one parameters, and making the search functionality appear more elegant.

Problem Statement

  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 criterion needs to be specified, there should be an 'Advanced Search' button.

E2079 Current Implementation

  1. E2079 Github Repository
  2. E2079 Pull Request
  1. Video Link

Previous implementation

  1. E1987 GitHub Repository
  2. Pull Requests

Proposed Solution

The design proposed in this iteration of the project is not much different from a high level than the design proposed form last year in Fall 2019 Design. Below you will see a copy description of the solution previously proposed and some additional design choices added to improve upon the previous iteration of this issue. Changes from the previous design will be denoted by clear statements indicating the revision.

Four main objects in this application are used as the basis for expanding search functionality. These are the user, assignment, questionnaire, and the review. Each of these points are searchable by the title of the object or not searchable at all. The remaining sections note the current situation and propose a tentative solution. Note the following is a copy of last year's proposal. Reference is listed at the bottom of the page.

Search for User:

In the current system workflow, 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 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.

Search for Assignments:

In the current system implementation, searching via the name of the assignment is supported with a 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, the user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below-containing text boxes 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. An empty list will be returned if the search criteria don't match any records in the database.

Search for Questionnaires:

The existing system does not have search functionality under Questionnaires. The proposed system will implement 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 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, the user can tap on the Advanced Search button available, adjacent to the Search button; a hidden div will then be rendered below-containing text boxes 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. An empty list will be returned if the search criteria don't match any records in the database. The questionnaires will be grouped on the basis of their courses and will be expanded when clicked.

Search for Reviews:

The existing system does not have search functionality under Reviews. The proposed system will implement search functionality for searching using the attributes like team name, score, reviewer, reviewee, comment, etc. by entering a partial or a complete text that matches 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.

Flowchart

Below is a flow diagram from last year's iteration that we will aim to follow in our implementation. Reference is listed at the bottom of the page.


Sequence diagram

This is the sequence diagram for the interaction between instructor and expertiza in the context of advanced search.

Code Changes

The code changes will be in the following files

In the Pull Request, some of the code changes in the diff of app/assets/javascripts/tree_display.jsx are unintentionally moved around,added and deleted in several places. This is likely caused due to code added in-between 2 other parts of code which makes it seem like it's been deleted and added at another place.

Controllers
app/controllers/users_controller.rb
Models
app/models/assignment_node.rb
app/models/questionnaire_node.rb
app/models/user.rb
app/models/on_the_fly_calc.rb
Views
app/views/reports/_searchbox.html.erb
app/views/users/_search.html.erb
app/views/users/list.html.erb
Helpers
app/helpers/summary_helper.rb
app/helpers/report_formatter_helper.rb
Rspec Tests
spec/models/assignment_spec.rb
spec/models/response_spec.rb
spec/models/user_spec.rb

Code Changes for Advanced Review Search

  • on_the_fly_calc.rb
  • summary_helper.rb
  • report_formatter_helper.rb (seen on branch review_adv_search_scores)
  • _searchbox.html.erb (seen on branch review_adv_search_scores)

Since the last team had this code working, we decided not to reinvent the wheel but use their implementation for the feature. Thus, both helper files were updated to accept additional search criteria. This was accomplished by updating the summarize_reviews_by_reviewees(...) function to include the search attribute criteria. This includes getting teams, min and max score, and text from the search criteria. A Query object the collects the team object, leaving the rest of the logic to filter reviews from team reviewees based on all search criteria. The _searchbox.html.erb file was also updated to reflect the graphical changes for a user to enter additional search criteria if the SummaryByRevieweeAndCriteria tab is selected in view reports. However, bugs were found in the beta branch that hindered the required webpages to load. Therefore, a few bugs were fixed while others still remain. As a result, these changes are left in the review_adv_search_scores branch instead if being merged into beta.

Code Changes for Advanced Questionnaire Search

  • tree_display.jsx
  • tree_display.scss
  • questionnaire_node.rb


There are 2 main classes associated with the QuestionnairesSearchBar and QuestionnairesAdvancedSearchBar. QuestionnairesSearchBar is the main search bar containing the traditional search bar also with the advanced search bar which is QuestionnairesAdvancedSearchBar. We have the option to enable or disable this UI element in the code.

For the model, we use the variables question_text, course and assignment which are bound to the model questionnaire_node.rb. The search parameters are also bound and will be updated automatically in the view and model. For example, when the user types text in the advanced search box, it can be accessed from the model and added to the query conditions.

Changes to app/models/questionnaire_node.rb. Added the extra search fields to the query conditions.

Changes to app/assets/javascripts/tree_display.jsx. React code for advanced search.

Changes to app/assets/javascripts/tree_display.jsx. React code for advanced search.

Changes to app/assets/javascripts/tree_display.jsx. React code for advanced search.


Changes to app/assets/javascripts/tree_display.jsx. React code for advanced search.

Code Changes for Advanced Assignment and Courses Search

  • tree_display.jsx
  • assignment_node.rb
  • tree_display.scss

The functionality of assignment search filtration was implemented using react in javascript. This code was implemented in tree_display.jsx which directly impacts how the webpage functions based off of data in JQuery objects. React objects were added to implement search filtering functionality for assignments. The file, assignment_node.rb is updated to enable search parameters to interact with the table.

The methods changeDateStart, changeDateEnd, changeAvailableToggle are relevant for the advanced search bar in assignments and courses.


Changes to app/assets/javascripts/tree_display.jsx. React code for UI components in Advanced search for assignments and courses.

Changes to app/assets/javascripts/tree_display.jsx. React code for UI components in Advanced search for assignments and courses.

Changes to app/assets/javascripts/tree_display.jsx. React code for UI components in Advanced search for assignments and courses.

Changes to app/assets/javascripts/tree_display.jsx. React code for UI components in Advanced search for assignments and courses.

Code Changes for Advanced User Search

  • users_controller.rb
  • user.rb
  • _search.html.erb
  • list.html.erb
  • user_spec.rb

The method "get_user_list" in user.rb and "search_parameters" in user_controller.erb from last team works perfectly doing the filtering work on this user page. These methods will accept 3 additional parameter that represent user name, full name and email of a user and return the filtered user list. The beta branch introduced a new paginate feature that divide the long user list on list.html.erb into multiple pages. We are using the "paginate_list" method to achieve this paginate function. The advanced searching box part is also from last team. The JS code works well on delivery our new searching parameters. The list.html.erb page takes a long time to load due to the large size of users in expertiza system. Please be patient for the loading and searching operations.

user_controller use the search_parameter method to filter user list by calling get_user_list method in user model class.

user model have new parameters on get_user_list method. It use these new parameters to filter list with regular expression.

The JS code for the advanced search box.

Bugs

Several bugs were found on beta before implementation took place. These bugs had to be dealt with before review summaries would be presented on the webpage. The following bugs were found in the following link:

  • /web_host/reports/response_report?class=form-inline&id=843

This link brings you to a page to view review statistics and graphics per assignment. Several optional views are listed but bugs have blocked pages from loading including the following:

1. Review Report (view)

2. Comment Summary by Review (view)

The review report view contained a bug in on_the_fly_calc.rb on line 54 where the code was calling an undefined method to retrieve a review topic id. This function was refactored to successfully retrieve a topic id given a team id. After this bug was fixed, the page loaded review reports correctly.

The comment summary by review contained multiple bugs. The first bug was found in summary_helper.rb when the code would try to split comments into sentences in function get_sentences(...). Comments would exist but in the presence of only one sentence with no comments, the code would return a nil object. Therefore, this bug was fixed by returning the comment if it consisted of a single sentence, or a list of sentences of multiple sentences existed in the comment. Solving this bug led to another bug related to displaying the average score by criteria. Returning floats seems to break the program but we have been unable to find the root to this issue. Therefore, this bug still exists. Our code for searching through reviews cannot be tested as a result.

Resulting Snapshots

The following screenshots show before and after an advanced search for courses, assignments, and users.


Courses

Assignments


Users


Questionnaires

Following are from the master branch

Test Plan

Automated Testing Using RSpec

Automated tests can be written to test the following functionalities:

  1. Given an unfiltered search result still show
  2. Given a filtered search, the result renders a list of objects containing the filtered search item
  3. Given an invalid search, an empty list returns

RSpec tests will be written to cover the depth of each test point above for all four search objects mentioned in the proposed solution. The one's shown below are not able to pass. This might be that the tests aren't written to test the exact functionality of our implementation.

This first set of rspec tests are written to demonstrate that the filtering logic is able to differentiate partial and incorrect search matches for first name and correct full name from an admin perspective.

This set of rspec tests is confirming that an incorrect full name renders 0 results, and a correct email will render the correct user.

This set of tests confirm that an incorrect email will render 0 results, while correct emails and correct first names will still render the correct user.

This set of tests confirms the functionality that full names and correct emails render correct users. It also tests first name and last name matches for all users. Additionally, a set of first name and full name combinations will render results for all matching users.

This set of tests confirms that narrowed first name, full name, and email render one specific result.

Manual UI Testing

UI tests will be performed to reproduce the behavior previously mentioned. These steps were reproduced from the previously proposed solution for this issue.

Search for User

  1. Log into 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 a 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 text boxes 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 don't match any valid records in the database.

Search for Assignment

  1. Log into 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 a 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 text boxes 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 don't match any valid records in the database.

Search for Questionnaire

  1. Log into 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 a 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 text boxes 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 don't match any valid records in the database.

Helpful Links

Link for Video Demo - https://drive.google.com/file/d/1yr_4b0SsN_J4qGMpZbQLzKXzWAjoX7fV/view

Identified Issues

Current issues exists in this PR for this issue, including build errors in the Travis CI build and various existing bugs within beta. Some of these bugs have been mitigated but others still remain. There needs to be more eyes and time on solving many of these bugs hidden within beta surrounding this issue.

Team Information

  1. Prasanth Yadla (pyadla2)
  2. Josh Beerul (jbeerel)
  3. Li, Junyan (jli56)
  4. Mahajan, Anjaney Chirag (acmahaja)


Mentor: Sanket Pai (sgpai2)
Professor: Dr. Edward F. Gehringer (efg)

References

  1. Fall 2019 Design
  2. Expertiza on GitHub
  3. RSpec Documentation