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.3.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

randomgroups-0.0.3-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: randomgroups-0.0.3.tar.gz
  • Upload date:
  • Size: 15.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.3.tar.gz
Algorithm Hash digest
SHA256 9fe7a5424bb1a4d95d3d75c0d8ab7b8da30ce618ec8f3c094221ecc1ec91f9e9
MD5 1bf0019fae6b8406c653960d5d974f35
BLAKE2b-256 63bfc881282b53da28f713331ca96ddf27f45aefcf9f9d6f372608427ad31349

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for randomgroups-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 08138940e19fce424b8206a709b7045191ece7d0147c3a0b4b67351de2af2853
MD5 073b41d2b23d2a070a71158d524f4f3d
BLAKE2b-256 bec6bbb5d67e8489748671f86d9fe601882a7f0dd2b54bfae0a48e2ea1bada2a

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