Skip to content
Snippets Groups Projects
Commit 828c3bd9 authored by Hafiz Emin Kosar's avatar Hafiz Emin Kosar
Browse files

- split RWTHFeedback method

parent 38dbdcb5
Branches
No related tags found
1 merge request!10- major changes in feedback
%% Cell type:markdown id: tags:
# Feedback
`rwth_nb.misc.rwth_feedback` adds a functionality to rate a certain course.
Usage examples are demonstrated in [Submission](#Submission).
Existing submissions retrieved by mail or from _RWTHJupyter_ submission service can be [evaluated](#Evaluation) later.
%% Cell type:markdown id: tags:
## Submission
``` RWTHFeedback(feedback_name, questions, feedback_path, lang, mail_to) ``` for usage with mail
``` RWTHFeedback(feedback_name, questions, realm) ``` for usage in _RWTHJupyter_ cluster
``` RWTHFeedbackMail(feedback_name, questions, feedback_path, lang, mail_to) ``` for usage with mail
``` RWTHFeedbackJupyter(feedback_name, questions, realm) ``` for usage in _RWTHJupyter_ cluster
Call method depending on use case:
%% Cell type:code id: tags:
``` python
import rwth_nb.misc.feedback as rwth_feedback
feedback_name = rwth_feedback.get_notebook_name() # get name of notebook automatically
questions = [
{'id': 'likes', 'type': 'free-text-required', 'label': 'Das war gut:'},
{'id': 'dislikes', 'type': 'free-text-required', 'label': 'Das könnte verbessert werden:'},
{'id': 'misc', 'type': 'free-text', 'label': 'Was ich sonst noch sagen möchte:'},
{'id': 'learning', 'type': 'scale', 'label' : 'Ich habe das Gefühl etwas gelernt zu haben.'},
{'id': 'supervision', 'type': 'scale', 'label' : 'Die Betreuung des Versuchs war gut.'},
{'id': 'script', 'type': 'scale', 'label' : 'Die Versuchsunterlagen sind verständlich.'},
]
```
%% Cell type:markdown id: tags:
Call methods depending on use case:
E-Mail or offline usage
%% Cell type:code id: tags:
``` python
mail_to = "example@rwth-aachen.de" # send feedback via mail
rwth_feedback.RWTHFeedback(feedback_name, questions, feedback_path='feedback.json', lang='de', mail_to=mail_to);
rwth_feedback.RWTHFeedbackMail(feedback_name, questions, feedback_path='feedback.json', lang='de', mail_to="example@rwth-aachen.de");
```
%% Cell type:markdown id: tags:
_RWTHJupyter_ submmission service
%% Cell type:code id: tags:
``` python
rwth_feedback.RWTHFeedback(feedback_name, questions, realm="feedback_gdet3");
rwth_feedback.RWTHFeedbackJupyter(feedback_name, questions, realm="feedback_gdet3");
```
%% Cell type:markdown id: tags:
## Evaluation
%% Cell type:markdown id: tags:
### Collection
``` RWTHFeedbackCollector() ```
* ``` get_all_folder(filepath) ``` - get submissions in form of json files inside a folder
* ``` get_all_jupyter(realm) ``` - retrieve and collect submissions from _RWTHJupyter_ submission realm
%% Cell type:code id: tags:
``` python
from rwth_nb.misc.feedback import RWTHFeedbackCollector
# get feedback for all notebooks in a folder
collector = RWTHFeedbackCollector()
data_v6 = collector.get_all_folder('./Feedbacks/FeedbackV6')
data_v7 = collector.get_all_jupyter('feedback_pti')
```
%% Cell type:markdown id: tags:
### Evaluation
``` RWTHFeedbackEvaluator(questions) ```
* ``` evaluate(data) ``` - build widgets for evaluation of data collections. Note that ```data``` can be a list of dataframes
%% Cell type:code id: tags:
``` python
%matplotlib widget
from rwth_nb.misc.feedback import RWTHFeedbackEvaluator
eva = RWTHFeedbackEvaluator(questions)
eva.evaluate([data_v6, data_v7], lang='de')
```
......
......@@ -263,7 +263,20 @@ class RWTHFeedbackBase:
class RWTHFeedbackJupyter(RWTHFeedbackBase):
def __init__(self, feedback_name, questions, lang='en', realm='feedback'):
""" RWTH Feedback submission with RWTHJupyters submission service
Parameters
----------
feedback_name: str
the feedbacks name
questions: dict
feedback options to be filled out
lang: str, optional
feedback language, scales are shown in that language
realm: str, optional
jupyter submission realm in which the feedback should be stored, is set automatically if None
"""
def __init__(self, feedback_name, questions, lang='en', realm=None):
self.realm = realm
profile = os.environ.get('JUPYTERHUB_PROFILE')
......@@ -285,6 +298,27 @@ class RWTHFeedbackJupyter(RWTHFeedbackBase):
class RWTHFeedbackMail(RWTHFeedbackBase):
""" RWTH Feedback submission with mail
Parameters
----------
feedback_name: str
the feedbacks name
questions: dict
feedback options to be filled out
lang: str, optional
feedback language, scales are shown in that language
feedback_path: str, optional
path in which a feedback json file should be stored
mail_to: str, optional
mail adress to which the feedback should be sent when submitted
mail_from: str, optional
mail adress from which the feedback should be sent when submitted
mail_subject: str, optional
subject of the mail
mail_smtp_host: str, optional
smtp host
"""
def __init__(self, feedback_name, questions, lang='en', feedback_path='feedback.json', mail_to=None,
mail_from='feedback@jupyter.rwth-aachen.de', mail_subject=None,
mail_smtp_host='smarthost.rwth-aachen.de'):
......@@ -386,46 +420,6 @@ class RWTHFeedbackMail(RWTHFeedbackBase):
self.save_entries()
class RWTHFeedback:
""" RWTHFeedback calling specific classes dependent on use cases
Parameters
----------
feedback_name: str
the feedbacks name
questions: dict
feedback options to be filled out
lang: str, optional
feedback language, scales are shown in that language
-- Only for RWTHJupyter usage ---
realm: str, optional
jupyter submission realm in which the feedback should be stored, is set automatically if None
-- Only for Offline usage --
feedback_path: str, optional
path in which a feedback json file should be stored
mail_to: str, optional
mail adress to which the feedback should be sent when submitted
mail_from: str, optional
mail adress from which the feedback should be sent when submitted
mail_subject: str, optional
subject of the mail
mail_smtp_host: str, optional
smtp host
"""
def __init__(self, feedback_name, questions, lang='de', realm=None, feedback_path='feedback.json', mail_to=None,
mail_from='feedback@jupyter.rwth-aachen.de', mail_subject=None,
mail_smtp_host='smarthost.rwth-aachen.de'):
profile = os.environ.get('JUPYTERHUB_PROFILE')
if profile is not None:
RWTHFeedbackJupyter(feedback_name, questions, lang, realm)
else:
RWTHFeedbackMail(feedback_name, questions, lang, feedback_path, mail_to, mail_from, mail_subject
, mail_smtp_host)
class RWTHFeedbackCollector:
""" RWTH Feedback Collector Class
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment