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

Fix blog build #891

merged 26 commits into from
Dec 5, 2023

Conversation

minhkhul
Copy link
Contributor

@minhkhul minhkhul commented Nov 10, 2023

This PR fixes 2 main problems with blog build + misc api key related improvements as following:

Fix #887

Fix Quidel data references in blog post by:

  • Remove R chunk result, so the code in the blog is still available for readers, but the resulting data won't be.
  • Warn readers that quidel data is no longer available for public.
    This approach preserves the content of the blog post while satisfying our goal to not show quidel data.

Fix covidcast versioning in python chunk

Problem: A blog post was not building due to lacking api key in a python chunk in the .Rmd. The deeper problem was the python covidcast version was locked at 0.1.3 since 3 years ago (not due to a need for that particular version), so the error messages were not helpful.
Solution: Add api key to post & upgrade covidcast version to latest, which fixed the problem.

Misc improvements:

  • Add instruction to build blog locally with personal api key in readme.
  • Make references to API key invisible in old blog posts. Make references to API key visible in old blog posts + instruction on how to get an API key for readers.
  • Plot display workaround.

Copy link

netlify bot commented Nov 10, 2023

Deploy Preview for cmu-delphi-main ready!

Name Link
🔨 Latest commit bd7ec32
🔍 Latest deploy log https://app.netlify.com/sites/cmu-delphi-main/deploys/656f600c3e755e00089e4552
😎 Deploy Preview https://deploy-preview-891--cmu-delphi-main.netlify.app/blog/2020/12/13/are-masks-widely-used-in-public
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

  • Nice job getting this to build!

  • I made a number of in-line comments regarding whitespace/formatting consistency (but they are mostly inconsequential), and one comment for verbiage that i think is important.

  • I don't know how we prevented it from being displayed before, but now the "template post" page is showing up in the netlify preview on the list of blog posts and as the article itself. It does not show on the current live site blog post list and the article page does not exist there either. We could delete the template file entirely to solve this, but i think it is probably worthwhile to keep as a reference if possible.

  • Are we sure we want to regenerate [all of] these blog post pages?

    • For instance, see the significant diff for the image file static/blog/2021-09-30-ensemble-analysis_files/figure-html/plot-forecasts-1.svg -- the newly generated version has a very different time scale on the x-axis (presumably because the maximum date was not specified in the code that produces it), and it may no longer convey the same meaning and detail as was originally intended. There could be more examples of this among the other images, but i did not inspect them all.

    • Not rebuilding [all of] the pages would also let us keep the 2020-08-28-api.html file intact, which preserves the quidel data table that becomes inaccessible with a rebuild. I dont think that we should be too concerned with trying to remove the table from our site, since it has already been captured by the wayback machine.

    • The generated stuff includes changes to js & css files which may be important for dependencies or style updates, but i'm not sure what the ramifications are.

  • Most or all of it is hidden now, but do we want to show the "API key"-related code? That makes it easier for users to replicate the results we showcase in the blog posts, it may encourage more users to sign up for and use API keys, and it can provide references for users who may run into API key problems in the future. This point becomes moot if we are going to preserve the "old" snapshots of the blog posts.

We probably want input from @rlunde on the questions i raised above.

content/blog/2020-08-28-api.Rmd Outdated Show resolved Hide resolved
content/blog/2020-08-28-api.Rmd Outdated Show resolved Hide resolved
content/blog/2020-08-28-api.Rmd Outdated Show resolved Hide resolved
content/blog/2020-10-06-survey-wave-4.Rmd Outdated Show resolved Hide resolved
content/blog/2020-12-10-masks-public.Rmd Outdated Show resolved Hide resolved
content/blog/2021-01-22-holiday-surveys.Rmd Outdated Show resolved Hide resolved
content/blog/2020-08-26-fb-survey.Rmd Outdated Show resolved Hide resolved
content/blog/_2021-04-20-jj-vaccine.Rmd Outdated Show resolved Hide resolved
minhkhul and others added 9 commits November 15, 2023 22:51
This reverts commit d21f9a9.
Co-authored-by: melange396 <george.haff@gmail.com>
Co-authored-by: melange396 <george.haff@gmail.com>
Co-authored-by: melange396 <george.haff@gmail.com>
Co-authored-by: melange396 <george.haff@gmail.com>
Co-authored-by: melange396 <george.haff@gmail.com>
Co-authored-by: melange396 <george.haff@gmail.com>
Co-authored-by: melange396 <george.haff@gmail.com>
@rlunde
Copy link
Contributor

