This script creates a custom iOS widget using Scriptable showing COVID-19 stats for a specific health region, province and all of Canada.
The small widget shows new cases for a specific health region, province and all of Canada. The medium widget shows new cases, active cases and tests taken that day for a specific health region, province and all of Canada.
A trend indicator shows today's new cases in comparison to last week's new cases.
The region can be set through the widget parameter or through constants in the code by either providing a health region code or a the two-letter province code.
The data is taken unaltered from the COVID-19 Canada Open Data Working Group – only the trend indicator is added. The data is cached for when device is offline.
The widgets support dark mode and the appearance can be configured in the code. By default the appearance of the widgets change with the appearance of the device.
- Download Scriptable from the App Store.
- Copy the code from covid19-widget-canada.js.
- Open Scriptable and add a new script.
- Edit the name of the script, paste the code and tap 'Done'.
- Go to your home screen and add a new Scriptable widget.
- Select this script and enter the health region code (e.g. '4601') or the two-letter province code (e.g. 'MB') in 'Parameter'.
The respective health region code can be found at https://opencovid.ca/api/#health-region-codes.
- Detect health region code automatically
- Deal with missing reports on weekends
- Cache data for when offline
- Show test positivity rate
- Utilize medium widget
- Utilize large widget
- CCODWG for the data and the API
- @rphl for the inspiration with corona-widget
- @kevinjalbert for the ground-breaking work on his script