Stream, sanitize, and schema-validate messy CSV files
Project description
Enterprise CSV Sanitizer & Schema Validator
A production-grade command-line interface (CLI) data engineering utility built to stream, scrub, and validate high-volume unstructured enterprise sheets and application logs cleanly without memory leaks or unhandled script execution crashes.
🎯 Core Project Overview (STAR Metrics)
-
Situation: Helpdesk systems and standard application roles regularly deal with corrupted data pipelines, downstream import rejections, and crashing analytics engines due to malformed, unescaped, and corrupt manual CSV exports from legacy corporate platforms.
-
Task: Build a resilient, automated command-line sanitation workflow capable of operating completely isolated from system-level environment risks. It must stream arbitrary file volumes, standardize dynamic mixed date formats, isolate corrupt multi-column breaks, and strip invisible anomalies without processing loop disruptions.
-
Action: Implemented a strict modular Python streaming engine. Wrapped processing iterations within isolated
try-exceptdata boundaries, enforcedpython-dotenvmasking configurations to eliminate raw environment path leaks, integratedpython-dateutilfor automated timeline parsing, and diverted structural edge cases into isolated fault logs. -
Result: Achieved 100% crash-resilient streaming loops over highly asymmetric rows. Converts messy runtime string configurations into clean ISO 8601 formatting, intercepts operating system level directory faults safely, and scales gracefully across large data sheets with a flat horizontal memory allocation signature.
⚙️ Environment Setup & Installation
- Initialize the Virtual Workspace Isolate the project dependency layout from your global system environment:
python -m venv .venv
.\.venv\Scripts\Activate.ps1
-
Dependency Ingestion Install the concrete engine components into your active virtual bubble: python -m pip install python-dotenv python-dateutil pytest
-
Environment Context Create an .env file in the root workspace directory to configure engine file streams dynamically: TARGET_INPUT_DIR=./data/Input CLEAN_OUTPUT_DIR=./data/Output ERROR_LOG_PATH=./data/Output/malformed_rows.log
🚀 Execution & Verification Pipelines Core Pipeline Execution To ingest, sanitize, and execute the core cleaning loops against your raw data targets: python .\Src\main.py
Test Suite Validation Execute full system assertion validations via the explicit Python module path layer: python -m pytest -v
📊 Pipeline Architecture The following data flow map demonstrates how data transitions through our validation layers cleanly:
graph TD
%% Base Color Layout Schemes
classDef input fill:#0d47a1,stroke:#1565c0,stroke-width:2px,color:#ffffff;
classDef process fill:#1e293b,stroke:#3b82f6,stroke-width:2px,color:#f8fafc;
classDef decision fill:#311b92,stroke:#673ab7,stroke-width:2px,color:#ffffff;
classDef success fill:#1b5e20,stroke:#2e7d32,stroke-width:2px,color:#ffffff;
classDef failure fill:#b71c1c,stroke:#c62828,stroke-width:2px,color:#ffffff;
%% Data Pipeline Node Tree Map
A([📥 Raw Dirty CSV Input Target]) --> B[⚙️ Load Environment Config via python-dotenv]
B --> C{🔍 Is Directory Valid?}
C -- Path Fault --> D[❌ Abort Loop & Log Configuration Fault]
C -- Valid Path --> E[🔄 Stream Row-by-Row Active Iterator]
E --> F{📐 Check Column Schema Dimensions}
F -- Size Mismatch --> G[⚠️ Route Malformed Row to Fault Log]
F -- Uniform Schema --> H[🪥 Clean Whitespace & Strip Hidden Bytes]
H --> I[📅 Standardize Mixed Timestamps to ISO 8601]
I --> J[📤 Commit Sanitized Payload to Stream Buffer]
J --> K([✨ Complete Production CSV File Pipeline])
%% Dynamic Class Injections
class A input;
class C,F decision;
class B,E,H,I,J process;
class D,G failure;
class K success;
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csv_sanitizer_schema_validator-0.1.0.tar.gz.
File metadata
- Download URL: csv_sanitizer_schema_validator-0.1.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fadee345bb1cf95269cf67d7a841c6feee149ae47f544840d47a9b37c10740de
|
|
| MD5 |
ad284e3ee231a06f171770d2e3bd8dbe
|
|
| BLAKE2b-256 |
c52bf4fe9defc1329f39f75daceb6ebb75f92a93d79132e7553931f10b3d46ef
|
File details
Details for the file csv_sanitizer_schema_validator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: csv_sanitizer_schema_validator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cf4411cff5c0df84a5885f072f54617b6404544597047004e6383544ab36ae7
|
|
| MD5 |
faf491dce889690df9da100d810d6ec9
|
|
| BLAKE2b-256 |
9ba8e77c354f76139947ca90f84ec59cdb589e4581f11618c0c5c68571f54e26
|