Meal plan organization with Pythonista, Things & a bit of Shortcuts

Hi all,

I have build an automation I am proud of, but my when I tell my spouse about it, she‘s happy because I am happy… I need to tell you folks, because you can appreciate (at least I hope so).

The situation:
In our kindergarten we take turns to cook. Each weekday has assigned a main ingredient (like pasta, rice, potatoes, …) so that the kids don’t get the same the whole week.

Problem 1:
When I get the dates, I want to generate the calendar entry and all the tasks in my task manager (Things).

Problem 2:
Somebody has to assign every family its turns, i.e. make the plan, which is a table in a pdf mailed to everyone. This needs to take into account a standard rotation plus additional modifications (some people have reduced cooking duties because of extra work they did, holidays, …).
In the old days, people sat down with an excel sheet, and probably also additionally pen and paper to work out the next plan. Not anymore!

My solution:
The trick here is to combine both problems, because whoever generates the plan, has the data in their desired format :sunglasses:
My preferred tool for automation is Pythonista :snake:

  1. I have stored or entered the rotation, holidays and other deviations in a json file (json-data). I generate the next plan from the json file and then save it again as a text file (json-plan). I also generate the json-data for next time.
  2. From the json-plan I generate a pdf (using reportlab). I also generate the email subject and body, using the json-data to inform about the deviations of the plan. I could somehow send the emails via python, but I like it simple, so I base 64 encode the pdf and call shortcuts to compose the email. This concludes sending the plan to the other parents :email:
  3. Now I need to get our cooking duties into my system. Because I have all the cooking duties conveniently as json-plan, I run another Pythonista script, that adds our cooking duties to our shared calendar and adds a project for each cooking duty in Things, of course with the main ingredient in the „look for recipe“ task. The good part here is that I have once thought when I want to be reminded of what task depending on the weekday of the cooking duty, and will never do it again. I am (at least in this respect) a widget cranking machine :robot:
  4. The same script also adds a project to Things that walks me through the process the next time. I am especially fond of the mailto-link in the task to remind me to ask the other parents to send me the extra work they have done in the last period. Just tapping a link in a task that opens a completely prepopulated mail is awesome and works basically from everywhere!

I really like the whole workflow. I tried it in shortcuts, but this was very quickly quite unreadable (at least on my phone). In Pythonista it remains somewhat readable (even though my program „architecture“ is quite a mess).
I am not sure that I will break even w.r.t. the time it took me to build this. But now it takes a few button taps and almost no brain power.

Another good thing about this workflow is that it runs completely on my phone. So I can run this on the bus or at home (where I use my computer only rarely).

Thanks for listening
Nils