# Distro bug monitoring
This contains scripts to notify data issues, delays and discrepancies in the delivery system.

## Scripts

### Encoding Order Discrepancies Script
This script finds the discrepancies between art_relations.encoding_order_detail and direct_delivery.encoding_queue_detail and sends an alert message to a slack channel.

### Missing Encoding Order for Physical products
This script finds any missing or delayed encoding orders of physical products.

### Missing Encoding Order for Digital products
This script finds any missing or delayed encoding orders of digital products.

## Running

```
usage: app.py [-h] [--days DAYS] [--print PRINT] [--slack SLACK]

options:
  -h, --help     show this help message and exit
  --days DAYS    Number of days to look back (from today).
  --print PRINT  Print output to console.
  --slack SLACK  Send output to Slack. Requires SLACK_BOT_USER_OAUTH_TOKEN and
                 SLACK_CHANNEL_ID to be set in environment variables.
```

### Access requirements

- AWS shared account ECR (via awsume & docker)
- `vector` app family access for Secrets Manager secrets
- Snowflake access to run DISTRIBUTION.DEV.SP_EOCHECK stored procedure

### Run As Container

```sh
docker compose run --rm --build app --days=1
```

### Run Locally

```sh
# Install locally
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt

# Run script
python app.py --days=1
```
