<jupyter_start><jupyter_text>Cases 7-day mean (US state, country)<jupyter_code>from covidvu.cryostation import Cryostation
from covidvu.config import MASTER_DATABASE
import os
import pandas as pd
dbName = os.path.join('..', MASTER_DATABASE)
with Cryostation(dbName) as cryostation:
    country = cryostation['US']
state = 'Oregon'
cases = country['provinces'][state]['confirmed']
offset = 0
casesByDate = dict()
counts = [count for count in cases.values()]
for date in cases.keys():
    if offset == 0:
        casesByDate[date] = 0
    else:
        casesByDate[date] = abs(counts[offset]-counts[offset-1])
    offset += 1
dataset = pd.DataFrame(casesByDate.items(), columns = ['date', 'new cases'])
dataset['7DayMean'] = dataset.rolling(7).mean()
import plotly
import plotly.graph_objs as go
barChart = go.Bar(x = dataset['date'], y = dataset['new cases'], name = 'new cases', opacity = 0.35)
lineChart = go.Scatter(x = dataset['date'], y = dataset['7DayMean'], name = '7-day mean', line_color = '#000000')
figure = go.Figure(data = barChart)
figure.layout['title'] = state
figure.add_trace(lineChart)
dataset.tail(10)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15130434782608695, 'fraction_numerical': 0.018260869565217393, 'mean_word_length': 5.359116022099448, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '639598', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 410, 'n_tokens_neox': 388, 'n_words': 98, 'path': 'work/experiments/US-global-cases-7-day-mean.ipynb', 'repo_name': 'VirusTrack/COVIDvu', 'size': '1150'}