# Weekly Summary Streaming CEA

This project generates and sends weekly streaming summary reports for CEA countries.
It collects streaming data, processes it, and emails formatted reports (with Excel attachments) to a mailing list for each country.

## Features

- Fetches weekly streaming data for multiple clients and partners.
- Generates summary tables and metrics for each country.
- Creates Excel attachments with top tracks, projects, and artists.
- Renders HTML email reports using Jinja2 templates.
- Sends emails with attachments to country-specific mailing lists.
- Logging and error handling included.

## Countries Currently Included

- Greece 🇬🇷
- Turkey 🇹🇷
- France 🇫🇷

## Quick Start

1. **Requirements & Dependencies** 
   - Python 3.11+
   - Use the provided `pyproject.toml` to set up your environment.

2. **Configure environment**  
   - Set the `LOGDIR` environment variable to specify where logs are stored.
   - Ensure access to the required table for mailing lists: prod_eu_analytics.weeklystreamreport_distro 

3. **Run the main script**
   ```
   python src/main.py
   ```
   or  
   with arguments if you want to control mail sending and writing the html to a file  
   1st argument is to send or not emails  
   2nd argument is to write the html to a file in the tmp folder  
   ```
   python src/main.py [s|send|y|yes or n|no] [w|write|y|yes]
   ```

4. **Output**  
   - Emails are sent to the configured recipients.
   - Excel files and HTML previews are saved in the `tmp/` directory.

## File Structure

- `src/main.py` — Main orchestration script.
- `src/config.py` — Configuration for clients, partners, countries, and email parameters.
- `src/content.py` — HTML and Excel files generation.
- `src/data.py` — Data access and transformation.
- `html/` — Jinja2 HTML templates.
- `tmp/` — Temporary output files (Excel, HTML).


