Cowin Slot Finder

Mac
3 min readMay 30, 2021

Covid-19 has become the biggest disaster of the century now. Everywhere around the world we have been listening about the same for almost 2 years now. It has been affecting each individual life in many different and catastrophic ways. Many nations had been affected so badly by different corona waves at different times and currently, India is going through a very bad phase because of corona’s second wave.

Although, we humans as a community got successful to find a vaccine for the disease in a very short span of time but still many nations in the world are still struggling to make their population fully vaccinated yet. India is also one of them where the population size is too big and available vaccine shots are too less to make the whole population fully vaccinated from the disease. And as we all know wherever we could see a difference between supply/demand ratio, a very surreal struggle takes a new birth.

This time in India, there is too much struggle to fulfill the supply/demand ratio in order to vaccinate the whole population. Where vaccination is the only way to save lives, people are dying in the absence of vaccines and relevant information about the available vaccination slots in their nearby areas. The online system which has been developed to book vaccination slots and get the relevant information from the Goverment is very good but there is a lack of proper notifications due to a shortage of vaccination. People have to leave their work and keep waiting for long hours on the online portal just to book a slot for them.

I tried to solve this long-waiting problem on the portal by creating a utility script that does the same work for you. I have written a python script and already made it publicly available on Github that would keep polling data on your behalf and updates you as soon as it gets an available slot for you through system notifications.

How to use cowin-slot-finder?

It is a tool to find available vaccination slots for covid vaccine using Co-WIN public APIs. It is a continuous, automated and, a multi-processing-based script that can take multiple pin codes and districts to find slots at a time and smart enough to manage the time difference between multiple requests to the server. The intention is to never cross 100 requests in 5 mins boundary imposed by the Co-Win public APIs.

This script requires Python3 environment and following packages,

  1. requests
  2. beepy
  3. plyer

This script can be used as a continuous process e.g a background job that keeps running in the background and notifies about the slot information via sound notifications. You can follow the below steps to fetch the script and start it.

git clone https://github.com/mukultaneja/cowin-slot-finder.git
cd cowin-slot-finder
pip3 install -r requirements.txt
python3 slotFinder.py slotInfo.json

slotFinder.py is the main script that helps to find an available slot for you. It requires few inputs from the user in order to find a suitable slot for it. Below are the required keys to be set in slotInfo.json

  1. dataPoints — List, A list of dictionaries define data points to query available slots
  2. communicationType — String, By default this field is set as ‘system’. As soon as a slot gets available, the script shall start beeping and notify/dumps relevant information inside slots-finder.txt in the executing directory. It supports Mac/Windows platform to provide slots information.
  3. searchCriteria — Dictionary, contains all the values to find a suitable slot for you. This could allow you to set search space as per your need. Below are the key values you could define as part of your search criteria,
  • minAgeLimit: String, Either could be set as a single age value e.g “18”/”45" or multiple age values e.g “18, 45”
  • vaccineName: String, Either could be set as a single vaccine name e.g “COVISHIELD”/”COVAXIN” or multiple names e.g “COVISHIELD, COVAXIN”
  • feeType: String, Either could be as e.g “Free”/”Paid” or “Free, Paid”
  • dose1: Boolean, Could be true or false
  • dose2: Boolean, Could be true or false
{ 
"dataPoints": [{
"district_id": 505,
"date": ""
},{
"district_id": 506,
"date": ""
}],
"communicationType": "system",
"searchCriteria": {
"minAgeLimit": "18, 45",
"vaccineName": "COVISHIELD, COVAXIN",
"feeType": "Free, Paid",
"dose1": true,
"dose2": false
}
}

Feel free to use/modify the script and raise issues if it is not working for you as expected. I did this work in the hope to serve the community and try to help them to get past this very hard time very soon while staying safe and fully vaccinated. I wish all of you very good luck and prosperous life.

--

--

Mac

data enthusiast, data viz expert, full stack developer, passionate programmer, quick learner, loves to read books and listen to music