A python flask API that regularly tracks Covid19 cases in India.
View Demo
- /getgeneral : Returns a JSON data of the current cases report of India.
- /getanalytics : Returns a JSON data of the past case report along with current cases in India .This is specifically for data visualization.
- /getstate?state=statename :Return a JSON data of the current case report of a particular state.Note : statename should be in lowercases and without any white spaces.
- /getstate?state=all :Return a JSON data of the current case report of all Indian states.
- app.py : Responsible for routing purpose.
- information_fetcher.py : Fetches the information for a particular route.
- scrapper.py :Scrapes the data from "https://www.mohfw.gov.in/"
- clock.py :Runs the cron job in the given interval of time.
- Python
- Flask
- Mongo DB
Here is a quick installation guide.Please note this is for Ubuntu machines.
- To Run the application for development ,Clone the repo
git clone https://github.com/090max/covid19Tracker_server
- Install requirements.
pip install requirements.txt
- Run the application.`
python app.py
- Go to any of the Mongo DB hosting website( ex - Mongo Atlas)
- Create a Database named "covid19".
- Create two collections named "general" and "state_wise"
- Paste the connection url in db_helper.py file.
-
Login to heroku and create a new web app.
-
Install heroku CLI .Follow this link.
-
Run the following commands on your terminal in the directory of project.Note : The Procfile and requirements.txt is already defined here , so no need of making a new one.
git init
heroku git:remote -a <your heroku app name>
git add .
git commit -m "Commit info"
git push heroku master
- Run the following commands to scale the clock (cron job) and web app , run on your terminal.
heroku ps:scale clock =1
heroku ps:scale web=1
- Add time zone to the heroku application ,run this on terminal
heroku config:add TZ="Asia/Kolkata"
- Thats is your application is LIVE !!.
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/FeatureBranch
) - Commit your Changes (
git commit -m 'Add some Feature'
) - Push to the Branch (
git push origin feature/FeatureBranch
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.