Help Refining a Shortcut with Things Integration

question
shortcuts
#1

Hi everyone,

I was wondering if anyone had some free time on their hands and could show me how to clean up and simplify the Shortcut I attached?

I work for a day care and the Shortcut allows me to pick out the various meals, sides, snacks we will be having for the week based on the date I enter. It then populates Things with individual tasks for all the ingredients. Each task is set to a specific list (store) in Things. Each task (ingredient) is also tagged with the location in our kitchen as well as a “Check” tag. That way I can work my way through the kitchen checking our various ingredients and deleting ones that aren’t needed.

As it stands stands now, it is a very long and cumbersome list of IF statements. It works, but it certainly isn’t pretty and editing any changes isn’t enjoyable.

I still don’t quite grasp dictionaries yet even after reading various things online. So let me ask, is there a way to create dictionaries for all the ingredients including their correct lists, tags, and notes and then have some sort of Repeating task that fills in the Add to Things with variables based on information in the Dictionary? If you laugh at my question it probably just proves that I don’t understand how dictionaries work.

Or, if you have a completely different way to clean it up I’d love to hear it.

I’m pretty sure I got the Shortcut attached below. Thanks for any help.

Shopping Shortcut

0 Likes

#2

Having had a quick browse through the actions, dictionaries and loops definitely look like they could help simplify the shortcut.

Dictionaries are very much like their book basis. Think of them like a collection of variables. Each entry has a name (called a key) and a value. The value could be text, a number, a true/false, or even a list of items or another dictionary.

Imagine a dictionary of meals. Each meal has several attributes - e.g. a name and a list of ingredients and their quantities. Starting at the most detailed level, we could say that each ingredient might have the following attributes. An ingredient name and a quantity. We could also add a store, but let’s put that aside for a moment.

Ingredient

  • Name
  • Quantity

That’s two key-value pairs so we could make each one of these as a little dictionary.

A set of ingredients is probably reasonably described as a list, so maybe we could make a list of these dictionaries within a recipe? That lists maybe gets a key of “Ingredients”. Then we add another key-value pair for the name of the meal.

We can express dictionaries in something called JSON, don’t worry about the what’s and why’s, but let’s write down a very basic fruit salad recipe as an example so that you can perhaps get the gist of the structure.

{
    “Meal” : “Fruit Salad”,
    “Ingredients” : 
    [
        {
            “Name” : “Pear”,
            “Quantity” : 20
        },
        {
            “Name” : “Grapes”,
            “Quantity” : 200
        },
        {
            “Name” : “Mango”,
            “Quantity” : 10
        }
    ]
}

You could build a separate dictionary like this for each recipe, or have a list of recipes as a value list within another dictionary. Kind of getting a bit Inception isn’t it?

Now I didn’t include the store against the ingredients, but I certainly could have. If it is an ingredient that shows up more than once, it kind of makes sense to hold that data outside of the recipe in a different dictionary of ingredient information. The principles around this are identical to the ones use to develop efficient databases; but think of it as if you have to change stores for an ingredient, or you are doing costings and the cost of an ingredient changes, you only have to change it in one place, not in a dozen recipes.

The basic premise of building up the ingredients dictionary would be the same as for the recipes above.

But the point about databases does bring up a couple of related points.

  1. Could using Airtable be more beneficial here than using dictionaries? I feel it would certainly be easier to maintain and read, and they probably already offer a database structure that you could start with and link a Shortcuts shortcut into.
  2. For all the effort this will take, is there an integrated offer out there. I know the Paprika app has some options around pre-populating grocery lists for example. Even if something doesn’t integrate directly with Things, perhaps it would simplify things enough to make it worthwhile or to the point where it simplifies development of a shortcut to load it into place.

Unfortunately I don’t use Things so there’s a lot of functionality I can’t see in the shortcut - just offers to install the app to get the functionality. As a result I can’t really offer more than that.

End of the day with your shortcut is that if it is working, then maybe look at incrementally tweaking it, or more specifically, a duplicate of your original. It’s a big shortcut, so perhaps it is big enough to warrant an approach of trying to separate it out into smaller, distinct separate shortcuts that you chain together, and then work on streamlining each of the shortcuts.

E.g.

  • A shortcut to build/store/access your recipe information.
  • A shortcut that lets you select a recipe.
  • A shortcut that lets you review all of the selected meals.
  • A shortcut that stores an intermediate set of aggregated ingredient information.
    • e.g. Doesn’t store Apples = 5, Apples = 10, but rather just Apples = 15.
  • A shortcut that adds all of the ingredients for the selected recipes to the various store lists in Things.

Really sorry I can’t suggest anything further, but hopefully there’s some ideas there that might help you and others who do use Things build something you feel is the next evolution of what you currently have.

0 Likes