Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix blog build #891

Merged
merged 26 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
8eaf48d
add instruction to build blog locally with personal api key
minhkhul Nov 10, 2023
ad85648
fix quidel #887 by removing r chunk result + warn readers
minhkhul Nov 10, 2023
197a505
upgrade python covidcast version + add api key to python chunk in blog
minhkhul Nov 10, 2023
1c9b847
api key add on
minhkhul Nov 10, 2023
d21f9a9
generated files
minhkhul Nov 10, 2023
9f29096
Revert "generated files"
minhkhul Nov 16, 2023
5198217
Update content/blog/2020-08-28-api.Rmd
minhkhul Nov 16, 2023
367e3f7
Update content/blog/2020-08-28-api.Rmd
minhkhul Nov 16, 2023
9a77f66
Update content/blog/2020-08-28-api.Rmd
minhkhul Nov 16, 2023
2875e9f
Update content/blog/2020-10-06-survey-wave-4.Rmd
minhkhul Nov 16, 2023
e7bec51
Update content/blog/2020-12-10-masks-public.Rmd
minhkhul Nov 16, 2023
3c8b2d6
Update content/blog/2021-01-22-holiday-surveys.Rmd
minhkhul Nov 16, 2023
ace2791
Update content/blog/_2021-04-20-jj-vaccine.Rmd
minhkhul Nov 16, 2023
8e53525
generated files (only ones with code changes)
minhkhul Nov 16, 2023
059a499
Revert "generated files (only ones with code changes)"
minhkhul Nov 20, 2023
887e338
add api keys visibility + instruction link
minhkhul Nov 20, 2023
302ce60
more api key visibility + instruction link
minhkhul Nov 20, 2023
17a1150
generated html for files with code changes
minhkhul Nov 20, 2023
57c77f3
Revert "generated html for files with code changes"
minhkhul Nov 22, 2023
665df51
every R chunk that import library(covidcast) will have an associated …
minhkhul Nov 22, 2023
fe5e6ff
fix visuals not showing up due to warning messages
minhkhul Nov 22, 2023
9bf703d
workaround render python chunk plot
minhkhul Nov 27, 2023
bd88c4b
generated files from rmd with changes
minhkhul Nov 27, 2023
529d4d8
remove warning in blog 2021-01-15-causal-effect-mobility
minhkhul Dec 5, 2023
4da2286
clean up plot fix
minhkhul Dec 5, 2023
bd7ec32
remove warning 2020-12-10-masks-public
minhkhul Dec 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions content/blog/2020-08-26-fb-survey.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand Down
19 changes: 10 additions & 9 deletions content/blog/2020-08-26-fb-survey.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,19 @@
toc: true
---

<script src="/rmarkdown-libs/header-attrs/header-attrs.js"></script>

<div id="TOC">
<ul>
<li><a href="#short-background">Short Background</a></li>
<li><a href="#why-run-these-surveys">Why Run These Surveys?</a></li>
<li><a href="#whats-in-the-survey">What’s in the Survey?</a></li>
<li><a href="#some-interesting-examples">Some Interesting Examples</a></li>
<li><a href="#basic-correlation-analysis">Basic Correlation Analysis</a>
<li><a href="#short-background" id="toc-short-background">Short Background</a></li>
<li><a href="#why-run-these-surveys" id="toc-why-run-these-surveys">Why Run These Surveys?</a></li>
<li><a href="#whats-in-the-survey" id="toc-whats-in-the-survey">What’s in the Survey?</a></li>
<li><a href="#some-interesting-examples" id="toc-some-interesting-examples">Some Interesting Examples</a></li>
<li><a href="#basic-correlation-analysis" id="toc-basic-correlation-analysis">Basic Correlation Analysis</a>
<ul>
<li><a href="#correlations-sliced-by-time">Correlations Sliced by Time</a></li>
<li><a href="#correlations-sliced-by-county">Correlations Sliced by County</a></li>
<li><a href="#correlations-sliced-by-time" id="toc-correlations-sliced-by-time">Correlations Sliced by Time</a></li>
<li><a href="#correlations-sliced-by-county" id="toc-correlations-sliced-by-county">Correlations Sliced by County</a></li>
</ul></li>
<li><a href="#whats-next-with-the-surveys">What’s Next with the Surveys</a></li>
<li><a href="#whats-next-with-the-surveys" id="toc-whats-next-with-the-surveys">What’s Next with the Surveys</a></li>
</ul>
</div>

