diff --git a/README.md b/README.md index e94923272..0bfae9ebb 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ As an alternative you can use Docker and Docker Compose: 1. `docker-compose up -d` to create a docker container for the current environment. 1. `docker-compose exec r bash` to jump into the container. 1. `micromamba activate www-main` to activate the environment +2. `export API_KEY=y0urAp1kEy` to add your own api key as env variable. Now you have the environment ready to start converting .Rmd blog files to html. #### Commands diff --git a/content/blog/2020-08-26-fb-survey.Rmd b/content/blog/2020-08-26-fb-survey.Rmd index 598ba02cc..0a49d9489 100644 --- a/content/blog/2020-08-26-fb-survey.Rmd +++ b/content/blog/2020-08-26-fb-survey.Rmd @@ -47,9 +47,6 @@ output: toc: true --- -```{r, echo=FALSE} -options(covidcast.auth = Sys.getenv("API_KEY")) -``` Since April 2020, in collaboration with Facebook, partner universities, and public health officials, @@ -140,6 +137,8 @@ library(covidcast) library(dplyr) library(gridExtra) +options(covidcast.auth = Sys.getenv("API_KEY")) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html + # Fetch Facebook % CLI signal and JHU confirmed case incidence proportion at # the state level start_day = "2020-06-15" diff --git a/content/blog/2020-08-26-fb-survey.html b/content/blog/2020-08-26-fb-survey.html index 0516c82b5..758fb7b4d 100644 --- a/content/blog/2020-08-26-fb-survey.html +++ b/content/blog/2020-08-26-fb-survey.html @@ -47,20 +47,19 @@ toc: true --- -
@@ -141,6 +140,8 @@

Short Background

library(dplyr) library(gridExtra) +options(covidcast.auth = Sys.getenv("API_KEY")) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html + # Fetch Facebook % CLI signal and JHU confirmed case incidence proportion at # the state level start_day = "2020-06-15" diff --git a/content/blog/2020-08-28-api.Rmd b/content/blog/2020-08-28-api.Rmd index 3828a5b36..c8675d28b 100644 --- a/content/blog/2020-08-28-api.Rmd +++ b/content/blog/2020-08-28-api.Rmd @@ -282,9 +282,10 @@ and ask "What was known _as of_ this date?" This is important because estimates can change for _weeks_ as new data arrives: -```{r q-versioning, warning=FALSE, message=FALSE, cache=TRUE} +```{r q-versioning, warning=FALSE, message=FALSE, cache=TRUE, eval=FALSE} library(covidcast) library(dplyr) +options(covidcast.auth = Sys.getenv("API_KEY")) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html query_date <- "2020-08-01" covidcast_signal( data_source = "quidel", @@ -300,6 +301,7 @@ covidcast_signal( col.names = c("Test date", "Positivity rate (%)", "Sample size", "Issued on", "Lag (days)")) ``` +*November 2023 update: Quidel data is no longer publicly available, so the table generated by the code chunk above has been removed.* Many data sources are subject to revisions: @@ -359,6 +361,7 @@ that are due to COVID-19 in several states. ```{r dv-graph, message=FALSE, cache=TRUE} library(covidcast) +options(covidcast.auth = Sys.getenv("API_KEY")) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html hosp <- covidcast_signal( data_source = "hospital-admissions", signal = "smoothed_adj_covid19_from_claims", start_day = "2020-03-01", end_day = "2020-08-30", @@ -398,14 +401,17 @@ this is the `fb-survey` data source's `smoothed_hh_cmnty_cli` signal. (Click the "Code" button to see the Python code used to produce this example.) ```{python python-data, dev='svg'} +import matplotlib.pyplot as plt import covidcast from datetime import date -import matplotlib.pyplot as plt +import os + +covidcast.use_api_key(os.environ['API_KEY']) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html data = covidcast.signal("fb-survey", "smoothed_hh_cmnty_cli", date(2020, 9, 8), date(2020, 9, 8), geo_type="state") -covidcast.plot_choropleth(data, figsize=(7, 5)) +covidcast.plot(data, plot_type="choropleth", figsize=(7, 5)) plt.title("% who know someone who is sick, Sept 8, 2020") ``` diff --git a/content/blog/2020-08-28-api.html b/content/blog/2020-08-28-api.html index 5a16146ff..8866b34e8 100644 --- a/content/blog/2020-08-28-api.html +++ b/content/blog/2020-08-28-api.html @@ -51,15 +51,14 @@ toc: true --- -
@@ -280,6 +279,7 @@

Tracking Observations and Revisions

can change for weeks as new data arrives:

library(covidcast)
 library(dplyr)
+options(covidcast.auth = Sys.getenv("API_KEY")) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html
 query_date <- "2020-08-01"
 covidcast_signal(
   data_source = "quidel",
@@ -294,182 +294,7 @@ 

Tracking Observations and Revisions

knitr::kable("html", digits = 2, col.names = c("Test date", "Positivity rate (%)", "Sample size", "Issued on", "Lag (days)"))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-Test date - -Positivity rate (%) - -Sample size - -Issued on - -Lag (days) -
-2020-08-01 - -1.01 - -198 - -2020-08-06 - -5 -
-2020-08-01 - -0.97 - -206 - -2020-08-07 - -6 -
-2020-08-01 - -1.41 - -284 - -2020-08-10 - -9 -
-2020-08-01 - -1.38 - -290 - -2020-08-12 - -11 -
-2020-08-01 - -1.33 - -377 - -2020-08-16 - -15 -
-2020-08-01 - -1.53 - -459 - -2020-08-19 - -18 -
-2020-08-01 - -1.47 - -477 - -2020-08-20 - -19 -
-2020-08-01 - -1.46 - -479 - -2020-08-26 - -25 -
-2020-08-01 - -1.36 - -513 - -2020-08-30 - -29 -
+

November 2023 update: Quidel data is no longer publicly available, so the table generated by the code chunk above has been removed.

Many data sources are subject to revisions: