Create Meds Shortcut Using Dictionaries & Data Jar?


I’m hoping for some guidance on building my shortcut.

I’m putting together a shortcut to log my meds.

I have it split into “Morning”, “As Needed” & “Bedtime”

I have already created a Choose from Menu shortcut that uses the app Hello Meds, and its shortcuts integration to log the meds at these three points in the day and then opens the Health app, so I can log it there too. Currently, there doesn’t seem to be a x-callback url to the medication app in the iOS beta 16.

This all works great and I even use NFC tags representing these three times to fire the shortcuts.

I’d like though to incorporate the Dictionary and Data Jar to capture this data and log it.

This would be a separate shortcut from the other.

I’ve tried playing around creating a dictionary of all the meds and a menu, that when chosen would log the meds taken under that time.

However, it just seems to bring back all date capture data from all meds, and doesn’t grab just the log data, for say, “Morning” meds.

I’m not sure what the best solution is between the shortcuts dictionaries and Data Jar to achieve this.

Thanks, in advance, for any help you can provide.



First and foremost:

Really really cool !

If I understand correctly you already have a dictionary in place which contains all entries? How do you identify the Morning / As Needed / Bedtime categories?
One option is to loop over all entries and only add into to a temporary dictionary those which have the right category and show the resulting list at the end. I’d maybe also put a start and end date as filter because over time the loop would be bigger and bigger to work with.

If I were in that situation I would split the data in three different “Dictionary” entries in Data Jar, Morning / As Needed / Bedtime and build from there. The key type would be String (a text representation of today, preferably formatted 2022-08-12 for easier sorting if need be) and the value would be the med.

How would you like to see the output actually?


I’ve created dictionaries, but having difficulty getting the needed data back.
At first I created a dictionary listing each med with a text key with the date/time values.
I then created the choose from list with the times, but when I ran it and chose, for example, “morning,” it would bring back all the meds with their timestamp. I can figure out how to filter for just the needed menu choice.
I also tried setting up a dictionary using the times with the medications under an array/text/date, but again it just brings back all med data.
I’d like to just have a database of my meds, whether in Shortcuts or Data Jar, that has not only date taken, but other info like date first prescribed, dosage and side effects.
Then when when running the shortcut, it logs the date/time taken.
I just can’t figure out the best path, or if it’s even possible.
Pull data from Data Jar and log or pull data from a dictionary(s) in shortcuts and save back to Data Jar.
Thanks, for your help. I hope I’ve explained the needs/issues clearly enough. :wink:

And to answer your question on output, I would like for it to show the last medication(s) logged when run. I was also thinking of adding a menu item that would show me the last medication logged, in case I can remember when I took my last dose.

Hi, I kind of forgot to follow-up in this topic :face_with_hand_over_mouth:

Would it be possible to send me your current Shortcut responsible for viewing your data and the content of Data Jar? (You may anonymize your meds’ names if you prefer of course!)

I suspect that we would need to first convert your data in a new structure so it’s cleaner to browse and export. I need to know first what your export exactly would look like to build the best database for it (having nested dictionaries crossed my mind, for example).

I also see two dimensions in the information: Different meds, and different times (“Morning”, “As Needed” & “Bedtime”), which one matters? This can greatly influence the way the data should be saved.

So, when you say “last medication logged” would it mean a list of date/times (ordered chronologically) with the med name next to it? Or it instead 3 lists (“Morning”, “As Needed” & “Bedtime”) with each their own list of taken meds in chronological order? Or something entirely different? What’s on your mind? :slight_smile:

Hey Sebastian-Did you receive my reply?

I did! My apologies. I regularly stare at your message, then tell myself “gosh I really should answer that”, then get interrupted by Life (work, my 2 toddlers, or sleep by exhaustion).

Now is the right time to answer to your message :slight_smile:

Totally understand! I have twins, though now 18, and starting college.
No rush, you have your hands full!