Git Product home page Git Product logo

bhattbhavesh91 / cowin-vaccination-slot-availability Goto Github PK

View Code? Open in Web Editor NEW
303.0 303.0 270.0 34.96 MB

Script to check the available slots for Covid-19 Vaccination Centers from CoWIN API in India.

License: Apache License 2.0

Jupyter Notebook 84.72% Python 14.22% Shell 0.80% Dockerfile 0.25%
covid-19 covid19-data covid19-vaccination covid19-vaccine-notification cowin cowin-api cowin-vaccine-tracker india python python-script vaccination-tracker vaccine-availability vaccine-tracker

cowin-vaccination-slot-availability's Introduction

Bhavesh Bhatt

I currently work as a AVP of Data Science (Generative AI), where I find immense joy in problem-solving. The ongoing research in the Generative AI domain fascinates me deeply & I try my level best to keep up with the advances.

Bhavesh's Youtube Bhavesh's Python Bhavesh's Twitter Bhavesh's Linkedin Bhavesh's Linktree Bhavesh's About Me Bhavesh's Medium Dev.to Link Telegram Channel Bhavesh's Blog Bhavesh's Github

In my journey so far,

  • In October 2019, I attained the prestigious title of a Google Developer Expert (GDE) in Machine Learning, marking a significant milestone in my professional journey and adding a noteworthy honor to my accomplishments.
  • The recognition as a recipient of the 40 Under 40 Data Scientist award by Analytics India Magazine in January 2020 stands as a significant achievement in my career.
  • In July 2021, I proudly received the GitHub Star ⭐ recognition, securing the 69th position globally among approximately 65 million developers. The acknowledgment of my open-source contributions is both rewarding and humbling, and I am grateful for the support of over 2300+ followers on GitHub.
  • I am truly humbled to be a member of the Google Cloud Innovator Program, having joined in December 2021.
  • In February 2023, I attained the status of a Neo4j Ninja 🥷 & by April of the same year, I had the honor of receiving the Community Excellence award at Graphsummit 2023, Neo4j's prestigious event.
  • The privilege of being selected as a Gartner Peer Community Ambassador for Data & Analytics in October 2023 is a source of deep honor and reinforces my commitment to the field.
  • The experience of developing a product that secured the esteemed Best AI/ML Product of the Year award at Cypher 2022, along with receiving recognition for my Generative AI project at Cypher 2023 has been genuinely humbling.
  • Attending the inaugural Indian National Creators Award in March 2024 was undeniably a remarkable privilege.

In order to give back to the community from which I learnt so much I started creating videos on YouTube & currently I have 2 YouTube channels with close to 400+ videos with 5+ Million views & 105k+ subscribers.

YouTube Channel Views
YouTube Channel Views

GitHub Follow GitHub User's stars Twitter Follow

GitHub Sponsor Telegram Channel Link

Do you want to contact me for collaboration opportunities?Contact Details

If you like my work, you can support me by buying me a coffee by clicking the link below

Buy Me A Coffee

cowin-vaccination-slot-availability's People

Contributors

amajee11us avatar bhattbhavesh91 avatar gurtejrehal avatar parikhkadam avatar rohan7055 avatar saboorakhee avatar sayandeepsanyal avatar somnathhazra avatar xybervenom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cowin-vaccination-slot-availability's Issues

Not working: might be some changes in api access!!

import requests
import datetime
import json
import pandas as pd

for state_code in range(1,40):
    print("State code: ", state_code)
    response = requests.get("https://cdn-api.co-vin.in/api/v2/admin/location/districts/{}".format(state_code))
    json_data = json.loads(response.text)
    print (json_data)
    #for i in json_data["districts"]:
        #print(i["district_id"],'\t', i["district_name"])
    #print("\n")

Output:

State code:  1
{'message': 'Forbidden'}
State code:  2
{'message': 'Forbidden'}
State code:  3
{'message': 'Forbidden'}
State code:  4
{'message': 'Forbidden'}
State code:  5
{'message': 'Forbidden'}
State code:  6
{'message': 'Forbidden'}
State code:  7
{'message': 'Forbidden'}
.
.
.
.

API not working in program

Hi,
I am using following code
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import requests
import datetime
import json
import pandas as pd

for state_code in range(1,40):
print("State code: ", state_code)
response = requests.get("https://cdn-api.co-vin.in/api/v2/admin/location/districts/{}".format(state_code))
#json_data = json.loads(response.text)
print (response)
#for i in json_data["districts"]:
#print(i["district_id"],'\t', i["district_name"])
#print("\n")
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Result is not coming . It is giving <Response [403]> . Whereas same api is working in web browser.

Snapshot attached.
webbrowser
coolab

Error

### Traceback (most recent call last):
File "c:\users\intel\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "c:\users\intel\appdata\local\programs\python\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\INTEL\AppData\Local\Programs\Python\Python39\Scripts\streamlit.exe_main
.py", line 4, in
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\streamlit_init
.py", line 46, in
from streamlit import logger as logger
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\streamlit\logger.py", line 21, in
from streamlit import config
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\streamlit\config.py", line 28, in
from streamlit import config_util
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\streamlit\config_util.py", line 4, in
import click
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\click_init
.py", line 7, in
PS C:\Users\INTEL\Desktop\Coding\cowin-vaccination-slot-availability-main> streamlit run app.py
Traceback (most recent call last):
File "c:\users\intel\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
return run_code(code, main_globals, None,
File "c:\users\intel\appdata\local\programs\python\python39\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\INTEL\AppData\Local\Programs\Python\Python39\Scripts\streamlit.exe_main
.py", line 4, in
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\streamlit_init
.py", line 46, in
from streamlit import logger as logger
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\streamlit\logger.py", line 21, in
from streamlit import config
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\streamlit\config.py", line 28, in
from streamlit import config_util
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\streamlit\config_util.py", line 4, in
import click
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\click_init
.py", line 7, in
from .core import Argument
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\click\core.py", line 9, in
from .compat import isidentifier
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\click_compat.py", line 685, in
import colorama
File "c:\users\intel\appdata\local\programs\python\python39\lib\site-packages\colorama_init
.py", line 2, in
from .initialise import init, deinit, reinit, colorama_text
ValueError: source code string cannot contain null bytes

it shows all this as errors

Not working OR to be modified

Hello,

Seems to be this code is not working or needs to update.

After checking found that the API url is changed. In addition to that the JSON structure is also have changed/additions.

Slots Opening Time

Is there any way by which we can find the rough time when slots open for a particular centre. This time data can be saved and by going through the trends, we can figure out the approximate time at which one can open the portal and book the slot.

Some data not coming

Jalukbari Girls High School of kamrup metropolitan district of assam is not getting displayed

Can it be automated?

Hello Sir;
I have a suggestion, The script is fine. I am running it and it is working flawlessly. Can we automate the process by setting a time interval? Say every 2 minutes or 15 minutes?

The shortcut is fine. When I press R on the keyboard it is getting executed. Whenever a slot is available a beep notification can be given as well.

Update readme.md

Please Update readme.md for Beginners so that they also can use this amazing piece you guys have prepared for us. Actually what happens is no one can directly use this master piece as a beginner. So what I wanna convey is Please add some * 1. , * 2. Points like this so that people can understand how to implement and take benefit.

Some Questions and Feedback

Hello @bhattbhavesh91, I saw your cowin-vaccination-slot-availability script. I had the same problem of booking for slots. Whenever I saw that a slot of our nearest center was empty, and went to ArogyaSetu to book it, I ran out of time and it was booked.

The main problem was that we had to refresh the page at www.cowin.gov.in an select the state and city every time to see the updated available slots. And this action, probably took some time. Then after that getting and OTP, and the typing it in, this wasted time and therefore, empty slots were booked before I book them.
This continued for 2 days after then I searched on Google to find a solution for quickly booking slots. I found some sites like vaccinateme and getjab, and many more like that which would WhatsApp or Email me whenever an empty slot was found in my area. I was really amazed and curious about how these did it. (BTW, it didn't send me any email or WhatsApp me yet, I did this 4 days before)

Then I searched how to track empty slots in Python, I got some github results, and the first was, obviously, yours. One thing I was really amazed by was the API of Cowin. I tried it, and it really worked (but after a bunch of trials and errors). Then finally, using requests (for, I suppose you know why) and rich (for coloured and pretty printing in console) libraries. Using my laptop every time just to check empty slots wasn't possible for me, so I am using Pydroid app for android to run Python scripts.I really got information about the centers near me and their available capacity. I furthed filtered it down to
if min_age == 18 and if available_capacity > 0 and also if name in LIST_OF_PREFERRED_CENTERS
to match my needs and see only data what I need.

And this really helped me and on 3rd day, I booked it.

I saw your Readme and came to know that you are going to implement certificate downloading and Booking via script. But I saw on API description that the booking one is protected API and the certificate one needed to verify OTP. I did not understand both of them.

So, if you have idea how to do that, or if you are going to implement these, please let me know, or more helpful, explain me if possible.

Thanks,
Harsh

Incorrect data

Api which you are using gives cached data not real time data.

Name of districts

Please refer to the image below.

  • We can see that there are two districts of the same name (but in different states)
  • It will be convenient if the state's name is added after the district's name

Screenshot 2021-05-05 235900_LI

streamlit is sowing error

_Traceback (most recent call last):
File "c:\users\rishu\appdata\local\programs\python\python37\lib\runpy.py", line 192, in _run_module_as_main
return run_code(code, main_globals, None, "main", mod_spec)
File "c:\users\rishu\appdata\local\programs\python\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\rishu\AppData\Local\Programs\Python\Python37\Scripts\streamlit.exe_main
.py", line 4, in
File "c:\users\rishu\appdata\local\programs\python\python37\lib\site-packages\streamlit_init
.py", line 49, in
from streamlit.proto.RootContainer_pb2 import RootContainer
File "c:\users\rishu\appdata\local\programs\python\python37\lib\site-packages\streamlit\proto\RootContainer_pb2.py", line 22, in
create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute 'internal_create_key'

I'm getting this error. can you please help me with it?
I've installed all the requirements and followed all the steps. I also have anaconda.

I'm running this command "streamlit run app.py" on powershell.

NameError: name 'pd' is not defined

facing this issue while running the script

Traceback:
File "c:\programdata\anaconda3\lib\site-packages\streamlit\script_runner.py", line 337, in _run_script
exec(code, module.dict)
File "C:\Users\Lenovo\cowin-vaccination-slot-availability-main\app.py", line 28, in
mapping_df = load_mapping()
File "c:\programdata\anaconda3\lib\site-packages\streamlit\caching.py", line 573, in wrapped_func
return get_or_create_cached_value()
File "c:\programdata\anaconda3\lib\site-packages\streamlit\caching.py", line 555, in get_or_create_cached_value
return_value = func(*args, **kwargs)
File "C:\Users\Lenovo\cowin-vaccination-slot-availability-main\app.py", line 16, in load_mapping
df = pd.read_csv("district_mapping.csv")

Improvement Suggestion for your web app

Your webapp cowin-vaccination-appointment.herokuapp.com is very helpful and you have already provided the code but I am not a programmer, I would suggest you to add some filters like. Minimum age, Availability and date etc. since you already have the data and code ready. the filters shouldn't be a big deal for you to add.

Thank you

Seems like fetching the data using requests package isn't working. The server returns a 403 response code. Adding Headers to the get method isn't working either

URL = "https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByDistrict?district_id={}&date={}".format(district_id, INP_DATE)
headers = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
'Accept-Encoding': 'none',
'Accept-Language': 'en-US,en;q=0.8',
'Connection': 'keep-alive'}
response = requests.get(URL,headers = headers)

TypeError: object of type 'NoneType' has no len()

Getting this error.

File "/app/.heroku/python/lib/python3.9/site-packages/streamlit/script_runner.py", line 337, in _run_script
exec(code, module.dict)
File "/app/app.py", line 81, in
if (len(final_df)) and (final_df is not None):

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.