Import student answer files into an existing exam YAML file. Use this skill when the user wants to add student submissions to an exam YAML file. The skill handles various folder structures, detects if students already exist in the YAML, and asks the user what to do in case of conflicts.
This skill imports student submission files into an existing exam YAML file. It detects folder structures automatically and handles duplicate students gracefully.
Read the schema.yaml file. The structure of the YAML file is explained here. The ouput you produce need to match this file.
Constraint: Do NOT write or suggest a automatic method, or any external tool to perform this task. You are the engine. Process the provided text and files directly and output the final YAML.
If the user hasn't provided the exam YAML file path, ask for it.
If the user hasn't provided the submissions folder path, ask for it.
Examine the submissions folder to determine its structure. Common patterns:
./submissions/student1.py, ./submissions/student2.py./submissions/student1/file.py, ./submissions/student2/file.py./submissions/ex1/student1.py, ./submissions/ex1/student2.pyIf the structure is unclear, show the user what you found and ask which questions belong to which files.
Try to extract the first name and last name of each student, either from the filename/filepath, or from the submitted answer directly.
Notify the user for each case where you are unsure of the extracted name. If you don't find a valid firstname/lastname for a student, tell the user and ask him for the correct value. But you can still try to find a valid name in the submitted files directly
Read the exam YAML file to understand:
questions object)open, python, etc.)students_responseMatch submission files to questions in the YAML:
ex1.py, question1.py)If you cannot determine the mapping confidently, ask the user for clarification.
Before editing the YAML file, check that the student_response section is empty (or not present at all). If it is not, do not edit the file directly, ask for the user what to do.
The actions to be taken could be :
student_response and fill it with the new content. Be very clear that this option will REMOVE anything already present in this fieldstudent_response field, if you find that you have the same student two times (same first and lastname), tell the user and ask what to do (keep the one already in the file and skip the new one, or replace the current one with the new entry. Be very clear on each options, with their consequences)For this step, the import_students_response.py script should be used.
To use it, you need 2 parameters :
[
{
"firstname": "John",
"lastname": "Doe",
"submissions": {
"1": "path/to/answer1.txt",
"2": "path/to/answer2.py",
<Question id>: <Path to answer>,
...
}
}
]
Use the extracted firstname/lastname of Step 3 to fill in those parameters
This script will add every student submission you give it into the yaml file.
python import_students_response.py "./exams/exam.yaml" --students '[{"firstname": "John", "lastname": "Doe", "submissions": {"1": "a.txt"}}]'
python import_students_response.py "./exams/exam.yaml" --students '[{"firstname": "John", "lastname": "Doe", "submissions": {"1": "john/q1.txt"}}, {"firstname": "Jane", "lastname": "Smith", "submissions": {"1": "jane/q1.txt"}}]'
Checks :
firstname and lastname you parsed make sense (ex asdaf is not a name). If one field is wrong, tell the user and ask for guidanceschema.yamlUser says: "Import student answers from ./submissions to exam.yaml"
You:
./submissions/JohnDoe/ex1.py, ./submissions/JohnDoe/ex2.py