CSC/ECE 517 Fall 2017/E1776 Enhance Imports: Difference between revisions
Line 98: | Line 98: | ||
In this project we have tried to make the import process more flexible. As stated in the previous section, in the old implementation, user had to import the files with restriction to the order of columns required. We tried to make this process flexible for the user, such that user is able to easily specify the order of columns using drop down menus. | In this project we have tried to make the import process more flexible. As stated in the previous section, in the old implementation, user had to import the files with restriction to the order of columns required. We tried to make this process flexible for the user, such that user is able to easily specify the order of columns using drop down menus. | ||
<big> Here is view used for the previous implementation of the User Imports - </big> | <span style="color:red;"><big> Here is view used for the previous implementation of the User Imports - </big></span> | ||
<big> Here is the view with our implementation of the User Imports - </big> | <span style="color:red;"><big> Here is the view with our implementation of the User Imports - </big></span> | ||
On the code side of imports, we have improved the implementation significantly. Previously, the import process used hard coded index values to retrieve specific columns from the import file - | On the code side of imports, we have improved the implementation significantly. Previously, the import process used hard coded index values to retrieve specific columns from the import file - | ||
<big>Code to show hard coded index values </big> | <span style="color:red;"><big>Code to show hard coded index values </big></span> | ||
This was the reason why columns were needed to be in a restricted order. But in our approach, we divide the rows of data provided in import files into hashes. Accessing data from hashes is flexible as we just need the keys to access certain values which we specify during our import process and thus we know ,before hand, what key to use to access a specific value whenever needed. | This was the reason why columns were needed to be in a restricted order. But in our approach, we divide the rows of data provided in import files into hashes. Accessing data from hashes is flexible as we just need the keys to access certain values which we specify during our import process and thus we know ,before hand, what key to use to access a specific value whenever needed. | ||
<big>Code to show hash implementation</big> | <span style="color:red;"><big>Code to show hash implementation</big></span? | ||
The import process in the previous implementation is as follows - | The import process in the previous implementation is as follows - |
Revision as of 17:51, 2 November 2017
Team Contact
- MEMBERS
- Pushpendra Patel: ppatel16@ncsu.edu
- Tanay Kothari: tkothar@ncsu.edu
- Timothy Dement: tmdement@ncsu.edu
- MENTOR
- Ferry Pramudianto: fferry@ncsu.edu
Topic Description
Backgroud
Expertiza is an open-source web application devloped on the Ruby on Rails platform that helps students to create reusable learning objects through peer review, and also supports document submission and team projects.
Expertiza includes several variations of import functionality, and allows the instructors to import following data:
- A list of users.
- A list of participants for an existing assignment.
- A list of participants for an existing course.
- A list of teams for an existing assignment
- A list of teams for an existing course.
- A list of reviewers (reviewing contributors to assignments).
- A list of meta-reviewers (reviewing reviewers).
These imports are done by uploading a file containing rows of data, with each individual value of a row separated by a given delimiter.
Expertiza allows four specifications for delimiters:
- Comma
- Space
- Tab
- Other (any custom delimiter provided by the user as text)
All of these import functions are routed through the Import File Controller, which is responsible for parsing file data and delegating the import process to the appropriate model.
Problem Statement
The following is an Expertiza-based OSS project which deals primarily with the Import File Controller. This project is associated with fixing issue #110, detailed on the Expertiza Github. A significant problem with the existing import functions is that they are not implemented consistently, and there are rigid restrictions placed on how the columns should be ordered in the given import files. In the current implementation, rows are taken is arrays, with the column numbers of specific fields hard-coded into the helper methods for different imports. The aim of this project is to improve the import functionality as well as provide a flexible and user-friendly interface so that users can easily and reliably take advantage of Expertiza's various import functions.
Solution
To resolve this issue, we have enhanced the interface and the import process, keeping the core methods of import intact, but expanding its functionality to increase its reliability, robustness, and ease-of-use. In the new interface, the system will display what will be imported in an easy-to-read grid before the import is finalized, letting the user verify the correctness of the data and, if necessary, choose from a dropdown menu which columns need to be rearranged. The default ordering is the same as what is currently required by Expertiza, unless a specific order is provided by the user as a header in the import file.
In our implementation of the import method, we have made the use of hash data structure. During the import process, we create an array of hashes, in which each row of the array corresponds to a row of the original import file. In each hash, keys refer to the field name, and values refer to the actual value of that field that will be saved to the database. This greatly improved the flexibility of the import process, since the order of the data in the import files is no longer required to be in one specific order only.
Test Plan and Demonstrations
User Import
This video demonstrates the enhanced import features for the User model with several varying examples, and also demonstrates that the original error messaging system is preserved with our new implementation.
Assigment Participant and Course Participant Import
This video demonstrates the enhanced import features for the Assignment Participant and Course Participant models with several varying examples.
Assignment Team and Course Team Import
This video demonstrates the enhanced import features for the Assignment Team and Course Team models with several varying examples.
Reviewer and Meta-reviewer Import
This video demonstrates the enhanced import features for the Review Response Map and Metareview Response Map models with several varying examples.
Plan of Work and Implementation Process
In this project we have tried to make the import process more flexible. As stated in the previous section, in the old implementation, user had to import the files with restriction to the order of columns required. We tried to make this process flexible for the user, such that user is able to easily specify the order of columns using drop down menus.
Here is view used for the previous implementation of the User Imports -
Here is the view with our implementation of the User Imports -
On the code side of imports, we have improved the implementation significantly. Previously, the import process used hard coded index values to retrieve specific columns from the import file -
Code to show hard coded index values
This was the reason why columns were needed to be in a restricted order. But in our approach, we divide the rows of data provided in import files into hashes. Accessing data from hashes is flexible as we just need the keys to access certain values which we specify during our import process and thus we know ,before hand, what key to use to access a specific value whenever needed.
Code to show hash implementation</span?
The import process in the previous implementation is as follows - 1. User initiates import process via links for importing files on different views for different models. 2. User is redirected to "start" view of import file controller. 3. User uploads the file containing data to be imported. User also modifies the options used for import on the "start" view. 4. "import" method of the Import File Controller is called which in turn calls the "import_file" method of the same controller. "import" method collects the error which might be encountered during the import process and displays it to the user. 5. "import_file" method checks which model is to be used to import the data and calls "import" method of the respective models. 6. "import" method of respective model performs the import based on hard coded order of columns.
Import process using our implementation is as follows - 1. User initiates import process via links for importing files on different views for different models. 2. User is redirected to "start" view of import file controller. 3. User uploads the file containing data to be imported. User also modifies the options used for import on the "start" view.
Files Changed
Assets
To implement the functionality of non-duplicate column names, we created two new methods checkIfUserColumnDuplicate() and checkIfParticipateColumnDuplicate() in the shared.js . We have also fixed the checkIfFileExist() method so that if the user doesn't select the file and click on import button it gives him/her an error stating that "No file has been selected to import".
Config
We needed to change the routes.rb so that the new partial views can be implemented.
Controllers
For the enhancement of the import functionality, we modified the import_file_controller. In this controller, we modified one existing method import(), other than that we had to declare some additional methods import_from_hash(), hash_rows_with_headers(), parse_to_hash(), parse_to_grid() and show().
Helpers
As we changed the original implementation from array to hash we need to also modify the import_file_helper a little bit.
Models
Here is a list of models and their respective methods that we had to modify to enhance the import functionality:
- assignment_participant : self.import()
- course_participant : self.import()
- course_team : add_member()
- metareview_response_map : self.import()
- review_response_map : self.import()
- team : import_team_members() and self.import()
- user : self.import()
Views
To use the import functionality in a new and enhanced way, we modified one of the existing view and added new views, listed below:
Views Modified:
- start.html.erb
Views Created:
- _metareviewer.html.erb
- _participant.html.erb
- show.html.erb
- _reviewer.html.erb
- _team.html.erb
- _user.html.erb
User Import
To begin the User import process, first select the "User" link from the "Manage" drop-down menu.
Next, scroll to the bottom of the page and click the "Import Users" link.
You will then be redirected to the User import page.
Participant Import
There are two types of Participants, Assignment Participants and Course Participants.
Assignment Participant Import
To begin the Assignment Participant import process, first select the "Assignments" link from the "Manage" drop-down menu.
Make sure that "Assignments" is highlighted on the "Manage content" page, then locate the appropriate assignment and click the "Add Participants" button.
Finally, scroll to the bottom of the page and click the "Import assignment participants" link.
You will then be redirected to the Assignment Participant import page.
Course Participant Import
To begin the Course Participant import process, first select the "Courses" link from the "Manage" drop-down menu.
Make sure that "Courses" is highlighted on the "Manage content" page, then locate the appropriate course and click the "Add Participants" button.
Finally, scroll to the bottom of the page and click the "Import course participants" link.
You will then be redirected to the Course Participant import page.
Team Import
There are two types of Teams, Assignment Teams and Course Teams.
Assignment Team Import
To begin the Assignment Team import process, first select the "Assignments" link from the "Manage" drop-down menu.
Make sure that "Assignments" is highlighted on the "Manage content" page, then locate the appropriate assignment and click the "Create Teams" button.
Finally, scroll to the bottom of the page and click the "Import Teams" link.
You will then be redirected to the Assignment Team import page.
Course Team Import
To begin the Course Team import process, first select the "Courses" link from the "Manage" drop-down menu.
Make sure that "Courses" is highlighted on the "Manage content" page, then locate the appropriate assignment and click the "Create Teams" button.
Finally, scroll to the bottom of the page and click the "Import Teams" link.
You will then be redirected to the Course Team import page.
Reviewer and Metareviewer Import
To begin the Reviewer and Metareviewer import process, first select the "Assignments" link from the "Manage" drop-down menu.
Make sure that "Assignments" is highlighted on the "Manage content" page, then locate the appropriate assignment and click the "Assign reviewers" button.
Finally, scroll to the bottom of the page, and click either the "Import reviewer mappings" link or the "Import meta reviewer mappings" link.
You will then be redirected to either the Reviewer import page or the Metareviewer import page.