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 18 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
6 changes: 5 additions & 1 deletion content/blog/2020-08-28-api.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ 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)
query_date <- "2020-08-01"
Expand All @@ -300,6 +300,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 @@ -401,6 +402,9 @@ this is the `fb-survey` data source's `smoothed_hh_cmnty_cli` signal.
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),
Expand Down
192 changes: 9 additions & 183 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 @@ -294,182 +293,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 @@ -556,13 +380,15 @@ <h2>Accessing the API</h2>
<pre class="python"><code>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))
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,
and mapping data from our API. (Note that the Export Data feature in the map can
also show you example R or Python code to download any signal from the map.)
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
15 changes: 8 additions & 7 deletions content/blog/2020-09-18-google-survey.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@
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="#cli-in-community">CLI-in-Community</a></li>
<li><a href="#our-two-surveys">Our Two Surveys</a></li>
<li><a href="#google-survey-redux">Google Survey Redux</a></li>
<li><a href="#short-background" id="toc-short-background">Short Background</a></li>
<li><a href="#cli-in-community" id="toc-cli-in-community">CLI-in-Community</a></li>
<li><a href="#our-two-surveys" id="toc-our-two-surveys">Our Two Surveys</a></li>
<li><a href="#google-survey-redux" id="toc-google-survey-redux">Google Survey Redux</a></li>
</ul>
</div>

Expand Down Expand Up @@ -138,6 +137,8 @@ <h2>CLI-in-Community</h2>
library(ggplot2)
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 county-level Google and Facebook % CLI-in-community signals, and JHU
# confirmed case incidence proportion
df_go = covidcast_signal(&quot;google-survey&quot;, &quot;smoothed_cli&quot;, geo_type = &quot;state&quot;)
Expand Down Expand Up @@ -195,7 +196,7 @@ <h2>CLI-in-Community</h2>
<p>In both plots, we see a reassuring trend,
but the trend on the left is noticeably stronger.
Indeed, the correlation here between the Google signal and case rates is
0.84,
0.83,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isnt a huge change, but it is kind of concerning... i think we can probably sweep it under the rug for now, unless @rlunde feels like escalating it.

while that between the Facebook signal and case rates is
0.64.
To be fair, we should note that the Google signal comprises a much
Expand Down Expand Up @@ -330,7 +331,7 @@ <h2>Google Survey Redux</h2>
or manually (in collaboration with partners in public health and/or data
journalists). Stay tuned to the Delphi blog for updates.</p>
</div>
<div class="footnotes">
<div class="footnotes footnotes-end-of-document">
<hr />
<ol>
<li id="fn1"><p>In the survey methodology literature, a “proxy question” is one in which
Expand Down
5 changes: 2 additions & 3 deletions content/blog/2020-10-06-survey-wave-4.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ output:
blogdown::html_page:
toc: true
---
```{r, echo=FALSE}
options(covidcast.auth = Sys.getenv("API_KEY"))
```
Beginning in early April 2020, the `r blogdown::shortcode_html("reflink", "/", "Delphi group")` has
conducted a major survey to track COVID-19 across the United States. With the
support of Facebook Data for Good, we have been able to recruit tens of
Expand Down Expand Up @@ -95,6 +92,8 @@ version is Wave 4.

```{r sample-size, message=FALSE, include=FALSE}
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
minhkhul marked this conversation as resolved.
Show resolved Hide resolved

start_day <- "2020-09-08"
end_day <- "2020-10-07"

Expand Down
Loading