Expand Down Expand Up @@ -141,6 +140,8 @@ <h2>Short Background</h2>
library(dplyr)
library(gridExtra)

options(covidcast.auth = Sys.getenv(&quot;API_KEY&quot;)) # 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 = &quot;2020-06-15&quot;
Expand Down
12 changes: 9 additions & 3 deletions content/blog/2020-08-28-api.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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}
minhkhul marked this conversation as resolved.
Show resolved Hide resolved
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",
Expand All @@ -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:

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
minhkhul marked this conversation as resolved.
Show resolved Hide resolved

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")
```

Expand Down
199 changes: 14 additions & 185 deletions content/blog/2020-08-28-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@
toc: true
---

<script src="/rmarkdown-libs/header-attrs/header-attrs.js"></script>

<div id="TOC">
<ul>
<li><a href="#purpose-of-the-api">Purpose of the API</a></li>
<li><a href="#unique-data-sources">Unique Data Sources</a></li>
<li><a href="#tracking-observations-and-revisions">Tracking Observations and Revisions</a></li>
<li><a href="#accessing-the-api">Accessing the API</a></li>
<li><a href="#putting-the-api-to-work">Putting the API to Work</a></li>
<li><a href="#purpose-of-the-api" id="toc-purpose-of-the-api">Purpose of the API</a></li>
<li><a href="#unique-data-sources" id="toc-unique-data-sources">Unique Data Sources</a></li>
<li><a href="#tracking-observations-and-revisions" id="toc-tracking-observations-and-revisions">Tracking Observations and Revisions</a></li>
<li><a href="#accessing-the-api" id="toc-accessing-the-api">Accessing the API</a></li>
<li><a href="#putting-the-api-to-work" id="toc-putting-the-api-to-work">Putting the API to Work</a></li>
</ul>
</div>

Expand Down Expand Up @@ -280,6 +279,7 @@ <h2>Tracking Observations and Revisions</h2>
can change for <em>weeks</em> as new data arrives:</p>
<pre class="r"><code>library(covidcast)
library(dplyr)
options(covidcast.auth = Sys.getenv(&quot;API_KEY&quot;)) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html
query_date &lt;- &quot;2020-08-01&quot;
covidcast_signal(
data_source = &quot;quidel&quot;,
Expand All @@ -294,182 +294,7 @@ <h2>Tracking Observations and Revisions</h2>
knitr::kable(&quot;html&quot;, digits = 2,
col.names = c(&quot;Test date&quot;, &quot;Positivity rate (%)&quot;, &quot;Sample size&quot;,
&quot;Issued on&quot;, &quot;Lag (days)&quot;))</code></pre>
<table>
<thead>
<tr>
<th style="text-align:left;">
Test date
</th>
<th style="text-align:right;">
Positivity rate (%)
</th>
<th style="text-align:right;">
Sample size
</th>
<th style="text-align:left;">
Issued on
</th>
<th style="text-align:right;">
Lag (days)
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
1.01
</td>
<td style="text-align:right;">
198
</td>
<td style="text-align:left;">
2020-08-06
</td>
<td style="text-align:right;">
5
</td>
</tr>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
0.97
</td>
<td style="text-align:right;">
206
</td>
<td style="text-align:left;">
2020-08-07
</td>
<td style="text-align:right;">
6
</td>
</tr>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
1.41
</td>
<td style="text-align:right;">
284
</td>
<td style="text-align:left;">
2020-08-10
</td>
<td style="text-align:right;">
9
</td>
</tr>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
1.38
</td>
<td style="text-align:right;">
290
</td>
<td style="text-align:left;">
2020-08-12
</td>
<td style="text-align:right;">
11
</td>
</tr>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
1.33
</td>
<td style="text-align:right;">
377
</td>
<td style="text-align:left;">
2020-08-16
</td>
<td style="text-align:right;">
15
</td>
</tr>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
1.53
</td>
<td style="text-align:right;">
459
</td>
<td style="text-align:left;">
2020-08-19
</td>
<td style="text-align:right;">
18
</td>
</tr>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
1.47
</td>
<td style="text-align:right;">
477
</td>
<td style="text-align:left;">
2020-08-20
</td>
<td style="text-align:right;">
19
</td>
</tr>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
1.46
</td>
<td style="text-align:right;">
479
</td>
<td style="text-align:left;">
2020-08-26
</td>
<td style="text-align:right;">
25
</td>
</tr>
<tr>
<td style="text-align:left;">
2020-08-01
</td>
<td style="text-align:right;">
1.36
</td>
<td style="text-align:right;">
513
</td>
<td style="text-align:left;">
2020-08-30
</td>
<td style="text-align:right;">
29
</td>
</tr>
</tbody>
</table>
<p><em>November 2023 update: Quidel data is no longer publicly available, so the table generated by the code chunk above has been removed.</em></p>
<p>Many data sources are subject to revisions:</p>
<ul>
<li>Case and death counts are frequently corrected or adjusted by authorities.</li>
Expand Down Expand Up @@ -520,6 +345,7 @@ <h2>Accessing the API</h2>
that are due to COVID-19 in several states.
(Click the “Code” button to see the R code used to produce this example.)</p>
<pre class="r"><code>library(covidcast)
options(covidcast.auth = Sys.getenv(&quot;API_KEY&quot;)) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html
hosp &lt;- covidcast_signal(
data_source = &quot;hospital-admissions&quot;, signal = &quot;smoothed_adj_covid19_from_claims&quot;,
start_day = &quot;2020-03-01&quot;, end_day = &quot;2020-08-30&quot;,
Expand Down Expand Up @@ -553,14 +379,17 @@ <h2>Accessing the API</h2>
According to the {{< apireflink "api/covidcast-signals/fb-survey.html" "relevant documentation page" >}},
this is the <code>fb-survey</code> data source’s <code>smoothed_hh_cmnty_cli</code> signal.
(Click the “Code” button to see the Python code used to produce this example.)</p>
<pre class="python"><code>import covidcast
<pre class="python"><code>import matplotlib.pyplot as plt
import covidcast
from datetime import date
import matplotlib.pyplot as plt
import os

covidcast.use_api_key(os.environ[&#39;API_KEY&#39;]) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html

data = covidcast.signal(&quot;fb-survey&quot;, &quot;smoothed_hh_cmnty_cli&quot;,
date(2020, 9, 8), date(2020, 9, 8),
geo_type=&quot;state&quot;)
covidcast.plot_choropleth(data, figsize=(7, 5))
covidcast.plot(data, plot_type=&quot;choropleth&quot;, figsize=(7, 5))
plt.title(&quot;% who know someone who is sick, Sept 8, 2020&quot;)</code></pre>
<p><img src="/blog/2020-08-28-api_files/figure-html/python-data-1.svg" /><!-- --></p>
<p>Each package’s documentation gives numerous other examples of pulling, plotting,
Expand Down
2 changes: 2 additions & 0 deletions content/blog/2020-09-18-google-survey.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ library(dplyr)
library(ggplot2)
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 county-level Google and Facebook % CLI-in-community signals, and JHU
# confirmed case incidence proportion
df_go = covidcast_signal("google-survey", "smoothed_cli", geo_type = "state")
Expand Down
Loading
Loading