AQI Tracking Over Time with Shortcuts, Data Jar, and Charty

I live in an area that was recently the most polluted city in the world, thanks to fires on all sides of us. Although I have the ability to glance at the AQI (Air Quality Index) widget on my Apple Watch and see the AQI instantly at any time, I also wanted to track AQI over time. To do so, I created a shortcut that uses Data Jar to store samples into periodically throughout the day, and to use the last 45 samples to generate a chart using Charty for Shortcuts actions which can then be displayed in an iOS widget stack using a Charty Widget.

The shortcut itself is quite simple. It gets the weather for the current location, and from that, the current AQI value. It then stores that value in Data Jar in a table called AQI with the current date and time (down to the second) as the key. It then grabs the key value pairs from the Data Jar AQI table and creates a chart using Charty shortcuts actions with the last 45 values.

AQI shortcut

I have this shortcut scheduled as a personal automation set to run several times daily. Because Shortcuts personal time of day automations can only be scheduled to run at one specific time per day at most, I had to create several automations to collect samples throughout the day and night.

AQI values saved in Data Jar

Where Charty comes in is in (obviously) creating the charts, but also in the Charty widgets I display on my Home Screen.

AQI chart with last values overlay

AQI Chart in Charty

Unfortunately my job consumed my life most of the time the sky was on fire, so this shortcut is a little late in terms of universal relevance, but here it is anyway.

For more on Charty, you can watch a video of a livestream session Matthew Cassinelli did with the creator of Charty, Rodrigo Araujo.