E1912 Export Tags
Introduction
About Expertiza
Expertiza is an Open Source Web Application Software managed by National Science Foundation. Expertiza is used by many courses including CSC 517 for assignment management. It has functionalities such as peer reviews, teammate reviews and tagging reviews in which students can provide feedback on other's work which helps peer in better developing the project.
Motivation
The Expertiza team currently had to manually fire queries in the database in order to get the tag submissions made by an individual user(student) on each review for a particular assignment. In this way, the team got the data from the entire class, which was then used to feed the Machine Learning algorithms. But many times it used to happen that students made random tags and the ML algorithm was not able to make good predictions out of it, hence in order to solve this issue a new idea was proposed as to select on the students which did not create outliers in the predictions and hence, therefore, it is a good proposal.
Tasks Identified
In order to perform this task following files were identified where the code hasbeen added.
- In _answer_tagging_report.html.erb view, a button is added for exporting the student's tagged values
- A checkbox for each row has been added in order to select students whose tags are to be exported(By default all will be selected).
- A method is written in export_file_controller.rb controller named export_tags that exports the CSV file.
Implementation
The workflow diagram of our implementation is shown here:
We have added a default select all checkbox under Report tags done by each user which enables student selection for exporting tags in the CSV file. We have added a column for the checkbox and a button named Export which on click generates the CSV file.
Below is the snippet of the same view _answer_tagging_report.html.erb
<%= form_tag(export_tags, method: 'put',:id => 'tst') do %> <div id="tab-summary"> <h4 align="center">Summary for each user</h4> <table class="table table-striped sortable"> <thead> <tr> <th class="sorter-true">Username</th> <th class="sorter-true">Name</th> <th class="sorter-true">Percentage of tags done</th> <th class="sorter-true"># tags done</th> <th class="sorter-true"># tags not done</th> <th class="sorter-true"># possible tags to do<img src='/assets/info.png' title='Number of answers that fulfil the prerequisite setup for each tags (Answer of certain question types and has a length of greater than the threshold).'/></th> <th>Tags export</th> </tr> </thead> <% @user_tagging_report.each do |key, val| %> <tr> <td><%= val.user.name(session[:ip]) %></td> <td><%= val.user.fullname(session[:ip]) %></td> <td><%= val.percentage.to_s %>%</td> <td><%= val.no_tagged.to_s %></td> <td><%= val.no_not_tagged.to_s %></td> <td><%= val.no_tagable %></td> <td><%= check_box_tag 'names[]', val.user.name(session[:ip]), true %></td> </tr> <% end %> </table> </div> <%= submit_tag "Export",:value => 'Export' ,:form => 'tst',method: 'put' %> <% end %>
Screen Record
- Here is the link to a screen recording on how to access the functionality and export the CSV file.
Code and Snapshots
We have written a method inside the export_file_controller.rb. Once this method is called it queries on the name array passed from the view and exports the CSV file with the required data.
def export_tags @user_ids = User.where("name IN (?)", params[:names]) @students = AnswerTag.select('answers.*, answer_tags.*').joins(:answer).where("answer_tags.answer_id = answers.id and answer_tags.user_id IN (?)", @user_ids.pluck(:id)) attributes = %w[user_id tag_prompt_deployment_id comments value] csv_data = CSV.generate(col_sep: ",") do |csv| csv << attributes @students.each do |item| csv << item.attributes.values_at(*attributes) end end filename = "Tags" send_data csv_data, type: 'text/csv; charset=iso-8859-1; header=present', disposition: "attachment; filename=#{filename}.csv" end
The output file has user_id, tag_prompt_deployment_id, comments and value. We can see that some comments are repeated it is because every review that is received has at least 1 tag for it. Hence we see the repetition. The value column has -1, 0 and 1 as No, not answered and Yes meaning respectively.
Design
The functionality for our project was to implement exporting of tagged comments from the Expertiza system. For this, we will approach the project by using the delegation pattern to add exporting capabilities to the export file controller for exporting tags.
Teammates
Mentor - Harsh Agrawal
- Aishwarya Subramanian (asubram7)
- Dyuti De (dde)
- Ankit Mody (amody)