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

Try to get website to publish #8

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
^ramnog\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^README.Rmd
^_pkgdown.yml
^docs
^.vscode
^.github
^.githooks
^.pre-commit-config.yaml
RELEASE_BODY\.txt
^\.github$
^_pkgdown\.yml$
^docs$
^pkgdown$
83 changes: 83 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master, dev]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

# If not pull request a brand new webpage is deployed
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs

# If pull request the webpage is deployed inside a dev/"PR number" folder for review
- name: Add pkgdown PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
header: pkgdown
message: |
# Github pages
Review the pkgdown webpage for the PR [here](https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/dev/${{ github.event.pull_request.number }})

- name: Copy page to temp folder
if: github.event_name == 'pull_request'
run: |
mkdir -p /home/runner/work/dev
cp -r ./docs/* /home/runner/work/dev

- name: Check out gh-pages branch
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
ref: gh-pages

- name: Copy and push to gh-pages
if: github.event_name == 'pull_request'
run: |
mkdir -p dev/${{ github.event.pull_request.number }}
cp -r /home/runner/work/dev/* ./dev/${{ github.event.pull_request.number }}
git config --global user.email "actions-robot@novonordisk.com"
git config --global user.name "Actions Robot From Github Actions"
git add .
git commit -m "Update gh pages from the PR"
git push
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.Rproj.user
inst/doc
docs/
launch.json
.Rhistory
docs
19 changes: 13 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,27 @@ Description: What the package does (one paragraph).
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.0
RoxygenNote: 7.3.1
Imports:
data.table (>= 1.14.2),
Suggests:
chef,
chefCriteria,
chefStats,
data.table (>= 1.14.2),
Suggests:
knitr,
targets,
usethis,
rmarkdown,
testthat (>= 3.0.0),
kableExtra (>= 1.4)
kableExtra (>= 1.4),
testr,
tidyr,
pharmaverseadam
Config/testthat/edition: 3
Remotes:
hta-pharma/chefStats,
hta-pharma/chef,
hta-pharma/chefCriteria,
hta-pharma/chefStats
Config/testthat/edition: 3
matthew-phelps/testr
VignetteBuilder: knitr
URL: https://hta-pharma.github.io/ramnog/
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by roxygen2: do not edit by hand

export(mk_adae_demo)
export(dummy_fn)
import(data.table)
9 changes: 9 additions & 0 deletions R/dummy_fn.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#' Title
#' @description exists only to import data.table
#' @return Nothing.
#' @export
#'
#' @import data.table
dummy_fn <- function(){

}
15 changes: 0 additions & 15 deletions R/mk_adae.R

This file was deleted.

28 changes: 7 additions & 21 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
url: ~
url: https://hta-pharma.github.io/ramnog/
template:
bootstrap: 5



articles:

- title: Overview
navbar: Overview
contents:
- ep_overview

contents: ep_overview
- title: Endpoint Population and Outcome Specification
navbar: Endpoint Population and Outcome Specification
contents:
Expand All @@ -20,29 +14,21 @@ articles:
- ep_spec_event_def
- ep_spec_strata_def
- ep_spec_label

- title: Endpoint Statistics
navbar: Endpoint Statistics
contents:
- starts_with('methods_')

contents: starts_with('methods_')
- title: Endpoint Results
navbar: Endpoint Results
contents:
- starts_with("results")

contents: starts_with("results")
- title: Endpoint Examples
navbar: Endpoint Examples
contents:
- starts_with("example_")

contents: starts_with("example_")
- title: Debugging
navbar: Debugging
contents:
- debugging

contents: debugging
- title: Development
navbar: Development
contents:
- starts_with("dev")
- validation

14 changes: 14 additions & 0 deletions man/dummy_fn.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions man/mk_adae_demo.Rd

This file was deleted.

48 changes: 32 additions & 16 deletions tests/testthat/_snaps/mild_ae_by_sex.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Complex pipeline runs without errors

Code
ep_stat[, .(stat_filter, endpoint_group_filter, label, description, qualifiers,
value)]
ep_stat[, .(stat_filter, endpoint_group_filter, stat_result_label,
stat_result_description, stat_result_qualifiers, stat_result_value)]
Output
stat_filter
<char>
1: TOTAL_ == "total" & TRT01A == "Placebo"
2: TOTAL_ == "total" & TRT01A == "Xanomeline High Dose"
3: TOTAL_ == "total" & TRT01A == "Placebo"
2: TOTAL_ == "total" & TRT01A == "Placebo"
3: TOTAL_ == "total" & TRT01A == "Xanomeline High Dose"
4: TOTAL_ == "total" & TRT01A == "Xanomeline High Dose"
5: SEX == "F" & TRT01A == "Placebo"
---
Expand All @@ -17,6 +18,7 @@
4277:
4278:
endpoint_group_filter
<char>
1: AESOC == "GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS" & AESEV == "MILD"
2: AESOC == "GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS" & AESEV == "MILD"
3: AESOC == "GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS" & AESEV == "MILD"
Expand All @@ -28,16 +30,30 @@
4276: AESOC == "EAR AND LABYRINTH DISORDERS" & AESEV == "SEVERE"
4277: AESOC == "NEOPLASMS BENIGN, MALIGNANT AND UNSPECIFIED (INCL CYSTS AND POLYPS)" & AESEV == "SEVERE"
4278: AESOC == "NEOPLASMS BENIGN, MALIGNANT AND UNSPECIFIED (INCL CYSTS AND POLYPS)" & AESEV == "SEVERE"
label description qualifiers value
1: E Number of events <NA> 36
2: E Number of events <NA> 75
3: N Number of subjects <NA> 86
4: N Number of subjects <NA> 72
5: E Number of events <NA> 18
---
4274: <NA> P-value interaction not conducted <NA> NA
4275: <NA> P-value interaction not conducted <NA> NA
4276: <NA> P-value interaction not conducted <NA> NA
4277: <NA> P-value interaction not conducted <NA> NA
4278: <NA> P-value interaction not conducted <NA> NA
stat_result_label stat_result_description
<char> <char>
1: E Number of events
2: N Number of subjects
3: E Number of events
4: N Number of subjects
5: E Number of events
---
4274: <NA> P-value interaction not conducted
4275: <NA> P-value interaction not conducted
4276: <NA> P-value interaction not conducted
4277: <NA> P-value interaction not conducted
4278: <NA> P-value interaction not conducted
stat_result_qualifiers stat_result_value
<char> <num>
1: <NA> 36
2: <NA> 86
3: <NA> 75
4: <NA> 72
5: <NA> 18
---
4274: <NA> NA
4275: <NA> NA
4276: <NA> NA
4277: <NA> NA
4278: <NA> NA

2 changes: 1 addition & 1 deletion tests/testthat/binary_type_2.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test_that("Binary outcomes of type 2 work", {
mk_adam_fn = list(mk_adae),
)
# ACT ---------------------------------------------------------------------
browser()

targets::tar_make()
targets::tar_load(ep_stat)

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-binary_type_2.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ test_that("multiplication works", {
# ACT ---------------------------------------------------------------------
targets::tar_make()
targets::tar_load(ep_stat)
browser()

})
15 changes: 10 additions & 5 deletions tests/testthat/test-demographics.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ test_that("Demographics work with other endpoints", {
mk_adam_fn = list(mk_adae, mk_advs),
)
# ACT ---------------------------------------------------------------------

targets::tar_make()
targets::tar_load(ep_stat)

Expand All @@ -54,7 +55,7 @@ test_that("Demographics work with other endpoints", {
actual <-
ep_stat[endpoint_group_filter == "AESOC == \"SOCIAL CIRCUMSTANCES\" & AESEV == \"SEVERE\"" &
fn_name == "RR" &
stat_filter == "SEX == \"F\""& label == "RR", value]
stat_filter == "SEX == \"F\"" & stat_result_label == "RR", "stat_result_value"]
x1 <- x[SEX == "F" & SAFFL == "Y"]
x1[AESOC == "SOCIAL CIRCUMSTANCES" &
AESEV == "SEVERE", event := TRUE]
Expand All @@ -65,12 +66,16 @@ test_that("Demographics work with other endpoints", {
c <- 0.5 # No outcome, not exposed
d <- 53.5 # No outcome, not exposed
expected <- (a / sum(a, b)) / (c / sum(c, d))
expect_identical(actual, expected)
expect_identical(actual$stat_result_value, expected)

# Spot check the Demographic stats
x <- mk_advs()
a <-
ep_stat[stat_result_qualifiers == "SEX" &
stat_result_label == "n_missing"] |> data.table::setorder(stat_filter)
expected <- x[is.na(SEX), .N, by = .(TRT01A)] |> data.table::setorder(TRT01A)

a <- ep_stat[qualifiers=="SEX"&label=="n_missing"] |> setorder(stat_filter)
expected <- x[is.na(SEX), .N, by=.(TRT01A)] |> setorder(TRT01A)
expect_equal(a$value, expected$N)
expect_equal(a$stat_result_value |> as.integer(), as.integer(expected$N))
})


2 changes: 1 addition & 1 deletion tests/testthat/test-empty_strata_level.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ test_that("stat funtion that produces a 0 returns result ",


actual <-
ep_stat[grepl("Placebo", stat_filter), value]
ep_stat[grepl("Placebo", stat_filter), stat_result_value]
expect_equal(actual, 0)
})
Loading
Loading