Skip to content

A Flask RESTful GET server that scraps data from https://mohfw.gov.in to update latest state level COVID-19 / Coronavirus data in India

License

Notifications You must be signed in to change notification settings

udaya2899/covid-india-api

Repository files navigation

Covid India API

REST API to track Coronavirus cases in India on state level

COVID 19 India States Data API

Announcement: covid-india-api is up and running again

Issues Forks Stars License

Coronavirus is shaking the world 🌍. At such crucial times, the purity of data is to be maintained. Govt. of India hasn't released an official API yet. This API scraps data from Official Website of Ministry of Health and Family Welfare ✔️ and exposes them as a REST API at https://covid-india-api.herokuapp.com/v1/api

Featured in POSTMAN COVID-19 API Resource Center

URL: https://covid-19-apis.postman.com/ POSTMAN COVID-19 API Resource Center

Usage 💻

REST API Sample Usage

cURL Command:

curl --request GET "https://covid-india-api.herokuapp.com/v1/api"

To run the server locally on your machine:

git clone https://github.com/udaya2899/covid-india-api.git
cd covid-india-api
pip install -r requirements.txt
python app.py

Implementation 👷

  • 🐍 Python 3
  • 🍶 Flask - REST GET Implementation
  • 🍲 BeautifulSoup - Web Scraping
  • ➡️ JSON - Data Serialization
  • 🔯 Heroku - Deployment

Requirements ⚡

Refer to requirements.txt for full list of requirements

beautifulsoup4==4.8.2
Flask==1.1.1
python-dateutil==2.8.1
requests==2.23.0

Data Source - Sample Table ✅

Sample data from Ministry of Health and Family Welfare, Govt. of India (link)

MOHFW Sample Data Table

API - Sample JSON 🚀

Sample API Response obtained from https://covid-india-api.herokuapp.com/v1/api

 {
  "data": {
    "state_data": [
      {
        "id": "1",
        "place": "Andhra Pradesh",
        "confirmed_indian": "14",
        "confirmed_foreign": "0",
        "cured": "1",
        "deaths": "0"
      },
      {
        "id": "2",
        "place": "Andaman and Nicobar Islands",
        "confirmed_indian": "6",
        "confirmed_foreign": "0",
        "cured": "0",
        "deaths": "0"
      },
      .
      .
      .
      {
	    "id": "27", 
	    "place": "West Bengal", 
	    "confirmed_indian": "15", 
	    "confirmed_foreign": "0", 
	    "cured": "0", 
	    "deaths": "1"
	  }
    ]
    "total_data": {
        "confirmed_indian": "862", 
        "confirmed_foreign": "47 ", 
        "cured": "80", 
        "deaths": "19"
        }, 
 "last_updated": "2020-03-28 17:45:00"
  }
}
}

Contribution 🤝

Pull requests are welcomed to make changes. To make drastic changes, open an issue to discuss.

Contact 📫

Mail me at [email protected] for further queries

License

MIT

About

A Flask RESTful GET server that scraps data from https://mohfw.gov.in to update latest state level COVID-19 / Coronavirus data in India

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages