Mark Mintoff My superpower is common sense

11Jul/112

Using Programming for Groceries

This is not something which fits in with the general theme of my blog, but it does involve programming. One of the things which I find irritating, wasteful and unnecessarily time consuming, is grocery shopping. If you want a lean grocery list with little waste, you need to spend time writing a list. If you don't have the time to write a list, you end up impulse buying and then eventually throwing out something when it starts going bad.

I decided that a little bit of programming would resolve this issue. What I resolved to do is type up an XML file with meals and the ingredients required of that meal. For example:

I then used XPath to walk over the XML file, creating a collection of objects. Then X (user-defined) meals are selected at random. The ingredients of each meal are collected together (aggregating the amounts for equivalently named ingredients) and a shopping list is generated. The costs of the ingredients are also aggregated to produce an estimate of the cost of your shopping trip.

My plans for this small application are to also add items which are recurring buys such as coffee, sugar, soap..etc. I am at this stage unsure of how to go about with this. Do I simply tack it onto every shopping list and then check my supplies? I think the best way would be to integrate this with an inventory-style system so that your list would be checked against your stock levels, effectively filtering out the items you already have from your final shopping list. I just wonder on the practicality of keeping an inventory system in a small household.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
Comments (2) Trackbacks (0)
  1. I’ve had this problem for a while. I also thought of doing some little program for it but as you mentioned at the end, I thought it wasn’t really practical for a small household.

    I found it easier to just have a list of items on my phone and whenever I run out of something I add it to it.

    • The point of the program I put together is two-fold:

      1. Randomize between a collection of meals, producing one unique meal per day.
      2. Generate the shopping list required for these meals

      So say you have around 25-30 distinct meals which you like (you can be as specific as you want; for example meat with roast vegetables is different than meat with salad). You randomize and are presented with a list of unique meals that you should make that week, hence taking away the decision process and also softly preventing you from resorting to junk food (pizza, burgers, noodles, any sort of takeout). The shopping list is a handy bonus on top of that concept, so keeping an excel sheet on my phone wouldn’t solve my particular problem.

      I’m giving serious thought towards the practicality of inventory management though. Additions to inventory would be from the program’s generated shopping list, but subtractions would be too tedious to manage on a consistent basis.


Leave a comment

No trackbacks yet.