# Python Sample: File Validation Pipeline ```python from pathlib import Path import pandas as pd INPUT_DIR = Path("/data/inbound") QUARANTINE_DIR = Path("/data/quarantine") REQUIRED_COLUMNS = {"member_id", "service_date", "amount"} def validate_file(csv_path: Path) -> tuple[bool, str]: frame = pd.read_csv(csv_path) missing = REQUIRED_COLUMNS - set(frame.columns.str.lower()) if missing: return False, f"Missing required columns: {sorted(missing)}" if frame["amount"].isna().any(): return False, "Amount column contains null values" return True, "Validation passed" for file_path in INPUT_DIR.glob("*.csv"): is_valid, message = validate_file(file_path) print(f"{file_path.name}: {message}") if not is_valid: target = QUARANTINE_DIR / file_path.name file_path.replace(target) ``` Use this pattern to: - Validate schema before ETL load. - Route failed files to quarantine. - Produce lightweight validation logs.