/blog

Blogging on the latest, greatest and most spectacular stuff happening around the pharmaverse

Primary LanguageRApache License 2.0Apache-2.0

pharmaverse blog

Purpose

The communications working group (CWG) seeks to promote and showcase how R can be used in the Clinical Reporting pipeline through short and informative blog posts. These posts will be hosted on this pharmaverse blog and promoted on the pharmaverse slack channels as well as on LinkedIn.

As the CWG is a small team, we hope to make the blog development process easy enough that pharmaverse community members will be able to easily write blog posts with guidance from the CWG team.

Spirit of a Blog Post

The CWG believes that the following 4 points will help guide the creation of Blog Posts.

  • Short
  • Personalized
  • Reproducible
  • Readable

Short: Posts should aim to be under a 10 minute read. We encourage longer posts to be broken up into multiple posts.

Personalized: Posts should have a personality! For example, a person wishing to post on a function in a package needs to differentiate the post from the documentation for function, i.e. we don't want to just recycle the documentation. How can you add your voice and experience? A bit of cheeky language is also encouraged.

Reproducible: Posts should work with minimal dependencies with data, packages and outside sources. Every dependency introduced in a post adds some risk to the post longevity. As package dependencies change, posts should be built in a way that they can be updated to stay relevant.

Readable: The CWG sees this site as more of introductory site rather advanced user site. Therefore, the CWG feels that code should be introduced in a way that promotes readability over complexity.

What types of posts are allowed on this site?

Overall, we want to stay focus on the Clinical Reporting Pipeline, which we see as the following topics:

  1. Packages in the Clinical Reporting Pipeline
  2. Functions from packages in the Clinical Reporting Pipeline
  3. Wider experiences of using R in the Clinical Reporting Pipeline
  4. Conference experiences and the Clinical Reporting Pipeline

However, it never hurts to ask if you topic might fit into this medium!.

Minimum Post Requirements

  • A unique image to help showcase the post.
  • Working Code
  • Self-contained data or package data.
  • Documentation of package versions

That is it! After that you can go wild, but we do ask that it is kept short!

How can I make a Blog Post

Step 1: Reach out to us through pharmaverse/slack or make an issue on our GitHub.

Step 2: Branch off main

Step 3: Create a new Blog Post skeleton using the create_blog_post.R script in the R/ folder.

  • Open the create_blogpost.R file.

  • Source the script help_create_blogpost.R from within the create_blogpost.R file.

  • Enter your information into the create_post function. For the post date, feel free to put a placeholder date as it will be automatically replaced once the post is merged onto main. Please note that we do not currently allow users to specify their own categories (or tags), so you must choose (possibly several) from this list: c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical").

  • Running that function will create a subfolder with a quarto file (*.qmd) in the posts/ folder. The folder will be named zzz_DO_NOT_EDIT_<your post name>, and the zzz_DO_NOT_EDIT portion of the folder name will also be automatically replaced once the post is merged onto main.

  • Open the newly created folder and start working within the *.qmd file.

Step 4: After you have finished your Blog Post, open the CICD.R file in the R/ folder. Run the script line by line to first check the spelling in your post and then to make sure your code is compatible with our code-style.

Step 5: Push to your branch, create a Pull Request, and review the Spirit of the Blog Post in the Pull Request Template.

Step 6: Poke us to do a review!

Most importantly:

Step 7: Have fun :)

Tips and Tricks

  • You can use the link package to create dynamic links for a function to its package down website in a blog post. For example, instead of doing function_name with markdown syntax for url linking, i.e link, you can just do admiral::derive_vars_dy() and it will create the link in your blog post. See the raw code in this post admiral 1.0.0 to see it in action.

  • You can use this code snippet to install all packages needed for the blog site or use the docker image cited below.

install.packages(c("jsonlite",
                   "tidyverse",
                   "spelling",
                   "janitor",
                   "diffdf",
                   "admiral",
                   "patchwork",
                   "here",
                   "reactable",
                   "pharmaversesdtm",
                   "metacore",
                   "metatools",
                   "xportr",
                   "pharmaverseadam",
                   "link",
                   "sessioninfo",
                   "rtables",
                   "teal",
                   "riskmetric",
                   "tidyCDISC"))

How to Use the blog Docker Image for Local Development

Contributors can benefit from using the blog Docker image when creating their blog posts. This way, contributors don't have to install all dependencies from other blog posts and can solely focus on their own blog post and its dependencies.

Here are the steps to use the blog's Docker image:

  1. Ensure you have Docker Desktop installed.
  2. Start Docker Desktop on your machine.
  3. Perform a Docker pull from the blog's GitHub registry by running this code:
docker pull ghcr.io/pharmaverse/blog:latest
  1. Clone this blog repository and take note of the location of the repo in your local machine.
  2. Update the code below specifying the location of your 'blog' repository and execute the script:
docker run --rm -ti -e PASSWORD=yourpassword -p 8787:8787 -v <location of your blog repo>:/home/rstudio/work ghcr.io/pharmaverse/blog

Here's an example:

docker run --rm -ti -e PASSWORD=yourpassword -p 8787:8787 -v ~/Documents/blog:/home/rstudio/work ghcr.io/pharmaverse/blog

This command will run the blog Docker image and mount your local folder to the image.

  1. Open http://localhost:8787/ and you should see the RStudio welcome page.
  2. The username will be rstudio, and the password is yourpassword.
  3. Once logged in, go to the work folder, and you should see the contents of the blog repository.
  4. Click the quarto-blog.Rproj file to open the project.
  5. You can test by opening the index.qmd and rendering the document.
  6. Quarto should run, and you should be able to see the rendered blog locally.
  7. Develop your blog post and re-render as needed.
  8. Once complete, you can close the RStudio session, shut down the image, and push your update to the blog repo.

Please note that there is no SSH or git capability in the docker image, so you can't push your update to the repo from the image directly. To push the update, you would have to do it from your local RStudio or terminal.

A Dockerfile is also provided in this repo if you want to build the image locally and add more functionalities.