Exporting Reports, Guide for Further Development
Project: TIMCAN
Document creator: Jere Ojala
Created: 23.5.2019
Modified: 6.6.2019
For further queries: tim@jyu.fi
1. Purpose and content of the guide
The report exporting feature compiles and prints the adaptive feedback test results in CSV form. Exporting option can be found on TIM in the Answers tab. In the dropdown menu of user answers list the menu item Create Feedback Report creates a test report. When Create Feedback report is clicked a dialog for the CSV formating is opened where a user can choose the options for it. By clicking OK the browser opens with the results.
The document defines the structure and the location of the report exporting feature developed into TIM by TIMCAN project. The purpose of the document is to give better understanding how the code works and its comments.
2. Structure and location of the test exporting in TIM
The report exporting code is divided in TIM thusly:
/timApp/answer/feedbackanswer.pycontains most of the code of compiling the information and exporting it into CSV form./timApp/static/scripts/tim/answer/feedbackAnswersController.tshandles theallFeedbackAnswerOptions.htmloptions and URL query./timApp/static/templates/allFeedbackAnswersOptions.htmlcontains the HTML for the option dialog window.- The option of report exporting was added into the already existing file
/timApp/static/scripts/tim/answer/userlistController.ts. /timApp/tests/server/test_feedback_report.pycontains automated tests of the reporting feature.
Onko otsikko jäänyt muuttamatta copy-pasten jäljiltä?
Voisi lisätä autom.testien tiedoston myös listaan.
—3. Description of functionality
The code fetches from the database the saved answers of the document or all documents in the folder and the users who answered them. The query is then sorted based primary on users and secondary on time and date they answered.
The script goes through each answer except the first one where it only saves the date. The script checks if the answer is from the feedback plugin.
If the answer is not saved by the feedback plugin the script skips the answer. If the answer is saved by the feedback plugin the script saves
- the correctness of the answer,
- the answer of the user,
- the correct answer and
- the given feedback
from the answer. The script calculates the times between the question was summited and the user continued after reading the feedback by subtracting the previous answer date. After the script has gone through all the answers the answer arrays are returned. Each array is then compiled into the CSV format.
4. Program logic file feedbackanswer.py
/timApp/answer/feedbackanswer.py contains most of the code of compiling the information and exporting it into CSV form. feedbackanswer.py doesn't contain any classes or interfaces.
4.1 Functions
feedbackanswer.py contains the following functions:
get_all_feedback_answersfetches all answers from database and sorts them by user and then by date. The function also filters answers based on validity.
compile_csvcompiles data from answers JSON into CSV form.
print_feedback_reportis a routed function to print compiled data. It handles also option parameters. The route is\feedback\report\.
5. Dialog controller feedbackAnswerController.ts
/timApp/static/scripts/tim/answer/feedbackAnswersController.ts handles the allFeedbackAnswerOptions.html options and URL query. feedbackAnswerController.ts is mainly modeled after already existing code allAnswerController.ts.
5.1 IFBOptions interface
The interface contains all the parameters of the exporting options. The functionalities of the option parameters will be handled in the feedbackanswer.py file. feedbackAnswerController.ts only initializes their default values. The interface contains the following parameters:
periodwill define from what period answers will be exported.validwill define filtering based on the validity of answers.namewill define how to display the identification of the users.periodFromwill define start of theperiod.periodTowill define end of theperiod.scopewill define whether to export the whole test or only one task.answerswill define whether to export all users, all the visible users or only the selected user.formatwill define CSV delimiters format.userswill define all the visible or selected users depending on theanswersoption.decimalwill define decimal format for the time units.
Voinee päätellä paljon jo nimistä, mutta onko näille olemassa myös selitteet?
—5.2 IFeedbackAnswersParams interface
The interface contains the following parameters for the routing.
identifieris the number id of the document.usersis the list of the users.urlis the URL for the report.allTasksis a boolean for showing the possibility of sorting the answers in a report. When exporting answers from a single TIM task it isfalse. When exporting answers from the Get answers dialog it istrue. Because the answer of a single question item of a dynamic feedback test is never exported on its own and the Export to CSV dialog is always used, this parameter is currently obsolete.
5.3 Relevant attributes of the FeedbackAnswersCtrl class
The following attributes are the most relevant of the FeedbackAnswersCtrl class:
componentis the name of the component.
optionsis the interface that contains all the reporting formating options.
storageis the storage where the previously selected options are stored.
datePickerOptionsFromhandles the period start picking.
datePickerOptionsTohandles the period end picking.
lastFetchstores the last fetched answer.
5.4 FeedbackAnswersCtrl class methods
FeedbackAnswersCtrl class contains the following methods:
getTitlereturns the title of the dialog window.
onInitinitializes options, handles the date pickers and compiles the query for the userlist handling.
okhandles events for the OK button.
cancelhandles events for the Cancel button.
6. Ideas for further development
The ideas for the further development include the following ones.
- Create Feedback Report option should be hidden when the
feedbackplugin is not in the document, - The points from the feedback plugin should be added into the feedback report.
- The route function should be moved into the
routes.pyfile.
The function for exporting test results was developed for the Centre for Applied Language Studies. The exporting only works if the feedback plugin is in the document or in at least one of the documents in the folder. The generality of exporting the test results depends on the generality of the feedback plugin.
"*was developed" varmaankin, kun kyse on yhdestä funktiosta.
—7. Relevant materials
Apart from the document, maintainers might find useful information from the following materials:
- User Manual for Creating Adaptive Feedback Test in the TIM
https://tim.jyu.fi/view/ kurssit/tie/proj/2019/timcan/kayttoohjeet/instructionsand - source code in GitLab
https://gitlab.com/jatakuiv/tim.
These are the current permissions for this document; please modify if needed. You can always modify these permissions from the manage page.