Package: matchdb
Welcome to MatchDBThis is a light wrapper around deta.space’s serverless database, Base.MatchDB is a database of people and their interests. Use it to manage
profiles and connect people who share interests.The main motivation was to help to connect people in large Slack/Discord
servers in the remote working community.Installpipinstallmatchdb# to get the latest versionpipinstallgit+https://github.com/batmanscode/MatchDB.git# install from sourcegitclonehttps://github.com/batmanscode/MatchDB.gitHow to useHere’s a brief quickstart guide. Please read thecomplete
documentationto
see everything you can do!First, let’s create a new project on deta.space and save your project
key to the environment variable"DETA_PROJECT_KEY"I’ve already created an environment variable but you can add it like
this if you haven’t:# import os# os.environ["DETA_PROJECT_KEY"] = "..."frommatchdb.matchdbimport*Next, create a name for your database. This will be visible in your
project on deta.space.I’ll define it globally here since I’ll be using just one database but
you can create as many as you like!DATABASE="users"Adding usersLet’s add two usersadd_interests(user_id=1111,group_id=2222,interests=['MMA','memes','Uk','tea'],database_name=DATABASE)find_user(1111,DATABASE)[{'date': '14-02-2023 06:00',
  'group_id': 2222,
  'interests': ['uk', 'memes', 'tea', 'mma'],
  'key': '01GS7ASNBN7BMKCFPTCV45VWBT',
  'user_id': 1111}]add_interests(user_id=3333,group_id=2222,interests=['anime','memes','ireland','coffee'],database_name=DATABASE)find_user(3333,DATABASE)[{'date': '14-02-2023 06:00',
  'group_id': 2222,
  'interests': ['ireland', 'anime', 'memes', 'coffee'],
  'key': '01GS7ASNGBHHPK4YMBEHN1REEZ',
  'user_id': 3333}]Matchmatch_list=match_interests(1111,DATABASE)This will show evreyone who has common interests with useer1111,
including themselves!match_list[{'group_id': 2222,
  'user_id': 1111,
  'common interests': ['uk', 'memes', 'tea', 'mma'],
  'common interests count': 4},
 {'group_id': 2222,
  'user_id': 3333,
  'common interests': ['memes'],
  'common interests count': 1}]You can exclude the user you are finding matches for like this:user=1111match_list=match_interests(1111,DATABASE)# for other ways to do this see here:# https://www.geeksforgeeks.org/python-removing-dictionary-from-list-of-dictionaries/match_list=[itemforiteminmatch_listifnot(item["user_id"]==user)]match_list[{'group_id': 2222,
  'user_id': 3333,
  'common interests': ['memes'],
  'common interests count': 1}]Get your whole databasedatabase_to_dataframe(DATABASE)<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</style>dategroup_idinterestskeyuser_id014-02-2023 06:002222[uk, memes, tea, mma]01GS7ASNBN7BMKCFPTCV45VWBT1111114-02-2023 06:002222[ireland, anime, memes, coffee]01GS7ASNGBHHPK4YMBEHN1REEZ3333Count unique interestsinterestcount_to_dataframe(DATABASE)<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</style>interestscount0memes21ireland12anime13tea14coffee15uk16mma1How to contributeForkInstall (more on this below)Make changes in./notebooksIn the terminal:nbdev_previewto preview docsnbdev_prepare(very important)And finally:Pull request!Please go thoughnbdevdocs. Theirend-to-end
tutorialwill show you
most of what you need to know.Installing for developmentCodespaces/VSCodeEverything you need will be installed when you open Codespaces/VSCode;
specified in.devcontainer/Notes for Codespaces:Currently Jupyter notebook doesn’t work on Codespaces for an unknown
reason, or at least I can’t, so you’ll have to use JupyterLabOpen withjupyter lab --NotebookApp.allow_origin='*' --NotebookApp.ip='0.0.0.0'For more info on using seehttps://code.visualstudio.com/docs/datascience/notebooks-webLocalYou’ll need to install Jupyter andnbdevat minimum. You
can do that with the following terminal commands:pipinstallnotebook
pipinstallnbdev
nbdev_install_quarto
nbdev_install_hooksFor convenience, you can install all these and optional Jupyter
extensions with:cdMatchDB
bash./.devcontainer/postCreateCommand.shThen install MatchDB in editable mode withpip install MatchDB/requirements.txt