Skip to content

About

Self-hosted idempotent Python ETL and alerting pipeline with strict Decimal parsing, SQLite WAL deduplication, quarantine CSVs, and Docker

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Python Ops Automation Pipeline

Language: English · Español (README.es.md)

CI License: MIT

Zero-dependency Python ETL and alerting pipeline designed as a self-hosted alternative to fragile Zapier/Make chains for messy operational CSV feeds. Runs with Python's standard library (sqlite3, decimal, csv, urllib) on any small Linux VPS or Docker container.


What It Does

  • Idempotent SQLite WAL ledger: Computes a SHA-256 fingerprint (external_id + normalized fields) per row so re-processing the same export inserts zero duplicates.
  • Strict Decimal monetary parser: Normalizes mixed US ($1,250.50) and LATAM/EU (1.250,50) strings, rejects negative/zero/garbage values, and never uses float.
  • Quarantine instead of crashing the batch: Malformed rows (missing IDs, invalid dates, bad amounts) are routed to quarantine.csv with the exact error reason while valid rows continue processing.
  • Clean exports + retryable webhook alerts: Emits clean_records.csv, summary.json, and an optional JSON webhook digest with exponential backoff retries.

Data Flow

Messy CSV Feed
      │
      ▼
Parser & Decimal Guard ──▶ Invalid rows ──▶ quarantine.csv (with error reason)
      │ Valid rows
      ▼
SQLite WAL Ledger ───────▶ Seen SHA-256 ──▶ Skipped (0 duplicates)
      │ New records
      ▼
Export & Digest ─────────▶ clean_records.csv + summary.json + Webhook Alert

Quick Start

# 1. Run against messy sample data (add --webhook-url https://... for JSON alerts)
PYTHONPATH=src python -m ops_pipeline.cli \
  --input examples/sample_orders_messy.csv \
  --out-dir ./output \
  --db ./output/state.db

# 2. Re-run the exact same file to verify idempotency (0 new inserts)
PYTHONPATH=src python -m ops_pipeline.cli \
  --input examples/sample_orders_messy.csv \
  --out-dir ./output \
  --db ./output/state.db

# 3. Run the automated test suite (stdlib unittest, zero external deps)
PYTHONPATH=src python -m unittest discover -s tests -v

Sample Terminal Output

# First run
[OpsPipeline] Run complete for 'sample_orders_messy.csv'
- Total rows read: 9
- New records ingested: 4
- Duplicates skipped: 1
- Quarantined rows: 4
- New volume: 1480.75 EUR, 1640.50 USD, 825.25 USDT

# Second run on the same file (idempotent)
[OpsPipeline] Run complete for 'sample_orders_messy.csv'
- Total rows read: 9
- New records ingested: 0
- Duplicates skipped: 5
- Quarantined rows: 4
- New volume: 0.00

Docker

docker build -t ops-automation-pipeline .
docker run --rm -v "$(pwd)/output:/app/output" ops-automation-pipeline

Author & License

Built by Víctor Yohan Betancourt Marín — quanticosystems.com.
Released under the MIT License.

About

Self-hosted idempotent Python ETL and alerting pipeline with strict Decimal parsing, SQLite WAL deduplication, quarantine CSVs, and Docker

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages