<jupyter_start><jupyter_text>OSCOVIDA Tutorial: Loading COVID19 data on cases and infections for a countryThe main function to access numbers of infections and deaths as a function of time is `get_country_data`. Here are some examples:<jupyter_code>cases, deaths, label = ov.get_country_data("Italy")<jupyter_output><empty_output><jupyter_text>We now have a Pandas Series object with the `cases` and the `deaths`:<jupyter_code>cases
deaths<jupyter_output><empty_output><jupyter_text>The third return value, here called `label`, is a string that can be used to describe the data - for example if multiple data sets should be plotted together:<jupyter_code>label<jupyter_output><empty_output><jupyter_text>As a quick check, we can plot the cumulative numbers we have retrieved:<jupyter_code>cases.plot();<jupyter_output><empty_output><jupyter_text>Or, if we are interested in the changes from day to day (i.e. to see the new infection per day as a function of time), we can use the `diff()` function that is provided for the Series object:<jupyter_code>cases.diff().plot();<jupyter_output><empty_output><jupyter_text>Regional information within countriesFor some countries, such as Germany and the US, further regional information is available:  GermanyIn Germany, there is a two-level subclassification: there are 16 Bundeslaender (called `regions` in oscovida) and for each Bundesland there are many Landkreise (called 'subregions' in oscovida). Here is how to retrieve such data, for example for the Bundesland Schleswig-Holstein:<jupyter_code>cases, deaths, label = ov.get_country_data("Germany", region="Schleswig-Holstein")
cases.diff().plot();<jupyter_output><empty_output><jupyter_text>To retrieve data for a Landkreis, we can use this notation: (It is not necessary to specify the region here, as the subregions within Germany are unique)<jupyter_code>cases, deaths, label = ov.get_country_data("Germany", subregion="LK Pinneberg")
cases.diff().plot();<jupyter_output><empty_output><jupyter_text>To get a list of regions in Germany, we can use:<jupyter_code>germany = ov.fetch_data_germany()
sorted(germany['Bundesland'].drop_duplicates())<jupyter_output><empty_output><jupyter_text>Similarly, to find the Landkreise, we can use:<jupyter_code>germany = ov.fetch_data_germany()
sorted(germany['Landkreis'].drop_duplicates())<jupyter_output><empty_output><jupyter_text>Note that the Landkreise (LK) which are a Stadt, are labelled with `SK` in the beginning - presumably for Stadtkreis.  United States For the United States, we have the states available:<jupyter_code>cases, deaths, label = ov.get_country_data("US", "California")
cases.diff().plot();<jupyter_output><empty_output><jupyter_text>To get a list of available states, we can use<jupyter_code>us_cases = ov.fetch_cases_US()
sorted(us_cases['Province_State'].drop_duplicates())<jupyter_output><empty_output><jupyter_text>Hungary For Hungary, more regional data is available for the following regions:<jupyter_code>ov.get_counties_hungary()<jupyter_output><empty_output><jupyter_text>As before, the `get_country_data` function can be used:<jupyter_code>cases, deaths, label = ov.get_country_data("Hungary", region="Baranya")
cases<jupyter_output><empty_output><jupyter_text>However, no data on deaths is available for Hungary, so the `deaths` object is just a `None` object:<jupyter_code>deaths
label<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09546258102533883, 'fraction_numerical': 0.0011785503830288745, 'mean_word_length': 8.250681198910081, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, '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': '14', 'dir': 'jupyter-structured-clean-dedup', 'id': '546181', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1081, 'n_words': 324, 'path': 'tools/pelican/content/ipynb/tutorial-accessing-cases-and-deaths.ipynb', 'repo_name': 'slel/oscovida', 'size': '3394'}