Am a beginner in web development.
I am building a dating site using flask. I have built a simple rule based recommender program which loops through all the user profiles and user preferences. from there it stores each of those recommendations in a mysql db. as shown below
mysql> select id, user_id1, user_id2, score from recommendations;
+————————————–+————————————–+————————————–+——-+
| id | user_id1 | user_id2 | score |
+————————————–+————————————–+————————————–+——-+
| 0abeebfd-4f55-4167-adb6-3c8b4edf8c04 | 49ea76ae-d5d3-4e40-8612-15a7b5434b49 | b3768514-ea3f-4c1d-9cb0-c97b8962157f | 27 |
| 100d21f7-2e38-46bd-b910-f43e7818cf59 | 1855ad4b-c743-4d64-98b9-04ac9c0c6bb0 | ea394af0-9869-469c-a905-723e40cf7518 | 19 |
| 214912b0-0585-4a79-a3fe-301488ef3af8 | 1855ad4b-c743-4d64-98b9-04ac9c0c6bb0 | 49ea76ae-d5d3-4e40-8612-15a7b5434b49 | 15 |
| 9a997611-8c97-45e7-beb3-b03a9ba4d445 | ea394af0-9869-469c-a905-723e40cf7518 | b3768514-ea3f-4c1d-9cb0-c97b8962157f | 15 |
+————————————–+————————————–+————————————–+——-+
4 rows in set (0.00 sec)
I have several questions on this.
(1). I know it is resource intensive to loop through all the raws in profiles and preferences tables and giving the users scores. I am thinking of making the code async and run in the background after a user updates his/her profile or preferences. Is there a better way to solve this?
(2). assuming the above assumption works fine. how will i implement a feature that if user_1 is liked by user_2, user_1 must also like user_2 for a match to be created?
I am thinking of creating a likes table and a matches table such that when a 2 users like each other a match is created. however i think this is also not very efficient
Moses Gitonga is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.