scorecovid


Namescorecovid JSON
Version 0.0.9 PyPI version JSON
download
home_pagehttps://github.com/ytakefuji/score-covid-19-policy
SummaryA package for scoring policies of covid-19
upload_time2023-06-08 10:15:18
maintainer
docs_urlNone
authoryoshiyasu takefuji
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # score-covid-19-policy
[![Open in Code Ocean](https://codeocean.com/codeocean-assets/badge/open-in-code-ocean.svg)](https://codeocean.com/capsule/0675fd94-870e-4a3c-ab47-6685096bf16d/tree)

Taiwan's data from the dataset was removed by the provider.

WHO is now handling all COVID-19 data:

https://covid19.who.int/WHO-COVID-19-global-data.csv

Takefuji Y. (2022). scorecovid for scoring individual country COVID-19 policies in the world. Software impacts, 14, 100453. https://doi.org/10.1016/j.simpa.2022.100453

DOI: https://doi.org/10.24433/CO.9411531.v1

The paper entitled "Sustainable policy: Don't get infected and don't infect others"
was published in Journal of Hazardous Materials Advances.

https://doi.org/10.1016/j.hazadv.2022.100165

The paper was published in Healthcare Analytics (2021):
SCORECOVID: A Python Package Index for scoring the individual policies against COVID-19

https://doi.org/10.1016/j.health.2021.100005

The paper was published in Journal of Infection and Public Health (2021):
Technological forecasting plays a key role in mitigating the pandemic

https://doi.org/10.1016/j.jiph.2021.09.010

scorecovid has been downloaded by 16757 times worldwide as of Feb.22, 2023.

You may create a file called countries for scoring individual policies of countries.

Country names must be separated by commas.

VSL_data.csv was created by Mr. Kiuchi using data of the following paper:
Viscusi, W., & Masterman, C. (2017). Income Elasticities and Global Values of a Statistical Life. Journal of Benefit-Cost Analysis, 8(2), 226-250. doi:10.1017/bca.2017.12

Taiwan VSL: https://www.cier.edu.tw/public/Data/2018-5.pdf

Taiwan GNI: https://eng.stat.gov.tw/point.asp?index=1

<pre>
$ cat countries
Iceland,South Korea,India,Brazil,France,New Zealand,Taiwan,Sweden,Japan,United States,Canada,United Kingdom,Israel
</pre>

# How to install and run scorecovid
<pre>
$ pip install scorecovid
or
$ pip install scorecovid --force-reinstall --no-cache-dir --no-binary :all:

$ scorecovid
score is created in result.csv
date is  2022-03-19
                deaths  population   score
country
New Zealand        151        4.82    31.3
Taiwan             853       23.82    35.8
Japan            27056      126.48   213.9
Australia         5725       25.50   224.5
South Korea      12428       51.27   242.4
Iceland             91        0.34   267.6
India           516479     1380.00   374.3
Canada           37204       37.74   985.8
Israel           10419        8.66  1203.1
Germany         126920       83.78  1514.9
Sweden           18053       10.10  1787.4
France          140972       65.27  2159.8
United Kingdom  163658       67.89  2410.6
United States   971087      331.00  2933.8
Brazil          657389      212.56  3092.7

</pre>

# Background
There are ways to mitigate pandemics and prevent infections.
We need to learn good policies from countries with high scores.
Scoring tells us the performance of health policies in individual 
countries that are coping well with pandemics and those that are not.

# How to handle errors
<pre>
For example, "ImportError: lxml not found, please install it"
$ pip install lxml

</pre>

# How scorecovid can score indivisual policies against covid-19?
Scoring of individual policies against covid-19 is calculated by dividing the total number of deaths due to covid-19 by the population (in millions).
The most recent values for total number of deaths and population are scraped from the Web sites.

# Exercises for students
1. Calculate economic loss of a country due to the total number of deaths due to COVID-19 using a value of statistical life (VSI).

2. Add two columns to the result of scorecovid: VSI and economic loss.

# scorecovid.py
$ cat scorecovid.py
<pre>
import requests,re
import pandas as pd

def main():
 url='https://www.worldometers.info/world-population/population-by-country/'
 print('scraping population...')
 page=requests.get(url)
 df = pd.read_html(page.text)[0]
 df.columns.values[1]='Country'
 df.columns.values[2]='Population'
 #df = pd.read_html(page.text,flavor='html5lib')[0]
 df.to_csv('pop.csv')
 print('pop.csv was created')

 print('downloading total_deaths.csv file')
 import subprocess as sp
 sp.call("wget https://github.com/owid/covid-19-data/raw/master/public/data/jhu/total_deaths.csv",shell=True)
 p=pd.read_csv('total_deaths.csv')
 date=p['date'][len(p)-1]

#
#from urllib.request import Request, urlopen
#url='https://www.worldometers.info/coronavirus/#nav-today/'
#print('scraping deaths informationi...')
#req = Request(url, headers={'User-Agent': 'Firefox/76.0.1'})
#page = re.sub(r'<.*?>', lambda g: g.group(0).upper(), urlopen(req).read().decode('utf-8') )
#df = pd.read_html(page)[0]
#df.to_csv('deaths.csv')
#print('deaths.csv was created')
#


 print('countries file was read...')
 d=open('countries').read().strip()
 d=d.split(',')
 print('scoring the following ',len(d),' countries...')
 print(d)

 dd=pd.DataFrame(
  {
   "country": d,
   "deaths": range(len(d)),
   "population": range(len(d)),
   "score": range(len(d)),
  })

 pp=pd.read_csv('pop.csv')
 print('calculating scores of countries\n')
 print('score is created in result.csv')
 print('date is ',date)

 for i in d:
 # print(p[i][len(p)-1])
  dd.loc[dd.country==i,'deaths']=int(p[i][len(p)-1])
 # print(pp.loc[pp.Country==i,'Population'])
  dd.loc[dd.country==i,'population']=int(pp.loc[pp.Country==i,'Population']/1000000)
  dd.loc[dd.country==i,'score']=int(dd.loc[dd.country==i,'deaths']/dd.loc[dd.country==i,'population'])
 dd=dd.sort_values(by=['score'])
 dd.to_csv('result.csv',index=False)
 dd=pd.read_csv('result.csv',index_col=0)
 print(dd)
 sp.call("rm total_deaths.csv pop.csv",shell=True)

if __name__ == "__main__":
 main()

</pre>



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ytakefuji/score-covid-19-policy",
    "name": "scorecovid",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "yoshiyasu takefuji",
    "author_email": "takefuji@keio.jp",
    "download_url": "https://files.pythonhosted.org/packages/fc/d9/e35d270849442d5d44a258c4654486515fedba7f7f17d0d14b79573569dd/scorecovid-0.0.9.tar.gz",
    "platform": null,
    "description": "# score-covid-19-policy\n[![Open in Code Ocean](https://codeocean.com/codeocean-assets/badge/open-in-code-ocean.svg)](https://codeocean.com/capsule/0675fd94-870e-4a3c-ab47-6685096bf16d/tree)\n\nTaiwan's data from the dataset was removed by the provider.\n\nWHO is now handling all COVID-19 data:\n\nhttps://covid19.who.int/WHO-COVID-19-global-data.csv\n\nTakefuji Y. (2022). scorecovid for scoring individual country COVID-19 policies in the world. Software impacts, 14, 100453. https://doi.org/10.1016/j.simpa.2022.100453\n\nDOI: https://doi.org/10.24433/CO.9411531.v1\n\nThe paper entitled \"Sustainable policy: Don't get infected and don't infect others\"\nwas published in Journal of Hazardous Materials Advances.\n\nhttps://doi.org/10.1016/j.hazadv.2022.100165\n\nThe paper was published in Healthcare Analytics (2021):\nSCORECOVID: A Python Package Index for scoring the individual policies against COVID-19\n\nhttps://doi.org/10.1016/j.health.2021.100005\n\nThe paper was published in Journal of Infection and Public Health (2021):\nTechnological forecasting plays a key role in mitigating the pandemic\n\nhttps://doi.org/10.1016/j.jiph.2021.09.010\n\nscorecovid has been downloaded by 16757 times worldwide as of Feb.22, 2023.\n\nYou may create a file called countries for scoring individual policies of countries.\n\nCountry names must be separated by commas.\n\nVSL_data.csv was created by Mr. Kiuchi using data of the following paper:\nViscusi, W., & Masterman, C. (2017). Income Elasticities and Global Values of a Statistical Life. Journal of Benefit-Cost Analysis, 8(2), 226-250. doi:10.1017/bca.2017.12\n\nTaiwan VSL: https://www.cier.edu.tw/public/Data/2018-5.pdf\n\nTaiwan GNI: https://eng.stat.gov.tw/point.asp?index=1\n\n<pre>\n$ cat countries\nIceland,South Korea,India,Brazil,France,New Zealand,Taiwan,Sweden,Japan,United States,Canada,United Kingdom,Israel\n</pre>\n\n# How to install and run scorecovid\n<pre>\n$ pip install scorecovid\nor\n$ pip install scorecovid --force-reinstall --no-cache-dir --no-binary :all:\n\n$ scorecovid\nscore is created in result.csv\ndate is  2022-03-19\n                deaths  population   score\ncountry\nNew Zealand        151        4.82    31.3\nTaiwan             853       23.82    35.8\nJapan            27056      126.48   213.9\nAustralia         5725       25.50   224.5\nSouth Korea      12428       51.27   242.4\nIceland             91        0.34   267.6\nIndia           516479     1380.00   374.3\nCanada           37204       37.74   985.8\nIsrael           10419        8.66  1203.1\nGermany         126920       83.78  1514.9\nSweden           18053       10.10  1787.4\nFrance          140972       65.27  2159.8\nUnited Kingdom  163658       67.89  2410.6\nUnited States   971087      331.00  2933.8\nBrazil          657389      212.56  3092.7\n\n</pre>\n\n# Background\nThere are ways to mitigate pandemics and prevent infections.\nWe need to learn good policies from countries with high scores.\nScoring tells us the performance of health policies in individual \ncountries that are coping well with pandemics and those that are not.\n\n# How to handle errors\n<pre>\nFor example, \"ImportError: lxml not found, please install it\"\n$ pip install lxml\n\n</pre>\n\n# How scorecovid can score indivisual policies against covid-19?\nScoring of individual policies against covid-19 is calculated by dividing the total number of deaths due to covid-19 by the population (in millions).\nThe most recent values for total number of deaths and population are scraped from the Web sites.\n\n# Exercises for students\n1. Calculate economic loss of a country due to the total number of deaths due to COVID-19 using a value of statistical life (VSI).\n\n2. Add two columns to the result of scorecovid: VSI and economic loss.\n\n# scorecovid.py\n$ cat scorecovid.py\n<pre>\nimport requests,re\nimport pandas as pd\n\ndef main():\n url='https://www.worldometers.info/world-population/population-by-country/'\n print('scraping population...')\n page=requests.get(url)\n df = pd.read_html(page.text)[0]\n df.columns.values[1]='Country'\n df.columns.values[2]='Population'\n #df = pd.read_html(page.text,flavor='html5lib')[0]\n df.to_csv('pop.csv')\n print('pop.csv was created')\n\n print('downloading total_deaths.csv file')\n import subprocess as sp\n sp.call(\"wget https://github.com/owid/covid-19-data/raw/master/public/data/jhu/total_deaths.csv\",shell=True)\n p=pd.read_csv('total_deaths.csv')\n date=p['date'][len(p)-1]\n\n#\n#from urllib.request import Request, urlopen\n#url='https://www.worldometers.info/coronavirus/#nav-today/'\n#print('scraping deaths informationi...')\n#req = Request(url, headers={'User-Agent': 'Firefox/76.0.1'})\n#page = re.sub(r'<.*?>', lambda g: g.group(0).upper(), urlopen(req).read().decode('utf-8') )\n#df = pd.read_html(page)[0]\n#df.to_csv('deaths.csv')\n#print('deaths.csv was created')\n#\n\n\n print('countries file was read...')\n d=open('countries').read().strip()\n d=d.split(',')\n print('scoring the following ',len(d),' countries...')\n print(d)\n\n dd=pd.DataFrame(\n  {\n   \"country\": d,\n   \"deaths\": range(len(d)),\n   \"population\": range(len(d)),\n   \"score\": range(len(d)),\n  })\n\n pp=pd.read_csv('pop.csv')\n print('calculating scores of countries\\n')\n print('score is created in result.csv')\n print('date is ',date)\n\n for i in d:\n # print(p[i][len(p)-1])\n  dd.loc[dd.country==i,'deaths']=int(p[i][len(p)-1])\n # print(pp.loc[pp.Country==i,'Population'])\n  dd.loc[dd.country==i,'population']=int(pp.loc[pp.Country==i,'Population']/1000000)\n  dd.loc[dd.country==i,'score']=int(dd.loc[dd.country==i,'deaths']/dd.loc[dd.country==i,'population'])\n dd=dd.sort_values(by=['score'])\n dd.to_csv('result.csv',index=False)\n dd=pd.read_csv('result.csv',index_col=0)\n print(dd)\n sp.call(\"rm total_deaths.csv pop.csv\",shell=True)\n\nif __name__ == \"__main__\":\n main()\n\n</pre>\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A package for scoring policies of covid-19",
    "version": "0.0.9",
    "project_urls": {
        "Bug Tracker": "https://github.com/ytakefuji/score-covid-19-policy",
        "Homepage": "https://github.com/ytakefuji/score-covid-19-policy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b23fd4f4e8df7bbc1e0f2a31b1663475703cc81fa8ad09a4907f69060de33340",
                "md5": "079f69c28803b9689685d63bbb50fd78",
                "sha256": "6d701e7a570622f281a69569ed925b03022d46dbc21b4c2ce6bb104389bbfea5"
            },
            "downloads": -1,
            "filename": "scorecovid-0.0.9-py3.8.egg",
            "has_sig": false,
            "md5_digest": "079f69c28803b9689685d63bbb50fd78",
            "packagetype": "bdist_egg",
            "python_version": "0.0.9",
            "requires_python": ">=3.6",
            "size": 5772,
            "upload_time": "2023-06-08T10:15:17",
            "upload_time_iso_8601": "2023-06-08T10:15:17.098402Z",
            "url": "https://files.pythonhosted.org/packages/b2/3f/d4f4e8df7bbc1e0f2a31b1663475703cc81fa8ad09a4907f69060de33340/scorecovid-0.0.9-py3.8.egg",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c86b075ec4d1caf4d2d823163cd90fbbb60fa374996ec5375b47d3a17c0cdbeb",
                "md5": "a71190877ba10211d3ae7dfeb55630c7",
                "sha256": "50df7b47a0402066c3cce9873e97ee577560451133a537c438d68b2bcd8a05be"
            },
            "downloads": -1,
            "filename": "scorecovid-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a71190877ba10211d3ae7dfeb55630c7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4939,
            "upload_time": "2023-06-08T10:15:13",
            "upload_time_iso_8601": "2023-06-08T10:15:13.513184Z",
            "url": "https://files.pythonhosted.org/packages/c8/6b/075ec4d1caf4d2d823163cd90fbbb60fa374996ec5375b47d3a17c0cdbeb/scorecovid-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fcd9e35d270849442d5d44a258c4654486515fedba7f7f17d0d14b79573569dd",
                "md5": "dc87c5cc4af685bd961a94a835183295",
                "sha256": "882865e2308e91f924c78e5462e7a748820fe8df98318a2477186f1ff1e99427"
            },
            "downloads": -1,
            "filename": "scorecovid-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "dc87c5cc4af685bd961a94a835183295",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4630,
            "upload_time": "2023-06-08T10:15:18",
            "upload_time_iso_8601": "2023-06-08T10:15:18.641737Z",
            "url": "https://files.pythonhosted.org/packages/fc/d9/e35d270849442d5d44a258c4654486515fedba7f7f17d0d14b79573569dd/scorecovid-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-08 10:15:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ytakefuji",
    "github_project": "score-covid-19-policy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "scorecovid"
}
        
Elapsed time: 0.08196s