{"id":20973684,"url":"https://github.com/grillazz/fastapi-redis","last_synced_at":"2025-04-07T10:26:54.032Z","repository":{"id":37862804,"uuid":"328745337","full_name":"grillazz/fastapi-redis","owner":"grillazz","description":"Showcase of Redis integration with Python FastAPI framework supported by Pydantic as API backend for RDKit: Open-Source Cheminformatics Software","archived":false,"fork":false,"pushed_at":"2025-02-17T03:34:57.000Z","size":713,"stargazers_count":83,"open_issues_count":22,"forks_count":10,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T04:27:05.557Z","etag":null,"topics":["api","asyncio","docker","fastapi","fastapi-redis","pydantic","python","python3","rdkit","redis"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grillazz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-11T17:45:40.000Z","updated_at":"2025-04-05T14:44:24.000Z","dependencies_parsed_at":"2023-01-25T15:32:04.177Z","dependency_job_id":"ece0608f-a451-49a2-86a1-bb9b2f8a8607","html_url":"https://github.com/grillazz/fastapi-redis","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grillazz%2Ffastapi-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grillazz%2Ffastapi-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grillazz%2Ffastapi-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grillazz%2Ffastapi-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grillazz","download_url":"https://codeload.github.com/grillazz/fastapi-redis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247634360,"owners_count":20970514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","asyncio","docker","fastapi","fastapi-redis","pydantic","python","python3","rdkit","redis"],"created_at":"2024-11-19T04:20:50.699Z","updated_at":"2025-04-07T10:26:54.010Z","avatar_url":"https://github.com/grillazz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fastapi-redis\n\n\n[![developer](https://img.shields.io/badge/Dev-grillazz-green?style)](https://github.com/grillazz)\n![language](https://img.shields.io/badge/language-python-blue?style)\n[![license](https://img.shields.io/github/license/grillazz/fastapi-redis)](https://github.com/grillazz/fastapi-redis/blob/main/LICENSE)\n![visitors](https://visitor-badge.laobi.icu/badge?page_id=grillazz.fastapi-redis\")\n[![CI](https://img.shields.io/github/workflow/status/grillazz/fastapi-redis/Unit%20Tests/main)](https://github.com/grillazz/fastapi-redis/actions/workflows/build-and-test.yml)\n\n![fastapi-redis](/static/mols.jpg)\n\n### Project Description\nPurpose of this showcase is integrate modern NoSQL backend Redis with FastAPI Python ASGI Framework\nas API for chemical compounds extended analyze with [RDKit](https://github.com/rdkit/rdkit) Library.\n\nData set coming from pub chem database, and you can download example from COVID-19 Disease Map here on this link: https://pubchem.ncbi.nlm.nih.gov/#query=covid-19\n\nPydantic schema was created for PubChem Compounds. You can replace it with your own schema to accept other source of SMILES.\n\nThere is many chemical compound sets. Now we are all in days when COVID-19 Pandemic is out there.\nWe all want to know as much as possible about best cure..., and it is my project background.\nShow power and robustness of Redis with speed of FastAPI and functionality of RDKit to deliver api \nwhich allow fast analyze chem molecules.\n\nThis showcase can be quickly integrated with other services via REST API and extended to deliver desired chem compound bakery.\n\nProject as whole is build on FastAPI framework, Python 3.11, Redis.\n\n\n### How to Setup\nTo build, run and test and more... use magic of make.\n```shell\nmake help\n```\nand you receive below list:\n```text\nbuild                Build project with compose\nclean                Reset project containers with compose\ndown                 Stop project containers with compose\nformat               Format project code.\nhelp                 Show this help\nlint                 Lint project code.\nlock                 Refresh pipfile.lock\nrequirements         Refresh requirements.txt from pipfile.lock\nsafety               Check project and dependencies with safety https://github.com/pyupio/safety\ntest                 Run project unit tests with coverage\nup                   Run project with compose\n```\n### How to Play\n1. Download sample JSON from PubChem database i.e. COVID-19 Disease Map here on this link:\n   https://pubchem.ncbi.nlm.nih.gov/#query=covid-19\n   \n2. Add SMILES to Redis Hash with `/smiles/add-to-hash` endpoint\n    ```shell\n    curl --location --request POST 'http://0.0.0.0:8080/smiles/add-to-hash?redis_hash=covid-19-canonical' \\\n    --header 'Content-Type: application/json' \\\n    --data-binary '@/fastapi-redis/PubChem_compound_text_covid-19_records.json'\n    ```\n    and get response like below with `201 Created`\n    ```json\n    {\n        \"number_of_inserted_keys\": 2364,\n        \"hash_name\": \"covid-19-canonical\"\n    }\n    ```\n3. Compare SMILES code to list loaded in previous step on Redis Hash with `/api/smiles/compare-to-hash` endpoint\n    ```shell\n    curl --location --request GET \n   'http://0.0.0.0:8080/smiles/compare-to-hash?compound=CCC(CC)COC(=O)C(C)NP(=O)(OCC1C(C(C(O1)(C%23N)C2=CC=C3N2N=CN=C3N)O)O)OC4=CC=CC=C4\u0026redis_hash=covid-19-canonical'\n   ```\n   and get response like below with `200 OK`\n   ```json\n   {\n        \"number_of_smiles_to_compare\": 2364,\n        \"similarity\": {\n            \"CCC(CC)COC(=O)[C@H](C)N[P@](=O)(OC[C@@H]1[C@H]([C@H]([C@](O1)(C#N)C2=CC=C3N2N=CN=C3N)O)O)OC4=CC=CC=C4\": 1.0,\n            \"CCC(CC)COC(=O)C(C)NP(=O)(OCC1C(C(C(O1)(C#N)C2=CC=C3N2N=CN=C3N)O)O)OC4=CC=CC=C4\": 1.0,\n            \"C1=C2C(=NC=NN2C(=C1)C3(C(C(C(O3)COP(=O)(O)O)O)O)C#N)N\": 0.8964264082374318,\n            \"C1=C2C(=NC=NN2C(=C1)[C@]3([C@@H]([C@@H]([C@H](O3)COP(=O)(O)O)O)O)C#N)N\": 0.8964264082374318,\n            \"C1=C2C(=NC=NN2C(=C1)[C@]3([C@@H]([C@@H]([C@H](O3)CO)O)O)C#N)N\": 0.8740109555690809,\n            \"C1=C2C(=NC=NN2C(=C1)C3(C(C(C(O3)CO)O)O)C#N)N\": 0.8740109555690809\n       }\n   }\n   ```\n4. For REST API Documentation please use: `http://0.0.0.0:8080/docs`\n    \n5. Finally, you can use postman collection here [Postman Collection](https://github.com/grillazz/fastapi-redis/blob/main/postman/fastapi-redis.postman_collection.json)\n\n### Backbone\nBeside of using latest and greatest version of [Redis](https://redis.io/) with it robustness, powerfulness and speed\nthere is [FastAPI](https://fastapi.tiangolo.com/) (modern, fast (high-performance), \nweb framework for building APIs with Python 3.11+ based on standard Python type hints.) already reviewed\non [thoughtworks](https://www.thoughtworks.com/radar/languages-and-frameworks?blipid=202104087) and presented in \nPython Developers [Survey 2021 Results](https://lp.jetbrains.com/python-developers-survey-2021/#FrameworksLibraries)\nas the fifth official annual Python Developers Survey, \nconducted as a collaborative effort between the Python Software Foundation and JetBrains.\n\n[redis-py](https://github.com/redis/redis-py) is already implemented as Python interface to the Redis key-value store.\n\nSpecial thanks going to maintainers of [rdkit-pypi](https://github.com/kuelumbus/rdkit-pypi).\n\nHope you enjoy it.\n\n### Change Log\n- 16 APR 2022 aioredis replaced with redis.asyncio\n- 15 JUN 2022 re-implement api with redis-om\n- 6 APR 2023 bump all project deps and rdkit = \"^2022.9.5\"\n- 6 APR 2023 move project to python 3.11\n- 6 APR 2023 switch project to poetry and remove pipenv\n- 14 APR 2023 implement rich for logging","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrillazz%2Ffastapi-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrillazz%2Ffastapi-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrillazz%2Ffastapi-redis/lists"}