This is a json interface for the summary of cases table in Bahrain Ministry of Health website.
You can just call the above link and it will return the data as a josn object.
key | Description |
---|---|
total_check | Total Tested |
existing_cases | Active Cases |
stable_existing_cases | Stable cases |
critical_existing_cases | Critical cases |
recovered_cases | Discharged |
deaths | Deaths |
request_timestamp | Unix time to know when the data fetched. |
curl --location --request GET 'https://cvapi.awal.pw/'
More example available in the example folder.
the following errors might happen:
- if there is no data cache and the server can not fetch data from the Bahrain MOH website it will return:
{"erorr": "connection error"}
- if there is a cached data and the server can not fetch data from the Bahrain MOH website, cache data will be returned.
The server code created with python3
using BeautifulSoup
to parse the HTML table from Ministry of Health website
following library are required to run the code locally:
Files:
- data_source.py: will load the data and return dictionary will all the keys
- server.py: will run a local server at
http://localhost:8181
Note:
- The data is being cached in
cvbh.json
so it will only request new data every 5 minutes. - The function
get_data
can take a (True|False) value to enable data cache.
To run the server locally just run
python3 server.py
- More information about Coronavirus (COVID-19)
- Volunteer in the Campaign to Combat Coronavirus (COVID-19) volunteer.gov.bh
- The Coronavirus Tech Handbook coronavirustechhandbook.com