This project consists of two main components:
- an API to retrieve quiz results and reading activities as CSV files, and
- a report generator that processes quiz data and generates an Excel file.
- Python 3.4+
- openpyxl
- Flask
- mysql-connector-python
To install the required packages, run:
pip install openpyxl flask mysql-connector-python
- Update the
HOST
,DATABASE
,USER
, andPASSWORD
variables in theapi.py
script with your MySQL database connection information. - Make sure your database contains the necessary tables and data.
- Run the API server:
python api.py
- Access the following endpoints using your browser or a tool like curl or Postman:
-
To get quiz results as a CSV file, go to:
http://127.0.0.1:5000/api/raw_quiz_results?grp=INFSCI2470Spring2023
-
To get reading activities as a CSV file, go to:
http://127.0.0.1:5000/api/raw_reading_activities?grp=INFSCI2470Spring2023
-
To generate an Excel report for quiz results, go to:
http://127.0.0.1:5000/api/xls_quiz_results?grp=INFSCI2470Spring2023
Replace INFSCI2470Spring2023
with the appropriate group identifier for your data.
Obtain a TSV or CSV file containing the quiz data you want to process.
Run the script:
python cli-report.py path/to/input_file.tsv path/to/output_file.xlsx
E.g.
python3 cli-report.py /Users/rully/Downloads/quiz_results.csv /Users/rully/Downloads/ISD_rc_results.xlsx
You can also provide a delimiter using the -d or --delimiter option:
python cli-report.py -d '\t' path/to/input_file.tsv path/to/output_file.xlsx
The script will read the data, process it, print the results, and save the results to an Excel file named results.xlsx
. The Excel file will have two sheets:
- User_DocSrc: Summary of users' correct answer per document source.
- User_DocNo: Users's correct answers for each document, along with the maximum possible correct answers per document in the second row.