From: Priyanka Rao, purchasing manager at Juniper Lane
Re: The Monday supplier feed
Cobalt Home sends us a stock and price file every Monday, and every week it has the same problems: column names with stray spaces, SKUs typed in different ways, prices with dollar signs and commas or written as N/A, the same SKU listed twice with different dates, negative stock, and the odd category we have never heard of.
I don't want a one-off fix. I want a pipeline we can run every Monday: a few functions that clean the file, and a checks table that says how many rows broke each rule, so I know what to chase the supplier about.
Week 1 is vendor_feed.csv, week 2 is vendor_feed_week2.csv, and our category list is vendor_categories.csv.
Code you'll run again belongs in functions. You'll write three small cleaning functions, chain them with pipe, write a checks function that returns one count per rule, and prove it all works by running it on a second file without changing a line.
Each function takes a table and returns a new one, so the steps can be tested one at a time and chained in any script.