A quick script to process data gathered in Google Forms into match results that can be emailed to participants.
- Python 3.8 or higher
pip3
andpipenv
- Clone this repo with
git clone https://github.com/DanielRunningen/SpeedFriendingMatcher.git
. - Open the new directory and run
pipenv install
. - Run
pipenv shell
to open the new environment. - Make any changes to the
config.json
file, if needed (this includes paths to you input csv and desired output file). - Run
python3 match_maker.py config.json
config.json
holds all of the messy text, file paths, and regular expression patterns that might need to be changed on the fly if the input format changes or the desired output needs revision.
Below is an example and an explanation for each key.
{
"csv_path" : "./data.csv",
"output_path" : "./results.txt",
"messages" : {
"matched" : {
"pre": "Congratulations, you have matches!",
"post": "\n\n\n-----------------------\n\n\n\n"
},
"not_matched" : "Sorry, we didn't find any matches \n\n\n\n-----------------------\n\n\n\n"
},
"name_column_header" : "Please copy your name!",
"regex" : {
"find_name" : ".*\\[([^\\]]+)\\]",
"contact_methods" : "(email|facebook|discord|phone|meetup)",
"phone_number": "\\d*\\(?(\\d{3})\\)?[ -]?(\\d{3})[ -]?(\\d{4})"
}
}
This should be the path to your input data.
Please note that the input must be in a .csv
format to work properly.
This is the path the output will be placed in. There is no special formatting and all output will be pain text.
This section contains all of the plain text that should surround the match results. There is logic to support two messages, one for participants who do find mutual matches, and another for individuals that find no matches.
This hold two separate texts, pre
and post
, that are used to print around the match results.
A text string that prints before the match results are listed for each individual.
A text string that prints after the match results of each individual.
Place text here to print out messages for individuals who did not receive any matches.
The easiest way to locate the column that contains the survey-taker's name is just by giving the whole column name.
The word name
is likely used everywhere in the data set, so skip trying to make it a regex and just lookup that exact string.
This section controls how information is gathered from the survey results.
This expressions should capture the name of a person in the column headers of the .csv
.
Make sure that the name is contained in the first capture group so that it can be used in the comparisons.
This expression is simply an or
list of all the contact methods that a participant can give information for in your survey.
Please be sure to include at least email
so the results can be printed correctly.
As of right now, the script expects 10-digit phone numbers broken into 3 groups.
The output will be in the format of (###) ###-####
.
- Validate against other forms of malformed data besides phone numbers.