This is an api
that simulates an api of a fictitious company (Lib Catalog) that stores and makes digital documents available.
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
- Python
- FastAPI
- HTTP
- Web Socket
- Firestore
- Redis
- PostgreSQL
- MongoDB
Python version: 3.11.9
virtualenv
fastapi
pymongo
redis
google-cloud-firestore
psycopg2
SQLAlchemy
[ ] 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
Run the Docker
docker compose up -d
- Install and create a virtual enviroment
pip install virtualenv
virtualenv .venv
Obs.: Activete the virtual enviroment before the next step
- Up docker with only databases
docker compose up databases -d
- Run the project
python app.py
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.