📚 The CoCalc Library - books, templates and other resources
License: OTHER
Math 157: Intro to Mathematical Software
UC San Diego, winter 2018
This script creates the final project groups based on the Google Form input. This input was sanitized to remove duplicate names and to insert students that did not fill out the Google Form.
We set a random seed to make this calculation reproducible.
Import a CSV file retrieved from Google Docs.
We only need the name and the first choice. Let's use the name as the axis.
Standardize capitalization and whitespace in the names.
To make sure that the input was sanitized correctly, compare with a CSV file of course grades generated by CoCalc.
Standardize capitalization and whitespace in the names.
Check that everything matches up. Make sure this is valid before using the results!
Convert the poll results into a dictionary.
Remove predefined groups before processing the rest of the list.
Separately, count the number of instances of each topic, including nan (blank).
In order to make the groups evenly sized, we add a dummy topic. Just like for real topics, we want no two dummies in the same group.
Distribute topics among the groups, from most to least popular (skipping the blanks). No topic may be assigned more than once within a group. To assign a particular topic, we choose a random subset of groups where each group is weighted by the number of empty spaces it has.
There is a probability of failure because we run out of empty groups. In case this occurs, we give up and try again.
Pad the remaining groups with blanks.
Fill students in at random according to their chosen topics.
Add back the preassigned groups.
For each group, assign each student who did not choose a topic to a random choice.
Print the groups to a file.
Create a workspace for each project. Make sure to edit the template chat room as appropriate before doing this.
After running this command, move the folder final_project_workspaces
into the shared project.