Not quite repeating calendar events

I have sleep apnea, and to reduce the hundreds of brief times that I would otherwise stop breathing every night, I use a CPAP machine to keep my air passages open while I sleep. There are certain parts of the machine that need to be rinsed daily, some that need to be rinsed weekly, and some that need to be replaced either every month (kind of) or every six months (kind of).

The daily schedule is easy to maintain; I take them into the bathroom with me when I wake up and rinse them out. The weekly schedule is easy, too. I do those parts every Sunday and have never had any trouble remembering. It’s the less frequent maintenance that I need help with, partly because the interval between actions is longer but mostly because of the “kind of” aspect to their schedule.

The “kind of” comes from how the replacement parts get to me. The supplier is coordinated with my doctor and insurance company to regularly get me the replacement parts I need. About four times a year, I get an automated call that asks me how I’m doing (fine) and whether I want all of the replacement parts I’m due (of course). About a week later the parts show up: three sets of filters and masks that get replaced approximately monthly, one hose that gets replaced approximately quarterly, and, with every other delivery, another hose and a reservoir that get replaced approximately biannually.

I was originally told the replacements would be done monthly, quarterly, and biannually, but I learned after the first year (which had some scheduling hiccups because the supplier didn’t have me properly entered in their database) that the deliveries were more like every 15 weeks and that I should replace the mask and filter every 5 weeks. I find a 5-week schedule hard to track without help, so I set up a recurring event in Calendar to remind me to replace whatever needs replacing on Sundays spaced 5 weeks apart.

That worked reasonably well, but unfortunately the deliveries aren’t consistent. Too often I find myself with an alert to change the filter and mask before a new set of filters and masks had arrived. Waiting a few extra days to do the replacement doesn’t bother me, but having to reset my recurring calendar event does. Yesterday, after another late delivery of supplies showed up at my door, I built a shortcut to create all the calendar events for the 15 (or so) week period between deliveries.

Here it is:

1 CPAP calendar Step 01 Use the current date as the default starting date, but let me choose another in case I run this a day or two later. The magic variable result is renamed to “First set.”
2 CPAP calendar Step 02 Create the calendar event for when the delivery came. I’ve shown this one in expanded view so you can see that it’s an all-day event in my home calendar. The others are the same except that I’ve added alerts to them. This one doesn’t need an alert because presumably I’ve already replaced the parts when I run the shortcut.
3 CPAP calendar Step 03 Calculate when I’ll need to replace the filter and mask. Rename this magic variable “Second set.”
4 CPAP calendar Step 04 Create a calendar event for replacing the filter and mask with the second set that came in the delivery.
5 CPAP calendar Step 05 Calculate when I’ll next need to replace the filter and mask. Rename this magic variable “Third set.”
6 CPAP calendar Step 06 Create a calendar event for replacing the filter and mask with the third and final set that came in the delivery.
7 CPAP calendar Step 07 Calculate when the next delivery should come. Rename this magic variable “Next delivery.”
8 CPAP calendar Step 08 Create a calendar event for the next delivery.

The idea is to run this shortcut on the day a delivery arrives and I make whatever replacements go with that delivery. It creates four calendar entries:

Whenever the next delivery comes, I’ll run the shortcut again, and the schedule for the next 15 weeks will be set. No need to dig into Calendar to delete or reset recurring events.