Skip to content

Commit c962234

Browse files
authored
Merge branch 'main' into 187-blog-post-power-of-partnership-code-collaboration-in-nest
2 parents e5f6fd5 + 7fb0276 commit c962234

File tree

152 files changed

+7238
-498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+7238
-498
lines changed

.github/pull_request_template.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ Thank you for your Pull Request! We have developed this task checklist to help w
33
Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the `main` branch until you have checked off each task.
44

55
- [ ] Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update), and make sure the corresponding issue is linked in the Development section on the right hand side
6+
- [ ] Ensure your new post folder is of the form `"posts/zzz_DO_NOT_EDIT_<your post title>"`. This is so that the post date can be auto-updated upon the merge into `main`.
67
- [ ] Run the script from `CICD.R` line by line to first check the spelling in your post and then to make sure your code is compatible with our code-style. Address any incongruences by following the instructions in the file!
7-
- [ ] Choose (possibly several) `tag(s)` or categories from the current list: `c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical")` for your blog post. If you cannot find anything that fits your blog post, add your own tag! We occasionally tidy up all `tags` for consistency.
8+
- [ ] Choose (possibly several) `tag(s)` or categories from the current list: ` c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical")` for your blog post. If you cannot find anything that fits your blog post, propose a new tag to the maintainers! Note: if you use a tag not from this list, the "Check Post Tags" CICD pipeline will error. We occasionally tidy up all `tags` for consistency.
89
- [ ] Add a short description for your blog post in the `description` field at the top of the markdown document.
910
- [ ] Blog post is *short*, *personalized*, *reproducible* and *readable*
1011
- [ ] Add a disclaimer at the top of your post, if appropriate (example: **Disclaimer**

.github/workflows/check_post_tags.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Check post tags
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'main'
7+
8+
jobs:
9+
Check-post-tags:
10+
runs-on: ubuntu-latest
11+
container:
12+
image: "rocker/tidyverse:4.2.1"
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Run check_post_tags
16+
run: source("R/check_post_tags.R")
17+
shell: Rscript {0}

.github/workflows/link_check.yml

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
name: Links (Fail Fast)
22

33
on:
4-
pull_request: {branches: ['main']}
4+
pull_request:
5+
branches:
6+
- main
7+
58
jobs:
69
linkChecker:
710
runs-on: ubuntu-latest
811
steps:
912
- uses: actions/checkout@v4
1013

11-
- name: switch .qmd to .md
12-
run: source("R/switch.R")
13-
shell: Rscript {0}
14+
- name: Set up R # Install R from CRAN
15+
uses: r-lib/actions/setup-r@v2
16+
with:
17+
r-version: '4.3.3' # You can specify a different R version if needed
18+
19+
- name: Install R packages
20+
run: |
21+
Rscript -e 'install.packages("fs")'
22+
shell: bash
23+
24+
- name: Switch .qmd to .md
25+
run: Rscript R/switch.R
26+
shell: bash
1427

1528
- name: Link Checker
1629
uses: lycheeverse/[email protected]
1730
with:
1831
fail: true
1932
env:
20-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

+42-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
1+
name: Quarto Publish
2+
13
on:
24
workflow_dispatch:
35
push:
46
branches: [main]
57

6-
name: Quarto Publish
7-
88
jobs:
9+
Update-post-dates:
10+
runs-on: ubuntu-latest
11+
container:
12+
image: "rocker/tidyverse:4.2.1"
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
ref: main
18+
token: ${{ secrets.PHARMAVERSE_BOT }}
19+
20+
- name: Run update_post_dates
21+
run: Rscript R/update_post_dates.R # running the R script with Rscript
22+
23+
- name: Configure Git safe directory
24+
run: git config --global --add safe.directory /__w/blog/blog
25+
26+
- name: Commit and push changes
27+
uses: stefanzweifel/git-auto-commit-action@v5
28+
with:
29+
commit_message: "[skip actions] Auto-update blog post date"
30+
file_pattern: "."
31+
commit_user_name: github-actions
32+
commit_user_email: >-
33+
41898282+github-actions[bot]@users.noreply.github.com
34+
continue-on-error: true
35+
936
build-deploy:
37+
needs: Update-post-dates
1038
runs-on: ubuntu-latest
1139
permissions:
1240
contents: write
@@ -32,6 +60,11 @@ jobs:
3260
janitor
3361
diffdf
3462
admiral
63+
admiralonco
64+
admiralophtha
65+
admiralpeds
66+
admiralvaccine
67+
admiralmetabolic
3568
patchwork
3669
here
3770
reactable
@@ -42,6 +75,13 @@ jobs:
4275
pharmaverseadam
4376
link
4477
sessioninfo
78+
rtables
79+
teal
80+
riskmetric
81+
tidyCDISC
82+
mirai
83+
sdtm.oak
84+
dverse
4585
4686
- name: Install tinytex
4787
run: quarto install tool tinytex

.github/workflows/spellcheck.yml

+18-17
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,28 @@ on:
44
jobs:
55
Spelling:
66
runs-on: ubuntu-latest
7-
container: {image: "rocker/tidyverse:4.2.1"}
7+
container: {image: "rocker/tidyverse:4.3.1"}
88
steps:
99
- name: Checkout repo
1010
uses: actions/checkout@v4
1111

12-
- name: Install spelling
13-
run: if (!require("spelling")) install.packages("spelling")
12+
- name: Install packages
13+
run: |
14+
if (!require("roxygen2")) install.packages("roxygen2")
15+
if (!require("spelling")) install.packages("spelling")
16+
if (!require("testthat")) install.packages("testthat")
1417
shell: Rscript {0}
1518

16-
- name: Install roxygen2
17-
run: if (!require("roxygen2")) install.packages("roxygen2")
18-
shell: Rscript {0}
19-
20-
- name: Run Spelling Check test
21-
run: spelling::spell_check_files(list.files(pattern = ".*.qmd$", recursive = TRUE), ignore = readr::read_lines("inst/WORDLIST.txt"))
22-
shell: Rscript {0}
23-
24-
- name: Install testthat
25-
run: if (!require("testthat")) install.packages("testthat")
26-
shell: Rscript {0}
27-
28-
- name: test typos
29-
run: testthat::test_that(desc = "No Typo", code = testthat::expect_equal(object = spelling::spell_check_files(list.files(pattern = ".*.qmd$", recursive = TRUE), ignore = readr::read_lines("inst/WORDLIST.txt")), expected = spelling::spell_check_files(path = "inst/WORDLIST.txt", ignore = readr::read_lines("inst/WORDLIST.txt"))))
19+
- name: Check spelling
20+
run: |
21+
testthat::test_that(desc = "Check spelling",
22+
code = {
23+
typos <- spelling::spell_check_files(list.files(pattern = ".*.qmd$", recursive = TRUE), ignore = readr::read_lines("inst/WORDLIST.txt"))
24+
print(typos)
25+
testthat::expect_equal(
26+
object = typos,
27+
expected = spelling::spell_check_files(path = "inst/WORDLIST.txt", ignore = readr::read_lines("inst/WORDLIST.txt"))
28+
)
29+
}
30+
)
3031
shell: Rscript {0}

.lycheeignore

+3
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ file:///home/runner/work/blog/blog/posts/2024-03-01_rhino_shiny_app_validation/A
1818
https://rsc.niaid.nih.gov/clinical-research-sites/daids-adverse-event-grading-tables
1919
https://gowerc.github.io/diffdf/reference/diffdf.html](https://gowerc.github.io/diffdf/reference/diffdf.html)
2020
https://gowerc.github.io/diffdf/reference/diffdf.html
21+
https://tel.meet/kyw-gdga-civ?pin=3167654532438
22+
https://meet.google.com/kyw-gdga-civ
23+
https://insightsengineering.github.io/roxy.shinylive/

Dockerfile

+32-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,20 @@ RUN apt-get update \
44
&& apt-get install -y --no-install-recommends \
55
ca-certificates \
66
curl \
7+
libxml2-dev \
8+
libcurl4-openssl-dev \
9+
zlib1g-dev \
10+
libfontconfig1-dev \
11+
libharfbuzz-dev libfribidi-dev \
12+
libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev \
13+
libmbedtls-dev cmake \
14+
libnng-dev xz-utils\
15+
libcairo2-dev \
16+
libgit2-dev \
17+
pkgconf \
718
&& apt-get clean \
819
&& rm -rf /var/lib/apt/lists/* \
9-
&& curl -o quarto.deb -L https://github.com/quarto-dev/quarto-cli/releases/download/v1.4.550/quarto-1.4.550-linux-amd64.deb \
20+
&& curl -o quarto.deb -L https://github.com/quarto-dev/quarto-cli/releases/download/v1.6.42/quarto-1.6.42-linux-arm64.deb \
1021
&& dpkg --install quarto.deb \
1122
&& rm -f quarto.deb \
1223
&& R -e 'install.packages(c( \
@@ -23,4 +34,23 @@ RUN apt-get update \
2334
"metacore", \
2435
"metatools", \
2536
"xportr", \
26-
"pharmaverseadam"))'
37+
"pharmaverseadam", \
38+
"link", \
39+
"sessioninfo", \
40+
"rtables", \
41+
"teal", \
42+
"riskmetric", \
43+
"tidyCDISC", \
44+
"mirai", \
45+
"dverse", \
46+
"DT", \
47+
"xportr", \
48+
"sdtm.oak", \
49+
"teal", \
50+
"riskmetric", \
51+
"tidyCDISC", \
52+
"admiralonco", \
53+
"admiralophtha", \
54+
"admiralpeds", \
55+
"admiralvaccine", \
56+
"admiralmetabolic"))'

R/CICD.R

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ words <- spelling::spell_check_files(list.files(pattern = ".*.qmd$", recursive =
1414
)
1515
# now you can add words to the wordlist
1616
#-- uncomment the following line
17-
write(words[[1]], file = "inst/WORDLIST.txt", append = TRUE)
17+
18+
# write(words[[1]], file = "inst/WORDLIST.txt", append = TRUE)
19+
# sort_words <- sort(readr::read_lines("inst/WORDLIST.txt"))
20+
# readr::write_lines(sort_words, "inst/WORDLIST.txt")
21+
1822

1923
spelling::spell_check_files(list.files(pattern = ".*.qmd$", recursive = TRUE),
2024
ignore = readr::read_lines("inst/WORDLIST.txt")

R/allowed_tags.R

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#' This is a vector of all the allowed blog post tags. It is stored in a separate file so that it can be referenced
2+
#' by `create_blogpost.R` and `check_post_tags.R`.
3+
4+
allowed_tags <- c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical")

R/appendix.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
library(dplyr)
1+
suppressMessages(library(dplyr))
22
# markdown helpers --------------------------------------------------------
33

44
markdown_appendix <- function(name, content) {

R/check_post_tags.R

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Get list of blog posts ----
2+
posts <- list.files("posts", recursive = TRUE, pattern = "*.qmd")
3+
4+
# Get vector of allowed tags ----
5+
source("R/allowed_tags.R")
6+
7+
# Function to extract tags from a post and check them against the allowed list ----
8+
check_post_tags <- function(post, allowed_post_tags = allowed_tags) {
9+
post_tags <- rmarkdown::yaml_front_matter(file.path("posts", post))$categories
10+
cross_check <- post_tags %in% allowed_post_tags
11+
problematic_tags <- post_tags[!cross_check]
12+
13+
if (!all(cross_check)) {
14+
cli::format_message("The tag(s) {.val {problematic_tags}} in the post {.val {post}} are not from the allowed list of tags.")
15+
}
16+
}
17+
18+
# Apply check_post_tags to all blog posts and find problem posts ----
19+
check_results <- lapply(posts, check_post_tags)
20+
error_messages <- unlist(Filter(Negate(is.null), check_results))
21+
22+
# Construct error message if one or more posts have problematic tags ----
23+
if (length(error_messages) > 0) {
24+
error_messages <- c(error_messages, "Please select from the following tags: {.val {allowed_tags}}, or contact one of the maintainers.")
25+
names(error_messages) <- rep("x", length(error_messages) - 1)
26+
27+
concatenated_error_messages <- cli::cli_bullets(error_messages)
28+
29+
cli::cli_abort(concatenated_error_messages)
30+
}

R/create_blogpost.R

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
# You can easily create a new blog post skeleton using the create_post() function.
2-
# First, we load the helping function:
2+
# First, we load the helping function and the allowed post tags:
33

44
source("R/help_create_blogpost.R")
5-
5+
source("R/allowed_tags.R")
66

77
## The available images are at the moment:
88
list.files("media") %>% tools::file_path_sans_ext()
99
## Please choose (possibly multiple) from this tags list:
10-
c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical")
10+
print(allowed_tags)
1111

1212
# Fill in the info, e.g.:
1313
create_post(
14-
post_name = "Code collaboration in NEST", # needs to be character vector (length 1)
15-
post_date = "2025-03-11", # needs to be character vector (length 1)
16-
description = "", # you can fill the description in later as well
17-
author = c("Ilse Augustyns", "Nicholas Masel", "Tad Lewandowski", "Gabriel Becker"), # one or more authors are permitted
18-
cover_image = "rtables", # chose one of the above (see line 8)
1914
tags = c("TLG", "ADaM") # chose (multiple) from line 10
15+
post_name = "My Blog", # needs to be character vector (length 1)
16+
post_date = "2024-12-01", # needs to be length 1 character vector and will be auto-updated when your post is merged
17+
description = "", # you can fill the description in later as well
18+
author = c("My Name"), # one or more authors are permitted
19+
cover_image = "pharmaverse", # chose one of the above (see line 8)
20+
tags = c("Metadata", "SDTM", "ADaM", "TLG", "Shiny", "Community", "Conferences", "Submissions", "Technical") # chose (multiple) from line 10
2021
)
2122

22-
2323
# Remove that post:
2424
# unlink("posts/2023-06-15_lbla", recursive = TRUE)
2525

R/help_create_blogpost.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ create_post <- function(post_name,
4545

4646
# Prepare values
4747
snake_name <- gsub(" ", "_", tolower(gsub("(.)([A-Z])", "\\1 \\2", post_name)))
48-
short_name <- paste(post_date, snake_name, sep = "_")
48+
short_name <- paste("zzz_DO_NOT_EDIT", snake_name, sep = "_")
4949

5050
if (short_name != short_name %>% stringr::str_trunc(30)) {
5151
message("For the folder creation:")

R/readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ Some of these files help in creating/developing blog-posts, others are used by o
44

55
- `create_blogpost.R`: use this script to create a new blogpost based on our blogpost template.
66
- `CICD.R`: use this script to spellcheck and stylecheck your blogpost.
7+
- `allowed_tags.R`: contains vector of allowed blog post tags
78

89
## development files
910
- `help_create_blogpost.R`: script containing the function(s) used by `create_blogpost.R`
1011
- `switch.R`: Used by CICD spellcheck workflow.
12+
- `check_post_tags.R`: Used by Check-Post-Tags CICD workflow
13+
- `update_post_dates.R`: Used by Update-Post-Dates CICD workflow

0 commit comments

Comments
 (0)