Assume how the Facebook application will store the millions of customer's record in real-time:
facebook = {
'jose': {
'name': 'jose', 'age': 33,
'hobby': ['cricket', 'python'], # cricket,football
'mobile': 1111111111, 'email': 'joset@gmail.com',
'contacts':[6666666666,3333333333,4444444444],
'pages': {
'python': {'sudha', 'priyanka'},
'BusinessMantra': {'sudha', 'oviya'}
}
},
'sudha': {
'name': 'sudha', 'age': 32, 'hobby': ['Khabadi', 'Movies', chess'],
'mobile': 2222222222, 'email': 'sudha.ram@gmail.com',
'contacts':[5555555555],
'pages':{
'python':{'sudha', 'lok'},
'furnitures': {'chris', 'priyanka'}
}
},
'lok': {
'name': 'lok', 'age': 26, 'hobby': ['python','football'],
'mobile': 3333333333, 'email': 'lok123@gmail.com',
'contacts':[3333333333,7777777777],
'pages':{
'python':{'chris', 'priyanka', 'jose'}
}
},
'priyanka': {
'name': 'priyanka', 'age': 26, 'hobby': 'football',
'mobile': 4444444444, 'email': 'pravi@gmail.com',
'contacts':[5555555555,3333333333,4444444444],
'pages':{'python':{'chris', 'jose'}}
},
'chris': {
'name': 'chris', 'age': 35, 'hobby': 'football',
'mobile': 5555555555, 'email': 'christopher.e@gmail.com',
'contacts':[6666666666,3333333333,4444444444]}
}
Assignment I(Store data):
- You have to allow fb-customer to enter multiple hobbies with comma separator(,) and you have to store them as a list in db.
Ex: 'jose': {'name': 'jose', 'age': '33', 'hobby': ['cricket', 'python'] - Sync Contacts: Basically facebook(Messenger) will sync all your contacts to it's database. Here, the user will enter all his contacts(mobile numbers) with comma separator, that you have to store as a list like below,
input: '6666666666,3333333333,4444444444' and store it in db like the below,
'contacts':[6666666666,3333333333,4444444444] - Validate the input of mobile number as 10-digit(Ex:9876543210), ask repeatedly if they enter invalid input.
Ex: Enter you mobile number:88 (if the user entered non 10-digit number, ask them correct mobile number until the valid input)
Enter valid mobile number: 9876543210 - Validate the Email-id with the format of Gmail account
- Get the Age and Mobile number as integer input
- A customer can run any number of pages, add an item as the above sample into their database with the pages and it's followers(set datatype)
Assignment II(Read operation):
- Find the person who has the hobby same as I am looking: List all the customer who has cricket as hobby
- Find the Target group for digital advt: A customer approaching FB to promote his page. How will they find the intended audience for the page-suggestion?
Ex: I wants to promote my 'Python Development&Automation' page, then how will you pick the right person for my page among the millions of user-profile exist in the fb db. - Suggest Friend: We usually get friend suggestion from facebook analytics. Have you ever wonder how does it work..? Let's simulate this.
As you know the pattern of stored data(facebook), you can classify the category like(same School/Company/Community/Birthplace/CurrentLocation/Contacts) - When the customer posting a status on their page, we have to let this know to all the followers
Ex: sudha wants to post the status in his ‘furnitures’ page, notify this to all it's followers