When a Moto Mate registers they give their email address, postcode (not full address), a travel radius they're willing to travel to meet with someone and their typical availability. This is the information we use to create matches between Mentors & Mentees.
1. The mailing list of Moto Mates is downloaded from MailChimp (an emailing list management service). New members are added in to the database and any members who have left the mailing list are removed.
2. We call a Google API (an API or Application Programming Interface, is code running on a server that our code can "call" - make a request of and passing some data - in this case a postcode - and receiving a reply with some other data in response) to turn Postcodes into a Latitude/Longitude and the name of the "postal town" represented by the centre point of that postcode area.
3. We then perform a series of checks that result in increasingly tighter/relevant matches;
A basic radius check finds all of those Mentors & Mentees whose location and travel distance overlap.
We then check that their availabilities overlap (weekdays, weekday evenings, Saturdays, Sundays).
Finally for each remaining match, we call a Google routing API to calculate the actual distance between each postcode centre - circular radius may seem quite "acceptable" but if that matches people either side of the Bristol Channel, it's not very practical and doesn't truly reflect how far people may have to ride.
We now have a set of matches between Mentors & Mentees. But we might have too many Mentees against a small number of Mentors or give a Mentee an overwhelming number of potential Mentors to contact. So, it was decided to limit the number for either group to three.
4. Each of the matches assigned to a mentee are examined to get the number down to the managable three;
Any mentor that's already got more than three is removed from the Mentees match list.
If there are still too many at this point, those matches with the longest distance are removed.
Each mentee now has no more than three matches. However that can still result in Mentors with more than three matches.
5. Each of the matches assigned to a mentor are examined to get the number down to the managable three;
Those with the longest distance are removed. This will result in some Mentees having a Mentor removed, and yes in some cases this will mean having no Mentor, yet.
6. Each of the matched Mentees are sent an email that gives the full name, email address, postal town and any additional information of each Mentor they've matched with. It is then up to them which or how many of the Mentors they then contact.
7. Each of the matched Mentors are sent an email that gives the first name, postal town and any additional information of each Mentee they've matched with. They won't be able to contact the Mentee, until contacted by them, but they will at least know the basics about them if they are contacted.
The above process is repeated any time a new Moto Mate signs up, or leaves (though we'd rather they didn't, some inevitably will) and if as a result there are any new matches both parties will be informed with the new full list of their counterparts. If a Moto Mate already has three matches they won't be included in an updated match, but the entire process will reset every four months which MIGHT mean new matches are made. Of course this doesn't mean any existing matches or meet ups are "no longer valid", since Moto Mates is simply all about putting people in touch with each other.