---
title: "Quickstart"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Quickstart}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
In this vignette we illustrate how to obtain data from the API using scarlet fever data in Ontario as an example.
![](images/Streptococcus_Pyogenes_(Group_A_Strep)_(52602981880).jpg){width="75%"}
(Image From: https://www.flickr.com/photos/niaid/52602981880/)
## Preliminaries
We use the following packages for this illustration.
```{r other_packages, message=FALSE}
library(dplyr)
library(ggplot2)
library(iidda.api)
```
We also turn off messages from the API that are not helpful when presenting this material.
```{r api_options}
options(iidda_api_msgs = FALSE)
```
## Scarlet Fever Data in Ontario
Data from the [canmod digitization project](https://canmod.net/digitization) provides communicable disease incidence data for all notifiable infectious diseases, including scarlet fever. The name of the main dataset from that project is `canmod-cdi-normalized`, which we can get and filter using the following `?featured_data` command.
```{r scarlet_fever_ontario}
scarlet_fever_ontario = featured_data(
dataset_id = "canmod-cdi-normalized"
, iso_3166 = "CA"
, iso_3166_2 = "CA-ON"
, time_scale = "wk"
, basal_disease = "scarlet-fever"
, period_end_date = "1929-08-01..1930-10-01"
)
print(scarlet_fever_ontario)
```
```{r scarlet_fever_ontario_plot, fig.width=7}
(scarlet_fever_ontario
|> ggplot(aes(period_end_date, cases_this_period))
+ geom_line() + geom_point()
+ ggtitle("Scarlet Fever Incidence in Ontario, Canada")
+ theme_bw()
)
```