How khmuhtadin/metosheet works
Main components of the system
a. Application Core Modules:
• main.py: The primary entry point that handles Facebook Ads data fetching, processing, and synchronization with Google Sheets.
• billing.py: A separate module used specifically for processing and tracking billing transactions, including VAT calculations and invoice URL generation.
b. Configuration and Environment:
• .env and .env.example: Files that store critical credentials and configuration details for accessing the Facebook Marketing API and Google Sheets API.
• requirements.txt: Lists the Python dependencies required, indicating the libraries and frameworks (such as gspread for Google Sheets integration) that support the application.
c. External Services and APIs:
• Facebook Marketing API: The source of the Facebook Ads data including campaign metrics (impressions, spend, clicks, etc.).
• Google Sheets API: Destination where data gets synchronized on a daily basis.
d. Automation and CI/CD:
• GitHub Actions workflows (in .github/workflows folder): Automated daily synchronization (triggered at 08:00 GMT+7). This setup ensures the synchronization tasks are scheduled and can be triggered manually if needed.
e. Documentation:
• docs/ directory: Contains assets (like images) and additional documentation that supports understanding and maintaining the system.
Architectural patterns and design principles
• The project follows a modular design where separate scripts serve distinct responsibilities (data collection vs. billing processing).
• Clear decoupling between configuration (environment variables) and logic, improving maintainability and security.
• Use of automation (CI/CD via GitHub Actions) indicates a pattern for continuous integration and scheduled tasks, ensuring data is regularly updated.
Specific elements
• Clearly labeled components: “main.py”, “billing.py”, “Configuration (.env)”, “GitHub Actions Workflow”, “Facebook Marketing API”, “Google Sheets API”, and “Documentation”.
• Labels and brief descriptions where possible, such as “Automated Daily Sync” next to the GitHub Actions component.