<jupyter_start><jupyter_text>[HPSC COVID-19 14-day Epidemiology Reports](https://www.hpsc.ie/a-z/respiratory/coronavirus/novelcoronavirus/surveillance/covid-1914-dayepidemiologyreports/)This notebook uses data copied from the daily [HPSC COVID-19 14-day Epidemiology Reports](https://www.hpsc.ie/a-z/respiratory/coronavirus/novelcoronavirus/surveillance/covid-1914-dayepidemiologyreports/), from 2021-01-01 to 2021-05-13 (see the [generated CSV file](https://github.com/derekocallaghan/covid19data/tree/main/notebooks/data/HSPC_COVID_Epidmiology_14Day_Report.csv)). It is currently used to perform some exploratory analysis of age group hospitalisation.<jupyter_code>df = pd.read_csv('./data/HSPC_COVID_Epidmiology_14Day_Report.csv', sep=" ", skiprows=13, parse_dates=["Date"], date_parser=lambda x: datetime.strptime(x, "%Y-%m-%d"))
df<jupyter_output><empty_output><jupyter_text>There appears to be an issue with the "Cases hospitalised (%)" for 2021-03-17 (total > 100%), so it's excluded for now. It has been confirmed that the [original report](https://www.hpsc.ie/a-z/respiratory/coronavirus/novelcoronavirus/surveillance/covid-1914-dayepidemiologyreports/COVID-19%2014%20day%20epidemiology%20report_20210317%20website%20final.pdf) also contains this issue.<jupyter_code>df[df.Date=='2021-03-17']
df = df[df.Date!='2021-03-17']<jupyter_output><empty_output><jupyter_text>Although there has been an increase in % hospitalisation for age groups 0-18 since approximately end of January, this is likely to be related to the corresponding decrease for age groups 75+.<jupyter_code>ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (df["Age Group (years)"].isin(['0-4', '5-12', '13-18', '19-24', '75-84', '85+']))], x='Date', y='Cases hospitalised (%)', hue='Age Group (years)')
ax.set_title('HPSC 14-day reports: Cases hospitalised (%) 2021, Age 0-24, 75+')
plt.xticks(rotation=30);<jupyter_output><empty_output><jupyter_text>Corresponding total cases hospitalised for these age groups<jupyter_code>ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (df["Age Group (years)"].isin(['0-4', '5-12', '13-18', '19-24', '75-84', '85+']))], x='Date', y='Cases hospitalised (n)', hue='Age Group (years)')
ax.set_title('HPSC 14-day reports: Cases hospitalised (n) 2021, Age 0-24, 75+')
plt.xticks(rotation=30);<jupyter_output><empty_output><jupyter_text>Corresponding total cases hospitalised for age 0-18<jupyter_code>ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (df["Age Group (years)"].isin(['0-4', '5-12', '13-18']))], x='Date', y='Cases hospitalised (n)', hue='Age Group (years)')
ax.set_title('HPSC 14-day reports: Cases hospitalised (n) 2021, Age 0-18')
plt.xticks(rotation=30);<jupyter_output><empty_output><jupyter_text>The "*Cases hospitalised (%)*" column in the source data is the percentage for a particular age group of the total cases hospitalised. Here, the percentage of the corresponding age group "*Number of cases (n)*" is calculated.<jupyter_code>df['AgeGroupHospPerc'] = df['Cases hospitalised (n)']*100/df['Number of cases (n)']
df.head()<jupyter_output><empty_output><jupyter_text>Daily/fortnightly mean hospitalised/cases percentage for 0-18, 75+<jupyter_code>ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (df["Age Group (years)"].isin(['0-4', '5-12', '13-18', '75-84', '85+']))], x='Date', y='AgeGroupHospPerc', hue='Age Group (years)')
ax.set_ylabel('% Hospitalisation/Cases')
ax.set_title('HPSC 14-day reports: Daily Hospitalisation/Cases (%) 2021, Age 0-18, 75+')
plt.xticks(rotation=30);

ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (df["Age Group (years)"].isin(['0-4', '5-12', '13-18', '75-84', '85+']))].groupby('Age Group (years)').resample('2W-MON', on='Date').mean().reset_index(), x='Date', y='AgeGroupHospPerc', hue='Age Group (years)')
ax.set_ylabel('% Hospitalisation/Cases')
ax.set_title('HPSC 14-day reports: Fortnightly Mean Hospitalisation/Cases (%) 2021, Age 0-18, 75+')
plt.xticks(rotation=30);<jupyter_output><empty_output><jupyter_text>Daily/14D/fortnightly mean hospitalised/cases percentage for 0-24<jupyter_code>ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (df["Age Group (years)"].isin(['0-4', '5-12', '13-18', '19-24']))], x='Date', y='AgeGroupHospPerc', hue='Age Group (years)')
ax.set_ylabel('% Hospitalisation/Cases')
ax.set_title('HPSC 14-day reports: Daily Hospitalisation/Cases (%) 2021, Age 0-24')
plt.xticks(rotation=30);
rdf = df[(df.Date>='2021-01-01')].copy()
rdf.Date = rdf.Date.dt.round('14D')
ax=sns.lineplot(data=rdf[(rdf["Age Group (years)"].isin(['0-4', '5-12', '13-18', '19-24']))], x='Date', y='AgeGroupHospPerc', hue='Age Group (years)')
ax.set_ylim((0,6.3))
ax.set_ylabel('% Hospitalisation/Cases')
ax.set_title('HPSC 14-day reports: 14D (Mean, 95% CI) Hospitalisation/Cases (%) 2021, Age 0-24')
plt.legend(loc='upper left')
plt.xticks(rotation=30);
ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (df["Age Group (years)"].isin(['0-4', '5-12', '13-18', '19-24']))].groupby('Age Group (years)').resample('2W-MON', on='Date').mean().reset_index(), x='Date', y='AgeGroupHospPerc', hue='Age Group (years)', hue_order=['0-4', '5-12', '13-18', '19-24'])
ax.set_ylim((0,6.3))
ax.set_ylabel('% Hospitalisation/Cases')
ax.set_title('HPSC 14-day reports: Fortnightly Mean Hospitalisation/Cases (%) 2021, Age 0-24')
plt.xticks(rotation=30);<jupyter_output><empty_output><jupyter_text>Daily/14D/fortnightly mean hospitalised/cases percentage for all ages<jupyter_code>ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (~df["Age Group (years)"].isin(['Unknown']))], x='Date', y='AgeGroupHospPerc', hue='Age Group (years)', hue_order=['0-4', '5-12', '13-18', '19-24', '25-34', '35-44', '45-54', '55-64', '65-74', '75-84', '85+'])
ax.set_ylabel('% Hospitalisation/Cases')
ax.set_title('HPSC 14-day reports: Daily Hospitalisation/Cases (%) 2021, All Ages (from HPSC 14-day totals)')
plt.xticks(rotation=30);
ax=sns.lineplot(data=rdf[(~rdf["Age Group (years)"].isin(['Unknown']))], x='Date', y='AgeGroupHospPerc', hue='Age Group (years)', hue_order=['0-4', '5-12', '13-18', '19-24', '25-34', '35-44', '45-54', '55-64', '65-74', '75-84', '85+'])
ax.set_ylabel('% Hospitalisation/Cases')
ax.set_title('HPSC 14-day reports: 14D (Mean, 95% CI) Hospitalisation/Cases (%) 2021, All Ages')
plt.legend(loc='upper left')
plt.xticks(rotation=30);
ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (~df["Age Group (years)"].isin(['Unknown']))].groupby('Age Group (years)').resample('2W-MON', on='Date').mean().reset_index(), x='Date', y='AgeGroupHospPerc', hue='Age Group (years)', hue_order=['0-4', '5-12', '13-18', '19-24', '25-34', '35-44', '45-54', '55-64', '65-74', '75-84', '85+'])
ax.set_ylabel('% Hospitalisation/Cases')
ax.set_title('HPSC 14-day reports: Fortnightly Mean Hospitalisation/Cases (%) 2021, All Ages (from HPSC 14-day totals)')
plt.xticks(rotation=30);<jupyter_output><empty_output><jupyter_text>14-day total cases hospitalised for 0-24, all ages<jupyter_code>ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (df["Age Group (years)"].isin(['0-4', '5-12', '13-18', '19-24']))], x='Date', y='Cases hospitalised (n)', hue='Age Group (years)')
ax.set_title('HPSC 14-day totals: Cases hospitalised (n) 2021, Age 0-24')
plt.xticks(rotation=30);
ax=sns.lineplot(data=df[(df.Date>='2021-01-01') & (~df["Age Group (years)"].isin(['Unknown']))], x='Date', y='Cases hospitalised (n)', hue='Age Group (years)', hue_order=['0-4', '5-12', '13-18', '19-24', '25-34', '35-44', '45-54', '55-64', '65-74', '75-84', '85+'])
ax.set_title('HPSC 14-day totals: Cases hospitalised (n) 2021, All Ages')
plt.xticks(rotation=30);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2180194378775939, 'fraction_numerical': 0.08917783031258208, 'mean_word_length': 7.109691160809372, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 54, 'https://': 4, 'lorem ipsum': 0, 'www.': 3, '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': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '490851', 'license': 'Apache-2.0', 'n_tokens_mistral': 3478, 'n_tokens_neox': 2920, 'n_words': 562, 'path': 'notebooks/HPSC COVID-19 14-day Epidemiology Reports.ipynb', 'repo_name': 'derekocallaghan/covid19data', 'size': '7614'}