Skip to main content

Algorithm to create recurring random groups

Project description

image

License image image image

Introduction

This package exports a single function called create_matching which can be used to create matchings for reccuring meetings from a varying but overlapping set of members. In particular, the internal algorithm makes sure that matchings at different meetings are mixed.

Installation

The package can be installed via pip. To do so, type the following commands in your favorite terminal emulator:

$ pip install randomgroups

Usage

The code expects a data file containing id, name, and joins columns, where id is used internally to keep track of matchings, name is a str column which is used when creating the human-readable output and joins is a {0, 1} column which denotes if the given individual wants to join the current meeting. An example file is given here names.csv. Note that the rows in id column have to be unique. If new individuals wish to be added these individuals simply need to be appended to the data file, the code will update all further files automatically.

First Time Use:

If no prior matchings have been recorded you can create a new set of groups by running the following lines in a Python shell

from randomgroups import create_matching

names_path = "/path/to/names.csv"
output_path = "/path/to/folder/where/to/store/output/data"

create_matching(
    names_path=names_path,
    output_path=output_path,
    min_size=2,
)

Here the argument min_size denotes the minimum number of members in a group. In the folder output_path two files will be created. One, matchings.txt which contain the named matchings for the current meeting, and second, matchings_history.csv which contains information on matchings. The latter file needs to be saved since it will be used in subsequent function calls. Example files are given here: matching.txt, matchings_history.csv.

Remark: If the files names.csv is a Google sheet which is updated on a regular basis it can be sensible not to donwload the file but to provide a link to the sheet directly. In the case with Google sheets this is easily done by opening the Google sheet and then publishing the document in the file options. This creates a link to a downloadable csv file which updates when the Google sheet is updated. This URL can then be passed to names_path.

Subsequent Usage:

Once the file matchings_history.csv has been created one can further pass the path of this file to the function call via matchings_history_path=.... The previous matchings will then influence new group formations.

Assortative Matching:

The 'status' column in the names csv-file allows one to distuingish between 'student' and 'faculty'. One can then use the 'wants_mixing' column to specify whether an individual wants to be mixed with people from another group. This is not absolute. A float parameter ("faculty_multiplier") can be specified in a dictionary an passed to the main function via the argument "matching_params". If this parameter is very high it will be less likely that faculty that does not want to mix is mixed.

Contributing

If you want to contribute to this repository feel free to open a pull request or submit an issue. You can also simply contact me, see here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

randomgroups-0.0.2.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

randomgroups-0.0.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file randomgroups-0.0.2.tar.gz.

File metadata

  • Download URL: randomgroups-0.0.2.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for randomgroups-0.0.2.tar.gz
Algorithm Hash digest
SHA256 59ce6bf6ec7c9ed5a25cc35ebfb2d886110b3031b4ba94848eef1bc04ee5042b
MD5 4480a8dcc0c4756c1d5bcc25090c79f2
BLAKE2b-256 182b96db3f2723727847e5c2d52c3a72e4a9cc6cc12c47df12c59d616210198d

See more details on using hashes here.

File details

Details for the file randomgroups-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for randomgroups-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 38e52f87f8981018623fd834b1b02339b1afae628a7bf18047416626ffb5b7cb
MD5 ba94b8f282242315da7071986bb97ad3
BLAKE2b-256 9b5c8b0b7d1072b1c341395b1b90d46560b8b3c051773f9141247eb3cb659c3b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page