Accepts a JSON input of user data and groups entries with common phone numbers.
Contact Grouper reads from a JSON file saved locally to ./data/user.json
. To use this script with custom input, simply modify users.json with new data while retaining the JSON structure.
With Pipenv:
$ git clone https://github.com/toddbirchard/group-contacts.git
$ cd group-contacts
$ pipenv update
$ pipenv shell
$ python3 main.py
With Pip:
$ git clone https://github.com/toddbirchard/group-contacts.git
$ cd group-contacts
$ pip3 install -r requirements.txt
$ python3 main.py
Running the script as-is should produce the following result:
{
'123-456-7890': [
{ 'email': 'x@yieldmo.com', 'name': 'Mr. X', 'phone': '123-456-7890' },
{ 'email': 'x@gmail.com', 'name': 'Mr. X1', 'phone': '123-456-7890' }
],
'456-789-1234': [
{ 'email': 'y@yieldmo.com', 'name': 'Ms. Y', 'phone': '456-789-1234' }
],
'456-789-9999': [
{ 'email': 'y@yieldmo.com', 'name': 'Ms. Y1', 'phone': '456-789-9999' }
]
}