/lib-catalog-api

Primary LanguagePythonMIT LicenseMIT

Lib Catalog API

architecture

About ℹ️

This is an api that simulates an api of a fictitious company (Lib Catalog) that stores and makes digital documents available.

About the Problem 🖊️

Lib Catalog is a Digital Document Library Company that processes thousands of documents every day in order to store and make these documents available for multiple users to access. It also has a metrics system that evaluates the number of documents that a user has uploaded and returns this in point format depending on the relevance of the document, number of likes, and size of the document, size in MB - MegaBytes that is later placed in a ranking for all users to view the most relevant documents on a topic. The rankings are separated into real-time rankings, daily rankings and weekly rankings. At the end of each week, an email is sent to users updating the weekly ranking. This company has a problem with having a system to manage this information and make it quickly available to its users.

Suppose that relevance is given by:

Relevance = 0.1 * Document Size (MB) + 0.9 * Number of Likes

Technologies Used ⚙️

Development

  • Python
  • FastAPI

Protocols

  • HTTP
  • Web Socket

Database

  • Firestore
  • Redis
  • PostgreSQL
  • MongoDB

Requirements (Python)

Python version: 3.11.9

virtualenv
fastapi
pymongo
redis
google-cloud-firestore
psycopg2
SQLAlchemy

Features ✅

[ ] Create docker with databases and connections [ ] Create upload route (POST/doc) [ ] Create download route (GET/doc/:id) [ ] Create like route (POST/doc/like) [ ] Create ranking route (ws/docs/ranking) [ ] Create daily ranking route (GET/docs/ranking/daily) [ ] Create weekly ranking route (GET/docs/ranking/weekly) [ ] create weekly email sending feature

Running the Project 🏃

For only use the api

Run the Docker

docker compose up -d

For improve with new features

  1. Install and create a virtual enviroment
pip install virtualenv
virtualenv .venv

Obs.: Activete the virtual enviroment before the next step

  1. Up docker with only databases
docker compose up databases -d
  1. Run the project
python app.py

Acknowledge ☺️

A thank you to Alpha EdTech, because through it I was able to present this project for the Academic Moment in 2024.

License 📖

This project is open-source and is distributed under the MIT License. Feel free to explore, modify, and utilize the codebase according to the terms outlined in the license.