Skip to content

Latest commit

Β 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


Python CSV Logging Scale Status


Typing SVG


A robust, Python-based auditing engine designed to process large-scale CSV transaction data β€” implementing dynamic column detection and professional error logging.


πŸ“Œ Table of Contents


🎬 Demo

Demo Platform Watch
πŸŽ₯ Live Demo Video Repo (mp4) β–Ά Watch in Repo
πŸ’Ό LinkedIn Demo LinkedIn β–Ά Watch on LinkedIn

πŸ”· Overview

Universal Data Auditor is a professional Python tool that moves away from hardcoded scripts by implementing dynamic column detection and production-grade error logging for large-scale CSV transaction data.

πŸ“„ CSV File β†’ πŸ” Dynamic Column Detection β†’ βœ… Validate β†’ πŸ“‹ Log Errors β†’ πŸ“Š Summary Report

No manual code changes needed for different file structures β€” the auditor adapts automatically.


⭐ Core Features

Feature Description
πŸ” Dynamic Column Detection Automatically identifies file structure from the header. Adapts to any number of columns without manual code changes.
βœ… Business Logic Validation Implements strict data integrity rules. Transactions with zero or negative values are caught using custom ValueError raises.
πŸ“‹ Production-Grade Logging All anomalies, missing columns, and validation failures recorded in production_audit.log for post-audit analysis.
🧩 Modular Architecture Built as a standalone function β€” easy to integrate into larger automation workflows or CI/CD pipelines.

πŸ”§ Technical Implementation

1. Data Integrity

The script uses a try-except block to ensure the entire process doesn't crash due to a single corrupted row. By using if amount <= 0: raise ValueError, the system separates standard data-type errors from specific business-rule violations.

try:
    if amount <= 0:
        raise ValueError(f"Invalid amount: {amount}")
except ValueError as e:
    logging.warning(f"Row {row_num} skipped β€” {e}")

2. Efficiency

The auditor reads files line-by-line using enumerate(file), ensuring low memory consumption even when processing files with 10,000+ rows.

with open(file_path, 'r') as file:
    for row_num, line in enumerate(file):
        # Process one row at a time β€” no full file load

βš™οΈ How It Works

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              UNIVERSAL DATA AUDITOR β€” PIPELINE                  β”‚
β”‚                                                                  β”‚
β”‚  πŸ“„ CSV File Input                                              β”‚
β”‚         β”‚                                                        β”‚
β”‚         β–Ό                                                        β”‚
β”‚  πŸ” Dynamic Column Detection                                    β”‚
β”‚    β€’ Read header row automatically                              β”‚
β”‚    β€’ Map columns β€” no hardcoding needed                         β”‚
β”‚         β”‚                                                        β”‚
β”‚         β–Ό                                                        β”‚
β”‚  πŸ”„ Row-by-Row Processing (enumerate)                           β”‚
β”‚    β€’ Low memory β€” reads line by line                            β”‚
β”‚    β€’ Handles 10,000+ rows efficiently                           β”‚
β”‚         β”‚                                                        β”‚
β”‚         β–Ό                                                        β”‚
β”‚  βœ… Business Logic Validation                                   β”‚
β”‚    β”œβ”€β”€ Amount ≀ 0 β†’ raise ValueError β†’ Log & Skip              β”‚
β”‚    β”œβ”€β”€ Missing column β†’ Log warning β†’ Continue                 β”‚
β”‚    └── Corrupted row β†’ try-except catches β†’ Log & Skip         β”‚
β”‚         β”‚                                                        β”‚
β”‚         β–Ό                                                        β”‚
β”‚  πŸ“‹ production_audit.log β€” Full Error Record                    β”‚
β”‚         β”‚                                                        β”‚
β”‚         β–Ό                                                        β”‚
β”‚  πŸ“Š Console Summary Report                                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ’‘ Use Cases

Use Case How It Helps
🏒 Business Transaction Auditing Validate thousands of daily transactions automatically
πŸ“Š Data Quality Checks Catch corrupted, missing, or invalid rows before they cause problems
πŸ”„ CI/CD Data Pipeline Validation Integrate as a modular function in automated pipelines
πŸ“‹ Compliance & Reporting Generate production-grade audit logs for regulatory needs
πŸ” CSV Data Cleaning Pre-process large datasets before analysis or import

πŸ“‚ Project Structure

universal-data-auditor/
β”‚
β”œβ”€β”€ main.py                        # Primary auditing engine β€” dynamic logic & validation rules
β”œβ”€β”€ audit.log                      # System-generated log β€” tracks all data discrepancies
β”œβ”€β”€ company_big_data.csv           # Sample large-scale CSV dataset for testing
β”œβ”€β”€ 2026-03-25 20-59-39.mp4       # Live demo video
└── README.md                      # Project documentation
File Description
main.py The primary auditing engine containing the dynamic logic and validation rules
audit.log Example of the system-generated log file tracking data discrepancies
company_big_data.csv Sample CSV dataset with large-scale transaction data

πŸš€ How to Use

Prerequisites

  • βœ… Python 3.11+
  • βœ… No external libraries required β€” uses Python standard library only

Steps

# 1. Clone this repository
git clone https://github.com/muhammadantor/universal-data-auditor

# 2. Navigate into the project
cd universal-data-auditor

# 3. Generate sample data
python data_creator.py

# 4. Run the auditor
python main.py

# 5. Review results
# β†’ Console: summary report
# β†’ audit.log: full breakdown of skipped or failed rows

πŸ—ΊοΈ Future Roadmap

  • Add support for Excel (.xlsx) and JSON formats
  • Integrate automated PDF report generation for audit summaries
  • Add a CLI (Command Line Interface) for easier file path input

πŸ‘€ Author

Muhammad Antor

AI Automation Engineer | AutomateIQ Labs ⚑

Building scalable AI & automation solutions

LinkedIn Facebook Email GitHub


⭐ If this project helped you, please give it a star!

Built with ❀️ using Python · CSV Processing · Production-Grade Logging

About

A professional Python-based auditing engine with dynamic column detection and automated error logging for large-scale CSV transaction data. Built for scalability and data integrity by AutomateIQ Labs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages