A sophisticated recommendation system that suggests personalized video content based on user preferences and engagement patterns using deep neural networks. Ref: to see what kind of motivational content you have to recommend, take reference from our Empowerverse App ANDROID || iOS.
This project implements a video recommendation algorithm that:
- Delivers personalized content recommendations
- Handles cold start problems using mood-based recommendations
- Utilizes Graph/Deep neural networks for content analysis
- Integrates with external APIs for data collection
- Implements efficient data caching and pagination
- Backend Framework: FastAPI
- Documentation: Swagger/OpenAPI
- ORM: SQLAlchemy
- ML/AI: PyTorch, scikit-learn, pandas, numpy
- Graph Neural Networks (GNN): Custom GNN model using PyTorch (see
app/ml/gnn_model.py) - Graph Processing: NetworkX
- Database: SQLite (default, can be changed)
- Async HTTP Client: httpx
- Environment Management: python-dotenv
- Testing: pytest
- Python 3.8+
- Virtual environment (recommended)
-
Clone the Repository
git clone https://github.com/Tim-Alpha/video-recommendation-assignment.git cd video-recommendation-engine -
Set Up Virtual Environment
python -m venv venv # On Unix/Mac source venv/bin/activate # On Windows venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Configure Environment Variables Create a
.envfile in the root directory:FLIC_TOKEN=your_flic_token API_BASE_URL=https://api.socialverseapp.com
-
Run Database Migrations
alembic upgrade head
-
Seed the Database with Example Data
This will populate your database with diverse example users, categories, topics, posts, and interactions:
python -m app.seed_data
-
Start the Server
uvicorn app.main:app --reload
-
Access API Documentation
Open http://localhost:8000/docs in your browser for interactive Swagger UI.
GET /- Root endpointGET /health- Health checkGET /feed?username={username}&limit={n}- Personalized feedGET /feed?username={username}&project_code={project_code}- Category-based feedPOST /sync- Sync data from external APIGET /stats- System statisticsGET /users- List usersGET /posts- List posts (with filters)GET /categories- List categoriesGET /topics- List topics (with filters)
Run the included tests with:
pytest- All endpoints return clear error messages and HTTP status codes.
- Errors are logged using Python's
loggingmodule. - See code for details on exception handling in each service and endpoint.
All dependencies are listed in requirements.txt. Make sure to install them before running the app.
app/- Main application codeapp/ml/- ML models (GNN, embeddings, seegnn_model.pyfor the GNN implementation)app/recommendation_engine.py- Recommendation engine using GNN and other ML techniquesapp/services.py- Data and recommendation servicesapp/external_api.py- External API integrationapp/seed_data.py- Script to seed the database with example datatests/- Test casesalembic/- Database migrations
- Complete GitHub repository
- Postman collection (
video-recommendation-api.postman_collection.json) - Documentation in
docs/ - Video demo (see original instructions)
- All APIs are functional
- Database migrations work correctly
- README is complete and clear
- Postman collection is included
- Code is well-documented
- Implementation handles edge cases
- Proper error handling is implemented
- Diverse example data is seeded
For any issues, please check the logs or open an issue on GitHub.