How mahdiahmadi87/hodhod works
Based on our analysis, this project is a full-stack news aggregation and recommendation system. Its purpose is to collect, classify, and display news content tailored to users’ interests. The system involves several distinct components: a Django-powered web application, background crawler scripts, machine learning modules for news classification and prediction, and a database that holds news and user-related data.
Main Components
• Frontend (User Interface): Represented by the Django "newsapp" component, which includes the templates, static assets (CSS, JS, images, and APK for Android), and pages (index, login, signup, news display, etc.).
• Backend (Django Framework): The core backend is built using Django (with submodules like “account” for user management and “cookie_consent”), which handles business logic, routing, and rendering views.
• Crawlers: A set of Python scripts in the “crawlers” directory (e.g., crawler.py, updateLastNews.py, deleteAllNews.py) that fetch and update news data from external sources.
• Machine Learning Modules:
• Classification Module: Found in the “classification” directory that uses pre-trained models (LogisticRegression.pkl and vectorizer.pkl) and classification logic in main.py.
• Regressor Module: In the “newsSelection” directory, which appears to perform regression analysis or predictions (regressor.py) possibly for personalized news ranking or recommendation.
• Database: Although Django uses its ORM, the README provides instructions to create a SQLite database manually (with tables like News, Viewed, and Users). This database stores all news content, user actions (views and ratings), and user metadata.
• External Services/Downloads: Additional resources include an external Persian FastText model (required for classification) and an APK download for Android distribution.
Relationships and Interactions
• Integration with External Resources: Indicate that the ML modules depend on external models (such as the Persian FastText vectors) by drawing a dependency link from the “Classification Module” to “External ML Models.”
Architectural Patterns and Technologies
• Modular Architecture: Clearly demarcate the components (crawlers, ML modules, Django web app) indicating that each is self-contained but communicates through the database.
• MVC-like Pattern: The Django project uses a Model-View approach through apps like “newsapp” and “account.” Show how views render templates while models interact with the database.
• Python/Django Ecosystem: Note the use of Python scripts, Django framework, and machine learning components integrated in a single project.
• Separation of Concerns: Emphasize that news fetching (crawlers), data processing (classification/regression), and user presentation (Django frontend) are logically separated.