Last month, the Indian government announced COVID-19 vaccinations would be available for citizens above 18 from May 1. The announcement came as a huge relief for the country struggling with the pandemic. However, the hope was short-lived. Governments and private hospitals are allocating vaccines every day, but vaccination slots fill up in just a couple of seconds.
Computer Software Engineer from BITS Pilani and IIT Madras alumnus Bragadeesh S recently faced a similar situation when his attempt to book a vaccination slot for himself and his wife failed. The IIT-Madras alumnus turned to his computer for assistance. Bragadeesh has developed a Python script to allow users to get real-time alerts for vaccination slots for the 18 to 45 age group.
How the code works
In conversation with Analytics India Magazine, Bragadeesh explained how he used Python to fetch information from the CoWIN website. The Chennai resident used the Government’s publicly available API (from API Setu) to write the Python script. The script constructs a URL path and hits the API to receive information in a JSON file.
“I then check for two criteria mentioned in every centre in the JSON file. First, if the age group is not equal to 45 years; and second, if the ‘Available Vaccine Doses’ is greater than zero,” Bragadeesh said. Once both these conditions are satisfied, the code sends an alert through email to users who have subscribed to receive alerts for every available vaccine slot.
The code has a couple of configurable parameters. First, its pin code parameter is configurable and can be changed as per the user’s requirement. Secondly, the time interval parameter can be altered as per the user’s discretion. Bragadeesh explains, “The script runs for a certain period through a While Loop where the internal parameters can be set. If the time set is 60 seconds, the script will keep checking the API or the website every one minute.”
However, Bragadeesh suggests the ideal period is five seconds.
Finally, the user must provide a username and password for the email, sending the trigger or alert to the subscribed users. Supposedly, when Bragadeesh enters his email address and password, and when both the criteria are satisfied, the code uses Bragadeesh’s email id to generate trigger or alert emails and send them to multiple people. Once the user receives the email alert, they will have to visit the CoWIN website and book their slots.
When asked about the privacy concernş, Bragadeesh said the code is safe to use since it runs on a user’s local or personal computer. The scripting can be done on any personal system without compromising the user id or password and privacy.
Launched on May 9, Bragadeesh has helped about 10 of his friends book their vaccination slots using the Python script, besides himself and his wife.
Bragadeesh explains the code here.