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

- refactoring contd

parent b71f261c
No related branches found
No related tags found
1 merge request!10- major changes in feedback
......@@ -367,12 +367,13 @@ class RWTHFeedback:
self.btn_submit.disabled = True
self.btn_submit.description = self.feedback_text['sent']
class RWTHCollector:
""" RWTH Collector Class
class RWTHFeedbackCollector:
""" RWTH Feedback Collector Class
Processes json feedback files in a folder and creates dataframes for every mentioned notebook.
Intended to be used with RWTHEvaluator but also standalone possible as the collected feedbacks are stored as pandas
Dataframes.
Intended to be used with RWTHFeedbackEvaluator but also standalone possible as the collected feedbacks are stored
as pandas Dataframes.
Parameters
----------
......@@ -384,15 +385,15 @@ class RWTHCollector:
Examples
--------
>>> from rwth_nb.misc.feedback import RWTHCollector
>>> from rwth_nb.misc.feedback import RWTHFeedbackCollector
>>> path_to_folder = './Feedbacks' # path to folder with feedback json files
>>> collector = RWTHCollector(path_to_folder)
>>> collector = RWTHFeedbackCollector(path_to_folder)
>>> data = collector.get_all() # get feedback for all notebooks (pandas Dataframe)
"""
feedbacks = {}
json_files = []
def __init__(self, folder_path: str, log_path: str='./collector.log'):
def __init__(self, folder_path: str, log_path: str = './feedback_collector.log'):
assert os.path.isdir(folder_path), 'Folder path is not a directory!'
self.root_folder = folder_path
......@@ -424,7 +425,8 @@ class RWTHCollector:
# if a data frame already exists for given notebook work with this, create new if not
if entry['name'] not in self.feedbacks.keys():
logging.warning('Notebook \'{}\' scanned for the first time. Creating dictionary'.format(entry['name']))
logging.warning(
'Notebook \'{}\' scanned for the first time. Creating dictionary'.format(entry['name']))
self.feedbacks[entry['name']] = {'user': [], 'date': []}
notebook_dict = self.feedbacks[entry['name']]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment