Covid Vaccine Availability using Flask Server
In this article, we are going to build Covid Vaccine Availability Checker using Flask Server.
We all are familiar that the whole world is suffering from the pandemic and the only thing which helps us to come out from this situation is mass Vaccination. But as we know due to the large population of the country it is very difficult to find vaccines in our nearby areas. So now technology comes under the picture and we will build our own covid vaccine availability checker which finds the availability of vaccines in our nearby areas.
We will be using some python libraries to find the availability of vaccines and display them using a flask server. In future, you can deploy it also on the real-time server. First of all, we have to install the python Flask Package using the below command:
pip install flask
After installing the python flask package, Open Pycharm or any IDE (Preferably Visual Studio Code) and make a new project. After this make a main python file app.py and two folders named templates and the other is static (name of the folder must be same as it is written).
Below is the image representing the Directory Structure of the project.
Step 1: In this first step, we have to import python libraries which we will use further in the project. Also, make an app of the Flask server.
Step 2: Adding the routes to handle the client requests.
Step 3: This is the main step of our project which finds the availability of vaccine (findslot() function that will do the following things):
- First of all take the parameters like age, pin, and find dates from DateTime library of python.
- Scrap the data from the official cowin website like vaccine doses, vaccination centers, availability, types of vaccine and price, etc.
- Store all the data in the python list.
Below is the Full Implementation of app.py
Step 4: Now make three files in the templates folder.
- index.html: Displaying the homepage of the project for entering the age and pin codes.
- slot.html: Displaying the data on the page.
- noavailable.html: If the vaccine is not found in any center then-No availability page.
Add the images or other files (if you have them) to the static folder.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course