From 23cec9546cb82d54d953a5b419647ca12f4bb068 Mon Sep 17 00:00:00 2001 From: Michael Sambou Date: Sat, 22 Mar 2025 11:19:42 -0400 Subject: [PATCH] polished info xml file --- ProgressScoresConsolidatedReport/info.xml | 43 +++++++++++-------- .../program/script.py | 10 ++--- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/ProgressScoresConsolidatedReport/info.xml b/ProgressScoresConsolidatedReport/info.xml index 1ab33bf7..71edd80e 100644 --- a/ProgressScoresConsolidatedReport/info.xml +++ b/ProgressScoresConsolidatedReport/info.xml @@ -1,25 +1,34 @@ -msambou - msambou@andrew.cmu.edu - -https://github.com/LearnSphere/WorkflowComponents/tree/master/ProgressScoresConsolidatedReport -February 17, 2025 -The ProgressScoresConsolidatedReport component is an example of a(n) Python component. -This program takes scores and progress as csv and produces a consolidated report in Excel format. + msambou msambou@andrew.cmu.edu + + + https://github.com/LearnSphere/WorkflowComponents/tree/master/ProgressScoresConsolidatedReport + February 17, 2025 + The ProgressScoresConsolidatedReport is a Python-based component. + + This program processes scores and progress data from CSV files to generate a consolidated report + in CSV format. The report provides each student's Pre-test and Post-test scores for a module, + along with their corresponding progress. + - -scores csv: A CSV file containing scores output from OLI. The colums expected columns are: section,student,email,page,resource_id,score,out_of
-progress csv: A CSV file containing students' progress. Expected columns are: section_title,module_title,user_id,email,name,children,progress
-
+ + scores csv: A CSV file containing scores output from OLI. The expected columns are: + section,student,email,page,resource_id,score,out_of +
+ progress csv: A CSV file containing students' progress. Expected columns are: + section_title,module_title,user_id,email,name,children,progress +
+
- -file
-This is the consolidated report in Excel format. -
+ + file +
+ This is the consolidated report in CSV format. +
- + -
+ \ No newline at end of file diff --git a/ProgressScoresConsolidatedReport/program/script.py b/ProgressScoresConsolidatedReport/program/script.py index a12ae64d..8aac7bd5 100644 --- a/ProgressScoresConsolidatedReport/program/script.py +++ b/ProgressScoresConsolidatedReport/program/script.py @@ -25,7 +25,6 @@ def get_module_details(email, scores, progress, modules, modules_raw): all_module_details = [] for module, module_raw in zip(modules, modules_raw): module_details = {} - # print (module) progress_values = progress[(progress['module_title'] == module_raw) & (progress['email'] == email)]['percent_progress'].tolist() module_details['progress'] = progress_values[0] if progress_values else None @@ -53,8 +52,8 @@ def get_module_details(email, scores, progress, modules, modules_raw): return all_module_details -# Helper function to convert results to Excel -def convert_to_excel(student_details, working_dir): +# Helper function to save output +def save_output(student_details, working_dir): # Convert student_details dictionary to a list of dictionaries data = [] modules = set() @@ -79,8 +78,7 @@ def convert_to_excel(student_details, working_dir): # Create MultiIndex columns df.columns = pd.MultiIndex.from_tuples(df.columns) - # Save to Excel - #df.to_excel(os.path.join(working_dir, 'output.xlsx')) + # Save the output in CSV format df.to_csv(os.path.join(working_dir, 'output.csv'), index=False) @@ -127,7 +125,7 @@ def main_program(scores, progress, working_dir): student_details = student_details.to_dict(orient='records') # Convert student details to Excel - convert_to_excel(student_details, working_dir) + save_output(student_details, working_dir) def progressMessage(progressLogFilePath, message):