python Data Science 3 files • 27 lines

Python Data Analytics & ETL Pipeline

Structured data ingestion, cleaning, KPI aggregation, and JSON report export pipeline in pure Python.

Repository Files:
pipeline.py (python) 19 lines
"""Data Cleaning & Aggregation Pipeline."""
import json
from statistics import mean


def summarize_records(records: list[dict]) -> dict:
    valid = [r for r in records if isinstance(r.get("score"), (int, float))]
    scores = [r["score"] for r in valid]
    return {
        "total_records": len(records),
        "valid_records": len(valid),
        "average_score": round(mean(scores), 2) if scores else 0.0,
        "max_score": max(scores) if scores else 0.0,
    }


if __name__ == "__main__":
    sample = [{"id": 1, "score": 92.5}, {"id": 2, "score": 88.0}, {"id": 3, "score": 95.0}]
    print(json.dumps(summarize_records(sample), indent=2))
config.json (json) 5 lines
{
  "pipeline_name": "daily_kpi_rollup",
  "batch_size": 500,
  "strict_validation": true
}
README.md (markdown) 3 lines
# Python Data Analytics & ETL Pipeline

Structured data processing pipeline with configurable batching in `config.json`.

How to Customize Inside WorkMA

Runtime: Python 3.12 + WorkMA Code Runner / Virtualenv

  1. Open the template directly inside WorkMA Code Nexus or fork it inside your workspace gallery.
  2. Configure any API tokens in the project's Encrypted Secrets Vault.
  3. Edit code in the browser Monaco editor with real-time file locking and 3-way merge safety.
  4. Sync upstream to GitHub with Sentinel regex + AI PR checks enabled.

DLP & Secrets Vault Readiness

All database URIs, JWT secrets, and third-party API keys should live inside WorkMA Encrypted Secrets Vault and inject strictly at runtime rather than committing plaintext .env configs.

More Code Nexus Starter Templates