Package: mentor-match
Mentor MatchThis is a package to help match mentees and mentors.It usesthis implementation of Munkresto find the most effective pairings. The Munkres algorithm works on a grid of scores.ScoringFull details of how the matches are calculated can be read in the code itself. Customisable configurations are on the
roadmap but are not planned for any upcoming releases.InstallationYou can install this project withpython -m pip install mentor-matchUseTo use this library, first install it (see above). You may need to munge your data for the system to be happy with it.
Use theexample CSV fileas guides for your mentor and mentee data, then put them together in the same folder.The software will run as many matching exercises as you passlist[AbstractRule]. So you'll need to come up with
some rules as to how you want your mentors and mentees to be matched. For more information on rules, seeRules.Here is a snippet that outlines a minimal use in a Python project:frommatchingimportprocessfrompathlibimportPathfrommatching.rules.ruleimportGenericdata_folder=Path("Documents/mentoring-data")mentors,mentees=process.conduct_matching_from_file(path_to_data=data_folder,rules=[[Generic({True:3,False:0},lambdamatch:match.mentee.organisation!=match.mentor.organisation)]])output_folder=data_folder/"output"process.create_mailing_list(mentors,output_folder)process.create_mailing_list(mentees,output_folder)This weights matches where mentors and mentees are in different organisations. For more on rules, seeRules.
The system then creates a mailing list according to a set template, ready for processing by your
favourite/enterprise mandated email solutionRulesAll rules are subclassed from theAbstractRuleclass. They need anevaluatemethod, which should take aMatchobject and return aboolean, and anapplymethod, which takes aMatchobject, evaluates it, and changes the
internal state of theMatchobject.I've included a couple of pre-defined rules to help start you off:GradeGradeneeds a target difference in grades between mentors and mentees, an operator to compare them, and a score to
give if the operation is true or if it's false. SoGrade(2, operator.gt, {True: 3, False: 0})will create a rule
that gives 3 points to a grade difference between the mentor and the mentee that's greater than 2.UnmatchedBonusUnmatchedBonusonly needs an integer value to add to the Match score. It'll add it if either the mentor or the
mentee doesn't have any connections. This is helpful if you run multiple rounds, as it'll give the edge to
mentors/mentees who haven't been successfully matched yet.DisqualifyDisqualifyneeds to be passed a function that takes aMatchobject and returns abool. It's an anti-rule: if the
condition evaluates toTrue, then thatMatchis disqualified for this round. TwoDisqualifyrules are
pre-defined on theMatchobject - aMatchis disqualified if bothMentorandMenteeare the same person, or
if they've already been matched once.GenericGeneric, likeDisqualify, takes a function with the signature[[Match], bool]. It also takes a dictionary,
likeGrade, where you define what score to be given to theMatchif the function evaluates to true, or indeed if
it evaluates to false!ExportThere's an inbuiltExportToSpreadsheetwhich very much does what it says on the tin. Instantiate it with a list ofPersonobjects and where you want the output to end up and callexportto do the thing.You can also subclassExportToEmailfor all your email-exporting needs. Or write your own thing entirely!