Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 26 additions & 17 deletions ProgressScoresConsolidatedReport/info.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>

<info>
<author>msambou
<email>msambou@andrew.cmu.edu</email>
</author>
<url>https://github.com/LearnSphere/WorkflowComponents/tree/master/ProgressScoresConsolidatedReport</url>
<date>February 17, 2025</date>
<abstract>The <b>ProgressScoresConsolidatedReport</b> component is an example of a(n) Python component.</abstract>
<description>This program takes scores and progress as csv and produces a consolidated report in Excel format.</description>
<author>msambou <email>msambou@andrew.cmu.edu</email>
</author>
<url>
https://github.com/LearnSphere/WorkflowComponents/tree/master/ProgressScoresConsolidatedReport</url>
<date>February 17, 2025</date>
<abstract>The <b>ProgressScoresConsolidatedReport</b> is a Python-based component. </abstract>
<description>
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.
</description>

<inputs>
<b>scores csv: A CSV file containing scores output from OLI. The colums expected columns are: section,student,email,page,resource_id,score,out_of</b><br/>
<b>progress csv: A CSV file containing students' progress. Expected columns are: section_title,module_title,user_id,email,name,children,progress </b><br/>
</inputs>
<inputs>
<b>scores csv: A CSV file containing scores output from OLI. The expected columns are:
section,student,email,page,resource_id,score,out_of</b>
<br />
<b>progress csv: A CSV file containing students' progress. Expected columns are:
section_title,module_title,user_id,email,name,children,progress </b>
<br />
</inputs>

<outputs>
<b>file</b><br/>
<b>This is the consolidated report in Excel format.</b>
</outputs>
<outputs>
<b>file</b>
<br />
<b>This is the consolidated report in CSV format.</b>
</outputs>

<options>
<options>
</options>

</info>
</info>
10 changes: 4 additions & 6 deletions ProgressScoresConsolidatedReport/program/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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)


Expand Down Expand Up @@ -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):
Expand Down