Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/covidify/covidify_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from convidify.sources import github, wiki

"""
global values
"""
class DataStoreBridge():
def jhu_sources(self):
return github.get()

def wiki_sources(self):
return github.get()
10 changes: 5 additions & 5 deletions src/covidify/data_prep.py → src/covidify/covidify_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Usage:
data_prep.py [options]
data_prep.py -h | --help

Options:
-h --help Show this message.
--output_folder=OUT Output folder for the data and reports to be saved.
Expand All @@ -21,7 +20,7 @@
from difflib import get_close_matches
from datetime import datetime, date, time

from covidify.sources import github, wiki
from covidify.covidify_data import DataStore
from covidify.config import REPO, TMP_FOLDER, TMP_GIT, DATA
from covidify.utils.utils import replace_arg_score

Expand All @@ -42,11 +41,13 @@
country = None

if source == 'JHU':
df = github.get()
datastore = DataStore()
df = datastore.jhu_sources()

elif source == 'wiki':
print('Apologies, the wikipedia source is not ready yet - getting github data')
df = github.get()
datastore = DataStore()
df = datastore.wiki_sources()



Expand Down Expand Up @@ -151,7 +152,6 @@ def get_exp_moving_average(tmp, col):
Calculate the number of people that are ACTUALLY infected on a given day
currently infected = sum of people date - (recovored + died)
ex: 5 = 10 - (4 - 1)

'''
current_infected = pd.DataFrame([])
current_infected['currently_infected'] = (df.groupby('file_date').confirmed.sum() - (df.groupby('file_date').deaths.sum() + df.groupby('file_date').recovered.sum()))
Expand Down
7 changes: 4 additions & 3 deletions src/covidify/list_countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import click
import covidify
import numpy as np
from covidify.sources import github
from covidify.config import SCRIPT
from covidify.covidify_data import DataStore
from config import SCRIPT

def get_countries():
print('Getting available countries...')
df = github.get()
datastore = DataStore()
df = datastore.jhu_sources()
df = df[df.confirmed > 0]

countries = sorted(list(set(df.country.values)))
Expand Down
1 change: 0 additions & 1 deletion src/covidify/sources/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def get():
sys.exit(1)

sheets = os.listdir(DATA)

# Clean the result to the sheet tabs we want
print('Getting sheets...')
cleaned_sheets = clean_sheet_names(sheets)
Expand Down