A map reduce script would work really well in your use case @brett.wilson with the getInputData phase looking for current top-selling items, the map phase eliminating results that have combined available inventory above your threshold, and your summary phase creating a PDF report and sending any emails.