Skip to main content

covid_19 Data Packages

An assortment of Data Scraping packages from publicly available git repos and website scrapings

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installing

This package is hosted on Pypi

python3 -m pip install covid-19-dryampy

Example Scripts

from covid_19.us_tests_cdc import us_tests_cdc

scraper = us_tests_cdc()
print(scraper.fetch())

or something a bit more complex;

from covid_19.csse_data import csse_retrieve
from covid_19.us_tests_cdc import us_tests_cdc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt


[data, dim_loc, dim_metric] = csse_retrieve().fetch()
test_dat = us_tests_cdc().fetch()

US_ids = dim_loc[dim_loc['Country/Region'] == 'US'].index.tolist()
US_data = data[data['loc_id'].isin(US_ids)]
US_case_data = US_data[US_data['metric_id'] == 0]
US_conf_cases = US_case_data[['counts', 'date']].groupby(['date']).agg(['sum'])
US_conf_cases.columns = ['total_counts']
US_conf_cases['daily_counts'] = np.gradient(US_conf_cases['total_counts'])

US_tests = test_dat[test_dat['status'] == 'complete']
US_tests['test_add'] = US_tests['cdc'] + US_tests['other']
US_tests = US_tests[['date', 'test_add']].groupby(['date']).agg(['sum'])
US_tests.columns = ['daily_counts']
US_tests['total_counts'] = US_tests['daily_counts'].cumsum()

final = US_conf_cases.join(US_tests, lsuffix='_cases', rsuffix='_tests')

ax = plt.gca()
plt.title('US tests and confirmed cases over time')

final2 = final.reset_index()
#final2.plot(kind='line',x='date',y='total_counts_tests', ax=ax, logy=True)
#final2.plot(kind='line',x='date',y='total_counts_cases', color='red', ax=ax, logy=True)
final2.plot(kind='line',x='date',y='total_counts_tests', color='blue', ax=ax)
final2.plot(kind='line',x='date',y='total_counts_cases', color='red', ax=ax)

plt.show()

Image description

Sources

US Test Data scraped from; https://www.cdc.gov/coronavirus/2019-ncov/cases-updates/testing-in-us.html World Confirmed/Recovered/Death data from https://github.com/CSSEGISandData/COVID-19

Authors

  • Steven Yampolsky

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE.md file for details

Release files for covid-19-dryampy 0.3.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for covid-19-dryampy 0.3.9
File Size Uploaded
covid-19-dryampy-0.3.9.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for covid-19-dryampy 0.3.9
File Interpreter ABI Platform
covid_19_dryampy-0.3.9-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / covid-19-dryampy-0.3.9.tar.gz

Download URL covid-19-dryampy-0.3.9.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c9a5fd6fce891383ac8b22520f9fee88266982bdd843d1f165d862b8e49164bc
BLAKE2b-256 checksum
How to use checksums
e9e4f0cf8c1f85f5692a86a943b9d90ee1b89bbd7c2aab442950ed482b55d920
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.3

Release files / covid_19_dryampy-0.3.9-py3-none-any.whl

Download URL covid_19_dryampy-0.3.9-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81665e772a48015e572efe4426a0265764838dd13a134da98bbec29333dfbe34
BLAKE2b-256 checksum
How to use checksums
6cd9b19a730a8ce78f7203ae13d5f3e54b4cb63e94e6b7bf7360d021e8d348c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.3.9 This release

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page