rlunde commented Nov 16, 2023

I like the idea of showing how the API key is used.

Also, only updating blog posts that have code changes is a good idea - thanks!

Do you know if we're going to have problems with it trying to add recreated markdown / html assets in the future, for blog posts that are not changed?

@minhkhul
Copy link
Contributor Author

@melange396 So for the API key related code, I have a few questions. Right now api-related code is written as sth like this options(covidcast.auth = Sys.getenv("API_KEY")) where the api key comes from system variable for CI purpose, but I'm not sure how to show a correct example key syntax without explaining the full context of api keys in the blog. I'm thinking of doing something like this:
options(covidcast.auth = Sys.getenv("API_KEY")) <!-- To know more about how api keys work, visit insert-api-docs-link-->
Do you think it's a good idea? and what link should I use?

@melange396
Copy link
Contributor

Do you think it's a good idea? and what link should I use?

Yeah, thats a great idea. I would use the python/rlang comment convention so it looks something like this:

options(covidcast.auth = Sys.getenv("API_KEY")) # for more on API keys, see: https://cmu-delphi.github.io/delphi-epidata/api/api_keys.html

@rlunde
Copy link
Contributor

rlunde commented Nov 20, 2023

@minhkhul @melange396 I've lost track of where we are with this one. Does Minh's last commit address all of the changes George asked for, or do we still need to figure out whether the template blog is still visible?

@minhkhul
Copy link
Contributor Author

minhkhul commented Nov 20, 2023

@rlunde @melange396 So I couldn't figure out exactly how the template-post hiding mechanism works, in that it historically has shown up in netlify preview, but is not seen in our released site. But in previous blog posts releases, I added new blog posts without making any changes related to the template post. So I don't think there needs to be any changes to that template posts now for it to be hidden. It's just that I have been looking around the repo for the past 15 minutes and could not find exactly how template-post is hidden. But it is.

@minhkhul
Copy link
Contributor Author

@melange396 So regarding the template file, the template rmd file is marked as a draft. Netlify previews are configured to build drafts while our actual deployment does not.
So we dont need to make changes to the template files. It won't be visible in the actual site.

@melange396
Copy link
Contributor

So regarding the template file, the template rmd file is marked as a draft. Netlify previews are configured to build drafts while our actual deployment does not.

Good find! Might we want to change the 'deploy-preview' build command so our Netlify preview actually reflects what will be pushed live? Or if we dont wanna go that far, we should at least add to the comment on the draft: true line to explain that it will show up in the Netlify preview but not on the fully live site...

Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

Comments on visibility and scope of a couple of the options(covidcast.auth = Sys.getenv("API_KEY")) # for more on API keys, see: https://... lines, and i found a number of rendering problems.

content/blog/2020-10-06-survey-wave-4.Rmd Show resolved Hide resolved
content/blog/2020-08-28-api.Rmd Show resolved Hide resolved
content/blog/2020-08-28-api.Rmd Show resolved Hide resolved
content/blog/2021-01-22-holiday-surveys.Rmd Show resolved Hide resolved
Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

almost there!

@@ -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.

content/blog/2021-01-15-causal-effect-mobility.html Outdated Show resolved Hide resolved
content/blog/2020-12-10-masks-public.html Outdated Show resolved Hide resolved
content/blog/2020-08-28-api.Rmd Outdated Show resolved Hide resolved
@@ -114,7 +115,7 @@ <h2>Travel and Other Social Behaviors During US Holidays</h2>
filter(geo_value %in% str_to_lower(statelist)) %&gt;%
mutate(value = plyr::mapvalues(geo_value, str_to_lower(statelist), regions),
value = as.integer(factor(value)))

attr(regionmap, &quot;metadata&quot;) &lt;- list(geo_type = &quot;state&quot;)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is weird: it was added in https://github.com/cmu-delphi/www-main/pull/706/files#diff-1fa4417df3994a017fb9ca08ed2a579d658b7167ccdae44b295a9e3aa3bf0880R111 but hasnt shown up til now... i guess we havent actually re-rendered this page in over a year? [no action needed; just wanted to point this out for posterity]

Copy link
Contributor

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

nice work!

@melange396 melange396 merged commit 0ab92e3 into dev Dec 5, 2023
8 checks passed
@melange396 melange396 deleted the fix-blog-build branch December 5, 2023 17:58
@melange396 melange396 mentioned this pull request Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"blog" build action/CI is broken
3 participants