A small, deterministic data pipeline that simulates TV tuning events and turns them into daily Rating% and Share% metrics, using a Medallion architecture (Bronze → Silver → Gold) on top of DuckDB and AWS S3, orchestrated entirely by GitHub Actions.
Built as a proof of concept for simple, idempotent, reproducible data engineering — no warehouse, no cluster, no long-lived AWS credentials.
flowchart LR
subgraph Generate
G["🎲 generator.events\nsimulated tuning events"]
end
subgraph Bronze
B["🥉 bronze.ingest\nvalidate & normalize"]
end
subgraph Silver
S["🥈 silver.clean\ndedupe & clean"]
end
subgraph Gold
Gd["🥇 gold.metrics\nRating% / Share%"]
end
G -->|raw/fecha=.../| B -->|bronze/fecha=.../| S -->|silver/fecha=.../| Gd -->|gold/fecha=.../| Out["📊 audience metrics"]
style G fill:#8b8b8b20,stroke:#8b8b8b
style B fill:#cd7f3220,stroke:#cd7f32
style S fill:#c0c0c020,stroke:#a8a8a8
style Gd fill:#ffd70020,stroke:#d4af37
Each stage reads only from the previous one, writes to its own S3 prefix, and is safe to re-run: same input → byte-identical output (see determinism & idempotency).
Requirements: Python 3.12.
pip install -e ".[dev]"Run the unit tests — no AWS involved, everything runs against local temp files:
pytest tests/unit -vRunning plain pytest also collects tests/integration/, but those
auto-skip locally unless BUCKET_NAME and AWS_REGION are set — see
tests/integration/README.md.
Try the reproducible event generator on its own:
python -m src.generator.events --seed 42 --date 2026-08-01 --out /tmp/eventosThe pipeline only ever runs in GitHub Actions against a real S3 bucket, authenticated via OIDC — never with local long-lived AWS keys (constitution Principle VII). One-time setup:
- Run
infra/bootstrap.shonce against your AWS account (see the script header for required environment variables) to create the OIDC provider, IAM role, and S3 bucket. - Configure the repo's
ROLE_ARNsecret andBUCKET_NAME/AWS_REGIONvariables in GitHub with the valuesbootstrap.shprints. - Trigger
.github/workflows/pipeline.ymlviaworkflow_dispatch, or let the dailyscheduletrigger run it.
Full walkthrough: specs/001-audience-metrics-poc/quickstart.md.
| Resource | What's in it |
|---|---|
docs/analisis-diseno.md |
Análisis y diseño (ES) — contexto, requisitos, historias de usuario, decisiones clave |
docs/manual-usuario.md |
Manual de usuario (ES) — cómo disparar corridas, consultar resultados, solucionar problemas |
DOCUMENTATION.md |
Consolidated technical reference — architecture, data model, module reference, security, CI/CD |
specs/001-audience-metrics-poc/ |
Full spec, plan, and design docs |
specs/001-audience-metrics-poc/quickstart.md |
End-to-end validation guide (local + real AWS) |
tests/integration/README.md |
How integration tests exercise real S3 |