Skip to content

Commit

Permalink
Update output file names to match others
Browse files Browse the repository at this point in the history
This is more consistent and allows for sorting by key to easily select matching files

* Change key files to TIMESTAMP__mcta_X_key.csv
* Change answers files to TIMESTAMP__mcta_X_results.csv
  • Loading branch information
iansan5653 committed Nov 3, 2021
1 parent 86477dc commit a369244
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions code/mcta_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create_keys_files(keys_results: OutputSheet, output_folder: pathlib.Path, fi
for row in keys_results.data[1:]:
code = row[form_code_col]
csv_data = build_key_csv(row[keys_results.first_question_column_index:])
save_mcta_csv(csv_data, output_folder, f"AnswerKey{code}", files_timestamp)
save_mcta_csv(csv_data, output_folder, f"{code}_key", files_timestamp)


def create_answers_files(answers_results: OutputSheet,
Expand Down Expand Up @@ -61,7 +61,7 @@ def create_answers_files(answers_results: OutputSheet,
csv_data = build_answers_csv(group_data)
# Test form code can be in [A|B] form if student selects A and B. The [|] are not safe for filename.
file_safe_code = code.replace("[", "").replace("]", "").replace("|", "")
save_mcta_csv(csv_data, output_folder, f"TestData{file_safe_code}", files_timestamp)
save_mcta_csv(csv_data, output_folder, f"{file_safe_code}_results", files_timestamp)


def build_key_csv(answers: tp.List[str]) -> tp.List[tp.List[str]]:
Expand Down Expand Up @@ -92,5 +92,5 @@ def save_mcta_csv(data: tp.List[tp.List[str]],
path: pathlib.PurePath,
basefilename: str,
timestamp: datetime):
filename = path / f"{format_timestamp_for_file(timestamp)}__MCTestAnalysis_{basefilename}.csv"
filename = path / f"{format_timestamp_for_file(timestamp)}__mcta_{basefilename}.csv"
save_csv(data, filename)

0 comments on commit a369244

Please sign in to comment.