Automating Insulin Ordering: A Journey Towards Convenience (Part 1)
Tags: programming, productivity, automation, processoptimisation
Published: 2024-06-04 08:18:56

Living with Type 1 diabetes comes with its own set of challenges, one of which is managing a regular supply of insulin. As someone who relies on this life-saving medication, I've often found myself entangled in a convoluted system just to get my prescription filled. This multi-part series will walk you through my journey of automating the insulin ordering process, saving time and reducing the hassle involved. In this first part, I'll outline the problem and set the stage for the solution we'll be building.

## The Problem
In my region, obtaining insulin isn't as straightforward as it might be elsewhere. Here’s a breakdown of the steps I currently need to take:

1. Contacting the GP: I have to get in touch with my General Practitioner (GP) to request a new prescription. This involves logging onto their website and sending a message asking them to upload the prescription to my healthcare insurance card.
2. Waiting for the Prescription: Once the GP uploads the prescription, I can then take my healthcare card to the pharmacy.
3. Pharmacy Visit: However, the pharmacy usually doesn’t have my specific insulin in stock. This means I have to go there, request the prescription to be filled, and wait for them to order it.
4. Second Pharmacy Visit: After they’ve ordered it, I have to return the next day to pick up my insulin.

This does not seem like too much hassle, but due to the local restrictions, I have to repeat this process every 2 weeks. 

## A Slight Improvement
To reduce the number of visits, I've started emailing the pharmacy in advance. I inform them of my prescription and ask them to pre-order the insulin. This way, I only need to visit the pharmacy once, to collect the prescription. While this is a step in the right direction, it still requires multiple manual steps:

- Requesting the prescription from my GP.
- Sending an email to the pharmacy to pre-order the insulin.
- Setting a reminder to pick up the insulin the next day.

## The Automation Idea
To streamline this process, I'm planning to write a terminal command that will automate these tasks and can be run in a cronjob on a schedule:

1. Automated Request to GP: The command will send a request to my GP to upload the prescription.
2. Automated Email to Pharmacy: Upon receiving a confirmation from the GP, it will send an automated email to the pharmacy to pre-order the insulin.
3. Google Calendar Integration: Finally, it will add a task to my Google Calendar, reminding me to pick up the insulin.

By automating these steps, I aim to minimise the manual effort and ensure that I never miss an insulin pickup. This series will detail the technical aspects of creating this automation, including writing the script, setting up a cron job, and integrating with email and calendar APIs.

## What’s Next?
In the next part of this series, we'll dive into the specifics of writing a terminal command to send a request to the GP. We'll cover everything from figuring out the request to send and how to convert it to a terminal command.

Stay tuned for the next instalment where we take the first step towards a fully automated insulin ordering system.

I hope this series will not only help others facing similar challenges but also provide an interesting automation project for tech enthusiasts. If you have any questions or suggestions, feel free to leave a comment below!

[Read Part 2](https://dev.to/goudekettingrm/automating-insulin-ordering-capturing-the-gp-request-part-2-4pl0)

Thank you for reading! If you enjoyed this post, don't forget to follow me for more updates and share it with anyone who might find it useful.